perf: WPO/LTCG, fix potential memory leaks, reduce busy-waits, loop opts; general optimizations

This commit is contained in:
2026-08-01 10:17:35 -07:00
parent dbc183bdf8
commit 8f89209699
18 changed files with 98 additions and 72 deletions
@@ -314,13 +314,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
Minecraft *pMinecraft = Minecraft::GetInstance();
// Make sure that we have transitioned through any joining/creating stages and are actually playing the game, so that we know the players should be valid
bool changedMessage = false;
while(!IsReadyToPlayOrIdle())
{
changedMessage = true;
pMinecraft->progressRenderer->progressStage( g_NetworkManager.CorrectErrorIDS(IDS_PROGRESS_SAVING_TO_DISC) ); // "Finalizing..." vaguest message I could find
pMinecraft->progressRenderer->progressStagePercentage( g_NetworkManager.GetJoiningReadyPercentage() );
Sleep(10);
}
while(!IsReadyToPlayOrIdle())
{
changedMessage = true;
pMinecraft->progressRenderer->progressStage( g_NetworkManager.CorrectErrorIDS(IDS_PROGRESS_SAVING_TO_DISC) ); // "Finalizing..." vaguest message I could find
pMinecraft->progressRenderer->progressStagePercentage( g_NetworkManager.GetJoiningReadyPercentage() );
Sleep(0);
}
if( changedMessage )
{
pMinecraft->progressRenderer->progressStagePercentage( 100 );
@@ -898,7 +898,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
while ( tPack->isLoadingData() || (Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()) )
{
Sleep(1);
Sleep(0);
}
ui.CleanUpSkinReload();
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
@@ -935,7 +935,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
{
while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()))
{
Sleep(1);
Sleep(0);
}
param->levelGen->loadBaseSaveData();
}
@@ -977,7 +977,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
while( g_NetworkManager.IsInSession() )
{
Sleep(1);
Sleep(0);
}
// Xbox should always be online when receiving invites - on PS3 we need to check & ask the user to sign in
@@ -1237,7 +1237,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
// wait for the current session to end
while( g_NetworkManager.IsInSession() )
{
Sleep(1);
Sleep(0);
}
// Reset this flag as the we don't need to know that we only lost the room only from this point onwards, the behaviour is exactly the same