diff options
Diffstat (limited to 'Minecraft.Client/Common')
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp | 32 | ||||
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h | 6 |
2 files changed, 26 insertions, 12 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index d73148f5..d7ad789a 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -206,6 +206,8 @@ int UIScene_LoadOrJoinMenu::LoadSaveCallback(LPVOID lpParam,bool bRes) UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { + constexpr uint64_t MAXIMUM_SAVE_STORAGE = 4LL * 1024LL * 1024LL * 1024LL; + // Setup all the Iggy references we need for this scene initialiseMovie(); app.SetLiveLinkRequired( true ); @@ -230,8 +232,8 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer m_controlJoinTimer.setVisible( true ); -#if defined(_XBOX_ONE) || defined(__ORBIS__) - m_spaceIndicatorSaves.init(L"",eControl_SpaceIndicator,0, (4LL *1024LL * 1024LL * 1024LL) ); +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) + m_spaceIndicatorSaves.init(L"",eControl_SpaceIndicator,0, MAXIMUM_SAVE_STORAGE); #endif m_bUpdateSaveSize = false; @@ -695,7 +697,7 @@ void UIScene_LoadOrJoinMenu::tick() if(m_eSaveTransferState == eSaveTransfer_Idle) m_bSaveTransferRunning = false; #endif -#if defined(_XBOX_ONE) || defined(__ORBIS__) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) if(m_bUpdateSaveSize) { if((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC)) @@ -716,7 +718,7 @@ void UIScene_LoadOrJoinMenu::tick() if(m_pSaveDetails!=nullptr) { //CD - Fix - Adding define for ORBIS/XBOXONE -#if defined(_XBOX_ONE) || defined(__ORBIS__) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) m_spaceIndicatorSaves.reset(); #endif @@ -758,6 +760,22 @@ void UIScene_LoadOrJoinMenu::tick() { #if defined(_XBOX_ONE) m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].totalSize); +#elif defined(_WINDOWS64) + int origIdx = sortedIdx[i]; + wchar_t wFilename[MAX_SAVEFILENAME_LENGTH]; + ZeroMemory(wFilename, sizeof(wFilename)); + mbstowcs(wFilename, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); + wstring filePath = wstring(L"Windows64\\GameHDD\\") + wstring(wFilename) + wstring(L"\\saveData.ms"); + + HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); + DWORD fileSize = 0; + + if (hFile != INVALID_HANDLE_VALUE) { + fileSize = GetFileSize(hFile, nullptr); + if (fileSize < 12 || fileSize == INVALID_FILE_SIZE) fileSize = 0; + CloseHandle(hFile); + } + m_spaceIndicatorSaves.addSave(fileSize); #elif defined(__ORBIS__) m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].blocksUsed * (32 * 1024) ); #endif @@ -770,12 +788,8 @@ void UIScene_LoadOrJoinMenu::tick() #else #ifdef _WINDOWS64 { - int origIdx = sortedIdx[i]; - wchar_t wFilename[MAX_SAVEFILENAME_LENGTH]; - ZeroMemory(wFilename, sizeof(wFilename)); - mbstowcs(wFilename, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); - wstring filePath = wstring(L"Windows64\\GameHDD\\") + wstring(wFilename) + wstring(L"\\saveData.ms"); wstring levelName = ReadLevelNameFromSaveFile(filePath); + if (!levelName.empty()) { m_buttonListSaves.addItem(levelName, wstring(L"")); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h index 9f5fe17f..76a7ed43 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h @@ -20,7 +20,7 @@ private: { eControl_SavesList, eControl_GamesList, -#if defined(_XBOX_ONE) || defined(__ORBIS__) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) eControl_SpaceIndicator, #endif }; @@ -52,7 +52,7 @@ protected: UIControl_SaveList m_buttonListGames; UIControl_Label m_labelSavesListTitle, m_labelJoinListTitle, m_labelNoGames; UIControl m_controlSavesTimer, m_controlJoinTimer; -#if defined(_XBOX_ONE) || defined(__ORBIS__) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) UIControl_SpaceIndicatorBar m_spaceIndicatorSaves; #endif @@ -68,7 +68,7 @@ private: UI_MAP_ELEMENT( m_controlSavesTimer, "SavesTimer") UI_MAP_ELEMENT( m_controlJoinTimer, "JoinTimer") -#if defined(_XBOX_ONE) || defined(__ORBIS__) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) UI_MAP_ELEMENT( m_spaceIndicatorSaves, "SaveSizeBar") #endif UI_END_MAP_ELEMENTS_AND_NAMES() |
