Rename misleading DWORD-style count parameters

This commit is contained in:
notmatthewbeshay 2026-03-16 05:30:42 +11:00
parent 7feae96ceb
commit 4866a895dc
8 changed files with 58 additions and 58 deletions

View file

@ -696,12 +696,12 @@ HRESULT C4JRender::LoadTextureData(const char* szFilename,
}
HRESULT C4JRender::LoadTextureData(std::uint8_t* pbData,
std::uint32_t dwBytes,
std::uint32_t byteCount,
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut) {
int width, height, channels;
unsigned char* data =
stbi_load_from_memory(pbData, dwBytes, &width, &height, &channels, 4);
stbi_load_from_memory(pbData, byteCount, &width, &height, &channels, 4);
if (!data) return E_FAIL;
HRESULT hr = LoadFromSTB(data, width, height, pSrcInfo, ppDataOut);

View file

@ -171,7 +171,7 @@ public:
void TextureDynamicUpdateEnd();
HRESULT LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo,
int** ppDataOut);
HRESULT LoadTextureData(std::uint8_t* pbData, std::uint32_t dwBytes,
HRESULT LoadTextureData(std::uint8_t* pbData, std::uint32_t byteCount,
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut);
HRESULT SaveTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo,
int* ppDataOut);

View file

@ -14,10 +14,10 @@ void C4JStorage::Tick(void) {}
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(
unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA,
unsigned int uiOptionC, unsigned int dwPad,
unsigned int uiOptionC, unsigned int pad,
int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam,
C4JStringTable* pStringTable, WCHAR* pwchFormatString,
unsigned int dwFocusButton) {
unsigned int focusButton) {
return EMessage_ResultAccept;
}
@ -59,11 +59,11 @@ PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes) {
return malloc(uiBytes);
}
void C4JStorage::SetSaveImages(std::uint8_t* pbThumbnail,
unsigned int dwThumbnailBytes,
unsigned int thumbnailBytes,
std::uint8_t* pbImage,
unsigned int dwImageBytes,
unsigned int imageBytes,
std::uint8_t* pbTextData,
unsigned int dwTextDataBytes) {}
unsigned int textDataBytes) {}
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int (*Func)(void*,
const bool),
void* lpParam) {
@ -97,15 +97,15 @@ C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(
void* lpParam) {
return ESaveGame_Idle;
}
void C4JStorage::GetSaveCacheFileInfo(unsigned int dwFile,
void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex,
XCONTENT_DATA& xContentData) {
memset(&xContentData, 0, sizeof(xContentData));
}
void C4JStorage::GetSaveCacheFileInfo(unsigned int dwFile,
void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex,
std::uint8_t** ppbImageData,
unsigned int* pdwImageBytes) {
unsigned int* pImageBytes) {
if (ppbImageData) *ppbImageData = nullptr;
if (pdwImageBytes) *pdwImageBytes = 0;
if (pImageBytes) *pImageBytes = 0;
}
C4JStorage::ESaveGameState C4JStorage::LoadSaveData(
PSAVE_INFO pSaveInfo, int (*Func)(void* lpParam, const bool, const bool),
@ -160,13 +160,13 @@ std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; }
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(
int iQuadrant, eGlobalStorage eStorageFacility,
C4JStorage::eTMS_FileType eFileType, WCHAR* pwchFilename,
std::uint8_t** ppBuffer, unsigned int* pdwBufferSize,
std::uint8_t** ppBuffer, unsigned int* pBufferSize,
int (*Func)(void*, WCHAR*, int, bool, int), void* lpParam, int iAction) {
return ETMSStatus_Fail;
}
bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
WCHAR* pwchFilename, std::uint8_t* pBuffer,
unsigned int dwBufferSize) {
unsigned int bufferSize) {
return false;
}
bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,

View file

