diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index bbcdaf57..eee6c507 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -113,8 +113,9 @@ 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, (4LL *1024LL * 1024LL * 1024LL) ); #endif m_bUpdateSaveSize = false; @@ -583,7 +584,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)) @@ -604,7 +605,7 @@ void UIScene_LoadOrJoinMenu::tick() if(m_pSaveDetails!=NULL) { //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 @@ -632,6 +633,21 @@ void UIScene_LoadOrJoinMenu::tick() m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].totalSize); #elif defined(__ORBIS__) m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].blocksUsed * (32 * 1024) ); +#elif defined(_WINDOWS64) + ZeroMemory(m_saveDetails[i].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH); + memcpy(m_saveDetails[i].UTF8SaveFilename, m_pSaveDetails->SaveInfoA[i].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); + wstring filePath = wstring(L"Windows64\\GameHDD\\") + app.UTF8ToWide(m_saveDetails[i].UTF8SaveFilename) + wstring(L"\\saveData.ms"); + + DWORD fileSize = 0; + WIN32_FIND_DATAW findData; + HANDLE hFile = FindFirstFileW(filePath.c_str(), &findData); + + if (hFile != INVALID_HANDLE_VALUE) { + if (findData.nFileSizeHigh == 0 && findData.nFileSizeLow >= 12) + fileSize = findData.nFileSizeLow; + FindClose(hFile); + } + m_spaceIndicatorSaves.addSave(fileSize); #endif #ifdef _DURANGO m_buttonListSaves.addItem(m_pSaveDetails->SaveInfoA[i].UTF16SaveTitle, L""); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h index bb655a38..3d832f33 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() diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp index ea1144b3..3cc0d21a 100644 --- a/Minecraft.Client/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Windows64/Windows64_App.cpp @@ -142,3 +142,12 @@ int CConsoleMinecraftApp::LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) { } + +std::wstring CConsoleMinecraftApp::UTF8ToWide(const char* utf8) +{ + int size = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, nullptr, 0); + std::wstring wstr(size, 0); + MultiByteToWideChar(CP_UTF8, 0, utf8, -1, &wstr[0], size); + wstr.resize(size - 1); + return wstr; +} diff --git a/Minecraft.Client/Windows64/Windows64_App.h b/Minecraft.Client/Windows64/Windows64_App.h index 963e5ebb..cebdde3a 100644 --- a/Minecraft.Client/Windows64/Windows64_App.h +++ b/Minecraft.Client/Windows64/Windows64_App.h @@ -31,6 +31,9 @@ public: // original code virtual void TemporaryCreateGameStart(); + + // str1k3r - UTF8 to wchar + std::wstring UTF8ToWide(const char* utf8); }; extern CConsoleMinecraftApp app;