fix(windows64): save space indicator
This commit is contained in:
1 parent
ca003f1afa
commit
4e79d92c24
6 files changed
+56
-14
No files matched your search
@@ -70,7 +70,6 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini
|
||||
m_checkboxes[eLaunchCheckbox_ResetNether].init(app.GetString(IDS_RESET_NETHER),eLaunchCheckbox_ResetNether,m_params->bResetNether);
|
||||
m_checkboxes[eLaunchCheckbox_Structures].init(app.GetString(IDS_GENERATE_STRUCTURES),eLaunchCheckbox_Structures,m_params->bStructures);
|
||||
m_checkboxes[eLaunchCheckbox_FlatWorld].init(app.GetString(IDS_SUPERFLAT_WORLD),eLaunchCheckbox_FlatWorld,m_params->bFlatWorld);
|
||||
m_checkboxes[eLaunchCheckbox_BonusChest].init(app.GetString(IDS_BONUS_CHEST),eLaunchCheckbox_BonusChest,m_params->bBonusChest);
|
||||
|
||||
if(m_loadedResolution == eSceneResolution_1080)
|
||||
{
|
||||
|
||||
@@ -191,7 +191,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
|
||||
else
|
||||
{
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__)|| defined(_DURANGO) || defined (__PSVITA__)
|
||||
#if defined(__PS3__) || defined(__ORBIS__)|| defined(_DURANGO) || defined (__PSVITA__) || defined(_WINDOWS64)
|
||||
// convert to utf16
|
||||
uint16_t u16Message[MAX_SAVEFILENAME_LENGTH];
|
||||
size_t srclen,dstlen;
|
||||
@@ -202,7 +202,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
|
||||
#elif defined(_DURANGO)
|
||||
// Already utf16 on durango
|
||||
memcpy(u16Message,params->saveDetails->UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH);
|
||||
#else // __ORBIS__
|
||||
#elif __ORBIS__ // __ORBIS__
|
||||
{
|
||||
SceCesUcsContext Context;
|
||||
sceCesUcsContextInit( &Context );
|
||||
@@ -211,6 +211,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
|
||||
}
|
||||
#endif
|
||||
m_thumbnailName = (wchar_t *)u16Message;
|
||||
#ifndef _WINDOWS64
|
||||
if(params->saveDetails->pbThumbnailData)
|
||||
{
|
||||
m_pbThumbnailData = params->saveDetails->pbThumbnailData;
|
||||
@@ -218,6 +219,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
|
||||
m_bSaveThumbnailReady = true;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
app.DebugPrintf("Requesting the save thumbnail\n");
|
||||
// set the save to load
|
||||
|
||||
@@ -111,8 +111,11 @@ 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 || __ORBIS__ || _WINDOWS64
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
m_spaceIndicatorSaves.init(L"",eControl_SpaceIndicator,0, (4LL *1024LL * 1024LL * 1024LL) );
|
||||
}
|
||||
#endif
|
||||
m_bUpdateSaveSize = false;
|
||||
|
||||
@@ -158,7 +161,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO)
|
||||
#if defined __PS3__ || __ORBIS__ || __PSVITA__ || _DURANGO || _WINDOWS64
|
||||
// Always clear the saves when we enter this menu
|
||||
StorageManager.ClearSavesInfo();
|
||||
#endif
|
||||
@@ -560,7 +563,7 @@ void UIScene_LoadOrJoinMenu::tick()
|
||||
// Stop loading thumbnails if we navigate forwards
|
||||
if(hasFocus(m_iPad))
|
||||
{
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
#if defined _XBOX_ONE || __ORBIS__ || _WINDOWS64
|
||||
if(m_bUpdateSaveSize)
|
||||
{
|
||||
if((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC))
|
||||
@@ -581,8 +584,11 @@ void UIScene_LoadOrJoinMenu::tick()
|
||||
if(m_pSaveDetails!=NULL)
|
||||
{
|
||||
//CD - Fix - Adding define for ORBIS/XBOXONE
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
m_spaceIndicatorSaves.reset();
|
||||
#if defined _XBOX_ONE || __ORBIS__ || _WINDOWS64
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
m_spaceIndicatorSaves.reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
AddDefaultButtons();
|
||||
@@ -605,10 +611,33 @@ void UIScene_LoadOrJoinMenu::tick()
|
||||
m_iSaveDetailsCount = m_pSaveDetails->iSaveC;
|
||||
for(unsigned int i = 0; i < m_pSaveDetails->iSaveC; ++i)
|
||||
{
|
||||
#if defined(_XBOX_ONE)
|
||||
#ifdef _XBOX_ONE
|
||||
m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].totalSize);
|
||||
#elif defined(__ORBIS__)
|
||||
#elif __ORBIS__
|
||||
m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].blocksUsed * (32 * 1024) );
|
||||
#elif _WINDOWS64
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
ZeroMemory(m_saveDetails[i].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH);
|
||||
memcpy(m_saveDetails[i].UTF8SaveFilename, m_pSaveDetails->SaveInfoA[i].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1);
|
||||
wstring folderPath = wstring(L"Windows64\\GameHDD\\") + app.UTF8ToWide(m_saveDetails[i].UTF8SaveFilename) + L"\\*";
|
||||
|
||||
DWORD fileSize = 0;
|
||||
WIN32_FIND_DATAW findData;
|
||||
HANDLE hFile = FindFirstFileW(folderPath.c_str(), &findData);
|
||||
|
||||
if (hFile != INVALID_HANDLE_VALUE) {
|
||||
do {
|
||||
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
fileSize = findData.nFileSizeLow;
|
||||
break;
|
||||
}
|
||||
} while (FindNextFileW(hFile, &findData));
|
||||
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 || __ORBIS__ || _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 || __ORBIS__ || _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 || __ORBIS__ || _WINDOWS64
|
||||
UI_MAP_ELEMENT( m_spaceIndicatorSaves, "SaveSizeBar")
|
||||
#endif
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
@@ -227,3 +227,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;
|
||||
}
|
||||
@@ -29,6 +29,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