@ -189,7 +189,7 @@ public:
} TMSPP_FILE_LIST, *PTMSPP_FILE_LIST;
typedef struct {
unsigned int dwSize;
unsigned int size;
std::uint8_t* pbData;
} TMSPP_FILEDATA, *PTMSPP_FILEDATA;
@ -200,10 +200,10 @@ public:
// Messages
C4JStorage::EMessageResult RequestMessageBox(
unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA,
unsigned int uiOptionC, unsigned int dwPad = XUSER_INDEX_ANY,
unsigned int uiOptionC, unsigned int pad = XUSER_INDEX_ANY,
int (*Func)(void*, int, const C4JStorage::EMessageResult) = NULL,
void* lpParam = NULL, C4JStringTable* pStringTable = NULL,
WCHAR* pwchFormatString = NULL, unsigned int dwFocusButton = 0);
WCHAR* pwchFormatString = NULL, unsigned int focusButton = 0);
C4JStorage::EMessageResult GetMessageBoxResult();
@ -231,10 +231,10 @@ public:
void GetSaveData(void* pvData, unsigned int* puiBytes);
PVOID AllocateSaveData(unsigned int uiBytes);
void SetSaveImages(
std::uint8_t* pbThumbnail, unsigned int dwThumbnailBytes,
std::uint8_t* pbImage, unsigned int dwImageBytes,
std::uint8_t* pbThumbnail, unsigned int thumbnailBytes,
std::uint8_t* pbImage, unsigned int imageBytes,
std::uint8_t* pbTextData,
unsigned int dwTextDataBytes); // Sets the thumbnail & image for the
unsigned int textDataBytes); // Sets the thumbnail & image for the
// save, optionally setting the
// metadata in the png
C4JStorage::ESaveGameState SaveSaveData(int (*Func)(void*, const bool),
@ -264,10 +264,10 @@ public:
void* lpParam); // Get the thumbnail for an individual save referenced
// by pSaveInfo
void GetSaveCacheFileInfo(unsigned int dwFile, XCONTENT_DATA& xContentData);
void GetSaveCacheFileInfo(unsigned int dwFile,
void GetSaveCacheFileInfo(unsigned int fileIndex, XCONTENT_DATA& xContentData);
void GetSaveCacheFileInfo(unsigned int fileIndex,
std::uint8_t** ppbImageData,
unsigned int* pdwImageBytes);
unsigned int* pImageBytes);
// Load the save. Need to call GetSaveData once the callback is called
C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo,
@ -314,12 +314,12 @@ public:
C4JStorage::ETMSStatus ReadTMSFile(
int iQuadrant, eGlobalStorage eStorageFacility,
C4JStorage::eTMS_FileType eFileType, WCHAR* pwchFilename,
std::uint8_t** ppBuffer, unsigned int* pdwBufferSize,
std::uint8_t** ppBuffer, unsigned int* pBufferSize,
int (*Func)(void*, WCHAR*, int, bool, int) = NULL, void* lpParam = NULL,
int iAction = 0);
bool WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
WCHAR* pwchFilename, std::uint8_t* pBuffer,
unsigned int dwBufferSize);
unsigned int bufferSize);
bool DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
WCHAR* pwchFilename);
void StoreTMSPathName(WCHAR* pwchName = NULL);
@ -329,7 +329,7 @@ public:
C4JStorage::ETMSStatus WriteTMSFile(
int iPad, C4JStorage::eGlobalStorage eStorageFacility,
C4JStorage::eTMS_FileType eFileType, CHAR* pchFilePath, CHAR* pchBuffer,
unsigned int dwBufferSize, TMSCLIENT_CALLBACK Func, LPVOID lpParam);
unsigned int bufferSize, TMSCLIENT_CALLBACK Func, LPVOID lpParam);
HRESULT GetUserQuotaInfo(int iPad, TMSCLIENT_CALLBACK Func, LPVOID lpParam);
#endif

View file

@ -16,7 +16,7 @@ TMS_FILE;
typedef struct
{
std::uint8_t *pbData;
unsigned int dwBytes;
unsigned int byteCount;
std::uint8_t ucRefCount;
}
MEMDATA,*PMEMDATA;
@ -197,7 +197,7 @@ FEATURE_DATA;
typedef struct
{
std::uint8_t *pBannedList;
unsigned int dwBytes;
unsigned int byteCount;
}
BANNEDLIST;

View file

