From 28931d538026dffb214b16bccb02273528fcee01 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 14:43:07 -0500 Subject: [PATCH] split out platform/storage --- targets/app/common/App_structs.h | 8 +- targets/app/common/Audio/SoundEngine.cpp | 2 +- targets/app/common/BannedListManager.cpp | 2 +- targets/app/common/DLC/DLCAudioFile.cpp | 12 +- targets/app/common/DLC/DLCManager.cpp | 34 ++-- targets/app/common/DLCController.cpp | 32 ++-- targets/app/common/DLCController.h | 6 +- targets/app/common/Game.cpp | 14 +- targets/app/common/Game.h | 40 ++--- .../LevelGenerationOptions.cpp | 6 +- targets/app/common/GameSettingsManager.cpp | 4 +- targets/app/common/GameSettingsManager.h | 2 +- targets/app/common/Game_XuiActions.cpp | 32 ++-- targets/app/common/MenuController.cpp | 20 +-- targets/app/common/MenuController.h | 16 +- .../app/common/Network/GameNetworkManager.cpp | 6 +- targets/app/common/NetworkController.cpp | 34 ++-- targets/app/common/NetworkController.h | 16 +- .../common/UI/All Platforms/IUIController.h | 4 +- .../UI/All Platforms/IUIScene_PauseMenu.cpp | 42 ++--- .../UI/All Platforms/IUIScene_PauseMenu.h | 18 +- .../app/common/UI/All Platforms/UIStructs.h | 4 +- .../IUIScene_StartGame.cpp | 10 +- .../IUIScene_StartGame.h | 8 +- .../UIScene_CreateWorldMenu.cpp | 8 +- .../UIScene_CreateWorldMenu.h | 6 +- .../UIScene_DLCMainMenu.cpp | 2 +- .../UIScene_DLCMainMenu.h | 4 +- .../UIScene_DLCOffersMenu.cpp | 6 +- .../UIScene_DLCOffersMenu.h | 4 +- .../UIScene_JoinMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_JoinMenu.h | 4 +- .../UIScene_LeaderboardsMenu.cpp | 2 +- .../UIScene_LeaderboardsMenu.h | 4 +- .../UIScene_LoadMenu.cpp | 64 ++++---- .../Frontend Menu screens/UIScene_LoadMenu.h | 12 +- .../UIScene_LoadOrJoinMenu.cpp | 154 +++++++++--------- .../UIScene_LoadOrJoinMenu.h | 16 +- .../UIScene_MainMenu.cpp | 20 +-- .../Frontend Menu screens/UIScene_MainMenu.h | 6 +- .../UIScene_HelpAndOptionsMenu.cpp | 4 +- .../Help & Options/UIScene_SettingsMenu.cpp | 4 +- .../Help & Options/UIScene_SettingsMenu.h | 4 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 4 +- .../Help & Options/UIScene_SkinSelectMenu.h | 4 +- .../UIScene_DeathMenu.cpp | 4 +- .../UIScene_InGameInfoMenu.cpp | 4 +- .../UIScene_InGameInfoMenu.h | 4 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 4 +- .../UIScene_InGamePlayerOptionsMenu.h | 4 +- .../UIScene_InGameSaveManagementMenu.cpp | 40 ++--- .../UIScene_InGameSaveManagementMenu.h | 2 +- .../UIScene_PauseMenu.cpp | 12 +- .../In-Game Menu Screens/UIScene_PauseMenu.h | 4 +- .../common/UI/Scenes/UIScene_MessageBox.cpp | 12 +- .../app/common/UI/Scenes/UIScene_MessageBox.h | 4 +- targets/app/common/UI/UIController.cpp | 36 ++-- targets/app/common/UI/UIController.h | 24 +-- targets/app/linux/LinuxGame.cpp | 6 +- targets/app/linux/Linux_Minecraft.cpp | 10 +- targets/app/windows/Windows64_App.cpp | 4 +- .../app/windows/src/Windows64_Minecraft.cpp | 2 +- targets/java/src/File.cpp | 2 +- targets/minecraft/client/Minecraft.cpp | 4 +- .../client/gui/CreateWorldScreen.cpp | 6 +- .../client/multiplayer/ClientConnection.cpp | 10 +- .../client/multiplayer/ClientConnection.h | 6 +- .../minecraft/client/skins/DLCTexturePack.cpp | 6 +- targets/minecraft/server/MinecraftServer.cpp | 6 +- .../minecraft/server/level/ServerLevel.cpp | 8 +- .../server/network/PendingConnection.cpp | 4 +- .../ConsoleSaveFileOriginal.cpp | 4 +- .../ConsoleSaveFileSplit.cpp | 4 +- .../level/storage/DirectoryLevelStorage.cpp | 2 +- targets/platform/PlatformServices.cpp | 2 - targets/platform/PlatformServices.h | 2 - targets/platform/ShutdownManager.h | 2 +- targets/platform/meson.build | 2 +- .../platform/{ => storage}/IPlatformStorage.h | 43 ++++- targets/platform/storage/storage.h | 3 + .../stub/StubStorage.cpp} | 141 ++++++++-------- .../Storage.h => storage/stub/StubStorage.h} | 89 +++------- 82 files changed, 611 insertions(+), 617 deletions(-) rename targets/platform/{ => storage}/IPlatformStorage.h (90%) create mode 100644 targets/platform/storage/storage.h rename targets/platform/{sdl2/Storage.cpp => storage/stub/StubStorage.cpp} (51%) rename targets/platform/{sdl2/Storage.h => storage/stub/StubStorage.h} (77%) diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index 408db6ccf..4ffa65c1e 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" @@ -171,10 +171,10 @@ typedef struct _DLCRequest { typedef struct _TMSPPRequest { eTMSContentState eState; eDLCContentType eType; - C4JStorage::eGlobalStorage eStorageFacility; - C4JStorage::eTMS_FILETYPEVAL eFileTypeVal; + IPlatformStorage::eGlobalStorage eStorageFacility; + IPlatformStorage::eTMS_FILETYPEVAL eFileTypeVal; // char szFilename[MAX_TMSFILENAME_SIZE]; - int (*CallbackFunc)(void*, int, int, C4JStorage::PTMSPP_FILEDATA, + int (*CallbackFunc)(void*, int, int, IPlatformStorage::PTMSPP_FILEDATA, const char* szFilename); wchar_t wchFilename[MAX_TMSFILENAME_SIZE]; diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 66ea8b8af..3eee15e86 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -1470,7 +1470,7 @@ void SoundEngine::playMusicUpdate() { std::string strFile = "TPACK:\\Data\\" + string(szName) + ".binka"; std::string mountedPath = - StorageManager.GetMountedPath(strFile); + PlatformStorage.GetMountedPath(strFile); strcpy(m_szStreamName, mountedPath.c_str()); } else { SetIsPlayingStreamingGameMusic(false); diff --git a/targets/app/common/BannedListManager.cpp b/targets/app/common/BannedListManager.cpp index d7171781c..216c1637b 100644 --- a/targets/app/common/BannedListManager.cpp +++ b/targets/app/common/BannedListManager.cpp @@ -56,7 +56,7 @@ void BannedListManager::addLevel(int iPad, PlayerUID xuid, // 4J-PB - write to TMS++ now // bool - // bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(std::uint8_t*)pBannedList, + // bRes=PlatformStorage.WriteTMSFile(iPad,IPlatformStorage::eGlobalStorage_TitleUser,L"BannedList",(std::uint8_t*)pBannedList, // dwDataBytes); delete[] pBannedList; diff --git a/targets/app/common/DLC/DLCAudioFile.cpp b/targets/app/common/DLC/DLCAudioFile.cpp index b7042a45e..cbe684142 100644 --- a/targets/app/common/DLC/DLCAudioFile.cpp +++ b/targets/app/common/DLC/DLCAudioFile.cpp @@ -6,7 +6,7 @@ #include #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" @@ -53,19 +53,19 @@ void ReadAudioDlcStruct(T* out, const std::uint8_t* data, } inline unsigned int AudioParamAdvance(unsigned int wcharCount) { - return static_cast(sizeof(C4JStorage::DLC_FILE_PARAM) + + return static_cast(sizeof(IPlatformStorage::DLC_FILE_PARAM) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); } inline unsigned int AudioDetailAdvance(unsigned int wcharCount) { - return static_cast(sizeof(C4JStorage::DLC_FILE_DETAILS) + + return static_cast(sizeof(IPlatformStorage::DLC_FILE_DETAILS) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); } inline std::wstring ReadAudioParamString(const std::uint8_t* data, unsigned int offset) { return ReadAudioDlcWString(data + offset + - offsetof(C4JStorage::DLC_FILE_PARAM, wchData)); + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData)); } } // namespace @@ -196,7 +196,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData, unsigned int uiParameterTypeCount = ReadAudioDlcValue(pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_PARAM paramBuf; + IPlatformStorage::DLC_FILE_PARAM paramBuf; ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte); for (unsigned int i = 0; i < uiParameterTypeCount; i++) { @@ -214,7 +214,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData, unsigned int uiFileCount = ReadAudioDlcValue(pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_DETAILS fileBuf; + IPlatformStorage::DLC_FILE_DETAILS fileBuf; ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); unsigned int tempByteOffset = uiCurrentByte; diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index a9dedfd62..c40c7c7dd 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -14,7 +14,7 @@ #include #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "DLCFile.h" #include "DLCPack.h" #include "app/common/GameRules/GameRuleManager.h" @@ -69,9 +69,9 @@ static_assert(sizeof(wchar_t) == 2, #endif #define DLC_PARAM_ADV(n) \ - (sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE) + (sizeof(IPlatformStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE) #define DLC_DETAIL_ADV(n) \ - (sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE) + (sizeof(IPlatformStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE) namespace { template @@ -90,7 +90,7 @@ std::wstring getMountedDlcReadPath(const std::string& path) { std::wstring readPath = convStringToWstring(path); #if defined(_WINDOWS64) - const std::string mountedPath = StorageManager.GetMountedPath(path.c_str()); + const std::string mountedPath = PlatformStorage.GetMountedPath(path.c_str()); if (!mountedPath.empty()) { readPath = convStringToWstring(mountedPath); } @@ -359,12 +359,12 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert( swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str()); - C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1, PlatformProfile.GetPrimaryPad(), nullptr, nullptr, wchFormat); } else { - C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA, 1, PlatformProfile.GetPrimaryPad()); } @@ -413,17 +413,17 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, memcpy((out), (buf) + (off), sizeof(unsigned int)) #define DLC_READ_PARAM(out, buf, off) \ - memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_PARAM)) + memcpy((out), (buf) + (off), sizeof(IPlatformStorage::DLC_FILE_PARAM)) #define DLC_READ_DETAIL(out, buf, off) \ - memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_DETAILS)) + memcpy((out), (buf) + (off), sizeof(IPlatformStorage::DLC_FILE_DETAILS)) // for details, read in the function below #define DLC_PARAM_WSTR(buf, off) \ - DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_PARAM, wchData)) + DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData)) #define DLC_DETAIL_WSTR(buf, off) \ - DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_DETAILS, wchFile)) + DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile)) { std::unordered_map parameterMapping; unsigned int uiCurrentByte = 0; @@ -466,7 +466,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, DLC_READ_UINT(&uiParameterCount, pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_PARAM parBuf; + IPlatformStorage::DLC_FILE_PARAM parBuf; DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte); // uint32_t dwwchCount=0; for (unsigned int i = 0; i < uiParameterCount; i++) { @@ -481,13 +481,13 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount); DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte); } - // ulCurrentByte+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); + // ulCurrentByte+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM); unsigned int uiFileCount; DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_DETAILS fileBuf; + IPlatformStorage::DLC_FILE_DETAILS fileBuf; DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); unsigned int dwTemp = uiCurrentByte; @@ -496,7 +496,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, DLC_READ_DETAIL(&fileBuf, pbData, dwTemp); } std::uint8_t* pbTemp = - &pbData[dwTemp]; //+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount; + &pbData[dwTemp]; //+ sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount; DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); for (unsigned int i = 0; i < uiFileCount; i++) { @@ -540,7 +540,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, pbTemp += DLC_PARAM_ADV(parBuf.dwWchCount); DLC_READ_PARAM(&parBuf, pbTemp, 0); } - // pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); + // pbTemp+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM); if (dlcTexturePack != nullptr) { unsigned int texturePackFilesProcessed = 0; @@ -643,7 +643,7 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData, unsigned int uiParameterCount = ReadDlcValue(pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_PARAM paramBuf; + IPlatformStorage::DLC_FILE_PARAM paramBuf; ReadDlcStruct(¶mBuf, pbData, uiCurrentByte); for (unsigned int i = 0; i < uiParameterCount; i++) { // Map DLC strings to application strings, then store the DLC index @@ -661,7 +661,7 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData, unsigned int uiFileCount = ReadDlcValue(pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_DETAILS fileBuf; + IPlatformStorage::DLC_FILE_DETAILS fileBuf; ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); unsigned int dwTemp = uiCurrentByte; diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index b7f1d50ee..7965ef4c9 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -9,7 +9,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "platform/profile/profile.h" #include "platform/XboxStubs.h" @@ -46,7 +46,7 @@ std::uint32_t DLCController::m_dwContentTypeA[e_Marketplace_MAX] = { }; int DLCController::marketplaceCountsCallback( - void* pParam, C4JStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) { + void* pParam, IPlatformStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) { app.DebugPrintf("Marketplace Counts= New - %d Total - %d\n", pTMSDetails->dwNewOffers, pTMSDetails->dwTotalOffers); @@ -73,9 +73,9 @@ bool DLCController::startInstallDLCProcess(int iPad) { m_iTotalDLCInstalled = 0; app.DebugPrintf( "--- DLCController::startInstallDLCProcess - " - "StorageManager.GetInstalledDLC\n"); + "PlatformStorage.GetInstalledDLC\n"); - StorageManager.GetInstalledDLC( + PlatformStorage.GetInstalledDLC( iPad, [this](int iInstalledC, int pad) { return dlcInstalledCallback(iInstalledC, pad); }); @@ -99,7 +99,7 @@ int DLCController::dlcInstalledCallback(int iInstalledC, int iPad) { void DLCController::mountNextDLC(int iPad) { app.DebugPrintf("--- DLCController::mountNextDLC: pad=%i.\n", iPad); if (m_iTotalDLCInstalled < m_iTotalDLC) { - if (StorageManager.MountInstalledDLC( + if (PlatformStorage.MountInstalledDLC( iPad, m_iTotalDLCInstalled, [this](int pad, std::uint32_t dwErr, std::uint32_t dwLicenceMask) { @@ -110,7 +110,7 @@ void DLCController::mountNextDLC(int iPad) { ++m_iTotalDLCInstalled; mountNextDLC(iPad); } else { - app.DebugPrintf("StorageManager.MountInstalledDLC ok\n"); + app.DebugPrintf("PlatformStorage.MountInstalledDLC ok\n"); } } else { m_bDLCInstallPending = false; @@ -135,7 +135,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr, app.m_dlcManager.incrementUnnamedCorruptCount(); } else { XCONTENT_DATA ContentData = - StorageManager.GetDLC(m_iTotalDLCInstalled); + PlatformStorage.GetDLC(m_iTotalDLCInstalled); DLCPack* pack = app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData)); @@ -176,7 +176,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr, pack->updateLicenseMask(dwLicenceMask); } - StorageManager.UnmountInstalledDLC(); + PlatformStorage.UnmountInstalledDLC(); } ++m_iTotalDLCInstalled; mountNextDLC(iPad); @@ -190,7 +190,7 @@ void DLCController::handleDLC(DLCPack* pack) { #if defined(_WINDOWS64) || defined(__linux__) std::vector dlcFilenames; #endif - StorageManager.GetMountedDLCFileList("DLCDrive", dlcFilenames); + PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames); for (int i = 0; i < dlcFilenames.size(); i++) { app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], pack); @@ -436,13 +436,13 @@ bool DLCController::retrieveNextDLCContent() { app.DebugPrintf("RetrieveNextDLCContent - type = %d\n", pCurrent->dwType); #endif - C4JStorage::EDLCStatus status = StorageManager.GetDLCOffers( + IPlatformStorage::EDLCStatus status = PlatformStorage.GetDLCOffers( PlatformProfile.GetPrimaryPad(), [this](int iOfferC, std::uint32_t dwType, int pad) { return dlcOffersReturned(iOfferC, dwType, pad); }, pCurrent->dwType); - if (status == C4JStorage::EDLC_Pending) { + if (status == IPlatformStorage::EDLC_Pending) { pCurrent->eState = e_DLC_ContentState_Retrieving; } else { app.DebugPrintf("RetrieveNextDLCContent - PROBLEM\n"); @@ -597,9 +597,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, &DLCController::tmsPPFileReturned; pTMSPPreq->lpCallbackParam = this; pTMSPPreq->eStorageFacility = - C4JStorage::eGlobalStorage_Title; + IPlatformStorage::eGlobalStorage_Title; pTMSPPreq->eFileTypeVal = - C4JStorage::TMS_FILETYPE_BINARY; + IPlatformStorage::TMS_FILETYPE_BINARY; memcpy(pTMSPPreq->wchFilename, pDLC->wchDataFile, sizeof(wchar_t) * MAX_BANNERNAME_SIZE); @@ -645,9 +645,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, &DLCController::tmsPPFileReturned; pTMSPPreq->lpCallbackParam = this; pTMSPPreq->eStorageFacility = - C4JStorage::eGlobalStorage_Title; + IPlatformStorage::eGlobalStorage_Title; pTMSPPreq->eFileTypeVal = - C4JStorage::TMS_FILETYPE_BINARY; + IPlatformStorage::TMS_FILETYPE_BINARY; memcpy(pTMSPPreq->wchFilename, pDLC->wchBanner, sizeof(wchar_t) * MAX_BANNERNAME_SIZE); pTMSPPreq->eType = eType; @@ -670,7 +670,7 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, } int DLCController::tmsPPFileReturned(void* pParam, int iPad, int iUserData, - C4JStorage::PTMSPP_FILEDATA pFileData, + IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) { DLCController* pClass = (DLCController*)pParam; diff --git a/targets/app/common/DLCController.h b/targets/app/common/DLCController.h index 0fc5d7425..c793de17f 100644 --- a/targets/app/common/DLCController.h +++ b/targets/app/common/DLCController.h @@ -8,7 +8,7 @@ #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "platform/XboxStubs.h" struct SCreditTextItemDef; @@ -32,7 +32,7 @@ public: void clearDLCInstalled() { m_bDLCInstallProcessCompleted = false; } static int marketplaceCountsCallback(void* pParam, - C4JStorage::DLC_TMS_DETAILS*, + IPlatformStorage::DLC_TMS_DETAILS*, int iPad); // DLC info registration @@ -73,7 +73,7 @@ public: unsigned int addTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote = false); static int tmsPPFileReturned(void* pParam, int iPad, int iUserData, - C4JStorage::PTMSPP_FILEDATA pFileData, + IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename); // Credit text diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 7dd456d9f..68e8992fd 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -4,7 +4,7 @@ #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" @@ -234,10 +234,10 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; } int Game::BannedLevelDialogReturned( - void* pParam, int iPad, const C4JStorage::EMessageResult result) { + void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { } else { if (iPad == PlatformProfile.GetPrimaryPad()) { pApp->SetAction(iPad, eAppAction_ExitWorld); @@ -316,10 +316,10 @@ int Game::GetLocalPlayerCount(void) { // std::uint32_t dwSize=0; // // 4J-PB - out for now for DaveK so he doesn't get the // birthday cape #ifdef _CONTENT_PACKAGE -// C4JStorage::ETMSStatus eTMSStatus; -// eTMSStatus=StorageManager.ReadTMSFile(PlatformProfile.GetPrimaryPad(),C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic, +// IPlatformStorage::ETMSStatus eTMSStatus; +// eTMSStatus=PlatformStorage.ReadTMSFile(PlatformProfile.GetPrimaryPad(),IPlatformStorage::eGlobalStorage_Title,IPlatformStorage::eTMS_FileType_Graphic, // L"Default_Cape.png",&pBuffer, &dwSize); -// if(eTMSStatus==C4JStorage::ETMSStatus_Idle) +// if(eTMSStatus==IPlatformStorage::ETMSStatus_Idle) // { // app.AddMemoryTextureFile(wTemp,pBuffer,dwSize); // } @@ -330,7 +330,7 @@ int Game::GetLocalPlayerCount(void) { // int Game::DLCReadCallback(void* -// pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData) +// pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData) // { // // diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index beb528a7c..ba7e61adb 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -5,7 +5,7 @@ #include "util/Timer.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" // using namespace std; @@ -145,7 +145,7 @@ public: bool IsAppPaused(); void SetAppPaused(bool val); - int displaySavingMessage(const C4JStorage::ESavingMessage eMsg, int iPad) { + int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad) { return m_gameSettingsManager.displaySavingMessage(eMsg, iPad); } bool GetGameStarted() { return m_bGameStarted; } @@ -486,11 +486,11 @@ public: return NetworkController::signoutExitWorldThreadProc(lpParameter); } static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult result) { + const IPlatformStorage::EMessageResult result) { return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, result); } static int EthernetDisconnectReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult result) { + const IPlatformStorage::EMessageResult result) { return NetworkController::ethernetDisconnectReturned(pParam, iPad, result); } static void ProfileReadErrorCallback(void* pParam) { @@ -523,7 +523,7 @@ public: #endif void SetDebugSequence(const char* pchSeq); // bool UploadFileToGlobalStorage(int iQuadrant, - // C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); + // IPlatformStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); // Installed DLC - delegated to DLCController bool StartInstallDLCProcess(int iPad) { return m_dlcController.startInstallDLCProcess(iPad); } @@ -539,7 +539,7 @@ public: bool DLCInstallProcessCompleted() { return m_dlcController.dlcInstallProcessCompleted(); } void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); } static int MarketplaceCountsCallback(void* pParam, - C4JStorage::DLC_TMS_DETAILS* details, + IPlatformStorage::DLC_TMS_DETAILS* details, int iPad) { return DLCController::marketplaceCountsCallback(pParam, details, iPad); } @@ -677,9 +677,9 @@ public: private: static int BannedLevelDialogReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const IPlatformStorage::EMessageResult); static int TexturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::texturePackDialogReturned(pParam, iPad, result); } @@ -730,41 +730,41 @@ public: private: static int UnlockFullExitReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::unlockFullExitReturned(pParam, iPad, result); } static int UnlockFullSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::unlockFullSaveReturned(pParam, iPad, result); } static int UnlockFullInviteReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::unlockFullInviteReturned(pParam, iPad, result); } static int TrialOverReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::trialOverReturned(pParam, iPad, result); } static int ExitAndJoinFromInvite(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return NetworkController::exitAndJoinFromInvite(pParam, iPad, result); } static int ExitAndJoinFromInviteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result); } static int ExitAndJoinFromInviteAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result); } static int ExitAndJoinFromInviteDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(pParam, iPad, result); } static int FatalErrorDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return NetworkController::warningTrialTexturePackReturned(pParam, iPad, result); } @@ -817,7 +817,7 @@ public: MenuController::exitGameFromRemoteSave(lpParameter); } static int ExitGameFromRemoteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result); } @@ -1021,7 +1021,7 @@ public: int GetDLCInfoTexturesOffersCount() { return m_dlcController.getDLCInfoTexturesOffersCount(); } static int TMSPPFileReturned(void* pParam, int iPad, int iUserData, - C4JStorage::PTMSPP_FILEDATA pFileData, + IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) { return DLCController::tmsPPFileReturned(pParam, iPad, iUserData, pFileData, szFilename); } diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index cf60b3801..90eaef659 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -32,7 +32,7 @@ #include "minecraft/world/phys/AABB.h" #include "platform/PlatformServices.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "strings.h" #include "util/StringHelpers.h" @@ -551,7 +551,7 @@ void LevelGenerationOptions::loadBaseSaveData() { mountIndex = m_parentDLCPack->GetDLCMountIndex(); if (mountIndex > -1) { - if (StorageManager.MountInstalledDLC( + if (PlatformStorage.MountInstalledDLC( PlatformProfile.GetPrimaryPad(), mountIndex, [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); @@ -638,7 +638,7 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr, } } } - uint32_t result = StorageManager.UnmountInstalledDLC("WPACK"); + uint32_t result = PlatformStorage.UnmountInstalledDLC("WPACK"); } lgo->setLoadedData(); diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index d34c8915d..bee25383a 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -22,7 +22,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "platform/input/input.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Audio/SoundEngine.h" #include @@ -1126,7 +1126,7 @@ void GameSettingsManager::setSpecialTutorialCompletionFlag(int iPad, } int GameSettingsManager::displaySavingMessage( - C4JStorage::ESavingMessage eVal, int iPad) { + IPlatformStorage::ESavingMessage eVal, int iPad) { ui.ShowSavingMessage(iPad, eVal); return 0; } diff --git a/targets/app/common/GameSettingsManager.h b/targets/app/common/GameSettingsManager.h index d3b437f6f..293969b20 100644 --- a/targets/app/common/GameSettingsManager.h +++ b/targets/app/common/GameSettingsManager.h @@ -64,7 +64,7 @@ public: static void setActionConfirmed(void* param); // Saving message - int displaySavingMessage(const C4JStorage::ESavingMessage eMsg, int iPad); + int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad); // Game settings array - public, referenced by Game via alias GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT]; diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 93a438579..e959e2a36 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -29,7 +29,7 @@ #include "minecraft/stats/StatsCounter.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "util/StringHelpers.h" #include "app/common/Audio/SoundEngine.h" @@ -49,11 +49,11 @@ void Game::HandleXuiActions(void) { { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage(IDS_CANT_PLACE_NEAR_SPAWN_TITLE, IDS_CANT_PLACE_NEAR_SPAWN_TEXT, uiIDA, 1, XUSER_INDEX_ANY); - if (result != C4JStorage::EMessage_Busy) + if (result != IPlatformStorage::EMessage_Busy) SetGlobalXuiAction(eAppAction_Idle); } break; @@ -127,7 +127,7 @@ void Game::HandleXuiActions(void) { // stop the dialog asking if we want to overwrite it coming // up on an autosave bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + PlatformStorage.DoesSaveExist(&bSaveExists); SetAction(i, eAppAction_Idle); if (!GetChangingSessionType()) { @@ -147,7 +147,7 @@ void Game::HandleXuiActions(void) { // Check that there is a name for the save - if we're saving // from the tutorial and this is the first save from the // tutorial, we'll not have a name - /*if(StorageManager.GetSaveName()==nullptr) + /*if(PlatformStorage.GetSaveName()==nullptr) { app.NavigateToScene(i,eUIScene_SaveWorld); } @@ -163,7 +163,7 @@ void Game::HandleXuiActions(void) { // int saveOrCheckpointId = 0; // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); @@ -229,7 +229,7 @@ void Game::HandleXuiActions(void) { // int saveOrCheckpointId = 0; // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); @@ -680,7 +680,7 @@ void Game::HandleXuiActions(void) { // inform the player they are being returned to the menus // because they signed out - StorageManager.SetSaveDeviceSelected(i, false); + PlatformStorage.SetSaveDeviceSelected(i, false); // need to clear the player stats - can't assume it'll be // done in setlevel - we may not be in the game StatsCounter* pStats = Minecraft::GetInstance()->stats[i]; @@ -877,7 +877,7 @@ void Game::HandleXuiActions(void) { // set the state back to pre-game PlatformProfile.ResetProfileProcessState(); // clear the save device - StorageManager.SetSaveDeviceSelected(i, false); + PlatformStorage.SetSaveDeviceSelected(i, false); ui.UpdatePlayerBasePositions(); // there are multiple layers in the help menu, so a navigate @@ -926,7 +926,7 @@ void Game::HandleXuiActions(void) { SetAction(i, eAppAction_Idle); // Check the player really wants to do this - if (!StorageManager.GetSaveDisabled() && + if (!PlatformStorage.GetSaveDisabled() && i == PlatformProfile.GetPrimaryPad() && g_NetworkManager.IsHost() && GetGameStarted()) { uiIDA[0] = IDS_CONFIRM_CANCEL; @@ -1000,7 +1000,7 @@ void Game::HandleXuiActions(void) { 1); const unsigned int result = - StorageManager.UnmountInstalledDLC("TPACK"); + PlatformStorage.UnmountInstalledDLC("TPACK"); app.DebugPrintf("Unmount result is %d\n", result); } @@ -1211,11 +1211,11 @@ void Game::HandleXuiActions(void) { case eAppAction_FailedToJoinNoPrivileges: { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, PlatformProfile.GetPrimaryPad()); - if (result != C4JStorage::EMessage_Busy) + if (result != IPlatformStorage::EMessage_Busy) SetAction(i, eAppAction_Idle); } break; case eAppAction_ProfileReadError: @@ -1269,12 +1269,12 @@ void Game::HandleXuiActions(void) { swprintf(wchFormat, 40, L"%ls\n\n%%ls", player->GetOnlineName()); - C4JStorage::EMessageResult result = + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IDS_BANNED_LEVEL_TITLE, IDS_PLAYER_BANNED_LEVEL, uiIDA, 2, i, &Game::BannedLevelDialogReturned, this, wchFormat); - if (result != C4JStorage::EMessage_Busy) + if (result != IPlatformStorage::EMessage_Busy) SetAction(i, eAppAction_Idle); } else { SetAction(i, eAppAction_Idle); @@ -1431,7 +1431,7 @@ void Game::HandleXuiActions(void) { */ case eTMSAction_TMS_RetrieveFiles_Complete: SetTMSAction(i, eTMSAction_Idle); - // if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) + // if(PlatformStorage.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) // { // // save device already // selected diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 79bf9ea90..0549a1cc3 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -19,7 +19,7 @@ #include "minecraft/world/level/tile/entity/HopperTileEntity.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include #include @@ -431,12 +431,12 @@ bool MenuController::loadBeaconMenu( } int MenuController::texturePackDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return 0; } int MenuController::unlockFullInviteReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Minecraft* pMinecraft = Minecraft::GetInstance(); bool bNoPlayer; @@ -448,16 +448,16 @@ int MenuController::unlockFullInviteReturned( } int MenuController::unlockFullSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return 0; } int MenuController::unlockFullExitReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; Minecraft* pMinecraft = Minecraft::GetInstance(); - if (result != C4JStorage::EMessage_ResultAccept) { + if (result != IPlatformStorage::EMessage_ResultAccept) { pApp->SetAction(pMinecraft->player->GetXboxPad(), eAppAction_ExitWorldTrial); } @@ -466,11 +466,11 @@ int MenuController::unlockFullExitReturned( } int MenuController::trialOverReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; Minecraft* pMinecraft = Minecraft::GetInstance(); - if (result != C4JStorage::EMessage_ResultAccept) { + if (result != IPlatformStorage::EMessage_ResultAccept) { pApp->SetAction(pMinecraft->player->GetXboxPad(), eAppAction_ExitTrial); } @@ -521,8 +521,8 @@ void MenuController::exitGameFromRemoteSave(void* lpParameter) { } int MenuController::exitGameFromRemoteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - if (result == C4JStorage::EMessage_ResultDecline) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { + if (result == IPlatformStorage::EMessage_ResultDecline) { app.SetAction(iPad, eAppAction_ExitWorld); } else { UIScene_FullscreenProgress* pScene = diff --git a/targets/app/common/MenuController.h b/targets/app/common/MenuController.h index c373df31e..8c2b74f5c 100644 --- a/targets/app/common/MenuController.h +++ b/targets/app/common/MenuController.h @@ -5,7 +5,7 @@ #include #include "app/common/App_structs.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "platform/XboxStubs.h" class Player; @@ -97,23 +97,23 @@ public: // Dialog callbacks static int texturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int fatalErrorDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int trialOverReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int unlockFullExitReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int unlockFullSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int unlockFullInviteReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); // Remote save static int remoteSaveThreadProc(void* lpParameter); static void exitGameFromRemoteSave(void* lpParameter); static int exitGameFromRemoteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); // Image text data void getImageTextData(std::uint8_t* imageData, unsigned int imageBytes, diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index f9138db5e..2f76df99a 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -12,7 +12,7 @@ #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" @@ -1301,7 +1301,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // 4J-PB - it's possible there is no primary pad here, when accepting an // invite from the dashboard - // StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + // PlatformStorage.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, // IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, // uiIDA,1,PlatformProfile.GetPrimaryPad(),nullptr,nullptr, // app.GetStringTable()); @@ -1505,7 +1505,7 @@ void CGameNetworkManager::ServerStoppedWait() { result = m_hServerStoppedEvent->waitForSignal(20); // Tick some simple things PlatformProfile.Tick(); - StorageManager.Tick(); + PlatformStorage.Tick(); PlatformInput.Tick(); RenderManager.Tick(); ui.tick(); diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index 367f90252..295079fdb 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -19,7 +19,7 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/input/input.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Audio/SoundEngine.h" #include @@ -97,7 +97,7 @@ void NetworkController::processInvite(std::uint32_t dwUserIndex, } int NetworkController::primaryPlayerSignedOutReturned( - void* pParam, int iPad, const C4JStorage::EMessageResult) { + void* pParam, int iPad, const IPlatformStorage::EMessageResult) { if (g_NetworkManager.IsInSession()) { app.SetAction(iPad, eAppAction_PrimaryPlayerSignedOutReturned); } else { @@ -107,7 +107,7 @@ int NetworkController::primaryPlayerSignedOutReturned( } int NetworkController::ethernetDisconnectReturned( - void* pParam, int iPad, const C4JStorage::EMessageResult) { + void* pParam, int iPad, const IPlatformStorage::EMessageResult) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (Minecraft::GetInstance()->player != nullptr) { @@ -241,7 +241,7 @@ void NetworkController::signInChangeCallback(void* pParam, bPrimaryPlayerChanged) { pApp->SetAction(iPrimaryPlayer, eAppAction_PrimaryPlayerSignedOut); pApp->InvalidateBannedList(iPrimaryPlayer); - StorageManager.ClearDLCOffers(); + PlatformStorage.ClearDLCOffers(); pApp->ClearAndResetDLCDownloadQueue(); pApp->ClearDLCInstalled(); } else { @@ -349,7 +349,7 @@ void NetworkController::signInChangeCallback(void* pParam, m_uiLastSignInData = uiSignInData; } else if (iPrimaryPlayer != -1) { pApp->InvalidateBannedList(iPrimaryPlayer); - StorageManager.ClearDLCOffers(); + PlatformStorage.ClearDLCOffers(); pApp->ClearAndResetDLCDownloadQueue(); pApp->ClearDLCInstalled(); } @@ -410,10 +410,10 @@ void NetworkController::liveLinkChangeCallback(void* pParam, bool bConnected) { } int NetworkController::exitAndJoinFromInvite( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { pApp->SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); } @@ -421,11 +421,11 @@ int NetworkController::exitAndJoinFromInvite( } int NetworkController::exitAndJoinFromInviteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Game* pClass = (Game*)pParam; - if (result == C4JStorage::EMessage_ResultDecline || - result == C4JStorage::EMessage_ResultThirdOption) { - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline || + result == IPlatformStorage::EMessage_ResultThirdOption) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); @@ -446,7 +446,7 @@ int NetworkController::exitAndJoinFromInviteSaveDialogReturned( } } bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + PlatformStorage.DoesSaveExist(&bSaveExists); if (bSaveExists) { unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_CANCEL; @@ -479,13 +479,13 @@ int NetworkController::exitAndJoinFromInviteSaveDialogReturned( } int NetworkController::warningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return 0; } int NetworkController::exitAndJoinFromInviteAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - if (result == C4JStorage::EMessage_ResultDecline) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); DLCPack* pDLCPack = tPack->getDLCPack(); @@ -509,8 +509,8 @@ int NetworkController::exitAndJoinFromInviteAndSaveReturned( } int NetworkController::exitAndJoinFromInviteDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - if (result == C4JStorage::EMessage_ResultDecline) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { + if (result == IPlatformStorage::EMessage_ResultDecline) { MinecraftServer::getInstance()->setSaveOnExit(false); app.SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); } diff --git a/targets/app/common/NetworkController.h b/targets/app/common/NetworkController.h index 0c1a706c0..4d226d8dd 100644 --- a/targets/app/common/NetworkController.h +++ b/targets/app/common/NetworkController.h @@ -4,7 +4,7 @@ #include "app/common/App_structs.h" #include "platform/NetTypes.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "platform/XboxStubs.h" #include "minecraft/network/packet/DisconnectPacket.h" @@ -33,9 +33,9 @@ public: static void clearSignInChangeUsersMask(); static int signoutExitWorldThreadProc(void* lpParameter); static int primaryPlayerSignedOutReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const IPlatformStorage::EMessageResult); static int ethernetDisconnectReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const IPlatformStorage::EMessageResult); static void profileReadErrorCallback(void* pParam); // Notifications @@ -51,15 +51,15 @@ public: std::uint32_t dwLocalUsersMask, const INVITE_INFO* pInviteInfo); static int exitAndJoinFromInvite(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int exitAndJoinFromInviteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int exitAndJoinFromInviteAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int exitAndJoinFromInviteDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int warningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); // Disconnect DisconnectPacket::eDisconnectReason getDisconnectReason() { diff --git a/targets/app/common/UI/All Platforms/IUIController.h b/targets/app/common/UI/All Platforms/IUIController.h index c8a71800e..210788677 100644 --- a/targets/app/common/UI/All Platforms/IUIController.h +++ b/targets/app/common/UI/All Platforms/IUIController.h @@ -1,6 +1,6 @@ #pragma once -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "UIEnums.h" #include "UIStructs.h" #include "minecraft/sounds/SoundTypes.h" @@ -82,7 +82,7 @@ public: virtual void ShowAutosaveCountdownTimer(bool show) = 0; virtual void UpdateAutosaveCountdownTimer(unsigned int uiSeconds) = 0; virtual void ShowSavingMessage(unsigned int iPad, - C4JStorage::ESavingMessage eVal) = 0; + IPlatformStorage::ESavingMessage eVal) = 0; virtual bool PressStartPlaying(unsigned int iPad) = 0; virtual void ShowPressStart(unsigned int iPad) = 0; diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index 24269ddad..2a106b1f8 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -32,12 +32,12 @@ class TexturePack; int IUIScene_PauseMenu::ExitGameDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_PauseMenu* pScene = dynamic_cast( ui.GetSceneFromCallbackId((std::size_t)pParam)); // Results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (pScene) pScene->SetIgnoreInput(true); app.SetAction(iPad, eAppAction_ExitWorld); } @@ -45,15 +45,15 @@ int IUIScene_PauseMenu::ExitGameDialogReturned( } int IUIScene_PauseMenu::ExitGameSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_PauseMenu* pScene = dynamic_cast( ui.GetSceneFromCallbackId((std::size_t)pParam)); // Exit with or without saving // Decline means save in this dialog - if (result == C4JStorage::EMessage_ResultDecline || - result == C4JStorage::EMessage_ResultThirdOption) { - if (result == C4JStorage::EMessage_ResultDecline) // Save + if (result == IPlatformStorage::EMessage_ResultDecline || + result == IPlatformStorage::EMessage_ResultThirdOption) { + if (result == IPlatformStorage::EMessage_ResultDecline) // Save { // 4J-PB - Is the player trying to save but they are using a trial // texturepack ? @@ -86,7 +86,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned( // does the save exist? bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + PlatformStorage.DoesSaveExist(&bSaveExists); // 4J-PB - we check if the save exists inside the libs // we need to ask if they are sure they want to overwrite the // existing game @@ -122,16 +122,16 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned( } int IUIScene_PauseMenu::ExitGameAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // 4J-PB - we won't come in here if we have a trial texture pack IUIScene_PauseMenu* pScene = dynamic_cast( ui.GetSceneFromCallbackId((std::size_t)pParam)); // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // int32_t saveOrCheckpointId = 0; // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); if (pScene) pScene->SetIgnoreInput(true); @@ -167,12 +167,12 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned( } int IUIScene_PauseMenu::ExitGameDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_PauseMenu* pScene = dynamic_cast( ui.GetSceneFromCallbackId((std::size_t)pParam)); // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (pScene) pScene->SetIgnoreInput(true); MinecraftServer::getInstance()->setSaveOnExit(false); // flag a app action of exit game @@ -206,7 +206,7 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned( } int IUIScene_PauseMenu::WarningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return 0; } @@ -452,9 +452,9 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) { } int IUIScene_PauseMenu::SaveGameDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // flag a app action of save game app.SetAction(iPad, eAppAction_SaveGame); } @@ -462,9 +462,9 @@ int IUIScene_PauseMenu::SaveGameDialogReturned( } int IUIScene_PauseMenu::EnableAutosaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // Set the global flag, so that we don't disable saving again once the // save is complete app.SetGameHostOption(eGameHostOption_DisableSaving, 0); @@ -475,7 +475,7 @@ int IUIScene_PauseMenu::EnableAutosaveDialogReturned( app.SetGameHostOption(eGameHostOption_DisableSaving, 1); } // Re-enable saving temporarily - StorageManager.SetSaveDisabled(false); + PlatformStorage.SetSaveDisabled(false); // flag a app action of save game app.SetAction(iPad, eAppAction_SaveGame); @@ -483,13 +483,13 @@ int IUIScene_PauseMenu::EnableAutosaveDialogReturned( } int IUIScene_PauseMenu::DisableAutosaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // Set the global flag, so that we disable saving again once the save is // complete app.SetGameHostOption(eGameHostOption_DisableSaving, 1); - StorageManager.SetSaveDisabled(false); + PlatformStorage.SetSaveDisabled(false); // flag a app action of save game app.SetAction(iPad, eAppAction_SaveGame); diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h index 366cf6a4d..46522bac3 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h @@ -1,7 +1,7 @@ #pragma once #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/DLC/DLCPack.h" class DLCPack; @@ -12,21 +12,21 @@ protected: public: static int ExitGameDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int ExitGameSaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int ExitGameAndSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int ExitGameDeclineSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int SaveGameDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int EnableAutosaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int DisableAutosaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int SaveWorldThreadProc(void* lpParameter); static int ExitWorldThreadProc(void* lpParameter); diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index f164eb8ab..1e5cf5b7b 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "UIEnums.h" #include "platform/C4JThread.h" @@ -397,7 +397,7 @@ typedef struct _MessageBoxInfo { uint32_t* uiOptionA; uint32_t uiOptionC; uint32_t dwPad; - int (*Func)(void*, int, const C4JStorage::EMessageResult); + int (*Func)(void*, int, const IPlatformStorage::EMessageResult); void* lpParam; // C4JStringTable *pStringTable; // 4J Stu - We don't need this for our // internal message boxes diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp index 897fc2d5e..022f2a29b 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp @@ -242,10 +242,10 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) { } int IUIScene_StartGame::TrialTexturePackWarningReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { pScene->checkStateAndStartGame(); } else { pScene->m_bIgnoreInput = false; @@ -254,10 +254,10 @@ int IUIScene_StartGame::TrialTexturePackWarningReturned( } int IUIScene_StartGame::UnlockTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { if (PlatformProfile.IsSignedIn(iPad)) { // the license change coming in when the offer has been installed // will cause this scene to refresh @@ -271,7 +271,7 @@ int IUIScene_StartGame::UnlockTexturePackReturned( } int IUIScene_StartGame::TexturePackDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_StartGame* pClass = (IUIScene_StartGame*)pParam; pClass->m_bIgnoreInput = false; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h index a7c13287d..b38d136ee 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -53,9 +53,9 @@ protected: void UpdateCurrentTexturePack(int iSlot); static int TrialTexturePackWarningReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int UnlockTexturePackReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int TexturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); }; \ No newline at end of file diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp index 50beae266..e353b9026 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp @@ -704,9 +704,9 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, // create the world and launch std::wstring wWorldName = pClass->m_worldName; - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level - StorageManager.SetSaveTitle((wchar_t*)wWorldName.c_str()); + PlatformStorage.SetSaveTitle((wchar_t*)wWorldName.c_str()); std::wstring wSeed; if (!pClass->m_MoreOptionsParams.seed.empty()) { @@ -977,10 +977,10 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, } int UIScene_CreateWorldMenu::ConfirmCreateReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { bool isClientSide = PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h index 9bb7c90f3..099081bcd 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -107,10 +107,10 @@ protected: static void CreateGame(UIScene_CreateWorldMenu* pClass, int32_t LocalUsersMask); static int ConfirmCreateReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int StartGame_SignInReturned(void* pParam, bool bContinue, int iPad); static int MustSignInReturnedPSN(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); virtual void checkStateAndStartGame(); }; \ No newline at end of file diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp index 21f38703c..69c000834 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp @@ -94,7 +94,7 @@ void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) { void UIScene_DLCMainMenu::handleTimerComplete(int id) {} int UIScene_DLCMainMenu::ExitDLCMainMenu(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { UIScene_DLCMainMenu* pClass = (UIScene_DLCMainMenu*)pParam; pClass->navigateBack(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h index 84b15c452..1467af02a 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" @@ -31,7 +31,7 @@ private: UI_END_MAP_ELEMENTS_AND_NAMES() static int ExitDLCMainMenu(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); public: UIScene_DLCMainMenu(int iPad, void* initData, UILayer* parentLayer); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp index b137ded49..3311a574e 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp @@ -58,7 +58,7 @@ UIScene_DLCOffersMenu::~UIScene_DLCOffersMenu() { void UIScene_DLCOffersMenu::handleTimerComplete(int id) {} int UIScene_DLCOffersMenu::ExitDLCOffersMenu( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_DLCOffersMenu* pClass = (UIScene_DLCOffersMenu*)pParam; ui.NavigateToHomeMenu(); // iPad,eUIScene_MainMenu); @@ -186,8 +186,8 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) { int iIndex = (int)childId; uint64_t ullIndexA[1]; - ullIndexA[0] = StorageManager.GetOffer(iIndex).qwOfferID; - StorageManager.InstallOffer(1, ullIndexA, nullptr); + ullIndexA[0] = PlatformStorage.GetOffer(iIndex).qwOfferID; + PlatformStorage.InstallOffer(1, ullIndexA, nullptr); } break; } } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h index 8f698873f..a2dc9c4f3 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -45,7 +45,7 @@ public: UIScene_DLCOffersMenu(int iPad, void* initData, UILayer* parentLayer); ~UIScene_DLCOffersMenu(); static int ExitDLCOffersMenu(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); virtual EUIScene getSceneType() { return eUIScene_DLCOffersMenu; } virtual void tick(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp index 96af029b0..68f768a4f 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp @@ -222,7 +222,7 @@ void UIScene_JoinMenu::friendSessionUpdated(bool success, void* pParam) { } int UIScene_JoinMenu::ErrorDialogReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult) { + const IPlatformStorage::EMessageResult) { UIScene_JoinMenu* scene = (UIScene_JoinMenu*)pParam; ui.NavigateBack(scene->m_iPad); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h index d39db7865..c77044633 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" @@ -72,7 +72,7 @@ public: void tick(); static void friendSessionUpdated(bool success, void* pParam); static int ErrorDialogReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const IPlatformStorage::EMessageResult); virtual void updateTooltips(); virtual void updateComponents(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp index 719b34536..65ecfd09b 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp @@ -849,7 +849,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { void UIScene_LeaderboardsMenu::handleTimerComplete(int id) {} int UIScene_LeaderboardsMenu::ExitLeaderboards( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LeaderboardsMenu* pClass = (UIScene_LeaderboardsMenu*)pParam; pClass->navigateBack(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h index bd934779f..f43436509 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h @@ -4,7 +4,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Leaderboards/LeaderboardInterface.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -113,7 +113,7 @@ private: UI_END_MAP_ELEMENTS_AND_NAMES() static int ExitLeaderboards(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); public: UIScene_LeaderboardsMenu(int iPad, void* initData, UILayer* parentLayer); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp index 3530b084b..81ff8352c 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp @@ -764,15 +764,15 @@ void UIScene_LoadMenu::LaunchGame(void) { } else { // set the save to load PSAVE_DETAILS pSaveDetails = - StorageManager.ReturnSavesInfo(); + PlatformStorage.ReturnSavesInfo(); app.DebugPrintf( "Loading save s [%s]\n", pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex] .UTF8SaveTitle, pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex] .UTF8SaveFilename); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveData( + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveData( &pSaveDetails ->SaveInfoA[(int)m_iSaveGameInfoIndex], [this](bool bCorrupt, bool bOwner) { @@ -781,10 +781,10 @@ void UIScene_LoadMenu::LaunchGame(void) { #if TO_BE_IMPLEMENTED if (eLoadStatus == - C4JStorage::ELoadGame_DeviceRemoved) { + IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving - StorageManager.SetSaveDisabled(true); - StorageManager.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDisabled(true); + PlatformStorage.SetSaveDeviceSelected(m_iPad, false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -816,24 +816,24 @@ void UIScene_LoadMenu::LaunchGame(void) { LoadDataComplete(this); } else { // set the save to load - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); app.DebugPrintf("Loading save %s [%s]\n", pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex] .UTF8SaveTitle, pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex] .UTF8SaveFilename); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveData( + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveData( &pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex], [this](bool bCorrupt, bool bOwner) { return loadSaveDataReturned(bCorrupt, bOwner); }); #if TO_BE_IMPLEMENTED - if (eLoadStatus == C4JStorage::ELoadGame_DeviceRemoved) { + if (eLoadStatus == IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving - StorageManager.SetSaveDisabled(true); - StorageManager.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDisabled(true); + PlatformStorage.SetSaveDeviceSelected(m_iPad, false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -849,14 +849,14 @@ void UIScene_LoadMenu::LaunchGame(void) { } int UIScene_LoadMenu::CheckResetNetherReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // continue and reset the nether pClass->LaunchGame(); - } else if (result == C4JStorage::EMessage_ResultAccept) { + } else if (result == IPlatformStorage::EMessage_ResultAccept) { // turn off the reset nether and continue pClass->m_MoreOptionsParams.bResetNether = false; pClass->LaunchGame(); @@ -868,34 +868,34 @@ int UIScene_LoadMenu::CheckResetNetherReturned( } int UIScene_LoadMenu::ConfirmLoadReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { if (pClass->m_levelGen != nullptr) { pClass->m_bIsCorrupt = false; pClass->LoadDataComplete(pClass); } else { // set the save to load - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); app.DebugPrintf( "Loading save %s [%s]\n", pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex] .UTF8SaveTitle, pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex] .UTF8SaveFilename); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveData( + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveData( &pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex], [pClass](const bool bCorrupt, const bool bOwner) { return pClass->loadSaveDataReturned(bCorrupt, bOwner); }); #if TO_BE_IMPLEMENTED - if (eLoadStatus == C4JStorage::ELoadGame_DeviceRemoved) { + if (eLoadStatus == IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving - StorageManager.SetSaveDisabled(true); - StorageManager.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDisabled(true); + PlatformStorage.SetSaveDeviceSelected(m_iPad, false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -1026,19 +1026,19 @@ int UIScene_LoadMenu::loadSaveDataReturned(bool bIsCorrupt, bool bIsOwner) { } int UIScene_LoadMenu::TrophyDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; return LoadDataComplete(pClass); } int UIScene_LoadMenu::DeleteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - StorageManager.DeleteSaveData( + if (result == IPlatformStorage::EMessage_ResultDecline) { + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); + PlatformStorage.DeleteSaveData( &pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex], [pClass](const bool bSuccess) { return pClass->deleteSaveDataReturned(bSuccess); @@ -1063,11 +1063,11 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, if (pClass->m_levelGen == nullptr) { int32_t saveOrCheckpointId = 0; bool validSave = - StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); } else { - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level - StorageManager.SetSaveTitle( + PlatformStorage.SetSaveTitle( pClass->m_levelGen->getDefaultSaveName().c_str()); } @@ -1080,7 +1080,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, ? true : false; - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); NetworkGameInitData* param = new NetworkGameInitData(); param->seed = pClass->m_seed; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h index 38cb289f3..837e68c12 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -120,19 +120,19 @@ private: void LaunchGame(void); static int ConfirmLoadReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static void StartGameFromSave(UIScene_LoadMenu* pClass, int localUsersMask); int loadSaveDataReturned(bool bIsCorrupt, bool bIsOwner); static int TrophyDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int LoadDataComplete(void* pParam); static int CheckResetNetherReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int DeleteSaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bSuccess); static int MustSignInReturnedPSN(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp index d78366689..6e668360f 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp @@ -194,10 +194,10 @@ void UIScene_LoadOrJoinMenu::updateTooltips() { } else if (DoesSavesListHaveFocus()) { if ((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC)) { - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { iRB = IDS_TOOLTIPS_DELETESAVE; } else { - if (StorageManager.EnoughSpaceForAMinSaveGame()) { + if (PlatformStorage.EnoughSpaceForAMinSaveGame()) { iRB = IDS_TOOLTIPS_SAVEOPTIONS; } else { iRB = IDS_TOOLTIPS_DELETESAVE; @@ -216,7 +216,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() { iLB = IDS_TOOLTIPS_PARTY_GAMES; } - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { } else { #if defined(SONY_REMOTE_STORAGE_DOWNLOAD) // Is there a save from PS3 or PSVita available? @@ -247,9 +247,9 @@ void UIScene_LoadOrJoinMenu::Initialise() { m_iDefaultButtonsC = 0; m_iMashUpButtonsC = 0; - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { #if TO_BE_IMPLEMENTED - if (StorageManager.GetSaveDeviceSelected(m_iPad)) + if (PlatformStorage.GetSaveDeviceSelected(m_iPad)) #endif { // saving is disabled, but we should still be able to load from a @@ -266,7 +266,7 @@ void UIScene_LoadOrJoinMenu::Initialise() { } else { // 4J-PB - we need to check that there is enough space left to create a // copy of the save (for a rename) - bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame(); + bool bCanRename = PlatformStorage.EnoughSpaceForAMinSaveGame(); GetSaveInfo(); } @@ -376,7 +376,7 @@ void UIScene_LoadOrJoinMenu::tick() { #endif // Display the saves if we have them if (!m_bSavesDisplayed) { - m_pSaveDetails = StorageManager.ReturnSavesInfo(); + m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails != nullptr) { // CD - Fix - Adding define for ORBIS/XBOXONE @@ -419,15 +419,15 @@ void UIScene_LoadOrJoinMenu::tick() { m_bRetrievingSaveThumbnails = true; app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveDataThumbnail( + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveDataThumbnail( &pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId], [this](std::uint8_t* data, unsigned int bytes) { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -485,16 +485,16 @@ void UIScene_LoadOrJoinMenu::tick() { app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails = - StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveDataThumbnail( + PlatformStorage.ReturnSavesInfo(); + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveDataThumbnail( &pSaveDetails ->SaveInfoA[(int)m_iRequestingThumbnailId], [this](std::uint8_t* data, unsigned int bytes) { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -541,7 +541,7 @@ void UIScene_LoadOrJoinMenu::tick() { m_bSavesDisplayed = false; m_iSaveInfoC = 0; m_buttonListSaves.clearList(); - StorageManager.ClearSavesInfo(); + PlatformStorage.ClearSavesInfo(); GetSaveInfo(); m_iState = e_SavesIdle; break; @@ -597,14 +597,14 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() { m_iSaveInfoC = 0; m_controlSavesTimer.setVisible(true); - m_pSaveDetails = StorageManager.ReturnSavesInfo(); + m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails == nullptr) { - C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo( + IPlatformStorage::ESaveGameState eSGIStatus = PlatformStorage.GetSavesInfo( m_iPad, nullptr, (char*)"save"); } #if TO_BE_IMPLEMENTED - if (eSGIStatus == C4JStorage::ESGIStatus_NoSaves) { + if (eSGIStatus == IPlatformStorage::ESGIStatus_NoSaves) { uiSaveC = 0; m_controlSavesTimer.setVisible(false); m_SavesList.SetEnable(true); @@ -696,7 +696,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, // the SD screen, disconnects from LIVE, and then selects a SD, the // title crashes. m_bIgnoreInput = true; - StorageManager.SetSaveDevice( + PlatformStorage.SetSaveDevice( &CScene_MultiGameJoinLoad::DeviceSelectReturned, this, true); ui.PlayUISFX(eSFX_Press); #endif @@ -721,7 +721,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, m_bIgnoreInput = true; // Could be delete save or Save Options - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { // delete the save game // Have to ask the player if they are sure they want to // delete this game @@ -734,7 +734,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, &UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned, this); } else { - if (StorageManager.EnoughSpaceForAMinSaveGame()) { + if (PlatformStorage.EnoughSpaceForAMinSaveGame()) { unsigned int uiIDA[4]; uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_TITLE_RENAMESAVE; @@ -1023,9 +1023,9 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions* levelGen) { // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level - StorageManager.SetSaveTitle(levelGen->getDefaultSaveName().c_str()); + PlatformStorage.SetSaveTitle(levelGen->getDefaultSaveName().c_str()); bool isClientSide = false; bool isPrivate = false; @@ -1287,10 +1287,10 @@ 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(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level - StorageManager.SetSaveTitle(saveFile->getName().c_str()); + PlatformStorage.SetSaveTitle(saveFile->getName().c_str()); int64_t fileSize = saveFile->length(); FileInputStream fis(*saveFile); @@ -1347,14 +1347,14 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() { strlen(app.getRemoteStorage()->getLocalFilename()) + 1); // plus null File cloudFile(wFileName); - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level wchar_t wSaveName[128]; mbstowcs( wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8()) + 1); // plus null - StorageManager.SetSaveTitle(wSaveName); + PlatformStorage.SetSaveTitle(wSaveName); int64_t fileSize = cloudFile.length(); FileInputStream fis(cloudFile); @@ -1407,7 +1407,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() { #endif int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // results switched for this dialog @@ -1417,13 +1417,13 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned( pClass->m_iDefaultButtonsC != 0 && pClass->m_iSaveListIndex >= pClass->m_iDefaultButtonsC; - if (result == C4JStorage::EMessage_ResultDecline && validSelection) { + if (result == IPlatformStorage::EMessage_ResultDecline && validSelection) { if (app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { pClass->m_bIgnoreInput = false; } else { { size_t cbId = pClass->GetCallbackUniqueId(); - StorageManager.DeleteSaveData( + PlatformStorage.DeleteSaveData( &pClass->m_pSaveDetails ->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC], @@ -1470,13 +1470,13 @@ int UIScene_LoadOrJoinMenu::renameSaveDataReturned(bool bRes) { } int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // results switched for this dialog // EMessage_ResultAccept means cancel switch (result) { - case C4JStorage::EMessage_ResultDecline: // rename + case IPlatformStorage::EMessage_ResultDecline: // rename { pClass->m_bIgnoreInput = true; // bring up a keyboard @@ -1499,7 +1499,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( IPlatformInput::EKeyboardMode_Default); } break; - case C4JStorage::EMessage_ResultThirdOption: // delete - + case IPlatformStorage::EMessage_ResultThirdOption: // delete - { // delete the save game // Have to ask the player if they are sure they want to delete this @@ -1513,7 +1513,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( } break; #if defined(SONY_REMOTE_STORAGE_UPLOAD) - case C4JStorage::EMessage_ResultFourthOption: // upload to cloud + case IPlatformStorage::EMessage_ResultFourthOption: // upload to cloud { unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_OK; @@ -1526,7 +1526,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( } break; #endif - case C4JStorage::EMessage_Cancelled: + case IPlatformStorage::EMessage_Cancelled: default: { // reset the tooltips pClass->updateTooltips(); @@ -1537,11 +1537,11 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( } int UIScene_LoadOrJoinMenu::TexturePackDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // Exit with or without saving - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { // we need to enable background downloading for the DLC // XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); } @@ -1606,7 +1606,7 @@ int UIScene_LoadOrJoinMenu::loadCrossSaveDataCallback(bool bIsCorrupt, } int UIScene_LoadOrJoinMenu::CrossSaveFinishedCallback( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; pClass->m_eSaveTransferState = eSaveTransfer_Idle; return 0; @@ -1618,7 +1618,7 @@ int UIScene_LoadOrJoinMenu::crossSaveDeleteOnErrorReturned(bool bRes) { } int UIScene_LoadOrJoinMenu::RemoteSaveNotFoundCallback( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; pClass->m_eSaveTransferState = eSaveTransfer_Idle; return 0; @@ -1696,27 +1696,27 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { } break; case eSaveTransfer_CreateDummyFile: { - StorageManager.ResetSaveData(); - byte* compData = (byte*)StorageManager.AllocateSaveData( + PlatformStorage.ResetSaveData(); + byte* compData = (byte*)PlatformStorage.AllocateSaveData( app.getRemoteStorage()->getSaveFilesize()); // Make our next save default to the name of the level const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8) + 1); // plus null - StorageManager.SetSaveTitle(wSaveName); + PlatformStorage.SetSaveTitle(wSaveName); std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; std::uint8_t* pbDataSaveImage = nullptr; unsigned int dwDataSizeSaveImage = 0; - StorageManager.GetDefaultSaveImage( + PlatformStorage.GetDefaultSaveImage( &pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail // (as set by SetDefaultImages) for // use on saving games t - StorageManager.GetDefaultSaveThumbnail( + PlatformStorage.GetDefaultSaveThumbnail( &pbThumbnailData, &dwThumbnailDataSize); // Get the default save image (as // set by SetDefaultImages) for use @@ -1731,17 +1731,17 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { hostOptions, app.getRemoteStorage()->getSaveTexturePack()); // set the icon and save image - StorageManager.SetSaveImages( + PlatformStorage.SetSaveImages( pbThumbnailData, dwThumbnailDataSize, pbDataSaveImage, dwDataSizeSaveImage, bTextMetadata, iTextMetadataBytes); - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState saveState = - StorageManager.SaveSaveData( + app.getRemoteStorage()->waitForPlatformStorageIdle(); + IPlatformStorage::ESaveGameState saveState = + PlatformStorage.SaveSaveData( [pClass](const bool bRes) { return pClass->createDummySaveDataCallback(bRes); }); - if (saveState == C4JStorage::ESaveGame_Save) { + if (saveState == IPlatformStorage::ESaveGame_Save) { pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; } else { @@ -1766,10 +1766,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { m_wstrStageText); } - app.getRemoteStorage()->waitForStorageManagerIdle(); + app.getRemoteStorage()->waitForPlatformStorageIdle(); app.DebugPrintf("CALL GetSavesInfo B\n"); - C4JStorage::ESaveGameState eSGIStatus = - StorageManager.GetSavesInfo( + IPlatformStorage::ESaveGameState eSGIStatus = + PlatformStorage.GetSavesInfo( pClass->m_iPad, [pClass](SAVE_DETAILS* pSaveDetails, const bool bRes) { return pClass->crossSaveGetSavesInfoCallback( @@ -1794,16 +1794,16 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { case eSaveTransfer_GetFileData: { bSaveFileCreated = true; - StorageManager.GetSaveUniqueFileDir( + PlatformStorage.GetSaveUniqueFileDir( pClass->m_downloadedUniqueFilename); if (pClass->m_saveTransferDownloadCancelled) { pClass->m_eSaveTransferState = eSaveTransfer_Error; break; } - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); int idx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; - app.getRemoteStorage()->waitForStorageManagerIdle(); + app.getRemoteStorage()->waitForPlatformStorageIdle(); bool bGettingOK = app.getRemoteStorage()->getSaveData( pClass->m_downloadedUniqueFilename, SaveTransferReturned, pClass); @@ -1846,7 +1846,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { break; } - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); int saveInfoIndex = -1; for (int i = 0; i < pSaveDetails->iSaveC; i++) { if (strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, @@ -1861,15 +1861,15 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { "CrossSaveGetSavesInfoCallback failed - couldn't find " "save\n"); } else { - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveData( + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveData( &pSaveDetails->SaveInfoA[saveInfoIndex], [pClass](const bool bIsCorrupt, const bool bIsOwner) { return pClass->loadCrossSaveDataCallback( bIsCorrupt, bIsOwner); }); - if (eLoadStatus == C4JStorage::ESaveGame_Load) { + if (eLoadStatus == IPlatformStorage::ESaveGame_Load) { pClass->m_eSaveTransferState = eSaveTransfer_LoadingSaveFromDisc; } else { @@ -1881,12 +1881,12 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { break; case eSaveTransfer_CreatingNewSave: { - unsigned int fileSize = StorageManager.GetSaveSize(); + unsigned int fileSize = PlatformStorage.GetSaveSize(); std::vector ba(fileSize); - StorageManager.GetSaveData(ba.data(), &fileSize); + PlatformStorage.GetSaveData(ba.data(), &fileSize); assert(ba.size() == fileSize); - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); { std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; @@ -1894,13 +1894,13 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { std::uint8_t* pbDataSaveImage = nullptr; unsigned int dwDataSizeSaveImage = 0; - StorageManager.GetDefaultSaveImage( + PlatformStorage.GetDefaultSaveImage( &pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save // thumbnail (as set by // SetDefaultImages) for use on // saving games t - StorageManager.GetDefaultSaveThumbnail( + PlatformStorage.GetDefaultSaveThumbnail( &pbThumbnailData, &dwThumbnailDataSize); // Get the default save image // (as set by SetDefaultImages) @@ -1918,7 +1918,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { app.getRemoteStorage()->getSaveTexturePack()); // set the icon and save image - StorageManager.SetSaveImages( + PlatformStorage.SetSaveImages( pbThumbnailData, dwThumbnailDataSize, pbDataSaveImage, dwDataSizeSaveImage, bTextMetadata, iTextMetadataBytes); } @@ -1949,12 +1949,12 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { pClass->m_eSaveTransferState = eSaveTransfer_Saving; pMinecraft->progressRenderer->progressStage( IDS_SAVETRANSFER_STAGE_SAVING); - StorageManager.SetSaveTitle(wSaveName); - StorageManager.SetSaveUniqueFilename( + PlatformStorage.SetSaveTitle(wSaveName); + PlatformStorage.SetSaveUniqueFilename( pClass->m_downloadedUniqueFilename); app.getRemoteStorage() - ->waitForStorageManagerIdle(); // we need to wait for the + ->waitForPlatformStorageIdle(); // we need to wait for the // save system to be idle // here, as Flush doesn't // check for it. @@ -1981,7 +1981,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; app.getRemoteStorage() - ->waitForStorageManagerIdle(); // wait for everything to + ->waitForPlatformStorageIdle(); // wait for everything to // complete before we hand // control back to the // player @@ -2015,7 +2015,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { // if the save file has already been created we have to // delete it again if there's been an error PSAVE_DETAILS pSaveDetails = - StorageManager.ReturnSavesInfo(); + PlatformStorage.ReturnSavesInfo(); int saveInfoIndex = -1; for (int i = 0; i < pSaveDetails->iSaveC; i++) { if (strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, @@ -2033,20 +2033,20 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { eSaveTransfer_ErrorMesssage; } else { // delete the save file - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState eDeleteStatus = - StorageManager.DeleteSaveData( + app.getRemoteStorage()->waitForPlatformStorageIdle(); + IPlatformStorage::ESaveGameState eDeleteStatus = + PlatformStorage.DeleteSaveData( &pSaveDetails->SaveInfoA[saveInfoIndex], [pClass](const bool bRes) { return pClass ->crossSaveDeleteOnErrorReturned(bRes); }); - if (eDeleteStatus == C4JStorage::ESaveGame_Delete) { + if (eDeleteStatus == IPlatformStorage::ESaveGame_Delete) { pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; } else { app.DebugPrintf( - "StorageManager.DeleteSaveData failed!!\n"); + "PlatformStorage.DeleteSaveData failed!!\n"); pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; } @@ -2060,7 +2060,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { break; case eSaveTransfer_ErrorMesssage: { app.getRemoteStorage() - ->waitForStorageManagerIdle(); // wait for everything to + ->waitForPlatformStorageIdle(); // wait for everything to // complete before we hand // control back to the // player diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h index af480fcd1..666f636ff 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -140,11 +140,11 @@ public: unsigned int thumbnailBytes); static int LoadSaveCallback(void* lpParam, bool bRes); static int DeleteSaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int SaveOptionsDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int TexturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); int renameSaveDataReturned(bool bRes); int handleKeyboardCompleteWorldName(bool bRes); @@ -202,10 +202,10 @@ private: int crossSaveGetSavesInfoCallback(SAVE_DETAILS* pSaveDetails, bool bRes); int loadCrossSaveDataCallback(bool bIsCorrupt, bool bIsOwner); static int CrossSaveFinishedCallback(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); int crossSaveDeleteOnErrorReturned(bool bRes); static int RemoteSaveNotFoundCallback(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int DownloadSonyCrossSaveThreadProc(void* lpParameter); static void SaveTransferReturned(void* lpParam, SonyRemoteStorage::Status s, int error_code); @@ -238,8 +238,8 @@ private: int error_code); static void CancelSaveUploadCallback(void* lpParam); static int SaveTransferDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int CrossSaveUploadFinishedCallback( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); #endif }; \ No newline at end of file diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp index 896d14489..9c2566ebf 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp @@ -394,10 +394,10 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion* region) { } int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { // we need to specify local game here to display local and LIVE profiles // in the list switch (pClass->m_eAction) { @@ -556,7 +556,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, if (app.GetTMSDLCInfoRead() && app.GetTMSXUIDsFileRead() && app.GetBanListRead(iPad)) { - if (StorageManager.SetSaveDevice( + if (PlatformStorage.SetSaveDevice( &UIScene_MainMenu::DeviceSelectReturned, pClass) == true) { // save device already selected @@ -749,11 +749,11 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, } int UIScene_MainMenu::ExitGameReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { // UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; // buttons reversed on this - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); app.ExitGame(); } @@ -799,12 +799,12 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { #if TO_BE_IMPLEMENTED // Check if there is any new DLC app.ClearNewDLCAvailable(); - StorageManager.GetAvailableDLCCount(iPad); + PlatformStorage.GetAvailableDLCCount(iPad); // check if all the TMS files are loaded if (app.GetTMSDLCInfoRead() && app.GetTMSXUIDsFileRead() && app.GetBanListRead(iPad)) { - if (StorageManager.SetSaveDevice( + if (PlatformStorage.SetSaveDevice( &CScene_Main::DeviceSelectReturned, this) == true) { // change the minecraft player name pMinecraft->user->name = @@ -1048,17 +1048,17 @@ void UIScene_MainMenu::LoadTrial(void) { // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // No saving in the trial - StorageManager.SetSaveDisabled(true); + PlatformStorage.SetSaveDisabled(true); app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false); // Set the global flag, so that we don't disable saving again once the save // is complete app.SetGameHostOption(eGameHostOption_DisableSaving, 1); - StorageManager.SetSaveTitle(L"Tutorial"); + PlatformStorage.SetSaveTitle(L"Tutorial"); // Reset the autosave time app.SetAutosaveTimerTime(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h index f79a276da..89892fa19 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -145,14 +145,14 @@ private: static int Achievements_SignInReturned(void* pParam, bool bContinue, int iPad); static int MustSignInReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int Leaderboards_SignInReturned(void* pParam, bool bContinue, int iPad); static int UnlockFullGame_SignInReturned(void* pParam, bool bContinue, int iPad); static int ExitGameReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); bool m_bRunGameChosen; int32_t m_errorCode; bool m_bErrorDialogRunning; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp index 5dabd1970..7284a450c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -70,8 +70,8 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void* initData, // example) doHorizontalResizeCheck(); - // StorageManager.TMSPP_GetUserQuotaInfo(C4JStorage::eGlobalStorage_TitleUser,iPad); - // StorageManager.WebServiceRequestGetFriends(iPad); + // PlatformStorage.TMSPP_GetUserQuotaInfo(IPlatformStorage::eGlobalStorage_TitleUser,iPad); + // PlatformStorage.WebServiceRequestGetFriends(iPad); } UIScene_HelpAndOptionsMenu::~UIScene_HelpAndOptionsMenu() {} diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp index d69287aca..13db8b4e4 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -144,11 +144,11 @@ void UIScene_SettingsMenu::handlePress(F64 controlId, F64 childId) { } int UIScene_SettingsMenu::ResetDefaultsDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_SettingsMenu* pClass = (UIScene_SettingsMenu*)pParam; // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { app.SetDefaultOptions( PlatformProfile.GetDashboardProfileSettings(pClass->m_iPad), pClass->m_iPad); diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h index fd47ffd53..c9109c033 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" @@ -52,5 +52,5 @@ protected: void handlePress(F64 controlId, F64 childId); static int ResetDefaultsDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); }; \ No newline at end of file diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp index 9bbedf0eb..914c330e9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -1229,10 +1229,10 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) { } int UIScene_SkinSelectMenu::UnlockSkinReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_SkinSelectMenu* pScene = (UIScene_SkinSelectMenu*)pParam; - if ((result == C4JStorage::EMessage_ResultAccept) && + if ((result == IPlatformStorage::EMessage_ResultAccept) && PlatformProfile.IsSignedIn(iPad)) { if (PlatformProfile.IsSignedInLive(iPad)) { } else // Is signed in, but not live. diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h index bd2b004cd..28315e94a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" @@ -162,7 +162,7 @@ private: void showNotOnlineDialog(int iPad); static int UnlockSkinReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int RenableInput(void* lpVoid, int, int); void AddFavoriteSkin(int iPad, int iSkinID); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp index 2e2ce00ad..a31062d8b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" @@ -108,7 +108,7 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) { ->getSessionTimer(); } - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_CONFIRM_OK; ui.RequestAlertMessage( diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp index 8e2a3358b..c5954b197 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp @@ -434,11 +434,11 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void* callbackParam, } int UIScene_InGameInfoMenu::KickPlayerReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { std::uint8_t smallId = *(std::uint8_t*)pParam; delete (std::uint8_t*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { Minecraft* pMinecraft = Minecraft::GetInstance(); std::shared_ptr localPlayer = pMinecraft->localplayers[iPad]; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h index cd670822e..ce3c4ee1d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -74,7 +74,7 @@ protected: public: static int KickPlayerReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static void OnPlayerChanged(void* callbackParam, INetworkPlayer* pPlayer, bool leaving); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp index f22a2fe04..80c3ffc85 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp @@ -590,11 +590,11 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) { } int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { std::uint8_t smallId = *(std::uint8_t*)pParam; delete (std::uint8_t*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { Minecraft* pMinecraft = Minecraft::GetInstance(); std::shared_ptr localPlayer = pMinecraft->localplayers[iPad]; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h index 7a1863f6f..cadd3122d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -101,7 +101,7 @@ public: virtual void handlePress(F64 controlId, F64 childId); static int KickPlayerReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static void OnPlayerChanged(void* callbackParam, INetworkPlayer* pPlayer, bool leaving); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp index a32fe1edb..c31632e5a 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp @@ -80,8 +80,8 @@ UIScene_InGameSaveManagementMenu::~UIScene_InGameSaveManagementMenu() { delete[] m_saveDetails; } app.unlockSaveNotification(); - StorageManager.SetSaveDisabled(false); - StorageManager.ContinueIncompleteOperation(); + PlatformStorage.SetSaveDisabled(false); + PlatformStorage.ContinueIncompleteOperation(); } void UIScene_InGameSaveManagementMenu::updateTooltips() { @@ -98,12 +98,12 @@ void UIScene_InGameSaveManagementMenu::updateTooltips() { void UIScene_InGameSaveManagementMenu::Initialise() { m_iSaveListIndex = 0; - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { GetSaveInfo(); } else { // 4J-PB - we need to check that there is enough space left to create a // copy of the save (for a rename) - bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame(); + bool bCanRename = PlatformStorage.EnoughSpaceForAMinSaveGame(); GetSaveInfo(); } @@ -154,7 +154,7 @@ void UIScene_InGameSaveManagementMenu::tick() { // Display the saves if we have them if (!m_bSavesDisplayed) { - m_pSaveDetails = StorageManager.ReturnSavesInfo(); + m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails != nullptr) { m_spaceIndicatorSaves.reset(); @@ -194,15 +194,15 @@ void UIScene_InGameSaveManagementMenu::tick() { m_bRetrievingSaveThumbnails = true; app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveDataThumbnail( + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveDataThumbnail( &pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId], [this](std::uint8_t* data, unsigned int bytes) { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -259,16 +259,16 @@ void UIScene_InGameSaveManagementMenu::tick() { app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails = - StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveDataThumbnail( + PlatformStorage.ReturnSavesInfo(); + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveDataThumbnail( &pSaveDetails ->SaveInfoA[(int)m_iRequestingThumbnailId], [this](std::uint8_t* data, unsigned int bytes) { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -295,7 +295,7 @@ void UIScene_InGameSaveManagementMenu::tick() { m_bSavesDisplayed = false; m_iSaveInfoC = 0; m_buttonListSaves.clearList(); - // StorageManager.ClearSavesInfo(); + // PlatformStorage.ClearSavesInfo(); // GetSaveInfo(); m_iState = e_SavesIdle; break; @@ -314,10 +314,10 @@ void UIScene_InGameSaveManagementMenu::GetSaveInfo() { m_iSaveInfoC = 0; m_controlSavesTimer.setVisible(true); - m_pSaveDetails = StorageManager.ReturnSavesInfo(); + m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails == nullptr) { - C4JStorage::ESaveGameState eSGIStatus = - StorageManager.GetSavesInfo(m_iPad, nullptr, (char*)"save"); + IPlatformStorage::ESaveGameState eSGIStatus = + PlatformStorage.GetSavesInfo(m_iPad, nullptr, (char*)"save"); } return; @@ -394,16 +394,16 @@ void UIScene_InGameSaveManagementMenu::handlePress(F64 controlId, F64 childId) { } int UIScene_InGameSaveManagementMenu::DeleteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_InGameSaveManagementMenu* pClass = (UIScene_InGameSaveManagementMenu*)pParam; // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { pClass->m_bIgnoreInput = false; } else { - StorageManager.DeleteSaveData( + PlatformStorage.DeleteSaveData( &pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex], [pClass](const bool bRes) { return pClass->deleteSaveDataReturned(bRes); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h index bd95c92c5..a96c8d79c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h @@ -93,7 +93,7 @@ public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, unsigned int thumbnailBytes); static int DeleteSaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); protected: diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp index f3d26fe92..5ea18e53b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp @@ -169,7 +169,7 @@ void UIScene_PauseMenu::updateControlsVisibility() { } // is saving disabled? - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { } } @@ -223,7 +223,7 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, // SD, the title crashes. m_bIgnoreInput = true; - StorageManager.SetSaveDevice( + PlatformStorage.SetSaveDevice( &UIScene_PauseMenu::DeviceSelectReturned, this, true); } rfHandled = true; @@ -332,7 +332,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { ->getSessionTimer(); } - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_CONFIRM_OK; ui.RequestAlertMessage( @@ -418,8 +418,8 @@ void UIScene_PauseMenu::PerformActionSaveGame() { // does the save exist? bool bSaveExists; - C4JStorage::ESaveGameState result = - StorageManager.DoesSaveExist(&bSaveExists); + IPlatformStorage::ESaveGameState result = + PlatformStorage.DoesSaveExist(&bSaveExists); { // we need to ask if they are sure they want to overwrite the @@ -470,7 +470,7 @@ void UIScene_PauseMenu::HandleDLCMountingComplete() { } int UIScene_PauseMenu::UnlockFullSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Minecraft* pMinecraft = Minecraft::GetInstance(); return 0; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h index 1bbc797af..957dcba9d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -45,7 +45,7 @@ private: virtual void HandleDLCMountingComplete(); virtual void HandleDLCInstalled(); static int UnlockFullSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int SaveGame_SignInReturned(void* pParam, bool bContinue, int iPad); public: diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 7068b8c65..e96515fa1 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -114,7 +114,7 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, if (pressed) { navigateBack(); if (m_Func) - m_Func(m_lpParam, iPad, C4JStorage::EMessage_Cancelled); + m_Func(m_lpParam, iPad, IPlatformStorage::EMessage_Cancelled); } break; case ACTION_MENU_OK: @@ -129,19 +129,19 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, } void UIScene_MessageBox::handlePress(F64 controlId, F64 childId) { - C4JStorage::EMessageResult result = C4JStorage::EMessage_Cancelled; + IPlatformStorage::EMessageResult result = IPlatformStorage::EMessage_Cancelled; switch ((int)controlId) { case 0: - result = C4JStorage::EMessage_ResultAccept; + result = IPlatformStorage::EMessage_ResultAccept; break; case 1: - result = C4JStorage::EMessage_ResultDecline; + result = IPlatformStorage::EMessage_ResultDecline; break; case 2: - result = C4JStorage::EMessage_ResultThirdOption; + result = IPlatformStorage::EMessage_ResultThirdOption; break; case 3: - result = C4JStorage::EMessage_ResultFourthOption; + result = IPlatformStorage::EMessage_ResultFourthOption; break; } diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.h b/targets/app/common/UI/Scenes/UIScene_MessageBox.h index 69c91028d..721aade9c 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.h +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -26,7 +26,7 @@ private: eControl_COUNT }; - int (*m_Func)(void*, int, const C4JStorage::EMessageResult); + int (*m_Func)(void*, int, const IPlatformStorage::EMessageResult); void* m_lpParam; int m_buttonCount; diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 561d4cbdd..e5032cb49 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -697,7 +697,7 @@ void UIController::CleanUpSkinReload() { if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { if (!Minecraft::GetInstance()->skins->getSelected()->hasAudio()) { const unsigned int result = - StorageManager.UnmountInstalledDLC("TPACK"); + PlatformStorage.UnmountInstalledDLC("TPACK"); } } @@ -1368,7 +1368,7 @@ void UIController::NavigateToHomeMenu() { // { // pDLCTexPack->m_pSoundBank->Destroy(); // } - const unsigned int result = StorageManager.UnmountInstalledDLC("TPACK"); + const unsigned int result = PlatformStorage.UnmountInstalledDLC("TPACK"); app.DebugPrintf("Unmount result is %d\n", result); } @@ -2070,14 +2070,14 @@ void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) { } void UIController::ShowSavingMessage(unsigned int iPad, - C4JStorage::ESavingMessage eVal) { + IPlatformStorage::ESavingMessage eVal) { bool show = false; switch (eVal) { - case C4JStorage::ESavingMessage_None: + case IPlatformStorage::ESavingMessage_None: show = false; break; - case C4JStorage::ESavingMessage_Short: - case C4JStorage::ESavingMessage_Long: + case IPlatformStorage::ESavingMessage_Short: + case IPlatformStorage::ESavingMessage_Long: show = true; break; } @@ -2154,28 +2154,28 @@ void UIController::HidePressStart() { void UIController::ClearPressStart() { m_iPressStartQuadrantsMask = 0; } -C4JStorage::EMessageResult UIController::RequestAlertMessage( +IPlatformStorage::EMessageResult UIController::RequestAlertMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, false); } -C4JStorage::EMessageResult UIController::RequestErrorMessage( +IPlatformStorage::EMessageResult UIController::RequestErrorMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, true); } -C4JStorage::EMessageResult UIController::RequestMessageBox( +IPlatformStorage::EMessageResult UIController::RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString, unsigned int dwFocusButton, bool bIsError) { @@ -2214,15 +2214,15 @@ C4JStorage::EMessageResult UIController::RequestMessageBox( // This may happen if we had to queue the message box, or there was // already a message box displaying and so the NavigateToScene returned // false; - return C4JStorage::EMessage_Pending; + return IPlatformStorage::EMessage_Pending; } else { - return C4JStorage::EMessage_Busy; + return IPlatformStorage::EMessage_Busy; } } -C4JStorage::EMessageResult UIController::RequestUGCMessageBox( +IPlatformStorage::EMessageResult UIController::RequestUGCMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const C4JStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { @@ -2242,9 +2242,9 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox( lpParam); } -C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox( +IPlatformStorage::EMessageResult UIController::RequestContentRestrictedMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const C4JStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index 04dc7f98f..e0b23c42c 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -23,7 +23,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/IUIController.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -410,7 +410,7 @@ public: virtual void ShowAutosaveCountdownTimer(bool show); virtual void UpdateAutosaveCountdownTimer(unsigned int uiSeconds); virtual void ShowSavingMessage(unsigned int iPad, - C4JStorage::ESavingMessage eVal); + IPlatformStorage::ESavingMessage eVal); virtual void ShowPlayerDisplayname(bool show); virtual bool PressStartPlaying(unsigned int iPad); @@ -418,33 +418,33 @@ public: virtual void HidePressStart(); void ClearPressStart(); - virtual C4JStorage::EMessageResult RequestAlertMessage( + virtual IPlatformStorage::EMessageResult RequestAlertMessage( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, - int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, wchar_t* pwchFormatString = nullptr); - virtual C4JStorage::EMessageResult RequestErrorMessage( + virtual IPlatformStorage::EMessageResult RequestErrorMessage( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, - int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, wchar_t* pwchFormatString = nullptr); private: - virtual C4JStorage::EMessageResult RequestMessageBox( + virtual IPlatformStorage::EMessageResult RequestMessageBox( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad, - int (*Func)(void*, int, const C4JStorage::EMessageResult), + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString, uint32_t dwFocusButton, bool bIsError); public: - C4JStorage::EMessageResult RequestUGCMessageBox( + IPlatformStorage::EMessageResult RequestUGCMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); - C4JStorage::EMessageResult RequestContentRestrictedMessageBox( + IPlatformStorage::EMessageResult RequestContentRestrictedMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); virtual void SetWinUserIndex(unsigned int iPad); diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 5c970cbd7..7ed076b48 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -6,7 +6,7 @@ #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" @@ -72,8 +72,8 @@ void LinuxGame::TemporaryCreateGameStart() { app.ClearTerrainFeaturePosition(); std::wstring wWorldName = L"TestWorld"; - StorageManager.ResetSaveData(); - StorageManager.SetSaveTitle(wWorldName.c_str()); + PlatformStorage.ResetSaveData(); + PlatformStorage.SetSaveTitle(wWorldName.c_str()); bool isFlat = false; int64_t seedValue = diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index 84a6669a7..c8fe148be 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -57,7 +57,7 @@ static void sigsegv_handler(int sig) { #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Network/GameNetworkManager.h" @@ -457,10 +457,10 @@ int main(int argc, const char* argv[]) { initGameServices(&services); ui.init(1920, 1080); // storage manager is needed for the trial key check - StorageManager.Init( + PlatformStorage.Init( 0, app.GetString(IDS_DEFAULT_SAVENAME), (char*)"savegame.dat", FIFTY_ONE_MB, - [](const C4JStorage::ESavingMessage eMsg, int iPad) { + [](const IPlatformStorage::ESavingMessage eMsg, int iPad) { return app.displaySavingMessage(eMsg, iPad); }, (char*)""); @@ -497,7 +497,7 @@ int main(int argc, const char* argv[]) { }); // Set a callback for when there is a read error on profile data - // StorageManager.SetProfileReadErrorCallback(&Game::ProfileReadErrorCallback, + // PlatformStorage.SetProfileReadErrorCallback(&Game::ProfileReadErrorCallback, // &app); // QNet needs to be setup after profile manager, as we do not want its @@ -535,7 +535,7 @@ int main(int argc, const char* argv[]) { PlatformProfile.Tick(); - StorageManager.Tick(); + PlatformStorage.Tick(); RenderManager.Tick(); diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp index 515ea05f0..74d266cb9 100644 --- a/targets/app/windows/Windows64_App.cpp +++ b/targets/app/windows/Windows64_App.cpp @@ -63,8 +63,8 @@ void WindowsGame::TemporaryCreateGameStart() { app.ClearTerrainFeaturePosition(); std::wstring wWorldName = L"TestWorld"; - StorageManager.ResetSaveData(); - StorageManager.SetSaveTitle(wWorldName.c_str()); + PlatformStorage.ResetSaveData(); + PlatformStorage.SetSaveTitle(wWorldName.c_str()); bool isFlat = false; int64_t seedValue = diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index 703c40451..3d0a960ea 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -794,7 +794,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // PlatformProfile.Tick(); - StorageManager.Tick(); + PlatformStorage.Tick(); RenderManager.Tick(); diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index 4af84d5de..dcc73d5b9 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -97,7 +97,7 @@ File::File(const std::wstring& pathname) { #ifdef _WINDOWS64 std::string path = std::filesystem::path(m_abstractPathName).string(); - std::string finalPath = StorageManager.GetMountedPath(path.c_str()); + std::string finalPath = PlatformStorage.GetMountedPath(path.c_str()); if (finalPath.size() == 0) finalPath = path; m_abstractPathName = convStringToWstring(finalPath); #endif diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 9be44bec7..52b18a4c7 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -15,7 +15,7 @@ #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" @@ -1074,7 +1074,7 @@ void Minecraft::run_middle() { // autosave If saving isn't disabled, and the main // player has a app action running , or has any crafting // or containers open, don't autosave - if (!StorageManager.GetSaveDisabled() && + if (!PlatformStorage.GetSaveDisabled() && (gameServices().getXuiAction(PlatformInput.GetPrimaryPad()) == eAppAction_Idle)) { if (!ui.IsPauseMenuDisplayed( diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index b5facb94f..662eb92b1 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -8,7 +8,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "Button.h" #include "EditBox.h" #include "MessageScreen.h" @@ -206,8 +206,8 @@ void CreateWorldScreen::buttonClicked(Button* button) { worldName = L"2slimey"; } - StorageManager.ResetSaveData(); - StorageManager.SetSaveTitle((wchar_t*)worldName.c_str()); + PlatformStorage.ResetSaveData(); + PlatformStorage.SetSaveTitle((wchar_t*)worldName.c_str()); std::wstring seedString = seedEdit->getValue(); diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index dbf1416cc..8aa82c20b 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -3428,7 +3428,7 @@ void ClientConnection::handleUpdateGameRuleProgressPacket( // Fix for #13191 - The host of a game can get a message informing them that the // connection to the server has been lost int ClientConnection::HostDisconnectReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // 4J-PB - if they have a trial texture pack, they don't get to save the // world if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { @@ -3448,7 +3448,7 @@ int ClientConnection::HostDisconnectReturned( // Give the player the option to save their game // does the save exist? bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + PlatformStorage.DoesSaveExist(&bSaveExists); // 4J-PB - we check if the save exists inside the libs // we need to ask if they are sure they want to overwrite the existing game if (bSaveExists) { @@ -3469,12 +3469,12 @@ int ClientConnection::HostDisconnectReturned( } int ClientConnection::ExitGameAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // int32_t saveOrCheckpointId = 0; // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // SentientManager.RecordLevelSaveOrCheckpoint(PlatformInput.GetPrimaryPad(), // saveOrCheckpointId); MinecraftServer::getInstance()->setSaveOnExit(true); diff --git a/targets/minecraft/client/multiplayer/ClientConnection.h b/targets/minecraft/client/multiplayer/ClientConnection.h index 1285bc367..d182f6ac1 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.h +++ b/targets/minecraft/client/multiplayer/ClientConnection.h @@ -6,7 +6,7 @@ #include #include "util/Timer.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" @@ -188,9 +188,9 @@ public: // 4J Added static int HostDisconnectReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int ExitGameAndSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); virtual void handleTextureChange( std::shared_ptr packet); virtual void handleTextureAndGeometryChange( diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 2d9cb5a6e..65aa87701 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -8,7 +8,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Colours/ColourTable.h" @@ -238,7 +238,7 @@ void DLCTexturePack::loadData() { int mountIndex = m_dlcInfoPack->GetDLCMountIndex(); if (mountIndex > -1) { - if (StorageManager.MountInstalledDLC( + if (PlatformStorage.MountInstalledDLC( PlatformInput.GetPrimaryPad(), mountIndex, [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); @@ -420,7 +420,7 @@ void DLCTexturePack::loadUI() { AbstractTexturePack::loadUI(); if (hasAudio() == false && !ui.IsReloadingSkin()) { - StorageManager.UnmountInstalledDLC("TPACK"); + PlatformStorage.UnmountInstalledDLC("TPACK"); } } diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 3a3120121..20468abb4 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -14,7 +14,7 @@ #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "ConsoleInput.h" #include "DispenserBootstrap.h" #include "minecraft/GameEnums.h" @@ -860,7 +860,7 @@ void MinecraftServer::saveGameRules() { void MinecraftServer::Suspend() { m_suspending = true; time_util::Timer timer; - if (m_bLoaded && (!StorageManager.GetSaveDisabled())) { + if (m_bLoaded && (!PlatformStorage.GetSaveDisabled())) { if (players != nullptr) { players->saveAll(nullptr); } @@ -907,7 +907,7 @@ void MinecraftServer::stopServer(bool didInit) { // if trial version or saving is disabled, then don't save anything. // Also don't save anything if we didn't actually get through the server // initialisation. - if (m_saveOnExit && (!StorageManager.GetSaveDisabled()) && didInit) { + if (m_saveOnExit && (!PlatformStorage.GetSaveDisabled()) && didInit) { if (players != nullptr) { players->saveAll(Minecraft::GetInstance()->progressRenderer, true); diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 86c9be140..d672999d4 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -8,7 +8,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "EntityTracker.h" #include "platform/ShutdownManager.h" #include "app/common/Console_Debug_enum.h" @@ -925,7 +925,7 @@ Pos* ServerLevel::getDimensionSpecificSpawn() { // 4j Added for XboxOne PLM void ServerLevel::Suspend() { - if (StorageManager.GetSaveDisabled()) return; + if (PlatformStorage.GetSaveDisabled()) return; saveLevelData(); chunkSource->saveAllEntities(); } @@ -935,7 +935,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener, if (!chunkSource->shouldSave()) return; // 4J-PB - check that saves are enabled - if (StorageManager.GetSaveDisabled()) return; + if (PlatformStorage.GetSaveDisabled()) return; if (progressListener != nullptr) { if (bAutosave) { @@ -983,7 +983,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener, void ServerLevel::saveToDisc(ProgressListener* progressListener, bool autosave) { // 4J-PB - check that saves are enabled - if (StorageManager.GetSaveDisabled()) return; + if (PlatformStorage.GetSaveDisabled()) return; // Check if we are using a trial version of a texture pack (which will be // the case for going into the mash-up pack world with a trial version) diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index f3c22b92b..2a8746dc8 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -8,7 +8,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" #include "app/common/Network/NetworkPlayerInterface.h" @@ -103,7 +103,7 @@ void PendingConnection::sendPreLoginResponse() { std::uint8_t ugcFriendsOnlyBits = 0; char szUniqueMapName[14]; - StorageManager.GetSaveUniqueFilename(szUniqueMapName); + PlatformStorage.GetSaveUniqueFilename(szUniqueMapName); PlayerList* playerList = MinecraftServer::getInstance()->getPlayers(); for (auto it = playerList->players.begin(); it != playerList->players.end(); diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index 24a668711..a9374fa06 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -33,7 +33,7 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/IPlatformStorage.h" +#include "platform/storage/storage.h" #include "platform/PlatformServices.h" #define RESERVE_ALLOCATION MEM_RESERVE @@ -587,7 +587,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { // 4J Stu - Added TU-1 interim // Attempt to allocate the required memory - // We do not own this, it belongs to the StorageManager + // We do not own this, it belongs to the PlatformStorage std::uint8_t* compData = (std::uint8_t*)PlatformStorage.AllocateSaveData(compLength); diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 353f50448..b4fc4b149 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -37,7 +37,7 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/IPlatformStorage.h" +#include "platform/storage/storage.h" #include "platform/PlatformServices.h" class ProgressListener; @@ -1299,7 +1299,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { // 4J Stu - Added TU-1 interim // Attempt to allocate the required memory - // We do not own this, it belongs to the StorageManager + // We do not own this, it belongs to the PlatformStorage std::uint8_t* compData = (std::uint8_t*)PlatformStorage.AllocateSaveData(compLength); diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 0fb639d42..edf927cda 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -42,7 +42,7 @@ #include "nbt/DoubleTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" -#include "platform/IPlatformStorage.h" +#include "platform/storage/storage.h" #include "platform/PlatformServices.h" const std::wstring DirectoryLevelStorage::sc_szPlayerDir(L"players/"); diff --git a/targets/platform/PlatformServices.cpp b/targets/platform/PlatformServices.cpp index 0963a3e75..0a1ccf85a 100644 --- a/targets/platform/PlatformServices.cpp +++ b/targets/platform/PlatformServices.cpp @@ -2,10 +2,8 @@ #include "StdFileIO.h" #include "sdl2/Render.h" -#include "sdl2/Storage.h" static StdFileIO s_stdFileIO; IPlatformFileIO& PlatformFileIO = s_stdFileIO; IPlatformRenderer& PlatformRender = RenderManager; -IPlatformStorage& PlatformStorage = StorageManager; diff --git a/targets/platform/PlatformServices.h b/targets/platform/PlatformServices.h index 2fe965439..915771d3c 100644 --- a/targets/platform/PlatformServices.h +++ b/targets/platform/PlatformServices.h @@ -4,7 +4,6 @@ #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" #include "IPlatformRenderer.h" -#include "IPlatformStorage.h" // Interface references to platform services. Game code uses these // instead of concrete globals directly. Bindings are established @@ -12,4 +11,3 @@ extern IPlatformFileIO& PlatformFileIO; extern IPlatformRenderer& PlatformRender; -extern IPlatformStorage& PlatformStorage; diff --git a/targets/platform/ShutdownManager.h b/targets/platform/ShutdownManager.h index c56ab13fe..33f1019be 100644 --- a/targets/platform/ShutdownManager.h +++ b/targets/platform/ShutdownManager.h @@ -18,7 +18,7 @@ public: eRunUpdateThread, eRenderChunkUpdateThread, eServerThread, - eStorageManagerThreads, + ePlatformStorageThreads, eConnectionReadThreads, eConnectionWriteThreads, eEventQueueThreads, diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 883c80490..b41600830 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -27,9 +27,9 @@ endif sdl2_sources = files( 'input/sdl2/SDL2Input.cpp', 'profile/stub/StubProfile.cpp', + 'storage/stub/StubStorage.cpp', 'sdl2/Render.cpp', 'sdl2/render_stubs.cpp', - 'sdl2/Storage.cpp', ) lib_platform_sdl2 = static_library('platform_sdl2', diff --git a/targets/platform/IPlatformStorage.h b/targets/platform/storage/IPlatformStorage.h similarity index 90% rename from targets/platform/IPlatformStorage.h rename to targets/platform/storage/IPlatformStorage.h index d17f7e82e..6f835a119 100644 --- a/targets/platform/IPlatformStorage.h +++ b/targets/platform/storage/IPlatformStorage.h @@ -8,12 +8,36 @@ #include "PlatformTypes.h" -struct SAVE_INFO; +#define MAX_DISPLAYNAME_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 +#define MAX_DETAILS_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 +#define MAX_SAVEFILENAME_LENGTH 32 // CELL_SAVEDATA_DIRNAME_SIZE +// Current version of the dlc data creator +#define CURRENT_DLC_VERSION_NUM 3 + +struct CONTAINER_METADATA { + time_t modifiedTime; + unsigned int dataSize; + unsigned int thumbnailSize; +}; + +struct SAVE_INFO { + char UTF8SaveFilename[MAX_SAVEFILENAME_LENGTH]; + char UTF8SaveTitle[MAX_DISPLAYNAME_LENGTH]; + CONTAINER_METADATA metaData; + std::uint8_t* thumbnailData; +}; using PSAVE_INFO = SAVE_INFO*; -struct SAVE_DETAILS; + +struct SAVE_DETAILS { + int iSaveC; + PSAVE_INFO SaveInfoA; +}; using PSAVE_DETAILS = SAVE_DETAILS*; + class C4JStringTable; + + class IPlatformStorage { public: // Enums live here so both the interface consumer and the concrete @@ -112,6 +136,21 @@ public: std::uint8_t bPadding[1024 - sizeof(std::uint32_t) * 4]; }; + struct DLC_FILE_DETAILS { + unsigned int uiFileSize; + std::uint32_t dwType; + std::uint32_t dwWchCount; + wchar_t wchFile[1]; + }; + using PDLC_FILE_DETAILS = DLC_FILE_DETAILS*; + + struct DLC_FILE_PARAM { + std::uint32_t dwType; + std::uint32_t dwWchCount; + wchar_t wchData[1]; + }; + using PDLC_FILE_PARAM = DLC_FILE_PARAM*; + virtual ~IPlatformStorage() = default; // Lifecycle diff --git a/targets/platform/storage/storage.h b/targets/platform/storage/storage.h new file mode 100644 index 000000000..0a6d962e7 --- /dev/null +++ b/targets/platform/storage/storage.h @@ -0,0 +1,3 @@ +#include "IPlatformStorage.h" + +extern IPlatformStorage& PlatformStorage; diff --git a/targets/platform/sdl2/Storage.cpp b/targets/platform/storage/stub/StubStorage.cpp similarity index 51% rename from targets/platform/sdl2/Storage.cpp rename to targets/platform/storage/stub/StubStorage.cpp index 012214a69..f93fcf86e 100644 --- a/targets/platform/sdl2/Storage.cpp +++ b/targets/platform/storage/stub/StubStorage.cpp @@ -1,4 +1,4 @@ -#include "Storage.h" +#include "StubStorage.h" #include @@ -6,187 +6,188 @@ #include #include -C4JStorage StorageManager; +StubStorage stub_storage_instance; +IPlatformStorage& PlatformStorage = stub_storage_instance; static XMARKETPLACE_CONTENTOFFER_INFO s_dummyOffer = {}; static XCONTENT_DATA s_dummyContentData = {}; -C4JStorage::C4JStorage() : m_pStringTable(nullptr) {} +StubStorage::StubStorage() : m_pStringTable(nullptr) {} -void C4JStorage::Tick(void) {} +void StubStorage::Tick(void) {} -C4JStorage::EMessageResult C4JStorage::RequestMessageBox( +StubStorage::EMessageResult StubStorage::RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int pad, - std::function callback, + std::function callback, C4JStringTable* pStringTable, wchar_t* pwchFormatString, unsigned int focusButton) { return EMessage_ResultAccept; } -C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { +StubStorage::EMessageResult StubStorage::GetMessageBoxResult() { return EMessage_Undefined; } -bool C4JStorage::SetSaveDevice(std::function callback, +bool StubStorage::SetSaveDevice(std::function callback, bool bForceResetOfSaveDevice) { return true; } -void C4JStorage::Init(unsigned int uiSaveVersion, +void StubStorage::Init(unsigned int uiSaveVersion, const wchar_t* pwchDefaultSaveName, char* pszSavePackName, int iMinimumSaveSize, std::function callback, const char* szGroupID) {} -void C4JStorage::ResetSaveData() {} -void C4JStorage::SetDefaultSaveNameForKeyboardDisplay( +void StubStorage::ResetSaveData() {} +void StubStorage::SetDefaultSaveNameForKeyboardDisplay( const wchar_t* pwchDefaultSaveName) {} -void C4JStorage::SetSaveTitle(const wchar_t* pwchDefaultSaveName) {} -bool C4JStorage::GetSaveUniqueNumber(int* piVal) { +void StubStorage::SetSaveTitle(const wchar_t* pwchDefaultSaveName) {} +bool StubStorage::GetSaveUniqueNumber(int* piVal) { if (piVal) *piVal = 0; return true; } -bool C4JStorage::GetSaveUniqueFilename(char* pszName) { +bool StubStorage::GetSaveUniqueFilename(char* pszName) { if (pszName) pszName[0] = '\0'; return true; } -void C4JStorage::SetSaveUniqueFilename(char* szFilename) {} -void C4JStorage::SetState(ESaveGameControlState eControlState, +void StubStorage::SetSaveUniqueFilename(char* szFilename) {} +void StubStorage::SetState(ESaveGameControlState eControlState, std::function callback) {} -void C4JStorage::SetSaveDisabled(bool bDisable) {} -bool C4JStorage::GetSaveDisabled(void) { return false; } -unsigned int C4JStorage::GetSaveSize() { return 0; } -void C4JStorage::GetSaveData(void* pvData, unsigned int* puiBytes) { +void StubStorage::SetSaveDisabled(bool bDisable) {} +bool StubStorage::GetSaveDisabled(void) { return false; } +unsigned int StubStorage::GetSaveSize() { return 0; } +void StubStorage::GetSaveData(void* pvData, unsigned int* puiBytes) { if (puiBytes) *puiBytes = 0; } -void* C4JStorage::AllocateSaveData(unsigned int uiBytes) { +void* StubStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); } -void C4JStorage::SetSaveImages(std::uint8_t* pbThumbnail, +void StubStorage::SetSaveImages(std::uint8_t* pbThumbnail, unsigned int thumbnailBytes, std::uint8_t* pbImage, unsigned int imageBytes, std::uint8_t* pbTextData, unsigned int textDataBytes) {} -C4JStorage::ESaveGameState C4JStorage::SaveSaveData( +StubStorage::ESaveGameState StubStorage::SaveSaveData( std::function callback) { return ESaveGame_Idle; } -void C4JStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail, +void StubStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail, unsigned int cbThumbnail, wchar_t* wchNewName, std::function callback) {} -void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} -bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } -C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool* pbExists) { +void StubStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} +bool StubStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } +StubStorage::ESaveGameState StubStorage::DoesSaveExist(bool* pbExists) { if (pbExists) *pbExists = false; return ESaveGame_Idle; } -bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; } -void C4JStorage::SetSaveMessageVPosition(float fY) {} -C4JStorage::ESaveGameState C4JStorage::GetSavesInfo( +bool StubStorage::EnoughSpaceForAMinSaveGame() { return true; } +void StubStorage::SetSaveMessageVPosition(float fY) {} +StubStorage::ESaveGameState StubStorage::GetSavesInfo( int iPad, std::function callback, char* pszSavePackName) { return ESaveGame_Idle; } -PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; } -void C4JStorage::ClearSavesInfo() {} -C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail( +PSAVE_DETAILS StubStorage::ReturnSavesInfo() { return nullptr; } +void StubStorage::ClearSavesInfo() {} +StubStorage::ESaveGameState StubStorage::LoadSaveDataThumbnail( PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } -void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex, +void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, XCONTENT_DATA& xContentData) { memset(&xContentData, 0, sizeof(xContentData)); } -void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex, +void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, std::uint8_t** ppbImageData, unsigned int* pImageBytes) { if (ppbImageData) *ppbImageData = nullptr; if (pImageBytes) *pImageBytes = 0; } -C4JStorage::ESaveGameState C4JStorage::LoadSaveData( +StubStorage::ESaveGameState StubStorage::LoadSaveData( PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } -C4JStorage::ESaveGameState C4JStorage::DeleteSaveData( +StubStorage::ESaveGameState StubStorage::DeleteSaveData( PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } -void C4JStorage::RegisterMarketplaceCountsCallback( - std::function callback) {} -void C4JStorage::SetDLCPackageRoot(char* pszDLCRoot) {} -C4JStorage::EDLCStatus C4JStorage::GetDLCOffers( +void StubStorage::RegisterMarketplaceCountsCallback( + std::function callback) {} +void StubStorage::SetDLCPackageRoot(char* pszDLCRoot) {} +StubStorage::EDLCStatus StubStorage::GetDLCOffers( int iPad, std::function callback, std::uint32_t dwOfferTypesBitmask) { return EDLC_NoOffers; } -unsigned int C4JStorage::CancelGetDLCOffers() { return 0; } -void C4JStorage::ClearDLCOffers() {} -XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(unsigned int dw) { +unsigned int StubStorage::CancelGetDLCOffers() { return 0; } +void StubStorage::ClearDLCOffers() {} +XMARKETPLACE_CONTENTOFFER_INFO& StubStorage::GetOffer(unsigned int dw) { return s_dummyOffer; } -int C4JStorage::GetOfferCount() { return 0; } -unsigned int C4JStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA, +int StubStorage::GetOfferCount() { return 0; } +unsigned int StubStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA, std::function callback, bool bTrial) { return 0; } -unsigned int C4JStorage::GetAvailableDLCCount(int iPad) { return 0; } -C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC( +unsigned int StubStorage::GetAvailableDLCCount(int iPad) { return 0; } +StubStorage::EDLCStatus StubStorage::GetInstalledDLC( int iPad, std::function callback) { if (callback) { callback(0, iPad); } return EDLC_NoInstalledDLC; } -XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) { +XCONTENT_DATA& StubStorage::GetDLC(unsigned int dw) { return s_dummyContentData; } -std::uint32_t C4JStorage::MountInstalledDLC( +std::uint32_t StubStorage::MountInstalledDLC( int iPad, std::uint32_t dwDLC, std::function callback, const char* szMountDrive) { return 0; } -unsigned int C4JStorage::UnmountInstalledDLC(const char* szMountDrive) { +unsigned int StubStorage::UnmountInstalledDLC(const char* szMountDrive) { return 0; } -void C4JStorage::GetMountedDLCFileList(const char* szMountDrive, +void StubStorage::GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList) { fileList.clear(); } -std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; } -C4JStorage::ETMSStatus C4JStorage::ReadTMSFile( +std::string StubStorage::GetMountedPath(std::string szMount) { return ""; } +StubStorage::ETMSStatus StubStorage::ReadTMSFile( int iQuadrant, eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, + StubStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, std::uint8_t** ppBuffer, unsigned int* pBufferSize, std::function callback, int iAction) { return ETMSStatus_Fail; } -bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, +bool StubStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, wchar_t* pwchFilename, std::uint8_t* pBuffer, unsigned int bufferSize) { return false; } -bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, +bool StubStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, wchar_t* pwchFilename) { return false; } -void C4JStorage::StoreTMSPathName(wchar_t* pwchName) {} -C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile( - int iPad, C4JStorage::eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, +void StubStorage::StoreTMSPathName(wchar_t* pwchName) {} +StubStorage::ETMSStatus StubStorage::TMSPP_ReadFile( + int iPad, StubStorage::eGlobalStorage eStorageFacility, + StubStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, std::function callback, int iUserData) { return ETMSStatus_Fail; } -unsigned int C4JStorage::CRC(unsigned char* buf, int len) { +unsigned int StubStorage::CRC(unsigned char* buf, int len) { unsigned int crc = 0xFFFFFFFF; for (int i = 0; i < len; i++) { crc ^= buf[i]; @@ -197,26 +198,26 @@ unsigned int C4JStorage::CRC(unsigned char* buf, int len) { return ~crc; } -int C4JStorage::AddSubfile(int regionIndex) { +int StubStorage::AddSubfile(int regionIndex) { (void)regionIndex; return 0; } -unsigned int C4JStorage::GetSubfileCount() { return 0; } -void C4JStorage::GetSubfileDetails(unsigned int i, int* regionIndex, +unsigned int StubStorage::GetSubfileCount() { return 0; } +void StubStorage::GetSubfileDetails(unsigned int i, int* regionIndex, void** data, unsigned int* size) { (void)i; if (regionIndex) *regionIndex = 0; if (data) *data = 0; if (size) *size = 0; } -void C4JStorage::ResetSubfiles() {} -void C4JStorage::UpdateSubfile(int index, void* data, unsigned int size) { +void StubStorage::ResetSubfiles() {} +void StubStorage::UpdateSubfile(int index, void* data, unsigned int size) { (void)index; (void)data; (void)size; } -void C4JStorage::SaveSubfiles(std::function callback) { +void StubStorage::SaveSubfiles(std::function callback) { if (callback) callback(true); } -C4JStorage::ESaveGameState C4JStorage::GetSaveState() { return ESaveGame_Idle; } -void C4JStorage::ContinueIncompleteOperation() {} +StubStorage::ESaveGameState StubStorage::GetSaveState() { return ESaveGame_Idle; } +void StubStorage::ContinueIncompleteOperation() {} diff --git a/targets/platform/sdl2/Storage.h b/targets/platform/storage/stub/StubStorage.h similarity index 77% rename from targets/platform/sdl2/Storage.h rename to targets/platform/storage/stub/StubStorage.h index 8599bfcf5..e654c377c 100644 --- a/targets/platform/sdl2/Storage.h +++ b/targets/platform/storage/stub/StubStorage.h @@ -12,54 +12,11 @@ class C4JStringTable; -#define MAX_DISPLAYNAME_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 -#define MAX_DETAILS_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 -#define MAX_SAVEFILENAME_LENGTH 32 // CELL_SAVEDATA_DIRNAME_SIZE - -struct CONTAINER_METADATA { - time_t modifiedTime; - unsigned int dataSize; - unsigned int thumbnailSize; -}; - -struct SAVE_INFO { - char UTF8SaveFilename[MAX_SAVEFILENAME_LENGTH]; - char UTF8SaveTitle[MAX_DISPLAYNAME_LENGTH]; - CONTAINER_METADATA metaData; - std::uint8_t* thumbnailData; -}; -using PSAVE_INFO = SAVE_INFO*; - -struct SAVE_DETAILS { - int iSaveC; - PSAVE_INFO SaveInfoA; -}; -using PSAVE_DETAILS = SAVE_DETAILS*; - typedef std::vector OfferDataArray; typedef std::vector XContentDataArray; -// typedef std::vector SaveDetailsArray; -// Current version of the dlc data creator -#define CURRENT_DLC_VERSION_NUM 3 - -class C4JStorage : public IPlatformStorage { +class StubStorage : public IPlatformStorage { public: - struct DLC_FILE_DETAILS { - unsigned int uiFileSize; - std::uint32_t dwType; - std::uint32_t dwWchCount; - wchar_t wchFile[1]; - }; - using PDLC_FILE_DETAILS = DLC_FILE_DETAILS*; - - struct DLC_FILE_PARAM { - std::uint32_t dwType; - std::uint32_t dwWchCount; - wchar_t wchData[1]; - }; - using PDLC_FILE_PARAM = DLC_FILE_PARAM*; - struct CACHEINFOSTRUCT { wchar_t wchDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH]; char szFileName[XCONTENT_MAX_FILENAME_LENGTH]; @@ -104,20 +61,20 @@ public: }; using PTMSPP_FILE_LIST = TMSPP_FILE_LIST*; - C4JStorage(); + StubStorage(); void Tick(void); // Messages - C4JStorage::EMessageResult RequestMessageBox( + StubStorage::EMessageResult RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int pad = XUSER_INDEX_ANY, - std::function callback = + std::function callback = nullptr, C4JStringTable* pStringTable = nullptr, wchar_t* pwchFormatString = nullptr, unsigned int focusButton = 0); - C4JStorage::EMessageResult GetMessageBoxResult(); + StubStorage::EMessageResult GetMessageBoxResult(); // save device bool SetSaveDevice(std::function callback, @@ -150,27 +107,27 @@ public: unsigned int textDataBytes); // Sets the thumbnail & image for the // save, optionally setting the // metadata in the png - C4JStorage::ESaveGameState SaveSaveData( + StubStorage::ESaveGameState SaveSaveData( std::function callback); void CopySaveDataToNewSave(std::uint8_t* pbThumbnail, unsigned int cbThumbnail, wchar_t* wchNewName, std::function callback); void SetSaveDeviceSelected(unsigned int uiPad, bool bSelected); bool GetSaveDeviceSelected(unsigned int iPad); - C4JStorage::ESaveGameState DoesSaveExist(bool* pbExists); + StubStorage::ESaveGameState DoesSaveExist(bool* pbExists); bool EnoughSpaceForAMinSaveGame(); void SetSaveMessageVPosition( float fY); // The 'Saving' message will display at a default position // unless changed // Get the info for the saves - C4JStorage::ESaveGameState GetSavesInfo( + StubStorage::ESaveGameState GetSavesInfo( int iPad, std::function callback, char* pszSavePackName); PSAVE_DETAILS ReturnSavesInfo(); void ClearSavesInfo(); // Clears results - C4JStorage::ESaveGameState LoadSaveDataThumbnail( + StubStorage::ESaveGameState LoadSaveDataThumbnail( PSAVE_INFO pSaveInfo, std::function @@ -184,18 +141,18 @@ public: unsigned int* pImageBytes); // Load the save. Need to call GetSaveData once the callback is called - C4JStorage::ESaveGameState LoadSaveData( + StubStorage::ESaveGameState LoadSaveData( PSAVE_INFO pSaveInfo, std::function callback); - C4JStorage::ESaveGameState DeleteSaveData( + StubStorage::ESaveGameState DeleteSaveData( PSAVE_INFO pSaveInfo, std::function callback); // DLC void RegisterMarketplaceCountsCallback( - std::function callback); + std::function callback); void SetDLCPackageRoot(char* pszDLCRoot); - C4JStorage::EDLCStatus GetDLCOffers( + StubStorage::EDLCStatus GetDLCOffers( int iPad, std::function callback, std::uint32_t dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT); unsigned int CancelGetDLCOffers(); @@ -207,7 +164,7 @@ public: bool bTrial = false); unsigned int GetAvailableDLCCount(int iPad); - C4JStorage::EDLCStatus GetInstalledDLC( + StubStorage::EDLCStatus GetInstalledDLC( int iPad, std::function callback); XCONTENT_DATA& GetDLC(unsigned int dw); std::uint32_t MountInstalledDLC( @@ -220,9 +177,9 @@ public: std::string GetMountedPath(std::string szMount); // Global title storage - C4JStorage::ETMSStatus ReadTMSFile( + StubStorage::ETMSStatus ReadTMSFile( int iQuadrant, eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, + StubStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, std::uint8_t** ppBuffer, unsigned int* pBufferSize, std::function callback = nullptr, int iAction = 0); @@ -235,18 +192,18 @@ public: // TMS++ #ifdef _XBOX - C4JStorage::ETMSStatus WriteTMSFile( - int iPad, C4JStorage::eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FileType eFileType, char* pchFilePath, char* pchBuffer, + StubStorage::ETMSStatus WriteTMSFile( + int iPad, StubStorage::eGlobalStorage eStorageFacility, + StubStorage::eTMS_FileType eFileType, char* pchFilePath, char* pchBuffer, unsigned int bufferSize, TMSCLIENT_CALLBACK Func, void* lpParam); int GetUserQuotaInfo(int iPad, TMSCLIENT_CALLBACK Func, void* lpParam); #endif // Older TMS++ write/quota entry points were kept in platform-specific // implementations and are intentionally not part of this shared API. - C4JStorage::ETMSStatus TMSPP_ReadFile( - int iPad, C4JStorage::eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, + StubStorage::ETMSStatus TMSPP_ReadFile( + int iPad, StubStorage::eGlobalStorage eStorageFacility, + StubStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, std::function callback = nullptr, int iUserData = 0); @@ -278,5 +235,3 @@ public: C4JStringTable* m_pStringTable; }; - -extern C4JStorage StorageManager;