From 0eea592b868e4410fc63f45fd2d1a0e234fde4b5 Mon Sep 17 00:00:00 2001 From: qloak Date: Tue, 14 Jul 2026 12:16:55 -0700 Subject: [PATCH] fix: player list count, leaderboard stubs --- .../Leaderboards/LeaderboardManager.cpp | 2 ++ .../Network/PlatformNetworkManagerStub.h | 2 +- .../Common/UI/UIScene_InGameInfoMenu.cpp | 10 +++++++-- Minecraft.Client/Extrax64Stubs.cpp | 4 ++-- Minecraft.Client/Minecraft.Client.vcxproj | 2 +- Minecraft.Client/Minecraft.cpp | 2 +- Minecraft.Client/Options.cpp | 2 +- .../Leaderboards/WindowsLeaderboardManager.h | 22 ++++++++++++++----- .../Windows64/Windows64_Minecraft.cpp | 2 +- Minecraft.World/Minecraft.World.vcxproj | 2 +- 10 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp b/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp index 007afadc..d7bed46f 100644 --- a/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp +++ b/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp @@ -9,7 +9,9 @@ const wstring LeaderboardManager::filterNames[eNumFilterModes] = L"Friends", L"MyScore", L"TopRank" }; +#if !defined(_WINDOWS64) && !defined(_DURANGO) && !defined(__ORBIS__) && !defined(__PS3__) && !defined(__PSVITA__) && !defined(_XBOX) LeaderboardManager *LeaderboardManager::m_instance = NULL; +#endif void LeaderboardManager::DeleteInstance() { diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h index a45a5e47..294980d5 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h @@ -165,6 +165,6 @@ private: void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer ); #ifndef _XBOX - void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); } + void FakeLocalPlayerJoined() { AddLocalPlayerByUserIndex(0); } #endif }; diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp index 092b7156..878e9249 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp @@ -93,7 +93,9 @@ void UIScene_InGameInfoMenu::updateTooltips() if(CGameNetworkManager::usingAdhocMode()) keyX = -1; #endif - INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId); + INetworkPlayer *selectedPlayer = NULL; + if(m_playerList.getCurrentSelection() < m_players.size()) + selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId); int keyA = -1; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -335,7 +337,9 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) break; case eControl_GamePlayers: int currentSelection = (int)childId; - INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[currentSelection]->m_smallId); + INetworkPlayer *selectedPlayer = NULL; + if(currentSelection < m_players.size()) + selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[currentSelection]->m_smallId); Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; @@ -387,6 +391,8 @@ void UIScene_InGameInfoMenu::handleFocusChange(F64 controlId, F64 childId) void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { + if(pPlayer == NULL) return; + app.DebugPrintf(" Player \"%ls\" %s (smallId: %d)\n", pPlayer->GetOnlineName(), leaving ? "leaving" : "joining", pPlayer->GetSmallId()); UIScene_InGameInfoMenu *scene = (UIScene_InGameInfoMenu *)callbackParam; diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index e7d5fd6a..19dcd797 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -231,8 +231,8 @@ DWORD IQNet::GetPlayerCount() { return s_playerCount; } QNET_STATE IQNet::GetState() { return _bQNetStubGameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE; } bool IQNet::IsHost() { return s_isHosting; } HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo) { return S_OK; } -void IQNet::HostGame() { _bQNetStubGameRunning = true; s_isHosting = true; } -void IQNet::ClientJoinGame() { _bQNetStubGameRunning = true; s_isHosting = false; } +void IQNet::HostGame() { _bQNetStubGameRunning = true; s_isHosting = true; if(s_playerCount == 0) s_playerCount = 1; } +void IQNet::ClientJoinGame() { _bQNetStubGameRunning = true; s_isHosting = false; if(s_playerCount == 0) s_playerCount = 1; } void IQNet::EndGame() { _bQNetStubGameRunning = false; s_isHosting = false; } DWORD MinecraftDynamicConfigurations::GetTrialTime() { return DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; } diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index b7b62029..30552ddc 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -34044,7 +34044,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false false - true + false false false false diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 07ab47d9..35261db8 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1858,7 +1858,7 @@ void Minecraft::run_middle() achievementPopup->render(); PIXBeginNamedEvent(0,"Sleeping"); - Sleep(0); // 4J - was Thread.yield() + //Sleep(0); // 4J - was Thread.yield() PIXEndNamedEvent(); // if (Keyboard::isKeyDown(Keyboard::KEY_F7)) Display.update(); // 4J - removed condition diff --git a/Minecraft.Client/Options.cpp b/Minecraft.Client/Options.cpp index 33e94060..c0095d6e 100644 --- a/Minecraft.Client/Options.cpp +++ b/Minecraft.Client/Options.cpp @@ -116,7 +116,7 @@ void Options::init() bobView = true; anaglyph3d = false; advancedOpengl = false; - framerateLimit = 2; + framerateLimit = 0; fancyGraphics = true; ambientOcclusion = true; renderClouds = true; diff --git a/Minecraft.Client/Windows64/Leaderboards/WindowsLeaderboardManager.h b/Minecraft.Client/Windows64/Leaderboards/WindowsLeaderboardManager.h index a469ba04..ec7f2d60 100644 --- a/Minecraft.Client/Windows64/Leaderboards/WindowsLeaderboardManager.h +++ b/Minecraft.Client/Windows64/Leaderboards/WindowsLeaderboardManager.h @@ -17,13 +17,23 @@ public: virtual void DeleteSession() {} //Write the given stats - //This is called synchronously and will not free any memory allocated for views when it is done + virtual bool WriteStats(unsigned int viewCount, ViewIn views) { return true; } - virtual bool WriteStats(unsigned int viewCount, ViewIn views) { return false; } - - virtual bool ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID) { return false; } - virtual bool ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount) { return false; } - virtual bool ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount) { return false; } + virtual bool ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount) { + ReadView view = { 0, NULL }; + callback->OnStatsReadComplete(eStatsReturn_Success, 0, view); + return true; + } + virtual bool ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount) { + ReadView view = { 0, NULL }; + callback->OnStatsReadComplete(eStatsReturn_Success, 0, view); + return true; + } + virtual bool ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount) { + ReadView view = { 0, NULL }; + callback->OnStatsReadComplete(eStatsReturn_Success, 0, view); + return true; + } //Perform a flush of the stats virtual void FlushStats() {} diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index baeeda99..0aae8055 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -498,7 +498,7 @@ app.DebugPrintf("width: %d, height: %d\n", width, height); DXGI_SWAP_CHAIN_DESC sd; ZeroMemory( &sd, sizeof( sd ) ); - sd.BufferCount = 1; + sd.BufferCount = 2; sd.BufferDesc.Width = width; sd.BufferDesc.Height = height; sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index 5df0d959..4169c2d7 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -1124,7 +1124,7 @@ Sync false $(OutDir)$(ProjectName).pch - MultiThreadedDebugDLL + MultiThreadedDebug _LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) Disabled true