@ -5319,7 +5319,7 @@ bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid)
return false;
}
void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int dwBytes)
void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int byteCount)
{
EnterCriticalSection(&csMemFilesLock);
// check it's not already in
@ -5332,13 +5332,13 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName, std::uint8_t
#endif
pData = (*it).second;
if(pData->dwBytes == 0 && dwBytes != 0)
if(pData->byteCount == 0 && byteCount != 0)
{
// This should never be NULL if dwBytes is 0
// This should never be NULL if byteCount is 0
if(pData->pbData!=NULL) delete [] pData->pbData;
pData->pbData=pbData;
pData->dwBytes=dwBytes;
pData->byteCount=byteCount;
}
++pData->ucRefCount;
@ -5355,7 +5355,7 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring &wName, std::uint8_t
pData = new MEMDATA();
pData->pbData=pbData;
pData->dwBytes=dwBytes;
pData->byteCount=byteCount;
pData->ucRefCount = 1;
// use the xuid to access the skin data
@ -5413,7 +5413,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const std::wstring &wName)
return val;
}
void CMinecraftApp::GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pdwBytes)
void CMinecraftApp::GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pByteCount)
{
EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName));
@ -5421,12 +5421,12 @@ void CMinecraftApp::GetMemFileDetails(const std::wstring &wName, std::uint8_t **
{
PMEMDATA pData = (*it).second;
*ppbData=pData->pbData;
*pdwBytes=pData->dwBytes;
*pByteCount=pData->byteCount;
}
LeaveCriticalSection(&csMemFilesLock);
}
void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int dwBytes)
void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int byteCount)
{
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
@ -5436,7 +5436,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned
{
pData = new MEMDATA();
pData->pbData=pbData;
pData->dwBytes=dwBytes;
pData->byteCount=byteCount;
pData->ucRefCount = 1;
m_MEM_TPD[iConfig]=pData;
@ -5514,7 +5514,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
return val;
}
void CMinecraftApp::GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pdwBytes)
void CMinecraftApp::GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pByteCount)
{
EnterCriticalSection(&csMemTPDLock);
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
@ -5522,7 +5522,7 @@ void CMinecraftApp::GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pd
{
PMEMDATA pData = (*it).second;
*ppbData=pData->pbData;
*pdwBytes=pData->dwBytes;
*pByteCount=pData->byteCount;
}
LeaveCriticalSection(&csMemTPDLock);
}
@ -8332,14 +8332,14 @@ int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStor
case e_DLC_TexturePackData:
{
// 4J-PB - we need to allocate memory for the file data and copy into it, since the current data is a reference into the blob download memory
std::uint8_t *pbData = new std::uint8_t[pFileData->dwSize];
memcpy(pbData,pFileData->pbData,pFileData->dwSize);
std::uint8_t *pbData = new std::uint8_t[pFileData->size];
memcpy(pbData,pFileData->pbData,pFileData->size);
pClass->m_vTMSPPData.push_back(pbData);
app.DebugPrintf("Got texturepack data\n");
// get the config value for the texture pack
int iConfig=app.GetTPConfigVal(pCurrent->wchFilename);
app.AddMemoryTPDFile(iConfig, pbData, pFileData->dwSize);
app.AddMemoryTPDFile(iConfig, pbData, pFileData->size);
}
break;
default:
@ -8347,12 +8347,12 @@ int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStor
if(pFileData->pbData[0]==0x89)
{
// 4J-PB - we need to allocate memory for the file data and copy into it, since the current data is a reference into the blob download memory
std::uint8_t *pbData = new std::uint8_t[pFileData->dwSize];
memcpy(pbData,pFileData->pbData,pFileData->dwSize);
std::uint8_t *pbData = new std::uint8_t[pFileData->size];
memcpy(pbData,pFileData->pbData,pFileData->size);
pClass->m_vTMSPPData.push_back(pbData);
app.DebugPrintf("Got image data - %ls\n",pCurrent->wchFilename);
app.AddMemoryTextureFile(pCurrent->wchFilename, pbData, pFileData->dwSize);
app.AddMemoryTextureFile(pCurrent->wchFilename, pbData, pFileData->size);
}
else
{
@ -8369,12 +8369,12 @@ int CMinecraftApp::TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStor
app.DebugPrintf("--- Got texturepack data %ls\n",pCurrent->wchFilename);
// get the config value for the texture pack
int iConfig=app.GetTPConfigVal(pCurrent->wchFilename);
app.AddMemoryTPDFile(iConfig, pFileData->pbData, pFileData->dwSize);
app.AddMemoryTPDFile(iConfig, pFileData->pbData, pFileData->size);
}
break;
default:
app.DebugPrintf("--- Got image data - %ls\n",pCurrent->wchFilename);
app.AddMemoryTextureFile(pCurrent->wchFilename, pFileData->pbData, pFileData->dwSize);
app.AddMemoryTextureFile(pCurrent->wchFilename, pFileData->pbData, pFileData->size);
break;
}
#endif

