diff options
| author | qwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com> | 2026-03-16 21:44:26 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-16 21:44:26 -0500 |
| commit | ce739f6045ec72127491286ea3f3f21e537c1b55 (patch) | |
| tree | f33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.Client/Durango/Durango_App.cpp | |
| parent | 255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff) | |
| parent | 5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff) | |
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Durango/Durango_App.cpp')
| -rw-r--r-- | Minecraft.Client/Durango/Durango_App.cpp | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/Minecraft.Client/Durango/Durango_App.cpp b/Minecraft.Client/Durango/Durango_App.cpp index 59ac8ba0..efef93b4 100644 --- a/Minecraft.Client/Durango/Durango_App.cpp +++ b/Minecraft.Client/Durango/Durango_App.cpp @@ -12,6 +12,7 @@ #include "ServiceConfig\Events-XBLA.8-149E11AEEvents.h" #include "..\..\Minecraft.World\DurangoStats.h" #include "..\..\Minecraft.Client\Durango\XML\xmlFilesCallback.h" +#include "Common/UI/UI.h" CConsoleMinecraftApp app; @@ -42,7 +43,7 @@ void CConsoleMinecraftApp::HandleDLCLicenseChange() XCONTENT_DATA *pContentData=StorageManager.GetInstalledDLC(xOffer.wszProductID); - if((pContentData!=NULL) &&(pContentData->bTrialLicense==false)) + if((pContentData!=nullptr) &&(pContentData->bTrialLicense==false)) { DLCPack *pack = app.m_dlcManager.getPackFromProductID(xOffer.wszProductID); if(pack) @@ -50,7 +51,7 @@ void CConsoleMinecraftApp::HandleDLCLicenseChange() // Clear the DLC installed flag so the scenes will pick up the new dlc (could be a full pack install) app.ClearDLCInstalled(); app.DebugPrintf(">>> HandleDLCLicenseChange - Updating license for DLC [%ls]\n",xOffer.wszOfferName); - pack->updateLicenseMask(1); + pack->updateLicenseMask(1); } else { @@ -100,7 +101,7 @@ void CConsoleMinecraftApp::ExitGame() } void CConsoleMinecraftApp::FatalLoadError() { - // 4J-PB - + // 4J-PB - //for(int i=0;i<10;i++) { #ifndef _CONTENT_PACKAGE @@ -193,7 +194,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages() { free(pDLCInfo->pbImageData); pDLCInfo->dwImageBytes=0; - pDLCInfo->pbImageData=NULL; + pDLCInfo->pbImageData=nullptr; } } } @@ -204,10 +205,10 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D // load the local file WCHAR wchFilename[64]; - + // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds swprintf(wchFilename,L"DLCImages/%s",wchName); - HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( hFile == INVALID_HANDLE_VALUE ) { @@ -221,9 +222,9 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D if(*pdwBytes!=0) { DWORD dwBytesRead; - PBYTE pbImageData=(PBYTE)malloc(*pdwBytes); + PBYTE pbImageData=static_cast<PBYTE>(malloc(*pdwBytes)); - if(ReadFile(hFile,pbImageData,*pdwBytes,&dwBytesRead,NULL)==FALSE) + if(ReadFile(hFile,pbImageData,*pdwBytes,&dwBytesRead,nullptr)==FALSE) { // failed free(pbImageData); @@ -244,7 +245,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(NULL); + app.setLevelGenerationOptions(nullptr); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -269,11 +270,11 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() StorageManager.SetSaveTitle(wWorldName.c_str()); bool isFlat = false; - __int64 seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements + int64_t seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = NULL; + param->saveData = nullptr; app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -299,7 +300,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast<LPVOID>(param); // Reset the autosave time app.SetAutosaveTimerTime(); @@ -308,7 +309,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() thread->Run(); } -typedef struct +typedef struct { eDLCContentType e_DLC_Type; //WCHAR *wchDisplayName; @@ -386,7 +387,7 @@ bool CConsoleMinecraftApp::UpdateProductId(XCONTENT_DATA &Data) // Do we have a product id for this? DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName(Data.wszDisplayName); - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { app.DebugPrintf("Updating product id for %ls\n",Data.wszDisplayName); swprintf_s(Data.wszProductID, 64,L"%ls",pDLCInfo->wsProductId.c_str()); @@ -397,7 +398,7 @@ bool CConsoleMinecraftApp::UpdateProductId(XCONTENT_DATA &Data) app.DebugPrintf("Couldn't find %ls\n",Data.wszDisplayName); } - return false; + return false; } void CConsoleMinecraftApp::Shutdown() @@ -454,9 +455,9 @@ bool CConsoleMinecraftApp::TMSPP_ReadBannedList(int iPad,eTMSAction NextAction) int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, int iUserData, LPVOID lpvData,WCHAR *wchFilename) { app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPReadBannedList\n"); - C4JStorage::PTMSPP_FILEDATA pFileData=(C4JStorage::PTMSPP_FILEDATA)lpvData; - - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + C4JStorage::PTMSPP_FILEDATA pFileData=static_cast<C4JStorage::PTMSPP_FILEDATA>(lpvData); + + CConsoleMinecraftApp* pClass = static_cast<CConsoleMinecraftApp *>(pParam); if(pFileData) { @@ -471,7 +472,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, in // mark the level as not checked against banned levels - it'll be checked once the level starts app.SetBanListCheck(iPad,false); - // Xbox One will clear things within the DownloadBlob + // Xbox One will clear things within the DownloadBlob #ifndef _XBOX_ONE delete [] pFileData->pbData; delete [] pFileData; @@ -486,7 +487,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, in } // change the state to the next action - pClass->SetTMSAction(iPad,(eTMSAction)iUserData); + pClass->SetTMSAction(iPad,static_cast<eTMSAction>(iUserData)); return 0; } @@ -555,14 +556,14 @@ void CConsoleMinecraftApp::TMSPP_RetrieveFileList(int iPad,C4JStorage::eGlobalSt int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, int iUserData, LPVOID lpvData, WCHAR *wchFilename) { - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + CConsoleMinecraftApp* pClass = static_cast<CConsoleMinecraftApp *>(pParam); app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n"); - if(lpvData!=NULL) - { - vector<C4JStorage::PTMSPP_FILE_DETAILS> *pvTmsFileDetails=(vector<C4JStorage::PTMSPP_FILE_DETAILS> *)lpvData; + if(lpvData!= nullptr) + { + vector<C4JStorage::PTMSPP_FILE_DETAILS> *pvTmsFileDetails=static_cast<vector<C4JStorage::PTMSPP_FILE_DETAILS> *>(lpvData); if(pvTmsFileDetails->size()>0) - { + { #ifdef _DEBUG // dump out the file list app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size()); @@ -578,7 +579,7 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, } } // change the state to the next action - pClass->SetTMSAction(iPad,(eTMSAction)iUserData); + pClass->SetTMSAction(iPad,static_cast<eTMSAction>(iUserData)); return 0; } @@ -586,8 +587,8 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int iUserData, LPVOID lpvData ,WCHAR *pwchFilename) { app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPReadDLCFile\n"); - C4JStorage::PTMSPP_FILEDATA pFileData= (C4JStorage::PTMSPP_FILEDATA)lpvData; - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + C4JStorage::PTMSPP_FILEDATA pFileData= static_cast<C4JStorage::PTMSPP_FILEDATA>(lpvData); + CConsoleMinecraftApp* pClass = static_cast<CConsoleMinecraftApp *>(pParam); #ifdef WRITE_DLCINFO if(0) @@ -635,7 +636,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i // hack for now to upload the file // open the local file - file = CreateFile(L"DLCXbox1.cmp", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile(L"DLCXbox1.cmp", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -653,12 +654,12 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i PBYTE pbData= new BYTE [dwFileSize]; - ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); + ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); if(bytesRead==dwFileSize) { - //StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"DLCXbox1.cmp",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.cmp",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); + //StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"DLCXbox1.cmp",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.cmp",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); } Sleep(5000); } @@ -667,7 +668,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i /* // now the icon - file = CreateFile(L"TP06.png", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile(L"TP06.png", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -684,11 +685,11 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i PBYTE pbData= new BYTE [dwFileSize]; - ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); + ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); if(bytesRead==dwFileSize) { - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); } Sleep(5000); } @@ -698,16 +699,16 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i } // change the state to the next action - pClass->SetTMSAction(iPad,(eTMSAction)iUserData); + pClass->SetTMSAction(iPad,static_cast<eTMSAction>(iUserData)); return 0; } void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage::ESaveIncompleteType saveIncompleteType) { - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + CConsoleMinecraftApp* pClass = static_cast<CConsoleMinecraftApp *>(pParam); - if ( saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota + if ( saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota || saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfLocalStorage ) { StorageManager.SetSaveDisabled(true); @@ -718,10 +719,10 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage: else message = IDS_SAVE_INCOMPLETE_EXPLANATION_LOCAL_STORAGE; UINT uiIDA[3] = - { - IDS_SAVE_INCOMPLETE_RETRY_SAVING, - IDS_SAVE_INCOMPLETE_DISABLE_SAVING, - IDS_SAVE_INCOMPLETE_DELETE_SAVES + { + IDS_SAVE_INCOMPLETE_RETRY_SAVING, + IDS_SAVE_INCOMPLETE_DISABLE_SAVING, + IDS_SAVE_INCOMPLETE_DELETE_SAVES }; if ( ui.RequestMessageBox( IDS_SAVE_INCOMPLETE_TITLE, message, uiIDA,3,0,Callback_SaveGameIncompleteMessageBoxReturned,pClass, app.GetStringTable()) == C4JStorage::EMessage_Busy) @@ -740,7 +741,7 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage: int CConsoleMinecraftApp::Callback_SaveGameIncompleteMessageBoxReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + CConsoleMinecraftApp* pClass = static_cast<CConsoleMinecraftApp *>(pParam); switch(result) { @@ -757,7 +758,7 @@ int CConsoleMinecraftApp::Callback_SaveGameIncompleteMessageBoxReturned(void *pP StorageManager.CancelIncompleteOperation(); break; case C4JStorage::EMessage_ResultThirdOption: - ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, NULL, eUILayer_Error, eUIGroup_Fullscreen); + ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, nullptr, eUILayer_Error, eUIGroup_Fullscreen); break; } return 0; |
