forked from cafeberry/cafeberry
fix: save space indicator
Credits to smartcmd for the base of this
This commit is contained in:
@@ -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"");
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ public:
|
||||
|
||||
// original code
|
||||
virtual void TemporaryCreateGameStart();
|
||||
|
||||
// str1k3r - UTF8 to wchar
|
||||
std::wstring UTF8ToWide(const char* utf8);
|
||||
};
|
||||
|
||||
extern CConsoleMinecraftApp app;
|
||||
|
||||
Reference in New Issue
Block a user