View file

@ -341,16 +341,16 @@ public:
bool isXuidNotch(PlayerUID xuid);
bool isXuidDeadmau5(PlayerUID xuid);
void AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int dwBytes);
void AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int byteCount);
void RemoveMemoryTextureFile(const std::wstring &wName);
void GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pdwBytes);
void GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pByteCount);
bool IsFileInMemoryTextures(const std::wstring &wName);
// Texture Pack Data files (icon, banner, comparison shot & text)
void AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int dwBytes);
void AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int byteCount);
void RemoveMemoryTPDFile(int iConfig);
bool IsFileInTPD(int iConfig);
void GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pdwBytes);
void GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pByteCount);
int GetTPDSize() {return m_MEM_TPD.size();}
#ifndef __PS3__
int GetTPConfigVal(WCHAR *pwchDataFile);
@ -839,12 +839,12 @@ public:
bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];}
void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;}
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;}
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].byteCount=0;}
std::uint32_t GetRequiredTexturePackID() { return m_dwRequiredTexturePackID; }
void SetRequiredTexturePackID(std::uint32_t texturePackId) { m_dwRequiredTexturePackID = texturePackId; }
virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int dwBytes, std::uint8_t **ppbData, unsigned int *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;}
virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int byteCount, std::uint8_t **ppbData, unsigned int *pByteCount ) {*ppbData = NULL; *pByteCount = 0;}
//XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; }

View file

@ -558,7 +558,7 @@ void C_4JProfile::ShowProfileCard(int iPad, PlayerUID targetUid) {}
#if defined(__linux__)
C4JStorage::C4JStorage() {}
void C4JStorage::Tick() {}
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA,unsigned int uiOptionC, unsigned int dwPad, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, C4JStringTable *pStringTable, WCHAR *pwchFormatString,unsigned int dwFocusButton) { return C4JStorage::EMessage_Undefined; }
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA,unsigned int uiOptionC, unsigned int pad, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, C4JStringTable *pStringTable, WCHAR *pwchFormatString,unsigned int focusButton) { return C4JStorage::EMessage_Undefined; }
C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { return C4JStorage::EMessage_Undefined; }
bool C4JStorage::SetSaveDevice(int( *Func)(LPVOID,const bool),LPVOID lpParam, bool bForceResetOfSaveDevice) { return true; }
void C4JStorage::Init(LPCWSTR pwchDefaultSaveName,char *pszSavePackName,int iMinimumSaveSize, int( *Func)(LPVOID, const ESavingMessage, int),LPVOID lpParam) {}
@ -585,8 +585,8 @@ void C4JStorage::SetSaveMessageVPosition(float fY) {}
//C4JStorage::ESGIStatus C4JStorage::GetSavesInfo(int iPad,bool ( *Func)(LPVOID, int, CACHEINFOSTRUCT *, int, HRESULT),LPVOID lpParam,char *pszSavePackName) { return C4JStorage::ESGIStatus_Idle; }
C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName) { return C4JStorage::ESaveGame_Idle; }
void C4JStorage::GetSaveCacheFileInfo(unsigned int dwFile,XCONTENT_DATA &xContentData) {}
void C4JStorage::GetSaveCacheFileInfo(unsigned int dwFile, std::uint8_t * *ppbImageData, unsigned int *pdwImageBytes) {}
void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex,XCONTENT_DATA &xContentData) {}
void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex, std::uint8_t * *ppbImageData, unsigned int *pImageBytes) {}
C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,const bool, const bool), LPVOID lpParam) {return C4JStorage::ESaveGame_Idle;}
C4JStorage::EDeleteGameStatus C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,const bool), LPVOID lpParam) { return C4JStorage::EDeleteGame_Idle; }
PSAVE_DETAILS C4JStorage::ReturnSavesInfo() {return NULL;}
@ -604,8 +604,8 @@ XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) { static XCONTENT_DATA r
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; }
unsigned int C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive) { return 0; }
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; }
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, WCHAR *pwchFilename,std::uint8_t **ppBuffer,unsigned int *pBufferSize,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 bufferSize) { 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; }