Remove WinAPI byte types from 4J.Storage

This commit is contained in:
notmatthewbeshay 2026-03-16 04:34:28 +11:00
parent 73a8cf8f8e
commit 719b89c7b5
3 changed files with 42 additions and 34 deletions

View file

@ -57,15 +57,19 @@ void C4JStorage::GetSaveData(void* pvData, unsigned int* puiBytes) {
PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes) {
return malloc(uiBytes);
}
void C4JStorage::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes,
PBYTE pbImage, DWORD dwImageBytes,
PBYTE pbTextData, DWORD dwTextDataBytes) {}
void C4JStorage::SetSaveImages(std::uint8_t* pbThumbnail,
unsigned int dwThumbnailBytes,
std::uint8_t* pbImage,
unsigned int dwImageBytes,
std::uint8_t* pbTextData,
unsigned int dwTextDataBytes) {}
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int (*Func)(void*,
const bool),
void* lpParam) {
return ESaveGame_Idle;
}
void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail,
void C4JStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail,
unsigned int cbThumbnail,
WCHAR* wchNewName,
int (*Func)(void* lpParam, bool),
void* lpParam) {}
@ -153,14 +157,14 @@ void C4JStorage::GetMountedDLCFileList(const char* szMountDrive,
std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; }
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(
int iQuadrant, eGlobalStorage eStorageFacility,
C4JStorage::eTMS_FileType eFileType, WCHAR* pwchFilename, BYTE** ppBuffer,
DWORD* pdwBufferSize, int (*Func)(void*, WCHAR*, int, bool, int),
void* lpParam, int iAction) {
C4JStorage::eTMS_FileType eFileType, WCHAR* pwchFilename,
std::uint8_t** ppBuffer, unsigned int* pdwBufferSize,
int (*Func)(void*, WCHAR*, int, bool, int), void* lpParam, int iAction) {
return ETMSStatus_Fail;
}
bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
WCHAR* pwchFilename, BYTE* pBuffer,
DWORD dwBufferSize) {
WCHAR* pwchFilename, std::uint8_t* pBuffer,
unsigned int dwBufferSize) {
return false;
}
bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,

View file

