mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-09-23 09:42:26 +00:00
split out platform/storage
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
eRunUpdateThread,
|
||||
eRenderChunkUpdateThread,
|
||||
eServerThread,
|
||||
eStorageManagerThreads,
|
||||
ePlatformStorageThreads,
|
||||
eConnectionReadThreads,
|
||||
eConnectionWriteThreads,
|
||||
eEventQueueThreads,
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "IPlatformStorage.h"
|
||||
|
||||
extern IPlatformStorage& PlatformStorage;
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Storage.h"
|
||||
#include "StubStorage.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -6,187 +6,188 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
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<int(int, const C4JStorage::EMessageResult)> callback,
|
||||
std::function<int(int, const StubStorage::EMessageResult)> 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<int(const bool)> callback,
|
||||
bool StubStorage::SetSaveDevice(std::function<int(const bool)> 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<int(const ESavingMessage, int)> 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<int(const bool)> 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<int(const bool)> 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<int(bool)> 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<int(SAVE_DETAILS* pSaveDetails, const bool)> 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<int(std::uint8_t* thumbnailData,
|
||||
unsigned int thumbnailBytes)>
|
||||
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<int(const bool, const bool)> callback) {
|
||||
return ESaveGame_Idle;
|
||||
}
|
||||
C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(
|
||||
StubStorage::ESaveGameState StubStorage::DeleteSaveData(
|
||||
PSAVE_INFO pSaveInfo,
|
||||
std::function<int(const bool)> callback) {
|
||||
return ESaveGame_Idle;
|
||||
}
|
||||
void C4JStorage::RegisterMarketplaceCountsCallback(
|
||||
std::function<int(C4JStorage::DLC_TMS_DETAILS*, int)> callback) {}
|
||||
void C4JStorage::SetDLCPackageRoot(char* pszDLCRoot) {}
|
||||
C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(
|
||||
void StubStorage::RegisterMarketplaceCountsCallback(
|
||||
std::function<int(StubStorage::DLC_TMS_DETAILS*, int)> callback) {}
|
||||
void StubStorage::SetDLCPackageRoot(char* pszDLCRoot) {}
|
||||
StubStorage::EDLCStatus StubStorage::GetDLCOffers(
|
||||
int iPad, std::function<int(int, std::uint32_t, int)> 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<int(int, int)> 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<int(int, int)> 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<int(int, std::uint32_t, std::uint32_t)> 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<std::string>& 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<int(wchar_t*, int, bool, int)> 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<int(int, int, PTMSPP_FILEDATA, const char*)> 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<int(const bool)> callback) {
|
||||
void StubStorage::SaveSubfiles(std::function<int(const bool)> 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() {}
|
||||
@@ -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<PXMARKETPLACE_CONTENTOFFER_INFO> OfferDataArray;
|
||||
typedef std::vector<PXCONTENT_DATA> XContentDataArray;
|
||||
// typedef std::vector <PSAVE_DETAILS> 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<int(int, const C4JStorage::EMessageResult)> callback =
|
||||
std::function<int(int, const StubStorage::EMessageResult)> 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<int(const bool)> 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<int(const bool)> callback);
|
||||
void CopySaveDataToNewSave(std::uint8_t* pbThumbnail,
|
||||
unsigned int cbThumbnail, wchar_t* wchNewName,
|
||||
std::function<int(bool)> 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<int(SAVE_DETAILS* pSaveDetails, const bool)> callback,
|
||||
char* pszSavePackName);
|
||||
PSAVE_DETAILS ReturnSavesInfo();
|
||||
void ClearSavesInfo(); // Clears results
|
||||
C4JStorage::ESaveGameState LoadSaveDataThumbnail(
|
||||
StubStorage::ESaveGameState LoadSaveDataThumbnail(
|
||||
PSAVE_INFO pSaveInfo,
|
||||
std::function<int(std::uint8_t* thumbnailData,
|
||||
unsigned int thumbnailBytes)>
|
||||
@@ -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<int(const bool, const bool)> callback);
|
||||
C4JStorage::ESaveGameState DeleteSaveData(
|
||||
StubStorage::ESaveGameState DeleteSaveData(
|
||||
PSAVE_INFO pSaveInfo,
|
||||
std::function<int(const bool)> callback);
|
||||
|
||||
// DLC
|
||||
void RegisterMarketplaceCountsCallback(
|
||||
std::function<int(C4JStorage::DLC_TMS_DETAILS*, int)> callback);
|
||||
std::function<int(StubStorage::DLC_TMS_DETAILS*, int)> callback);
|
||||
void SetDLCPackageRoot(char* pszDLCRoot);
|
||||
C4JStorage::EDLCStatus GetDLCOffers(
|
||||
StubStorage::EDLCStatus GetDLCOffers(
|
||||
int iPad, std::function<int(int, std::uint32_t, int)> 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<int(int, int)> 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<int(wchar_t*, int, bool, int)> 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<int(int, int, PTMSPP_FILEDATA, const char*)> callback =
|
||||
nullptr,
|
||||
int iUserData = 0);
|
||||
@@ -278,5 +235,3 @@ public:
|
||||
|
||||
C4JStringTable* m_pStringTable;
|
||||
};
|
||||
|
||||
extern C4JStorage StorageManager;
|
||||
Reference in New Issue
Block a user