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 --- Minecraft.Client/PSVita/PSVita_Minecraft.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Minecraft.Client/PSVita/PSVita_Minecraft.cpp') diff --git a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp index 7544c98d..db1e7f0f 100644 --- a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp +++ b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp @@ -289,7 +289,7 @@ void MemSect(int sect) void debugSaveGameDirect() { - C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, NULL, "debugSaveGameDirect"); + C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, nullptr, "debugSaveGameDirect"); thread->Run(); thread->WaitForCompletion(1000); } @@ -521,7 +521,7 @@ int main() PSVitaNPToolkit::init(); // initialise the storage manager with a default save display name, a Minimum save size, and a callback for displaying the saving message - StorageManager.Init( 0, L"savegame.dat", "savePackName", FIFTY_ONE_MB, &CConsoleMinecraftApp::DisplaySavingMessage, (LPVOID)&app, NULL); + StorageManager.Init( 0, L"savegame.dat", "savePackName", FIFTY_ONE_MB, &CConsoleMinecraftApp::DisplaySavingMessage, (LPVOID)&app, nullptr); StorageManager.SetDLCProductCode(app.GetProductCode()); StorageManager.SetProductUpgradeKey(app.GetUpgradeKey()); ProfileManager.SetServiceID(app.GetCommerceCategory()); @@ -625,9 +625,9 @@ int main() StorageManager.SetDefaultImages((PBYTE)baOptionsIcon.data, baOptionsIcon.length,(PBYTE)baSaveImage.data, baSaveImage.length,(PBYTE)baSaveThumbnail.data, baSaveThumbnail.length); - if(baOptionsIcon.data!=NULL){ delete [] baOptionsIcon.data; } - if(baSaveThumbnail.data!=NULL){ delete [] baSaveThumbnail.data; } - if(baSaveImage.data!=NULL){ delete [] baSaveImage.data; } + if(baOptionsIcon.data!=nullptr){ delete [] baOptionsIcon.data; } + if(baSaveThumbnail.data!=nullptr){ delete [] baSaveThumbnail.data; } + if(baSaveImage.data!=nullptr){ delete [] baSaveImage.data; } StorageManager.SetIncompleteSaveCallback(CConsoleMinecraftApp::Callback_SaveGameIncomplete, (LPVOID)&app); @@ -656,7 +656,7 @@ int main() #endif StorageManager.SetDLCInfoMap(app.GetSonyDLCMap()); - app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL + app.CommerceInit(); // MGH - moved this here so GetCommerce isn't nullptr // 4J-PB - Kick of the check for trial or full version - requires ui to be initialised app.GetCommerce()->CheckForTrialUpgradeKey(); @@ -857,7 +857,7 @@ int main() else { MemSect(28); - pMinecraft->soundEngine->tick(NULL, 0.0f); + pMinecraft->soundEngine->tick(nullptr, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1068,7 +1068,7 @@ vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); - if( strUtf8 != NULL ) + if( strUtf8 != nullptr ) { vRichPresenceStrings.push_back(strUtf8); } @@ -1078,7 +1078,7 @@ uint8_t * AddRichPresenceString(int iID) void FreeRichPresenceStrings() { uint8_t *strUtf8; - for(int i=0;i