From 28614b922fb77149a54da1a87bebfbc98736f296 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:08:36 -0400 Subject: Modernize project codebase (#906) * Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides * Add safety checks and fix a issue with vector going OOR --- .../PSVita/Network/SonyVoiceChat_Vita.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp') diff --git a/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp index 842e6b8d..37fea828 100644 --- a/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp @@ -67,7 +67,7 @@ void LoadPCMVoiceData() { char filename[64]; sprintf(filename, "voice%d.pcm", i+1); - HANDLE file = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(filename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); DWORD dwHigh=0; g_loadedPCMVoiceDataSizes[i] = GetFileSize(file,&dwHigh); @@ -75,7 +75,7 @@ void LoadPCMVoiceData() { g_loadedPCMVoiceData[i] = new char[g_loadedPCMVoiceDataSizes[i]]; DWORD bytesRead; - BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, NULL); + BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, nullptr); assert(bSuccess); } g_loadedPCMVoiceDataPos[i] = 0; @@ -285,7 +285,7 @@ void SQRVoiceConnection::readRemoteData() if( dataSize > 0 ) { VoicePacket packet; - unsigned int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, NULL ); + unsigned int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, nullptr ); unsigned int writeSize; if( bytesRead > 0 ) { @@ -378,7 +378,7 @@ uint32_t lastReadFrameCnt = 0; void PrintAllOutputVoiceStates( std::vector& connections) { - for(int rIdx=0;rIdxm_bConnected) @@ -668,7 +668,7 @@ void SonyVoiceChat_Vita::tick() EnterCriticalSection(&m_csRemoteConnections); - for(int i=m_remoteConnections.size()-1;i>=0;i--) + for(int i = (int)m_remoteConnections.size() - 1; i >= 0; i--) { if(m_remoteConnections[i]->m_bFlaggedForShutdown) { @@ -911,7 +911,7 @@ void SonyVoiceChat_Vita::initLocalPlayer(int playerIndex) if(m_localVoiceDevices[playerIndex].isValid() == false) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); // create all device ports required m_localVoiceDevices[playerIndex].init(chatRestricted); @@ -948,7 +948,7 @@ SQRVoiceConnection* SonyVoiceChat_Vita::GetVoiceConnectionFromRudpCtx( int RudpC if(m_remoteConnections[i]->m_rudpCtx == RudpCtx) return m_remoteConnections[i]; } - return NULL; + return nullptr; } void SonyVoiceChat_Vita::connectPlayerToAll( int playerIndex ) @@ -973,7 +973,7 @@ SQRVoiceConnection* SonyVoiceChat_Vita::getVoiceConnectionFromRoomMemberID( SceN } } - return NULL; + return nullptr; } void SonyVoiceChat_Vita::disconnectLocalPlayer( int localIdx ) @@ -998,7 +998,7 @@ void SonyVoiceChat_Vita::disconnectLocalPlayer( int localIdx ) if(m_numLocalDevicesConnected == 0) // no more local players, kill all the remote connections { - for(int i=0;i