From a2ddb7c2f085704d50e91fbcf2cc2fc557bfea6d Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Sat, 14 Mar 2026 06:52:03 +1100 Subject: [PATCH] Remove WinAPI ints from network and save helpers --- .../Platform/Common/Consoles_App.cpp | 2 +- .../Common/Network/GameNetworkManager.cpp | 2 +- .../Network/PlatformNetworkManagerInterface.h | 2 +- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 2 +- .../Platform/Common/XUI/XUI_LoadSettings.cpp | 2 +- .../Xbox/Network/PlatformNetworkManagerXbox.cpp | 16 +++++++++------- .../IO/Files/ConsoleSaveFileOriginal.cpp | 2 +- .../IO/Files/ConsoleSaveFileSplit.cpp | 2 +- .../Network/Packets/AddPlayerPacket.cpp | 2 +- 9 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 26aa0419e..33d0f34f5 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5709,7 +5709,7 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4 // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) { - INT saveOrCheckpointId = 0; + int saveOrCheckpointId = 0; // Check they have the full texture pack if they are using one // 4J-PB - Is the player trying to save but they are using a trial texturepack ? diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp index 84cdf7740..2948e1297 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp @@ -342,7 +342,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, void *lpParamet else { // 4J Stu - Host needs to generate a unique multiplayer id for sentient telemetry reporting - INT multiplayerInstanceId = TelemetryManager->GenerateMultiplayerInstanceId(); + int multiplayerInstanceId = TelemetryManager->GenerateMultiplayerInstanceId(); TelemetryManager->SetMultiplayerInstanceId(multiplayerInstanceId); } TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h index e5987b525..6b9aa04bb 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h @@ -21,7 +21,7 @@ class CGameNetworkManager; typedef struct _SearchForGamesData { - DWORD sessionIDCount; + unsigned int sessionIDCount; XSESSION_SEARCHRESULT_HEADER *searchBuffer; XNQOS **ppQos; SessionID *sessionIDList; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index db9c7c796..845d4b98f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -1428,7 +1428,7 @@ int UIScene_LoadMenu::DeleteSaveDataReturned(void *pParam,bool bSuccess) // 4J Stu - Shared functionality that is the same whether we needed a quadrant sign-in or not void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, int localUsersMask) { - INT saveOrCheckpointId = 0; + int saveOrCheckpointId = 0; bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); TelemetryManager->RecordLevelResume(pClass->m_iPad, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, app.GetGameSettings(pClass->m_iPad,eGameSetting_Difficulty), app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount(), saveOrCheckpointId); diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp index f3bee23ca..b082709f5 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_LoadSettings.cpp @@ -940,7 +940,7 @@ int CScene_LoadGameSettings::DeviceRemovedDialogReturned(void *pParam,int iPad,C // 4J Stu - Shared functionality that is the same whether we needed a quadrant sign-in or not void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass, DWORD dwLocalUsersMask) { - INT saveOrCheckpointId = 0; + int saveOrCheckpointId = 0; bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); TelemetryManager->RecordLevelResume(pClass->m_iPad, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, app.GetGameSettings(pClass->m_iPad,eGameSetting_Difficulty), app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount(), saveOrCheckpointId); diff --git a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp index 58598cf17..158cbfe8c 100644 --- a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp +++ b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp @@ -1298,10 +1298,11 @@ void CPlatformNetworkManagerXbox::SearchForGames() return; } - DWORD sessionIDCount = std::min( XSESSION_SEARCH_MAX_IDS, friendsSessions[m_lastSearchPad].size() ); + unsigned int sessionIDCount = static_cast(std::min(XSESSION_SEARCH_MAX_IDS, friendsSessions[m_lastSearchPad].size())); + DWORD xboxSessionIDCount = sessionIDCount; SessionID *sessionIDList = new SessionID[sessionIDCount]; - for(DWORD i = 0; i < sessionIDCount; ++i) + for(unsigned int i = 0; i < sessionIDCount; ++i) { sessionIDList[i] = friendsSessions[m_lastSearchPad].at(i)->sessionId; } @@ -1313,7 +1314,7 @@ void CPlatformNetworkManagerXbox::SearchForGames() // size. dwStatus = XSessionSearchByIds( - sessionIDCount, + xboxSessionIDCount, sessionIDList, g_NetworkManager.GetPrimaryPad(), &cbResults, // Pass in the address of the size variable @@ -1344,7 +1345,7 @@ void CPlatformNetworkManagerXbox::SearchForGames() // this time use the modified buffer size and a pointer to a buffer that // matches it. dwStatus = XSessionSearchByIds( - sessionIDCount, + xboxSessionIDCount, sessionIDList, g_NetworkManager.GetPrimaryPad(), &cbResults, // Pass in the address of the size variable @@ -1388,12 +1389,13 @@ int CPlatformNetworkManagerXbox::SearchForGamesThreadProc( void* lpParameter ) { SearchForGamesData *threadData = (SearchForGamesData *)lpParameter; - DWORD sessionIDCount = threadData->sessionIDCount; + unsigned int sessionIDCount = threadData->sessionIDCount; + DWORD xboxSessionIDCount = sessionIDCount; XOVERLAPPED *pOverlapped = threadData->pOverlapped; DWORD dwStatus = ERROR_SUCCESS; - DWORD cbResults = sessionIDCount; + DWORD cbResults = xboxSessionIDCount; XSESSION_SEARCHRESULT_HEADER *pSearchResults = (XSESSION_SEARCHRESULT_HEADER *)threadData->searchBuffer; while( !XHasOverlappedIoCompleted(pOverlapped) ) @@ -1415,7 +1417,7 @@ int CPlatformNetworkManagerXbox::SearchForGamesThreadProc( void* lpParameter ) const XNKEY *QoSxnkey[XSESSION_SEARCH_MAX_IDS];// = new XNKEY*[sessionIDCount]; - for(DWORD i = 0; i < pSearchResults->dwSearchResults; ++i) + for(unsigned int i = 0; i < pSearchResults->dwSearchResults; ++i) { QoSxnaddr[i] = &pSearchResults->pResults[i].info.hostAddress; QoSxnkid[i] = &pSearchResults->pResults[i].info.sessionID; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index d3030fdd4..e01f7d66a 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -775,7 +775,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, seed, hasSeed, app.GetGameHostOption(eGameHostOption_All), Minecraft::GetInstance()->getCurrentTexturePackId()); - INT saveOrCheckpointId = 0; + int saveOrCheckpointId = 0; bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); TelemetryManager->RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId, compLength+8); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 1c363bb48..9c0968ef9 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -1455,7 +1455,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) } - INT saveOrCheckpointId = 0; + int saveOrCheckpointId = 0; bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); TelemetryManager->RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId, compLength+8); diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp index 57c3a5214..8f28fca56 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp @@ -81,7 +81,7 @@ void AddPlayerPacket::read(DataInputStream *dis) //throws IOException m_playerIndex = dis->readByte(); m_skinId = static_cast(dis->readInt()); m_capeId = static_cast(dis->readInt()); - INT privileges = dis->readInt(); + int privileges = dis->readInt(); m_uiGamePrivileges = static_cast(privileges); MemSect(1); unpack = SynchedEntityData::unpack(dis);