diff options
| author | Loki Rautio <lokirautio@gmail.com> | 2026-03-07 21:12:22 -0600 |
|---|---|---|
| committer | Loki Rautio <lokirautio@gmail.com> | 2026-03-07 21:12:22 -0600 |
| commit | 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch) | |
| tree | 69454763e73ca764af4e682d3573080b13138a0e /Minecraft.Client/Common/Network | |
| parent | a9be52c41a02d207233199e98898fe7483d7e817 (diff) | |
Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.Client/Common/Network')
14 files changed, 195 insertions, 197 deletions
diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index aef1ef9c..92ea8ad0 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -56,8 +56,8 @@ CGameNetworkManager::CGameNetworkManager() m_bFullSessionMessageOnNextSessionChange = false; #ifdef __ORBIS__ - m_pUpsell = nullptr; - m_pInviteInfo = nullptr; + m_pUpsell = NULL; + m_pInviteInfo = NULL; #endif } @@ -120,26 +120,26 @@ void CGameNetworkManager::DoWork() s_pPlatformNetworkManager->DoWork(); #ifdef __ORBIS__ - if (m_pUpsell != nullptr && m_pUpsell->hasResponse()) + if (m_pUpsell != NULL && m_pUpsell->hasResponse()) { int iPad_invited = m_iPlayerInvited, iPad_checking = m_pUpsell->m_userIndex; m_iPlayerInvited = -1; delete m_pUpsell; - m_pUpsell = nullptr; + m_pUpsell = NULL; if (ProfileManager.HasPlayStationPlus(iPad_checking)) { this->GameInviteReceived(iPad_invited, m_pInviteInfo); // m_pInviteInfo deleted by GameInviteReceived. - m_pInviteInfo = nullptr; + m_pInviteInfo = NULL; } else { delete m_pInviteInfo; - m_pInviteInfo = nullptr; + m_pInviteInfo = NULL; } } #endif @@ -194,16 +194,16 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame ProfileManager.SetDeferredSignoutEnabled(true); #endif - int64_t seed = 0; - if (lpParameter != nullptr) + int64_t seed = 0; + if(lpParameter != NULL) { - NetworkGameInitData *param = static_cast<NetworkGameInitData *>(lpParameter); + NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; seed = param->seed; app.setLevelGenerationOptions(param->levelGen); - if(param->levelGen != nullptr) + if(param->levelGen != NULL) { - if(app.getLevelGenerationOptions() == nullptr) + if(app.getLevelGenerationOptions() == NULL) { app.DebugPrintf("Game rule was not loaded, and seed is required. Exiting.\n"); return false; @@ -248,10 +248,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -259,18 +259,18 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #endif if( fileHandle != INVALID_HANDLE_VALUE ) { - DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -312,7 +312,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame } else { - Socket::Initialise(nullptr); + Socket::Initialise(NULL); } #ifndef _XBOX @@ -358,27 +358,27 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame if( g_NetworkManager.IsHost() ) { - connection = new ClientConnection(minecraft, nullptr); + connection = new ClientConnection(minecraft, NULL); } else { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(ProfileManager.GetLockedProfile()); - if(pNetworkPlayer == nullptr) + if(pNetworkPlayer == NULL) { MinecraftServer::HaltServer(); app.DebugPrintf("%d\n",ProfileManager.GetLockedProfile()); - // If the player is nullptr here then something went wrong in the session setup, and continuing will end up in a crash + // If the player is NULL here then something went wrong in the session setup, and continuing will end up in a crash return false; } Socket *socket = pNetworkPlayer->GetSocket(); // Fix for #13259 - CRASH: Gameplay: loading process is halted when player loads saved data - if(socket == nullptr) + if(socket == NULL) { assert(false); MinecraftServer::HaltServer(); - // If the socket is nullptr here then something went wrong in the session setup, and continuing will end up in a crash + // If the socket is NULL here then something went wrong in the session setup, and continuing will end up in a crash return false; } @@ -389,12 +389,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame { assert(false); delete connection; - connection = nullptr; + connection = NULL; MinecraftServer::HaltServer(); return false; } - connection->send(std::make_shared<PreLoginPacket>(minecraft->user->name)); + connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) ); // Tick connection until we're ready to go. The stages involved in this are: // (1) Creating the ClientConnection sends a prelogin packet to the server @@ -453,7 +453,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // Already have setup the primary pad if(idx == ProfileManager.GetPrimaryPad() ) continue; - if( GetLocalPlayerByUserIndex(idx) != nullptr && !ProfileManager.IsSignedIn(idx) ) + if( GetLocalPlayerByUserIndex(idx) != NULL && !ProfileManager.IsSignedIn(idx) ) { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); Socket *socket = pNetworkPlayer->GetSocket(); @@ -467,7 +467,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // when joining any other way, so just because they are signed in doesn't mean they are in the session // 4J Stu - If they are in the session, then we should add them to the game. Otherwise we won't be able to add them later INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) continue; ClientConnection *connection; @@ -481,7 +481,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // Open the socket on the server end to accept incoming data Socket::addIncomingSocket(socket); - connection->send(std::make_shared<PreLoginPacket>(convStringToWstring(ProfileManager.GetGamertag(idx)))); + connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) ); createdConnections.push_back( connection ); @@ -744,7 +744,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(FriendSession // Make sure that the Primary Pad is in by default localUsersMask |= GetLocalPlayerMask( ProfileManager.GetPrimaryPad() ); - return static_cast<eJoinGameResult>(s_pPlatformNetworkManager->JoinGame(searchResult, localUsersMask, primaryUserIndex)); + return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex )); } void CGameNetworkManager::CancelJoinGame(LPVOID lpParam) @@ -762,7 +762,7 @@ bool CGameNetworkManager::LeaveGame(bool bMigrateHost) int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad) { - INVITE_INFO * pInviteInfo = static_cast<INVITE_INFO *>(pParam); + INVITE_INFO * pInviteInfo = (INVITE_INFO *)pParam; if(bContinue==true) { @@ -801,9 +801,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL); #elif defined(__ORBIS__) - ProfileManager.GetChatAndContentRestrictions(iPad,false,nullptr,&noUGC,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL); #endif if(noUGC) @@ -823,7 +823,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin { #if defined(__ORBIS__) || defined(__PSVITA__) bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( 0, ProfileManager.GetPrimaryPad() ); @@ -912,7 +912,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed ); } // If we failed before the server started, clear the game rules. Otherwise the server will clear it up. - if(MinecraftServer::getInstance() == nullptr) app.m_gameRules.unloadCurrentGameRules(); + if(MinecraftServer::getInstance() == NULL) app.m_gameRules.unloadCurrentGameRules(); Tile::ReleaseThreadStorage(); return -1; } @@ -929,15 +929,15 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) int CGameNetworkManager::ServerThreadProc( void* lpParameter ) { - int64_t seed = 0; - if (lpParameter != nullptr) + int64_t seed = 0; + if(lpParameter != NULL) { - NetworkGameInitData *param = static_cast<NetworkGameInitData *>(lpParameter); + NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; seed = param->seed; app.SetGameHostOption(eGameHostOption_All,param->settings); // 4J Stu - If we are loading a DLC save that's separate from the texture pack, load - if( param->levelGen != nullptr && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) ) + if( param->levelGen != NULL && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) ) { while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin())) { @@ -966,7 +966,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter ) IntCache::ReleaseThreadStorage(); Level::destroyLightingCache(); - if(lpParameter != nullptr) delete lpParameter; + if(lpParameter != NULL) delete lpParameter; return S_OK; } @@ -979,7 +979,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam ) Compression::UseDefaultThreadStorage(); //app.SetGameStarted(false); - UIScene_PauseMenu::_ExitWorld(nullptr); + UIScene_PauseMenu::_ExitWorld(NULL); while( g_NetworkManager.IsInSession() ) { @@ -988,7 +988,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam ) // Xbox should always be online when receiving invites - on PS3 we need to check & ask the user to sign in #if !defined(__PS3__) && !defined(__PSVITA__) - JoinFromInviteData *inviteData = static_cast<JoinFromInviteData *>(lpParam); + JoinFromInviteData *inviteData = (JoinFromInviteData *)lpParam; app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, lpParam); #else if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) @@ -1216,14 +1216,14 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) #endif // Null the network player of all the server players that are local, to stop them being removed from the server when removed from the session - if( pServer != nullptr ) + if( pServer != NULL ) { PlayerList *players = pServer->getPlayers(); for(auto& servPlayer : players->players) { if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() ) { - servPlayer->connection->connection->getSocket()->setPlayer(nullptr); + servPlayer->connection->connection->getSocket()->setPlayer(NULL); } } } @@ -1259,7 +1259,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) char numLocalPlayers = 0; for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr ) + if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL ) { numLocalPlayers++; localUsersMask |= GetLocalPlayerMask(index); @@ -1277,11 +1277,11 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) } // Restore the network player of all the server players that are local - if( pServer != nullptr ) + if( pServer != NULL ) { for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr ) + if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL ) { PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid(); @@ -1295,7 +1295,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) } // Player might have a pending connection - if (pMinecraft->m_pendingLocalConnections[index] != nullptr) + if (pMinecraft->m_pendingLocalConnections[index] != NULL) { // Update the network player pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index)); @@ -1361,8 +1361,8 @@ void CGameNetworkManager::renderQueueMeter() #ifdef _XBOX int height = 720; - CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(nullptr, false); - CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(nullptr, false); + CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(NULL, false); + CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(NULL, false); Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->gui->renderGraph(CGameNetworkManager::messageQueue_length, CGameNetworkManager::messageQueuePos, CGameNetworkManager::messageQueue, 10, 1000, CGameNetworkManager::byteQueue, 100, 25000); @@ -1426,7 +1426,7 @@ void CGameNetworkManager::StateChange_AnyToStarting() { LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = nullptr; + loadingParams->lpParam = NULL; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1447,7 +1447,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(i); - if(pNetworkPlayer != nullptr && ProfileManager.IsSignedIn( i ) ) + if(pNetworkPlayer != NULL && ProfileManager.IsSignedIn( i ) ) { app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i ); Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex()); @@ -1482,12 +1482,12 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc { Minecraft *pMinecraft = Minecraft::GetInstance(); - Socket *socket = nullptr; + Socket *socket = NULL; shared_ptr<MultiplayerLocalPlayer> mpPlayer = nullptr; int userIdx = pNetworkPlayer->GetUserIndex(); if (userIdx >= 0 && userIdx < XUSER_MAX_COUNT) mpPlayer = pMinecraft->localplayers[userIdx]; - if( localPlayer && mpPlayer != nullptr && mpPlayer->connection != nullptr) + if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL) { // If we already have a MultiplayerLocalPlayer here then we are doing a session type change socket = mpPlayer->connection->getSocket(); @@ -1523,14 +1523,14 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc if( connection->createdOk ) { - connection->send(std::make_shared<PreLoginPacket>(pNetworkPlayer->GetOnlineName())); + connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) ); pMinecraft->addPendingLocalConnection(idx, connection); } else { pMinecraft->connectionDisconnected( idx , DisconnectPacket::eDisconnect_ConnectionCreationFailed ); delete connection; - connection = nullptr; + connection = NULL; } } } @@ -1540,10 +1540,10 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc void CGameNetworkManager::CloseConnection( INetworkPlayer *pNetworkPlayer ) { MinecraftServer *server = MinecraftServer::getInstance(); - if( server != nullptr ) + if( server != NULL ) { PlayerList *players = server->getPlayers(); - if( players != nullptr ) + if( players != NULL ) { players->closePlayerConnectionBySmallId(pNetworkPlayer->GetSmallId()); } @@ -1559,7 +1559,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer ) for (int iPad=0; iPad<XUSER_MAX_COUNT; ++iPad) { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad); - if (pNetworkPlayer == nullptr) continue; + if (pNetworkPlayer == NULL) continue; app.SetRichPresenceContext(iPad,CONTEXT_GAME_STATE_BLANK); if (multiplayer) @@ -1586,7 +1586,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer ) { for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(Minecraft::GetInstance()->localplayers[idx] != nullptr) + if(Minecraft::GetInstance()->localplayers[idx] != NULL) { TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } @@ -1609,7 +1609,7 @@ void CGameNetworkManager::PlayerLeaving( INetworkPlayer *pNetworkPlayer ) { for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(Minecraft::GetInstance()->localplayers[idx] != nullptr) + if(Minecraft::GetInstance()->localplayers[idx] != NULL) { TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } @@ -1632,7 +1632,7 @@ void CGameNetworkManager::WriteStats( INetworkPlayer *pNetworkPlayer ) void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *pInviteInfo) { #ifdef __ORBIS__ - if (m_pUpsell != nullptr) + if (m_pUpsell != NULL) { delete pInviteInfo; return; @@ -1721,7 +1721,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * { // 4J-PB we shouldn't bring any inactive players into the game, except for the invited player (who may be an inactive player) // 4J Stu - If we are not in a game, then bring in all players signed in - if(index==userIndex || pMinecraft->localplayers[index]!=nullptr ) + if(index==userIndex || pMinecraft->localplayers[index]!=NULL ) { ++joiningUsers; if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; @@ -1736,7 +1736,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * BOOL pccAllowed = TRUE; BOOL pccFriendsAllowed = TRUE; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL); #else ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1781,14 +1781,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * uiIDA[0]=IDS_CONFIRM_OK; // 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard - //StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + //StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,XUSER_INDEX_ANY); } else { #if defined(__ORBIS__) || defined(__PSVITA__) bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -1984,7 +1984,7 @@ const char *CGameNetworkManager::GetOnlineName(int playerIdx) void CGameNetworkManager::ServerReadyCreate(bool create) { - m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : nullptr ); + m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : NULL ); } void CGameNetworkManager::ServerReady() @@ -2000,17 +2000,17 @@ void CGameNetworkManager::ServerReadyWait() void CGameNetworkManager::ServerReadyDestroy() { delete m_hServerReadyEvent; - m_hServerReadyEvent = nullptr; + m_hServerReadyEvent = NULL; } bool CGameNetworkManager::ServerReadyValid() { - return ( m_hServerReadyEvent != nullptr ); + return ( m_hServerReadyEvent != NULL ); } void CGameNetworkManager::ServerStoppedCreate(bool create) { - m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : nullptr ); + m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : NULL ); } void CGameNetworkManager::ServerStopped() @@ -2051,12 +2051,12 @@ void CGameNetworkManager::ServerStoppedWait() void CGameNetworkManager::ServerStoppedDestroy() { delete m_hServerStoppedEvent; - m_hServerStoppedEvent = nullptr; + m_hServerStoppedEvent = NULL; } bool CGameNetworkManager::ServerStoppedValid() { - return ( m_hServerStoppedEvent != nullptr ); + return ( m_hServerStoppedEvent != NULL ); } int CGameNetworkManager::GetJoiningReadyPercentage() diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.h b/Minecraft.Client/Common/Network/GameNetworkManager.h index 3357b3cd..15c7f0b0 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Common/Network/GameNetworkManager.h @@ -108,7 +108,7 @@ public: static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface bool LeaveGame(bool bMigrateHost); static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad); - void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); void SendInviteGUI(int iPad); void ResetLeavingGame(); @@ -137,17 +137,17 @@ public: // Events - void ServerReadyCreate(bool create); // Create the signal (or set to nullptr) + void ServerReadyCreate(bool create); // Create the signal (or set to NULL) void ServerReady(); // Signal that we are ready void ServerReadyWait(); // Wait for the signal void ServerReadyDestroy(); // Destroy signal - bool ServerReadyValid(); // Is non-nullptr + bool ServerReadyValid(); // Is non-NULL void ServerStoppedCreate(bool create); // Create the signal void ServerStopped(); // Signal that we are ready - void ServerStoppedWait(); // Wait for the signal - void ServerStoppedDestroy(); // Destroy signal - bool ServerStoppedValid(); // Is non-nullptr + void ServerStoppedWait(); // Wait for the signal + void ServerStoppedDestroy(); // Destroy signal + bool ServerStoppedValid(); // Is non-NULL #ifdef __PSVITA__ static bool usingAdhocMode(); diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h index 3ed0f888..31c415a7 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h @@ -93,7 +93,7 @@ private: public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr) = 0; + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL) = 0; private: virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) = 0; diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 03be8ec9..970dfd24 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -26,7 +26,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) bool createFakeSocket = false; bool localPlayer = false; - NetworkPlayerXbox *networkPlayer = static_cast<NetworkPlayerXbox *>(addNetworkPlayer(pQNetPlayer)); + NetworkPlayerXbox *networkPlayer = (NetworkPlayerXbox *)addNetworkPlayer(pQNetPlayer); if( pQNetPlayer->IsLocal() ) { @@ -103,7 +103,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -112,7 +112,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -127,11 +127,11 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer) app.DebugPrintf("Player 0x%p \"%ls\" leaving.\n", pQNetPlayer, pQNetPlayer->GetGamertag()); INetworkPlayer* networkPlayer = getNetworkPlayer(pQNetPlayer); - if (networkPlayer == nullptr) + if (networkPlayer == NULL) return; Socket* socket = networkPlayer->GetSocket(); - if (socket != nullptr) + if (socket != NULL) { if (m_pIQNet->IsHost()) g_NetworkManager.CloseConnection(networkPlayer); @@ -146,7 +146,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer) for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (playerChangedCallback[idx] != nullptr) + if (playerChangedCallback[idx] != NULL) playerChangedCallback[idx](playerChangedCallbackParam[idx], networkPlayer, true); } @@ -162,7 +162,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = nullptr; + playerChangedCallback[ i ] = NULL; } m_bLeavingGame = false; @@ -173,8 +173,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_pSearchParam = NULL; + m_SessionsUpdatedCallback = NULL; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -182,10 +182,10 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_lastSearchStartTime[i] = 0; // The results that will be filled in with the current search - m_pSearchResults[i] = nullptr; - m_pQoSResult[i] = nullptr; - m_pCurrentSearchResults[i] = nullptr; - m_pCurrentQoSResult[i] = nullptr; + m_pSearchResults[i] = NULL; + m_pQoSResult[i] = NULL; + m_pCurrentSearchResults[i] = NULL; + m_pCurrentQoSResult[i] = NULL; m_currentSearchResultsCount[i] = 0; } @@ -231,7 +231,7 @@ void CPlatformNetworkManagerStub::DoWork() while (WinsockNetLayer::PopDisconnectedSmallId(&disconnectedSmallId)) { IQNetPlayer* qnetPlayer = m_pIQNet->GetPlayerBySmallId(disconnectedSmallId); - if (qnetPlayer != nullptr && qnetPlayer->m_smallId == disconnectedSmallId) + if (qnetPlayer != NULL && qnetPlayer->m_smallId == disconnectedSmallId) { NotifyPlayerLeaving(qnetPlayer); qnetPlayer->m_smallId = 0; @@ -386,7 +386,7 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame, #ifdef _WINDOWS64 int port = WIN64_NET_DEFAULT_PORT; - const char* bindIp = nullptr; + const char* bindIp = NULL; if (g_Win64DedicatedServer) { if (g_Win64DedicatedServerPort > 0) @@ -419,7 +419,7 @@ bool CPlatformNetworkManagerStub::_StartGame() int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int localUsersMask, int primaryUserIndex) { #ifdef _WINDOWS64 - if (searchResult == nullptr) + if (searchResult == NULL) return CGameNetworkManager::JOINGAME_FAIL_GENERAL; const char* hostIP = searchResult->data.hostIP; @@ -493,8 +493,8 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = nullptr; - playerChangedCallbackParam[iPad] = nullptr; + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; } } @@ -514,7 +514,7 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame() if (IQNet::m_player[i].m_isRemote) { INetworkPlayer* pNetworkPlayer = getNetworkPlayer(&IQNet::m_player[i]); - if (pNetworkPlayer != nullptr && pNetworkPlayer->GetSocket() != nullptr) + if (pNetworkPlayer != NULL && pNetworkPlayer->GetSocket() != NULL) { Socket::addIncomingSocket(pNetworkPlayer->GetSocket()); } @@ -524,14 +524,14 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame() return true; } -void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) +void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) { // DWORD playerCount = m_pIQNet->GetPlayerCount(); // // if( this->m_bLeavingGame ) // return; // -// if( GetHostPlayer() == nullptr ) +// if( GetHostPlayer() == NULL ) // return; // // for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) @@ -551,13 +551,13 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN // } // else // { -// m_hostGameSessionData.players[i] = nullptr; +// m_hostGameSessionData.players[i] = NULL; // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); // } // } // else // { -// m_hostGameSessionData.players[i] = nullptr; +// m_hostGameSessionData.players[i] = NULL; // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); // } // } @@ -568,18 +568,18 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = static_cast<INetworkPlayer *>(lpParam); + INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); delete socket; } @@ -669,7 +669,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset() void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == nullptr ) return; + if( pNetworkPlayer == NULL ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -685,7 +685,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) { return false; } @@ -713,7 +713,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() for(unsigned int i = 0; i < GetPlayerCount(); ++i) { - IQNetPlayer *pQNetPlayer = static_cast<NetworkPlayerXbox *>(GetPlayerByIndex(i))->GetQNetPlayer(); + IQNetPlayer *pQNetPlayer = ((NetworkPlayerXbox *)GetPlayerByIndex( i ))->GetQNetPlayer(); if(!pQNetPlayer->IsLocal()) { @@ -728,7 +728,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() void CPlatformNetworkManagerStub::TickSearch() { #ifdef _WINDOWS64 - if (m_SessionsUpdatedCallback == nullptr) + if (m_SessionsUpdatedCallback == NULL) return; static DWORD lastSearchTime = 0; @@ -757,7 +757,7 @@ void CPlatformNetworkManagerStub::SearchForGames() size_t nameLen = wcslen(lanSessions[i].hostName); info->displayLabel = new wchar_t[nameLen + 1]; wcscpy_s(info->displayLabel, nameLen + 1, lanSessions[i].hostName); - info->displayLabelLength = static_cast<unsigned char>(nameLen); + info->displayLabelLength = (unsigned char)nameLen; info->displayLabelViewableStartIndex = 0; info->data.netVersion = lanSessions[i].netVersion; @@ -772,8 +772,7 @@ void CPlatformNetworkManagerStub::SearchForGames() info->data.playerCount = lanSessions[i].playerCount; info->data.maxPlayers = lanSessions[i].maxPlayers; - info->sessionId = static_cast<uint64_t>(inet_addr(lanSessions[i].hostIP)) | - static_cast<uint64_t>(lanSessions[i].hostPort) << 32; + info->sessionId = (SessionID)((uint64_t)inet_addr(lanSessions[i].hostIP) | ((uint64_t)lanSessions[i].hostPort << 32)); friendsSessions[0].push_back(info); } @@ -813,7 +812,7 @@ void CPlatformNetworkManagerStub::SearchForGames() size_t nameLen = wcslen(label); info->displayLabel = new wchar_t[nameLen+1]; wcscpy_s(info->displayLabel, nameLen + 1, label); - info->displayLabelLength = static_cast<unsigned char>(nameLen); + info->displayLabelLength = (unsigned char)nameLen; info->displayLabelViewableStartIndex = 0; info->data.isReadyToJoin = true; info->data.isJoinable = true; @@ -827,9 +826,9 @@ void CPlatformNetworkManagerStub::SearchForGames() std::fclose(file); } - m_searchResultsCount[0] = static_cast<int>(friendsSessions[0].size()); + m_searchResultsCount[0] = (int)friendsSessions[0].size(); - if (m_SessionsUpdatedCallback != nullptr) + if (m_SessionsUpdatedCallback != NULL) m_SessionsUpdatedCallback(m_pSearchParam); #endif } @@ -877,7 +876,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() m_searchResultsCount[i] = 0; m_lastSearchStartTime[i] = 0; delete m_pSearchResults[i]; - m_pSearchResults[i] = nullptr; + m_pSearchResults[i] = NULL; } } @@ -904,7 +903,7 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer) { - return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : nullptr; + return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL; } diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h index 4a3f4068..261639f2 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h @@ -81,7 +81,7 @@ private: GameSessionData m_hostGameSessionData; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Common/Network/SessionInfo.h b/Minecraft.Client/Common/Network/SessionInfo.h index 7ae53c28..ce6365bc 100644 --- a/Minecraft.Client/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Common/Network/SessionInfo.h @@ -113,7 +113,7 @@ public: FriendSessionInfo() { - displayLabel = nullptr; + displayLabel = NULL; displayLabelLength = 0; displayLabelViewableStartIndex = 0; hasPartyMember = false; @@ -121,7 +121,7 @@ public: ~FriendSessionInfo() { - if (displayLabel != nullptr) + if (displayLabel != NULL) delete displayLabel; } }; diff --git a/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp b/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp index a1cc4038..21cd82aa 100644 --- a/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp +++ b/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp @@ -4,7 +4,7 @@ NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer *qnetPlayer) { m_sqrPlayer = qnetPlayer; - m_pSocket = nullptr; + m_pSocket = NULL; m_lastChunkPacketTime = 0; } @@ -16,12 +16,12 @@ unsigned char NetworkPlayerSony::GetSmallId() void NetworkPlayerSony::SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority, bool ack) { // TODO - handle priority - m_sqrPlayer->SendData( static_cast<NetworkPlayerSony *>(player)->m_sqrPlayer, pvData, dataSize, ack ); + m_sqrPlayer->SendData( ((NetworkPlayerSony *)player)->m_sqrPlayer, pvData, dataSize, ack ); } bool NetworkPlayerSony::IsSameSystem(INetworkPlayer *player) { - return m_sqrPlayer->IsSameSystem(static_cast<NetworkPlayerSony *>(player)->m_sqrPlayer); + return m_sqrPlayer->IsSameSystem(((NetworkPlayerSony *)player)->m_sqrPlayer); } int NetworkPlayerSony::GetOutstandingAckCount() @@ -133,5 +133,5 @@ int NetworkPlayerSony::GetTimeSinceLastChunkPacket_ms() } int64_t currentTime = System::currentTimeMillis(); - return static_cast<int>(currentTime - m_lastChunkPacketTime); + return (int)( currentTime - m_lastChunkPacketTime ); } diff --git a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp index 107101f4..a9799d26 100644 --- a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp +++ b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp @@ -123,7 +123,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom); Socket *socket = pPlayerFrom->GetSocket(); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(data, dataSize, false); } else @@ -132,7 +132,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo); Socket *socket = pPlayerTo->GetSocket(); //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(data, dataSize); } } @@ -226,7 +226,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer * for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -235,7 +235,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer * int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -258,7 +258,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay { // Get our wrapper object associated with this player. Socket *socket = networkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { // If we are in game then remove this player from the game as well. // We may get here either from the player requesting to exit the game, @@ -274,19 +274,19 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay // We need this as long as the game server still needs to communicate with the player //delete socket; - networkPlayer->SetSocket( nullptr ); + networkPlayer->SetSocket( NULL ); } if( m_pSQRNet->IsHost() && !m_bHostChanged ) { if( isSystemPrimaryPlayer(pSQRPlayer) ) { - SQRNetworkPlayer *pNewSQRPrimaryPlayer = nullptr; + SQRNetworkPlayer *pNewSQRPrimaryPlayer = NULL; for(unsigned int i = 0; i < m_pSQRNet->GetPlayerCount(); ++i ) { SQRNetworkPlayer *pSQRPlayer2 = m_pSQRNet->GetPlayerByIndex( i ); - if ( pSQRPlayer2 != nullptr && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) ) + if ( pSQRPlayer2 != NULL && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) ) { pNewSQRPrimaryPlayer = pSQRPlayer2; break; @@ -298,7 +298,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay m_machineSQRPrimaryPlayers.erase( it ); } - if( pNewSQRPrimaryPlayer != nullptr ) + if( pNewSQRPrimaryPlayer != NULL ) m_machineSQRPrimaryPlayers.push_back( pNewSQRPrimaryPlayer ); } @@ -311,7 +311,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); } @@ -320,7 +320,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -391,7 +391,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa if(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) { // we're signed into the PSN, but we won't be online yet, force a sign-in online here - m_pSQRNet_Vita->AttemptPSNSignIn(nullptr, nullptr); + m_pSQRNet_Vita->AttemptPSNSignIn(NULL, NULL); } @@ -402,7 +402,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = nullptr; + playerChangedCallback[ i ] = NULL; } m_bLeavingGame = false; @@ -413,11 +413,11 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_pSearchParam = NULL; + m_SessionsUpdatedCallback = NULL; m_searchResultsCount = 0; - m_pSearchResults = nullptr; + m_pSearchResults = NULL; m_lastSearchStartTime = 0; @@ -622,11 +622,11 @@ bool CPlatformNetworkManagerSony::RemoveLocalPlayerByUserIndex( int userIndex ) SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(userIndex); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - if(pNetworkPlayer != nullptr) + if(pNetworkPlayer != NULL) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { // We can't remove the player from qnet until we have stopped using it to communicate C4JThread* thread = new C4JThread(&CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc, pNetworkPlayer, "RemovePlayerOnSocketClosed"); @@ -702,11 +702,11 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost) SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - if(pNetworkPlayer != nullptr) + if(pNetworkPlayer != NULL) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); DWORD result = socket->m_socketClosedEvent->WaitForSignal(INFINITE); @@ -718,13 +718,13 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost) // 4J Stu - Clear our reference to this socket pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); } delete socket; } else { - //printf("Socket is already nullptr\n"); + //printf("Socket is already NULL\n"); } } @@ -878,8 +878,8 @@ void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = nullptr; - playerChangedCallbackParam[iPad] = nullptr; + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; } } @@ -917,7 +917,7 @@ bool CPlatformNetworkManagerSony::_RunNetworkGame() // Note that this does less than the xbox equivalent as we have HandleResyncPlayerRequest that is called by the underlying SQRNetworkManager when players are added/removed etc., so this // call is only used to update the game host settings & then do the final push out of the data. -void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) +void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) { if( this->m_bLeavingGame ) return; @@ -934,7 +934,7 @@ void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pN // If this is called With a pNetworkPlayerLeaving, then the call has ultimately started within SQRNetworkManager::RemoveRemotePlayersAndSync, so we don't need to sync each change // as that function does a sync at the end of all changes. - if( pNetworkPlayerLeaving == nullptr ) + if( pNetworkPlayerLeaving == NULL ) { m_pSQRNet->UpdateExternalRoomData(); } @@ -946,14 +946,14 @@ int CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc( void* lpP Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); delete socket; } @@ -1030,7 +1030,7 @@ void CPlatformNetworkManagerSony::SystemFlagReset() void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == nullptr ) return; + if( pNetworkPlayer == NULL ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -1046,7 +1046,7 @@ void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) { return false; } @@ -1064,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, wstring CPlatformNetworkManagerSony::GatherStats() { #if 0 - return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_MESSAGES ) ) - + L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ) ); + return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + + L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); #else return L""; #endif @@ -1111,7 +1111,7 @@ void CPlatformNetworkManagerSony::TickSearch() } m_bSearchPending = false; - if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam); + if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); } } else @@ -1126,7 +1126,7 @@ void CPlatformNetworkManagerSony::TickSearch() if( usingAdhocMode()) searchDelay = 5000; #endif - if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + searchDelay) < GetTickCount() ) + if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + searchDelay) < GetTickCount() ) { if( m_pSQRNet->FriendRoomManagerSearch() ) { @@ -1189,7 +1189,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session if(memcmp( &pSearchResult->info.sessionID, &sessionId, sizeof(SessionID) ) != 0) continue; bool foundSession = false; - FriendSessionInfo *sessionInfo = nullptr; + FriendSessionInfo *sessionInfo = NULL; auto itFriendSession = friendsSessions[iPad].begin(); for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession) { @@ -1231,7 +1231,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session sessionInfo->data.isJoinable) { foundSessionInfo->data = sessionInfo->data; - if(foundSessionInfo->displayLabel != nullptr) delete [] foundSessionInfo->displayLabel; + if(foundSessionInfo->displayLabel != NULL) delete [] foundSessionInfo->displayLabel; foundSessionInfo->displayLabel = new wchar_t[100]; memcpy(foundSessionInfo->displayLabel, sessionInfo->displayLabel, 100 * sizeof(wchar_t) ); foundSessionInfo->displayLabelLength = sessionInfo->displayLabelLength; @@ -1267,7 +1267,7 @@ void CPlatformNetworkManagerSony::ForceFriendsSessionRefresh() m_lastSearchStartTime = 0; m_searchResultsCount = 0; delete m_pSearchResults; - m_pSearchResults = nullptr; + m_pSearchResults = NULL; } INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) @@ -1293,7 +1293,7 @@ void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlay INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) { - return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : nullptr; + return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : NULL; } diff --git a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h index 9131e897..258acd83 100644 --- a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h +++ b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h @@ -102,7 +102,7 @@ private: GameSessionData m_hostGameSessionData; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp b/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp index 7561c17d..f23a0a63 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp @@ -16,7 +16,7 @@ int SQRNetworkManager::GetSendQueueSizeBytes() for(int i = 0; i < playerCount; ++i) { SQRNetworkPlayer *player = GetPlayerByIndex( i ); - if( player != nullptr ) + if( player != NULL ) { queueSize += player->GetTotalSendQueueBytes(); } @@ -31,7 +31,7 @@ int SQRNetworkManager::GetSendQueueSizeMessages() for(int i = 0; i < playerCount; ++i) { SQRNetworkPlayer *player = GetPlayerByIndex( i ); - if( player != nullptr ) + if( player != NULL ) { queueSize += player->GetTotalSendQueueMessages(); } diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp index 4ed27824..79c9835b 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp @@ -279,12 +279,12 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack { // no data, just the flag assert(dataSize == 0); - assert(data == nullptr); + assert(data == NULL); int dataSize = dataRemaining; if( dataSize > SNP_MAX_PAYLOAD ) dataSize = SNP_MAX_PAYLOAD; - sendBlock.start = nullptr; - sendBlock.end = nullptr; - sendBlock.current = nullptr; + sendBlock.start = NULL; + sendBlock.end = NULL; + sendBlock.current = NULL; sendBlock.ack = ackFlags; m_sendQueue.push(sendBlock); } @@ -387,9 +387,9 @@ int SQRNetworkPlayer::ReadDataPacket(void* data, int dataSize) unsigned char* packetData = new unsigned char[packetSize]; #ifdef __PS3__ - int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr ); + int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL ); #else // __ORBIS__ && __PSVITA__ - int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr ); + int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL ); #endif if(bytesRead == sc_wouldBlockFlag) { @@ -426,9 +426,9 @@ void SQRNetworkPlayer::ReadAck() { DataPacketHeader header; #ifdef __PS3__ - int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr ); + int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL ); #else // __ORBIS__ && __PSVITA__ - int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr ); + int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL ); #endif if(bytesRead == sc_wouldBlockFlag) { @@ -459,7 +459,7 @@ void SQRNetworkPlayer::ReadAck() void SQRNetworkPlayer::WriteAck() { - SendInternal(nullptr, 0, e_flag_AckReturning); + SendInternal(NULL, 0, e_flag_AckReturning); } int SQRNetworkPlayer::GetOutstandingAckCount() diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h index c67069d1..a72e5a41 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h @@ -63,7 +63,7 @@ class SQRNetworkPlayer public: DataPacketHeader() : m_dataSize(0), m_ackFlags(e_flag_AckUnknown) {} DataPacketHeader(int dataSize, AckFlags ackFlags) : m_dataSize(dataSize), m_ackFlags(ackFlags) { } - AckFlags GetAckFlags() { return static_cast<AckFlags>(m_ackFlags);} + AckFlags GetAckFlags() { return (AckFlags)m_ackFlags;} int GetDataSize() { return m_dataSize; } }; diff --git a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp index 47beb63c..02fc73cf 100644 --- a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp +++ b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp @@ -29,8 +29,8 @@ static SceRemoteStorageStatus statParams; // void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) // { // app.DebugPrintf("remoteStorageCallback err : 0x%08x\n"); -// -// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, nullptr); +// +// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL); // } @@ -39,13 +39,13 @@ static SceRemoteStorageStatus statParams; void SonyRemoteStorage::SetRetrievedDescData() { DescriptionData* pDescDataTest = (DescriptionData*)m_remoteFileInfo->fileDescription; - ESavePlatform testPlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3])); + ESavePlatform testPlatform = (ESavePlatform)MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3]); if(testPlatform == SAVE_FILE_PLATFORM_NONE) { // new version of the descData DescriptionData_V2* pDescData2 = (DescriptionData_V2*)m_remoteFileInfo->fileDescription; m_retrievedDescData.m_descDataVersion = GetU32FromHexBytes(pDescData2->m_descDataVersion); - m_retrievedDescData.m_savePlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3])); + m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3]); m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData2->m_seed); m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData2->m_hostOptions); m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData2->m_texturePack); @@ -58,7 +58,7 @@ void SonyRemoteStorage::SetRetrievedDescData() // old version,copy the data across to the new version DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription; m_retrievedDescData.m_descDataVersion = 1; - m_retrievedDescData.m_savePlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3])); + m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]); m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData->m_seed); m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData->m_hostOptions); m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData->m_texturePack); @@ -73,7 +73,7 @@ void SonyRemoteStorage::SetRetrievedDescData() void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam); + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; app.DebugPrintf("remoteStorageGetInfoCallback err : 0x%08x\n", error_code); if(error_code == 0) { @@ -99,7 +99,7 @@ void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int static void getSaveInfoInitCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam); + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; if(error_code != 0) { app.DebugPrintf("getSaveInfoInitCallback err : 0x%08x\n", error_code); @@ -143,7 +143,7 @@ bool SonyRemoteStorage::getSaveData( const char* localDirname, CallbackFunc cb, static void setSaveDataInitCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam); + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; if(error_code != 0) { app.DebugPrintf("setSaveDataInitCallback err : 0x%08x\n", error_code); @@ -181,7 +181,7 @@ const char* SonyRemoteStorage::getLocalFilename() const char* SonyRemoteStorage::getSaveNameUTF8() { if(m_getInfoStatus != e_infoFound) - return nullptr; + return NULL; return m_retrievedDescData.m_saveNameUTF8; } @@ -244,7 +244,7 @@ bool SonyRemoteStorage::setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpPara int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - SonyRemoteStorage *pClass= static_cast<SonyRemoteStorage *>(lpParam); + SonyRemoteStorage *pClass= (SonyRemoteStorage *)lpParam; if(pClass->m_bAborting) { @@ -261,12 +261,12 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum } else { - app.DebugPrintf("Thumbnail data is nullptr, or has size 0\n"); - pClass->m_thumbnailData = nullptr; + app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); + pClass->m_thumbnailData = NULL; pClass->m_thumbnailDataSize = 0; } - if(pClass->m_SetDataThread != nullptr) + if(pClass->m_SetDataThread != NULL) delete pClass->m_SetDataThread; pClass->m_SetDataThread = new C4JThread(setDataThread, pClass, "setDataThread"); @@ -277,7 +277,7 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum int SonyRemoteStorage::setDataThread(void* lpParam) { - SonyRemoteStorage* pClass = static_cast<SonyRemoteStorage *>(lpParam); + SonyRemoteStorage* pClass = (SonyRemoteStorage*)lpParam; pClass->m_startTime = System::currentTimeMillis(); pClass->setDataInternal(); return 0; @@ -322,8 +322,8 @@ int SonyRemoteStorage::getDataProgress() int64_t time = System::currentTimeMillis(); int elapsedSecs = (time - m_startTime) / 1000; - float estimatedTransfered = static_cast<float>(elapsedSecs * transferRatePerSec); - int progVal = m_dataProgress + (estimatedTransfered / static_cast<float>(totalSize)) * 100; + float estimatedTransfered = float(elapsedSecs * transferRatePerSec); + int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100; if(progVal > nextChunk) return nextChunk; if(progVal > 99) @@ -346,7 +346,7 @@ bool SonyRemoteStorage::shutdown() app.DebugPrintf("Term request done \n"); m_bInitialised = false; free(m_memPoolBuffer); - m_memPoolBuffer = nullptr; + m_memPoolBuffer = NULL; return true; } else @@ -406,11 +406,10 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData) unsigned int uiHostOptions; bool bHostOptionsRead; DWORD uiTexturePack; - char seed[22]; - app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize, reinterpret_cast<unsigned char*>(seed), - uiHostOptions, bHostOptionsRead, uiTexturePack); + char seed[22]; + app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - int64_t iSeed = strtoll(seed, nullptr,10); + int64_t iSeed = strtoll(seed,NULL,10); SetU64HexBytes(descData.m_seed, iSeed); // Save the host options that this world was last played with SetU32HexBytes(descData.m_hostOptions, uiHostOptions); @@ -449,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData) char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - int64_t iSeed = strtoll(seed, nullptr,10); + int64_t iSeed = strtoll(seed,NULL,10); SetU64HexBytes(descData.m_seed, iSeed); // Save the host options that this world was last played with SetU32HexBytes(descData.m_hostOptions, uiHostOptions); diff --git a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h index 5740f78d..89ecc066 100644 --- a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h +++ b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h @@ -140,7 +140,7 @@ public: static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); static int setDataThread(void* lpParam); - SonyRemoteStorage() : m_getInfoStatus(e_noInfoFound), m_bInitialised(false),m_memPoolBuffer(nullptr) {} + SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {} protected: const char* getRemoteSaveFilename(); |
