diff options
| author | qwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com> | 2026-03-05 17:17:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-05 17:17:45 -0600 |
| commit | 0666959d312dc74903f55d1071488a90239330f1 (patch) | |
| tree | 5c6886f7ec65a7828bc6e34a469514e418bcf78b /Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp | |
| parent | 9370cbc7d878df1615d8ce76bc459e8b414d0f19 (diff) | |
| parent | eed770b121aa4ce38f002db042d0137c24c6d344 (diff) | |
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp')
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp | 284 |
1 files changed, 198 insertions, 86 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index d3cbe4c3..8664aca1 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -31,6 +31,32 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) { + // Check for a worldname.txt sidecar written by the rename feature first + size_t slashPos = filePath.rfind(L'\\'); + if (slashPos != wstring::npos) + { + wstring sidecarPath = filePath.substr(0, slashPos + 1) + L"worldname.txt"; + FILE *fr = NULL; + if (_wfopen_s(&fr, sidecarPath.c_str(), L"r") == 0 && fr) + { + char buf[128] = {}; + if (fgets(buf, sizeof(buf), fr)) + { + int len = (int)strlen(buf); + while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r' || buf[len-1] == ' ')) + buf[--len] = '\0'; + fclose(fr); + if (len > 0) + { + wchar_t wbuf[128] = {}; + mbstowcs(wbuf, buf, 127); + return wstring(wbuf); + } + } + else fclose(fr); + } + } + HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (hFile == INVALID_HANDLE_VALUE) return L""; @@ -110,8 +136,8 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) if (freeSaveData) delete[] saveData; delete[] rawData; - // "world" is the engine default — it means no real name was ever set, so - // return empty to let the caller fall back to the save filename (timestamp). + // "world" is the engine default - it means no real name was ever set, + // so return empty to let the caller fall back to the save filename (timestamp). if (result == L"world") result = L""; return result; } @@ -300,7 +326,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer bool bTexturePackAlreadyListed; bool bNeedToGetTPD=false; Minecraft *pMinecraft = Minecraft::GetInstance(); - int texturePacksCount = pMinecraft->skins->getTexturePackCount(); + int texturePacksCount = pMinecraft->skins->getTexturePackCount(); for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { @@ -407,7 +433,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() // update the tooltips // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should the the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; int iLB = -1; int iX=-1; @@ -418,7 +444,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() else if (DoesSavesListHaveFocus()) { if((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC)) - { + { if(StorageManager.GetSaveDisabled()) { iRB=IDS_TOOLTIPS_DELETESAVE; @@ -474,7 +500,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() // Is there a save from PS3 or PSVita available? // Sony asked that this be displayed at all times so users are aware of the functionality. We'll display some text when there's no save available //if(app.getRemoteStorage()->saveIsAvailable()) - { + { bool bSignedInLive = ProfileManager.IsSignedInLive(m_iPad); if(bSignedInLive) { @@ -489,7 +515,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK, iX, iY,-1,-1,iLB,iRB); } -// +// void UIScene_LoadOrJoinMenu::Initialise() { m_iSaveListIndex = 0; @@ -577,7 +603,7 @@ void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack) { app.SetLiveLinkRequired( true ); - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); // re-enable button presses m_bIgnoreInput=false; @@ -644,8 +670,6 @@ void UIScene_LoadOrJoinMenu::tick() { UIScene::tick(); - - #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined _WINDOWS64 || defined __PSVITA__) if(m_bExitScene) // navigate forward or back { @@ -661,7 +685,7 @@ void UIScene_LoadOrJoinMenu::tick() #ifdef SONY_REMOTE_STORAGE_DOWNLOAD // if the loadOrJoin menu has focus again, we can clear the saveTransfer flag now. Added so we can delay the ehternet disconnect till it's cleaned up if(m_eSaveTransferState == eSaveTransfer_Idle) - m_bSaveTransferRunning = false; + m_bSaveTransferRunning = false; #endif #if defined(_XBOX_ONE) || defined(__ORBIS__) if(m_bUpdateSaveSize) @@ -978,7 +1002,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() m_pSaveDetails=StorageManager.ReturnSavesInfo(); if(m_pSaveDetails==NULL) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); } #endif @@ -1027,7 +1051,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() m_pSaveDetails=StorageManager.ReturnSavesInfo(); if(m_pSaveDetails==NULL) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); } #if TO_BE_IMPLEMENTED @@ -1054,10 +1078,8 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() int i = 0; - for(AUTO_VAR(it, app.getLevelGenerators()->begin()); it != app.getLevelGenerators()->end(); ++it) + for ( LevelGenerationOptions *levelGen : *app.getLevelGenerators() ) { - LevelGenerationOptions *levelGen = *it; - // retrieve the save icon from the texture pack, if there is one unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId(); @@ -1071,7 +1093,7 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() continue; } } - + // 4J-JEV: For debug. Ignore worlds with no name. LPCWSTR wstr = levelGen->getWorldName(); m_buttonListSaves.addItem( wstr ); @@ -1124,7 +1146,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr case ACTION_MENU_X: #if TO_BE_IMPLEMENTED // Change device - // Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage + // Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage // device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes. m_bIgnoreInput=true; StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned,this,true); @@ -1142,7 +1164,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr { bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); if(bSignedInLive) - { + { LaunchSaveTransfer(); } } @@ -1334,10 +1356,14 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo UIScene_LoadOrJoinMenu *pClass=(UIScene_LoadOrJoinMenu *)lpParam; pClass->m_bIgnoreInput=false; if (bRes) - { + { uint16_t ui16Text[128]; ZeroMemory(ui16Text, 128 * sizeof(uint16_t) ); +#ifdef _WINDOWS64 + Win64_GetKeyboardText(ui16Text, 128); +#else InputManager.GetText(ui16Text); +#endif // check the name is valid if(ui16Text[0]!=0) @@ -1345,15 +1371,47 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined(__PSVITA__)) // open the save and overwrite the metadata StorageManager.RenameSaveData(pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC, ui16Text,&UIScene_LoadOrJoinMenu::RenameSaveDataReturned,pClass); +#elif defined(_WINDOWS64) + { + int listPos = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; + + // Convert the ui16Text input to a wide string + wchar_t wNewName[128] = {}; + for (int k = 0; k < 127 && ui16Text[k]; k++) + wNewName[k] = (wchar_t)ui16Text[k]; + + // Convert to narrow for storage and in-memory update + char narrowName[128] = {}; + wcstombs(narrowName, wNewName, 127); + + // Build the sidecar path: Windows64\GameHDD\{folder}\worldname.txt + wchar_t wFilename[MAX_SAVEFILENAME_LENGTH] = {}; + mbstowcs(wFilename, pClass->m_saveDetails[listPos].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); + wstring sidecarPath = wstring(L"Windows64\\GameHDD\\") + wstring(wFilename) + wstring(L"\\worldname.txt"); + + FILE *fw = NULL; + if (_wfopen_s(&fw, sidecarPath.c_str(), L"w") == 0 && fw) + { + fputs(narrowName, fw); + fclose(fw); + } + + // Update the in-memory display name so the list reflects it immediately + strncpy_s(pClass->m_saveDetails[listPos].UTF8SaveName, narrowName, 127); + pClass->m_saveDetails[listPos].UTF8SaveName[127] = '\0'; + + // Reuse the existing callback to trigger the list repopulate + UIScene_LoadOrJoinMenu::RenameSaveDataReturned(pClass, true); + } #endif } - else + else { pClass->m_bIgnoreInput=false; pClass->updateTooltips(); } - } - else + } + else { pClass->m_bIgnoreInput=false; pClass->updateTooltips(); @@ -1367,13 +1425,13 @@ void UIScene_LoadOrJoinMenu::handleInitFocus(F64 controlId, F64 childId) app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleInitFocus - %d , %d\n", (int)controlId, (int)childId); } -void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) +void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) { app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", (int)controlId, (int)childId); - + switch((int)controlId) { - case eControl_GamesList: + case eControl_GamesList: m_iGameListIndex = childId; m_buttonListGames.updateChildFocus( (int) childId ); break; @@ -1409,7 +1467,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) ui.PlayUISFX(eSFX_Press); if((int)childId == JOIN_LOAD_CREATE_BUTTON_INDEX) - { + { app.SetTutorialMode( false ); m_controlJoinTimer.setVisible( false ); @@ -1461,7 +1519,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) } else #endif - { + { app.SetTutorialMode( false ); if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) @@ -1503,7 +1561,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) case eControl_GamesList: { m_bIgnoreInput=true; - + m_eAction = eAction_JoinGame; //CD - Added for audio @@ -1538,7 +1596,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) bool bPlayStationPlus=true; int iPadWithNoPlaystationPlus=0; - bool isSignedInLive = true; + bool isSignedInLive = true; int iPadNotSignedInLive = -1; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -1631,7 +1689,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; - param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; + param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); iResult=sceNpCommerceDialogOpen(¶m); @@ -1714,7 +1772,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) } void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) -{ +{ // Load data from disc //File saveFile( L"Tutorial\\Tutorial" ); //LoadSaveFromDisk(&saveFile); @@ -1812,7 +1870,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should show the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; int iX=-1; @@ -1859,10 +1917,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() unsigned int sessionIndex = 0; m_buttonListGames.setCurrentSelection(0); - for( AUTO_VAR(it, m_currentSessions->begin()); it < m_currentSessions->end(); ++it) + for( FriendSessionInfo *sessionInfo : *m_currentSessions ) { - FriendSessionInfo *sessionInfo = *it; - wchar_t textureName[64] = L"\0"; // Is this a default game or a texture pack game? @@ -2036,7 +2092,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) if(iImageDataBytes!=0) { - // set the image + // set the image registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,true); m_iConfigA[i]=-1; } @@ -2049,7 +2105,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) bool bAllDone=true; for(int i=0;i<m_iTexturePacksNotInstalled;i++) { - if(m_iConfigA[i]!=-1) + if(m_iConfigA[i]!=-1) { bAllDone = false; } @@ -2064,13 +2120,13 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) } break; -#endif +#endif } } void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform savePlatform /*= SAVE_FILE_PLATFORM_LOCAL*/) -{ +{ // we'll only be coming in here when the tutorial is loaded now StorageManager.ResetSaveData(); @@ -2128,7 +2184,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save #ifdef SONY_REMOTE_STORAGE_DOWNLOAD void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() -{ +{ wchar_t wFileName[128]; mbstowcs(wFileName, app.getRemoteStorage()->getLocalFilename(), strlen(app.getRemoteStorage()->getLocalFilename())+1); // plus null @@ -2193,6 +2249,31 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() #endif //SONY_REMOTE_STORAGE_DOWNLOAD +#ifdef _WINDOWS64 +static bool Win64_DeleteSaveDirectory(const wchar_t* wPath) +{ + wchar_t wSearch[MAX_PATH]; + swprintf_s(wSearch, MAX_PATH, L"%s\\*", wPath); + WIN32_FIND_DATAW fd; + HANDLE hFind = FindFirstFileW(wSearch, &fd); + if (hFind != INVALID_HANDLE_VALUE) + { + do + { + if (wcscmp(fd.cFileName, L".") == 0 || wcscmp(fd.cFileName, L"..") == 0) continue; + wchar_t wChild[MAX_PATH]; + swprintf_s(wChild, MAX_PATH, L"%s\\%s", wPath, fd.cFileName); + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + Win64_DeleteSaveDirectory(wChild); + else + DeleteFileW(wChild); + } while (FindNextFileW(hFind, &fd)); + FindClose(hFind); + } + return RemoveDirectoryW(wPath) != 0; +} +#endif // _WINDOWS64 + int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; @@ -2201,7 +2282,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt // Check that we have a valid save selected (can get a bad index if the save list has been refreshed) bool validSelection= pClass->m_iDefaultButtonsC != 0 && pClass->m_iSaveListIndex >= pClass->m_iDefaultButtonsC; - if(result==C4JStorage::EMessage_ResultDecline && validSelection) + if(result==C4JStorage::EMessage_ResultDecline && validSelection) { if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { @@ -2209,7 +2290,24 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt } else { +#ifdef _WINDOWS64 + { + // Use m_saveDetails (sorted display order) so the correct folder is targeted + int displayIdx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; + bool bSuccess = false; + if (pClass->m_saveDetails && displayIdx >= 0 && pClass->m_saveDetails[displayIdx].UTF8SaveFilename[0]) + { + wchar_t wFilename[MAX_SAVEFILENAME_LENGTH] = {}; + mbstowcs_s(NULL, wFilename, MAX_SAVEFILENAME_LENGTH, pClass->m_saveDetails[displayIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); + wchar_t wFolderPath[MAX_PATH] = {}; + swprintf_s(wFolderPath, MAX_PATH, L"Windows64\\GameHDD\\%s", wFilename); + bSuccess = Win64_DeleteSaveDirectory(wFolderPath); + } + UIScene_LoadOrJoinMenu::DeleteSaveDataReturned((LPVOID)pClass->GetCallbackUniqueId(), bSuccess); + } +#else StorageManager.DeleteSaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC], UIScene_LoadOrJoinMenu::DeleteSaveDataReturned, (LPVOID)pClass->GetCallbackUniqueId()); +#endif pClass->m_controlSavesTimer.setVisible( true ); } } @@ -2231,7 +2329,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) if(bRes) { // wipe the list and repopulate it - pClass->m_iState=e_SavesRepopulateAfterDelete; + pClass->m_iState=e_SavesRepopulateAfterDelete; } else pClass->m_bIgnoreInput=false; @@ -2285,7 +2383,21 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS case C4JStorage::EMessage_ResultDecline: // rename { pClass->m_bIgnoreInput=true; -#ifdef _DURANGO +#ifdef _WINDOWS64 + { + wchar_t wSaveName[128]; + ZeroMemory(wSaveName, 128 * sizeof(wchar_t)); + mbstowcs_s(NULL, wSaveName, 128, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, _TRUNCATE); + UIKeyboardInitData kbData; + kbData.title = app.GetString(IDS_RENAME_WORLD_TITLE); + kbData.defaultText = wSaveName; + kbData.maxChars = 25; + kbData.callback = &UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback; + kbData.lpParam = pClass; + kbData.pcMode = !Win64_IsControllerConnected(); + ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); + } +#elif defined _DURANGO // bring up a keyboard InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE), (pClass->m_saveDetails[pClass->m_iSaveListIndex-pClass->m_iDefaultButtonsC]).UTF16SaveName,(DWORD)0,25,&UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); #else @@ -2363,7 +2475,7 @@ int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStora { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack, pClass); } @@ -2391,7 +2503,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon if(bContinue==true) { - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); if(pSONYDLCInfo!=NULL) { char chName[42]; @@ -2420,7 +2532,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon } else { - app.Checkout(chSkuID); + app.Checkout(chSkuID); } } } @@ -2436,7 +2548,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam; // Exit with or without saving - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { // we need to enable background downloading for the DLC XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); @@ -2454,7 +2566,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS } #endif - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); if(pSONYDLCInfo!=NULL) { char chName[42]; @@ -2483,16 +2595,16 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS } else { - app.Checkout(chSkuID); + app.Checkout(chSkuID); } } } #endif -#if defined _XBOX_ONE +#if defined _XBOX_ONE if(ProfileManager.IsSignedIn(iPad)) - { + { if (ProfileManager.IsSignedInLive(iPad)) { wstring ProductId; @@ -2501,13 +2613,13 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); } else - { + { // 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why. UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); } } -#endif +#endif } pClass->m_bIgnoreInput=false; @@ -2519,7 +2631,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStora { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { #if defined(__PS3__) SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass); @@ -2679,7 +2791,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter Compression::UseDefaultThreadStorage(); UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; pClass->m_saveTransferDownloadCancelled = false; - m_bSaveTransferRunning = true; + m_bSaveTransferRunning = true; bool bAbortCalled = false; Minecraft *pMinecraft=Minecraft::GetInstance(); bool bSaveFileCreated = false; @@ -2728,7 +2840,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); } } - else + else { // no save available, inform the user about the functionality UINT uiIDA[1]; @@ -2752,7 +2864,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that + StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that BYTE bTextMetadata[88]; ZeroMemory(bTextMetadata,88); @@ -2784,7 +2896,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter { // we can't cancel here, we need the saves info so we can delete the file if(pClass->m_saveTransferDownloadCancelled) - { + { WCHAR wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; @@ -2799,7 +2911,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter break; case eSaveTransfer_GettingSavesInfo: if(pClass->m_saveTransferDownloadCancelled) - { + { WCHAR wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; @@ -2916,7 +3028,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that + StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that BYTE bTextMetadata[88]; ZeroMemory(bTextMetadata,88); @@ -2929,12 +3041,12 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter } -#ifdef SPLIT_SAVES +#ifdef SPLIT_SAVES ConsoleSaveFileOriginal oldFormatSave( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() ); pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - pSave->Flush(false,false); + pSave->Flush(false,false); pClass->m_eSaveTransferState = eSaveTransfer_Saving; #else pSave = new ConsoleSaveFileOriginal( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() ); @@ -2970,7 +3082,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter delete pSave; - + pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); pClass->m_eSaveTransferState = eSaveTransfer_Succeeded; } @@ -2984,7 +3096,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } break; @@ -2999,7 +3111,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter if(bSaveFileCreated) { if(pClass->m_saveTransferDownloadCancelled) - { + { WCHAR wcTemp[256]; swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; @@ -3077,7 +3189,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter #endif } - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } if(bSaveFileCreated) // save file has been created, then deleted. @@ -3223,7 +3335,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); pClass->m_eSaveUploadState = esaveUpload_Finished; } break; @@ -3240,7 +3352,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); pClass->m_eSaveUploadState = esaveUpload_Finished; } } @@ -3289,7 +3401,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferDialogReturned(void *pParam,int iPad,C4J { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // results switched for this dialog - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { // upload the save pClass->LaunchSaveUpload(); @@ -3408,13 +3520,13 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) ByteArrayInputStream bais(UIScene_LoadOrJoinMenu::s_transferData); DataInputStream dis(&bais); - wstring saveTitle = dis.readUTF(); + wstring saveTitle = dis.readUTF(); StorageManager.SetSaveTitle(saveTitle.c_str()); wstring saveUniqueName = dis.readUTF(); // 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save - // However if the player downloads the same save multiple times, it will overwrite the previous version + // However if the player downloads the same save multiple times, it will overwrite the previous version // with that filname, and they could have made changes to it. //StorageManager.SetSaveUniqueFilename((wchar_t *)saveUniqueName.c_str()); @@ -3424,7 +3536,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) byteArray ba(thumbnailSize); dis.readFully(ba); - + // retrieve the seed value from the image metadata, we need to change to host options, then set it back again bool bHostOptionsRead = false; @@ -3458,13 +3570,13 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) case eSaveTransferFile_SaveData: { #ifdef SPLIT_SAVES - if(!pStateContainer->m_bSaveTransferCancelled) + if(!pStateContainer->m_bSaveTransferCancelled) { ConsoleSaveFileOriginal oldFormatSave( L"Temp name", UIScene_LoadOrJoinMenu::s_transferData.data, UIScene_LoadOrJoinMenu::s_transferData.length, false, SAVE_FILE_PLATFORM_X360 ); pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); + if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); } pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving; @@ -3485,7 +3597,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) pSave->ConvertToLocalPlatform(); pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); + if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); pStateContainer->m_iProgress+=1; if(pStateContainer->m_iProgress==101) @@ -3501,8 +3613,8 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) // On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete // the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. #if defined(_DURANGO) || defined(__ORBIS__) - pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); - + pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) { Sleep(10); @@ -3517,9 +3629,9 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) #ifdef _XBOX_ONE pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE); #endif - + pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - + // wipe the list and repopulate it if(!pStateContainer->m_bSaveTransferCancelled) pStateContainer->m_pClass->m_iState=e_SavesRepopulateAfterTransferDownload; @@ -3559,7 +3671,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) } void UIScene_LoadOrJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename ) -{ +{ Minecraft *pMinecraft=Minecraft::GetInstance(); // get the save file size @@ -3665,7 +3777,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsigned l if(pClass->m_bSaveTransferCancelled) // was cancelled { - pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING); + pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING); swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING)); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3740,7 +3852,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStor { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { LoadingInputParams *loadingParams = new LoadingInputParams(); @@ -3785,7 +3897,7 @@ int UIScene_LoadOrJoinMenu::CopySaveThreadProc( LPVOID lpParameter ) ui.LeaveCallbackIdCriticalSection(); // Copy save data takes two callbacks - one for completion, and one for progress. The progress callback also lets us cancel the operation, if we return false. StorageManager.CopySaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC],UIScene_LoadOrJoinMenu::CopySaveDataReturned,UIScene_LoadOrJoinMenu::CopySaveDataProgress,lpParameter); - + bool bContinue = true; do { @@ -3822,7 +3934,7 @@ int UIScene_LoadOrJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C { pClass->m_bCopying = false; // wipe the list and repopulate it - pClass->m_iState=e_SavesRepopulateAfterDelete; + pClass->m_iState=e_SavesRepopulateAfterDelete; ui.LeaveCallbackIdCriticalSection(); } else |
