ESaveGame_GetSaveThumbnail,// Not used as an actual state in the PS4, but the game expects this to be returned to indicate success when getting a thumbnail
ESaveGame_GetSaveInfo,
ESaveGame_SaveCache,
ESaveGame_ReconstructCache
};
enumEOptionsState
{
EOptions_Idle=0,
EOptions_Save,
EOptions_Load,
EOptions_Delete,
EOptions_NoSpace,
EOptions_Corrupt,
};
enumESaveGameStatus
{
EDeleteGame_Idle=0,
EDeleteGame_InProgress,
};
enumEDLCStatus
{
EDLC_Error=0,
EDLC_Idle,
EDLC_NoOffers,
EDLC_AlreadyEnumeratedAllOffers,
EDLC_NoInstalledDLC,
EDLC_Pending,
EDLC_LoadInProgress,
EDLC_Loaded,
EDLC_ChangedDevice
};
enumESavingMessage
{
ESavingMessage_None=0,
ESavingMessage_Short,
ESavingMessage_Long
};
enumESaveIncompleteType
{
ESaveIncomplete_None,
ESaveIncomplete_OutOfQuota,
ESaveIncomplete_OutOfLocalStorage,
ESaveIncomplete_Unknown
};
enumETMSStatus
{
ETMSStatus_Idle=0,
ETMSStatus_Fail,
ETMSStatus_ReadInProgress,
ETMSStatus_ReadFileListInProgress,
ETMSStatus_WriteInProgress,
ETMSStatus_Fail_ReadInProgress,
ETMSStatus_Fail_ReadFileListInProgress,
ETMSStatus_Fail_ReadDetailsNotRetrieved,
ETMSStatus_Fail_WriteInProgress,
ETMSStatus_DeleteInProgress,
ETMSStatus_Pending,
};
enumeTMS_FileType
{
eTMS_FileType_Normal=0,
eTMS_FileType_Graphic,
};
enumESGIStatus
{
ESGIStatus_Error=0,
ESGIStatus_Idle,
ESGIStatus_ReadInProgress,
ESGIStatus_NoSaves,
};
enum
{
PROFILE_READTYPE_ALL,
PROFILE_READTYPE_XBOXSETTINGS// just read the settings (after a notification of settings change)
};
enumeOptionsCallback
{
eOptions_Callback_Idle,
eOptions_Callback_Write,
eOptions_Callback_Write_Fail_NoSpace,
eOptions_Callback_Write_Fail,
eOptions_Callback_Read,
eOptions_Callback_Read_Fail,
eOptions_Callback_Read_FileNotFound,
eOptions_Callback_Read_Corrupt,
eOptions_Callback_Read_CorruptDeletePending,
eOptions_Callback_Read_CorruptDeleted
};
///////////////////////////////////////////////////////////////////////////// Global storage manager //////////////////////////////////////////////////////////////////////////////
C4JStorage();
voidTick(void);// General storage manager tick to be called from game
///////////////////////////////////////////////////////////////////////////// Savegame data ///////////////////////////////////////////////////////////////////////////////////////
// Initialisation
voidInit(unsignedintuiSaveVersion,LPCWSTRpwchDefaultSaveName,char*pszSavePackName,intiMinimumSaveSize,// General manager initialisation
voidSetGameSaveFolderTitle(WCHAR*wszGameSaveFolderTitle);// Sets the title to be set in the param.sfo of saves (this doesn't vary, the sub-title is used for the user cho
voidSetSaveCacheFolderTitle(WCHAR*wszSaveCacheFolderTitle);// Sets the title to be set in the param.sfo of the save cache
voidSetOptionsFolderTitle(WCHAR*wszOptionsFolderTitle);// Sets the title to be set in the param.sfo of the options file
voidSetGameSaveFolderPrefix(char*szGameSaveFolderPrefix);// Sets the prefix to be added to the unique filename of each save to construct a final folder name
voidSetMaxSaves(intiMaxC);// Sets the maximum number of saves to be evaluated by GetSavesInfo etc.
voidSetDefaultImages(PBYTEpbOptionsImage,DWORDdwOptionsImageBytes,PBYTEpbSaveImage,DWORDdwSaveImageBytes,// Sets default save image and thumbnail, which can be used when saving a game that hasn't generated any yet
PBYTEpbSaveThumbnail,DWORDdwSaveThumbnailBytes);
voidSetIncompleteSaveCallback(void(*Func)(LPVOID,constESaveIncompleteType,intblocksRequired),LPVOIDparam);// Sets callback to be used in the event of a save method not being able to complete
// Miscellaneous control
voidSetSaveDisabled(boolbDisable);// Sets saving disabled/enabled state
boolGetSaveDisabled(void);// Determines whether saving has been disabled
voidResetSaveData();// Releases any internal storage being held for previously saved/loaded data
C4JStorage::ESaveGameStateDoesSaveExist(bool*pbExists);// Determine if current savegame exists on storage device
PSAVE_DETAILSReturnSavesInfo();// Returns result of search (or NULL if not yet received)
voidClearSavesInfo();// Clears results
C4JStorage::ESaveGameStateLoadSaveDataThumbnail(PSAVE_INFOpSaveInfo,int(*Func)(LPVOIDlpParam,PBYTEpbThumbnail,DWORDdwThumbnailBytes),LPVOIDlpParam);// Get the thumbnail for an individual save referenced by pSaveInfo
// Loading savedata & obtaining information from just-loaded file
C4JStorage::ESaveGameStateLoadSaveData(PSAVE_INFOpSaveInfo,int(*Func)(LPVOIDlpParam,constbool,constbool),LPVOIDlpParam);// Loads savedata referenced by pSaveInfo, calls callback once complete
unsignedintGetSaveSize();// Obtains sizse of just-loaded save
voidGetSaveData(void*pvData,unsignedint*puiBytes);// Obtains pointer to, and size, of just-loaded save
boolGetSaveUniqueNumber(INT*piVal);// Gets the unique numeric portion of the folder name used for the save (encodes m
boolGetSaveUniqueFilename(char*pszName);// Get the full unique "filename" used as part of the folder name for the save
boolGetSaveUniqueFileDir(char*pszName);// Get the full unique "filename" used as part of the folder name for the save
// Saving savedata
voidSetSaveTitle(constwchar_t*UTF16String);// Sets the name which is used as a sub-title in the savedata param.sfo
PVOIDAllocateSaveData(unsignedintuiBytes);// Allocate storage manager owned memory to the data which is to be saved to
voidSetSaveDataSize(unsignedintuiBytes);// Set the actual size of data to be saved
voidGetDefaultSaveImage(PBYTE*ppbSaveImage,DWORD*pdwSaveImageBytes);// Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t
voidGetDefaultSaveThumbnail(PBYTE*ppbSaveThumbnail,DWORD*pdwSaveThumbnailBytes);// Get the default save image (as set by SetDefaultImages) for use on saving games that
voidSetSaveImages(PBYTEpbThumbnail,DWORDdwThumbnailBytes,PBYTEpbImage,DWORDdwImageBytes,PBYTEpbTextData,DWORDdwTextDataBytes);// Sets the thumbnail & image for the save, optionally setting the metadata in the png
C4JStorage::ESaveGameStateSaveSaveData(int(*Func)(LPVOID,constbool),LPVOIDlpParam);// Save the actual data, calling callback on completion
// Handling of incomplete saves (either sub-files or save data). To be used after game has had callback for an incomplete save event
voidContinueIncompleteOperation();
voidCancelIncompleteOperation();
ESaveIncompleteTypeGetSaveError();// Returns the save error [SaveData]
voidClearSaveError();// Clears any save error
ESaveIncompleteTypeGetOptionsSaveError();// Returns the save error [Options]
voidClearOptionsSaveError();// Clears any save error
// Other file operations
C4JStorage::ESaveGameStateDeleteSaveData(PSAVE_INFOpSaveInfo,int(*Func)(LPVOIDlpParam,constbool),LPVOIDlpParam);// Deletes savedata referenced by pSaveInfo, calls callback when comple
C4JStorage::ESaveGameStateRenameSaveData(intiRenameIndex,uint16_t*pui16NewName,int(*Func)(LPVOIDlpParam,constbool),LPVOIDlpParam);// Renamed savedata with index from last established ReturnSavesInfo.
voidSetSaveUniqueFilename(char*szFilename);// MGH - made this public, used for the cross save stuff
voidEnableDownloadSave();// CD - Used for cross/download-save, sets a flag for saving
///////////////////////////////////////////////////////////////////////////// Profile data ////////////////////////////////////////////////////////////////////////////////////////
public:
// Initialisation
voidInitialiseProfileData(unsignedshortusProfileVersion,UINTuiProfileValuesC,UINTuiProfileSettingsC,DWORD*pdwProfileSettingsA,intiGameDefinedDataSizeX4,unsignedint*puiGameDefinedDataChangedBitmask);// General initialisation
intSetDefaultOptionsCallback(int(*Func)(LPVOID,PROFILESETTINGS*,constintiPad),LPVOIDlpParam);// Set a callback that can initialise a profile's storage to its default settings
voidSetOptionsDataCallback(int(*Func)(LPVOID,intiPad,unsignedshortusVersion,C4JStorage::eOptionsCallback),LPVOIDlpParam);// Sets callback that is called when status of any options has changed
PROFILESETTINGS*GetDashboardProfileSettings(intiPad);// Get pointer to the standard (originally xbox dashboard) profile data for one user
void*GetGameDefinedProfileData(intiQuadrant);// Get pointer to the game-defined profile data for one user
// Reading and writing profiles
voidReadFromProfile(intiQuadrant,intiReadType=PROFILE_READTYPE_ALL);// Initiate read profile data for one user - read type is ignored on this platform
voidWriteToProfile(intiQuadrant,boolbGameDefinedDataChanged=false,boolbOverride5MinuteLimitOnProfileWrites=false);// Initiate write profile for one user
voidDeleteOptionsData(intiPad);// Delete profile data for one user
voidForceQueuedProfileWrites(intiPad=XUSER_INDEX_ANY);// Force any queued profile writes to write now