@ -20,7 +20,7 @@ typedef struct {
char UTF8SaveFilename[MAX_SAVEFILENAME_LENGTH];
char UTF8SaveTitle[MAX_DISPLAYNAME_LENGTH];
CONTAINER_METADATA metaData;
PBYTE thumbnailData;
std::uint8_t* thumbnailData;
} SAVE_INFO, *PSAVE_INFO;
typedef struct {
@ -40,14 +40,14 @@ public:
// Structs defined in the DLC_Creator, but added here to be used in the app
typedef struct {
unsigned int uiFileSize;
DWORD dwType;
DWORD dwWchCount; // count of WCHAR in next array
std::uint32_t dwType;
std::uint32_t dwWchCount; // count of WCHAR in next array
WCHAR wchFile[1];
} DLC_FILE_DETAILS, *PDLC_FILE_DETAILS;
typedef struct {
DWORD dwType;
DWORD dwWchCount; // count of WCHAR in next array;
std::uint32_t dwType;
std::uint32_t dwWchCount; // count of WCHAR in next array;
WCHAR wchData[1]; // will be an array of size dwBytes
} DLC_FILE_PARAM, *PDLC_FILE_PARAM;
// End of DLC_Creator structs
@ -55,17 +55,18 @@ public:
typedef struct {
WCHAR wchDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH];
CHAR szFileName[XCONTENT_MAX_FILENAME_LENGTH];
DWORD dwImageOffset;
DWORD dwImageBytes;
std::uint32_t dwImageOffset;
std::uint32_t dwImageBytes;
} CACHEINFOSTRUCT;
// structure to hold DLC info in TMS
typedef struct {
DWORD dwVersion;
DWORD dwNewOffers;
DWORD dwTotalOffers;
DWORD dwInstalledTotalOffers;
BYTE bPadding[1024 - sizeof(DWORD) * 4]; // future expansion
std::uint32_t dwVersion;
std::uint32_t dwNewOffers;
std::uint32_t dwTotalOffers;
std::uint32_t dwInstalledTotalOffers;
std::uint8_t bPadding[1024 - sizeof(std::uint32_t) * 4];
// future expansion
} DLC_TMS_DETAILS;
enum eGTS_FileTypes { eGTS_Type_Skin = 0, eGTS_Type_Cape, eGTS_Type_MAX };
@ -188,8 +189,8 @@ public:
} TMSPP_FILE_LIST, *PTMSPP_FILE_LIST;
typedef struct {
DWORD dwSize;
PBYTE pbData;
unsigned int dwSize;
std::uint8_t* pbData;
} TMSPP_FILEDATA, *PTMSPP_FILEDATA;
C4JStorage();
@ -230,14 +231,16 @@ public:
void GetSaveData(void* pvData, unsigned int* puiBytes);
PVOID AllocateSaveData(unsigned int uiBytes);
void SetSaveImages(
PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage,
DWORD dwImageBytes, PBYTE pbTextData,
DWORD dwTextDataBytes); // Sets the thumbnail & image for the save,
// optionally setting the metadata in the png
std::uint8_t* pbThumbnail, unsigned int dwThumbnailBytes,
std::uint8_t* pbImage, unsigned int dwImageBytes,
std::uint8_t* pbTextData,
unsigned int dwTextDataBytes); // Sets the thumbnail & image for the
// save, optionally setting the
// metadata in the png
C4JStorage::ESaveGameState SaveSaveData(int (*Func)(void*, const bool),
void* lpParam);
void CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail,
WCHAR* wchNewName,
void CopySaveDataToNewSave(std::uint8_t* pbThumbnail,
unsigned int cbThumbnail, WCHAR* wchNewName,
int (*Func)(void* lpParam, bool), void* lpParam);
void SetSaveDeviceSelected(unsigned int uiPad, bool bSelected);
bool GetSaveDeviceSelected(unsigned int iPad);
@ -309,11 +312,12 @@ public:
C4JStorage::ETMSStatus ReadTMSFile(
int iQuadrant, eGlobalStorage eStorageFacility,
C4JStorage::eTMS_FileType eFileType, WCHAR* pwchFilename,
BYTE** ppBuffer, DWORD* pdwBufferSize,
std::uint8_t** ppBuffer, unsigned int* pdwBufferSize,
int (*Func)(void*, WCHAR*, int, bool, int) = NULL, void* lpParam = NULL,
int iAction = 0);
bool WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
WCHAR* pwchFilename, BYTE* pBuffer, DWORD dwBufferSize);
WCHAR* pwchFilename, std::uint8_t* pBuffer,
unsigned int dwBufferSize);
bool DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
WCHAR* pwchFilename);
void StoreTMSPathName(WCHAR* pwchName = NULL);

View file

@ -576,7 +576,7 @@ unsigned int C4JStorage::GetSaveSize() { return 0; }
void C4JStorage::GetSaveData(void *pvData,unsigned int *pulBytes) {}
PVOID C4JStorage::AllocateSaveData(unsigned int ulBytes) { return new char[ulBytes]; }
void C4JStorage::SaveSaveData(unsigned int ulBytes,PBYTE pbThumbnail,DWORD cbThumbnail,PBYTE pbTextData, DWORD dwTextLen) {}
void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam) {}
void C4JStorage::CopySaveDataToNewSave(std::uint8_t *pbThumbnail,unsigned int cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam) {}
void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad,bool bSelected) {}
bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; }
C4JStorage::ELoadGameStatus C4JStorage::DoesSaveExist(bool *pbExists) { return C4JStorage::ELoadGame_Idle; }
@ -604,8 +604,8 @@ XCONTENT_DATA& C4JStorage::GetDLC(DWORD dw) { static XCONTENT_DATA retval =
C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam) { return C4JStorage::EDLC_Idle; }
std::uint32_t C4JStorage::MountInstalledDLC(int iPad,std::uint32_t dwDLC,int( *Func)(void *, int, std::uint32_t, std::uint32_t),void *lpParam,LPCSTR szMountDrive) { return 0; }
DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive) { return 0; }
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int),LPVOID lpParam, int iAction) { return C4JStorage::ETMSStatus_Idle; }
bool C4JStorage::WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize) { return true; }
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, WCHAR *pwchFilename,std::uint8_t **ppBuffer,unsigned int *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int),LPVOID lpParam, int iAction) { return C4JStorage::ETMSStatus_Idle; }
bool C4JStorage::WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,std::uint8_t *pBuffer,unsigned int dwBufferSize) { return true; }
bool C4JStorage::DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename) { return true; }
void C4JStorage::StoreTMSPathName(WCHAR *pwchName) {}
unsigned int C4JStorage::CRC(unsigned char *buf, int len) { return 0; }