Remove Win32 byte pointers from DLC file interfaces

This commit is contained in:
notmatthewbeshay 2026-03-10 00:17:57 +11:00
parent b02bcd27f5
commit 66538b67f2
19 changed files with 57 additions and 56 deletions

View file

@ -12,7 +12,7 @@ DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLC
m_dwBytes = 0; m_dwBytes = 0;
} }
void DLCAudioFile::addData(PBYTE pbData, DWORD dwBytes) void DLCAudioFile::addData(uint8_t *pbData, DWORD dwBytes)
{ {
m_pbData = pbData; m_pbData = pbData;
m_dwBytes = dwBytes; m_dwBytes = dwBytes;
@ -20,7 +20,7 @@ void DLCAudioFile::addData(PBYTE pbData, DWORD dwBytes)
processDLCDataFile(pbData,dwBytes); processDLCDataFile(pbData,dwBytes);
} }
PBYTE DLCAudioFile::getData(DWORD &dwBytes) uint8_t *DLCAudioFile::getData(DWORD &dwBytes)
{ {
dwBytes = m_dwBytes; dwBytes = m_dwBytes;
return m_pbData; return m_pbData;
@ -120,7 +120,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
} }
} }
bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) bool DLCAudioFile::processDLCDataFile(uint8_t *pbData, DWORD dwLength)
{ {
std::unordered_map<int, EAudioParameterType> parameterMapping; std::unordered_map<int, EAudioParameterType> parameterMapping;
unsigned int uiCurrentByte=0; unsigned int uiCurrentByte=0;
@ -164,7 +164,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
dwTemp+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR); dwTemp+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR);
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp];
} }
PBYTE pbTemp=((PBYTE )pFile); uint8_t *pbTemp = reinterpret_cast<uint8_t *>(pFile);
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
for(unsigned int i=0;i<uiFileCount;i++) for(unsigned int i=0;i<uiFileCount;i++)
@ -213,4 +213,4 @@ std::wstring &DLCAudioFile::GetSoundName(int iIndex)
iWorldType++; iWorldType++;
} }
return m_parameters[iWorldType].at(iIndex); return m_parameters[iWorldType].at(iIndex);
} }

View file

@ -32,17 +32,17 @@ public:
DLCAudioFile(const std::wstring &path); DLCAudioFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(uint8_t *pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes); virtual uint8_t *getData(DWORD &dwBytes);
bool processDLCDataFile(PBYTE pbData, DWORD dwLength); bool processDLCDataFile(uint8_t *pbData, DWORD dwLength);
int GetCountofType(DLCAudioFile::EAudioType ptype); int GetCountofType(DLCAudioFile::EAudioType ptype);
std::wstring &GetSoundName(int iIndex); std::wstring &GetSoundName(int iIndex);
private: private:
using DLCFile::addParameter; using DLCFile::addParameter;
PBYTE m_pbData; uint8_t *m_pbData;
DWORD m_dwBytes; DWORD m_dwBytes;
static const int CURRENT_AUDIO_VERSION_NUM=1; static const int CURRENT_AUDIO_VERSION_NUM=1;
//std::unordered_map<int, std::wstring> m_parameters; //std::unordered_map<int, std::wstring> m_parameters;

View file

@ -6,7 +6,7 @@ DLCCapeFile::DLCCapeFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy
{ {
} }
void DLCCapeFile::addData(PBYTE pbData, DWORD dwBytes) void DLCCapeFile::addData(uint8_t *pbData, DWORD dwBytes)
{ {
app.AddMemoryTextureFile(m_path,pbData,dwBytes); app.AddMemoryTextureFile(m_path,pbData,dwBytes);
} }

View file

@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile
public: public:
DLCCapeFile(const std::wstring &path); DLCCapeFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(uint8_t *pbData, DWORD dwBytes);
}; };

View file

@ -19,8 +19,8 @@ DLCColourTableFile::~DLCColourTableFile()
} }
} }
void DLCColourTableFile::addData(PBYTE pbData, DWORD dwBytes) void DLCColourTableFile::addData(uint8_t *pbData, DWORD dwBytes)
{ {
ColourTable *defaultColourTable = Minecraft::GetInstance()->skins->getDefault()->getColourTable(); ColourTable *defaultColourTable = Minecraft::GetInstance()->skins->getDefault()->getColourTable();
m_colourTable = new ColourTable(defaultColourTable, pbData, dwBytes); m_colourTable = new ColourTable(defaultColourTable, pbData, dwBytes);
} }

View file

@ -12,7 +12,7 @@ public:
DLCColourTableFile(const std::wstring &path); DLCColourTableFile(const std::wstring &path);
~DLCColourTableFile(); ~DLCColourTableFile();
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(uint8_t *pbData, DWORD dwBytes);
ColourTable *getColourTable() { return m_colourTable; } ColourTable *getColourTable() { return m_colourTable; }
}; };

View file

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
#include "DLCManager.h" #include "DLCManager.h"
class DLCFile class DLCFile
@ -16,10 +17,10 @@ public:
std::wstring getPath() { return m_path; } std::wstring getPath() { return m_path; }
DWORD getSkinID() { return m_dwSkinId; } DWORD getSkinID() { return m_dwSkinId; }
virtual void addData(PBYTE pbData, DWORD dwBytes) {} virtual void addData(uint8_t *pbData, DWORD dwBytes) {}
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; } virtual uint8_t *getData(DWORD &dwBytes) { dwBytes = 0; return NULL; }
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {} virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {}
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; }
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;} virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;}
}; };

View file

@ -8,14 +8,14 @@ DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCM
m_dwBytes = 0; m_dwBytes = 0;
} }
void DLCGameRulesFile::addData(PBYTE pbData, DWORD dwBytes) void DLCGameRulesFile::addData(uint8_t *pbData, DWORD dwBytes)
{ {
m_pbData = pbData; m_pbData = pbData;
m_dwBytes = dwBytes; m_dwBytes = dwBytes;
} }
PBYTE DLCGameRulesFile::getData(DWORD &dwBytes) uint8_t *DLCGameRulesFile::getData(DWORD &dwBytes)
{ {
dwBytes = m_dwBytes; dwBytes = m_dwBytes;
return m_pbData; return m_pbData;
} }

View file

@ -4,12 +4,12 @@
class DLCGameRulesFile : public DLCGameRules class DLCGameRulesFile : public DLCGameRules
{ {
private: private:
PBYTE m_pbData; uint8_t *m_pbData;
DWORD m_dwBytes; DWORD m_dwBytes;
public: public:
DLCGameRulesFile(const std::wstring &path); DLCGameRulesFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(uint8_t *pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes); virtual uint8_t *getData(DWORD &dwBytes);
}; };

View file

@ -21,7 +21,7 @@ DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(
lgo = NULL; lgo = NULL;
} }
void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) void DLCGameRulesHeader::addData(uint8_t *pbData, DWORD dwBytes)
{ {
m_pbData = pbData; m_pbData = pbData;
m_dwBytes = dwBytes; m_dwBytes = dwBytes;
@ -73,13 +73,13 @@ void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
#endif #endif
} }
PBYTE DLCGameRulesHeader::getData(DWORD &dwBytes) uint8_t *DLCGameRulesHeader::getData(DWORD &dwBytes)
{ {
dwBytes = m_dwBytes; dwBytes = m_dwBytes;
return m_pbData; return m_pbData;
} }
void DLCGameRulesHeader::setGrfData(PBYTE fData, DWORD fSize, StringTable *st) void DLCGameRulesHeader::setGrfData(uint8_t *fData, DWORD fSize, StringTable *st)
{ {
if (!m_hasData) if (!m_hasData)
{ {
@ -89,4 +89,4 @@ void DLCGameRulesHeader::setGrfData(PBYTE fData, DWORD fSize, StringTable *st)
app.m_gameRules.readRuleFile(lgo, fData, fSize, st); app.m_gameRules.readRuleFile(lgo, fData, fSize, st);
} }
} }

View file

@ -8,7 +8,7 @@ class DLCGameRulesHeader : public DLCGameRules, public JustGrSource
private: private:
// GR-Header // GR-Header
PBYTE m_pbData; uint8_t *m_pbData;
DWORD m_dwBytes; DWORD m_dwBytes;
bool m_hasData; bool m_hasData;
@ -33,10 +33,10 @@ public:
public: public:
DLCGameRulesHeader(const std::wstring &path); DLCGameRulesHeader(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(uint8_t *pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes); virtual uint8_t *getData(DWORD &dwBytes);
void setGrfData(PBYTE fData, DWORD fSize, StringTable *); void setGrfData(uint8_t *fData, DWORD fSize, StringTable *);
virtual bool ready() { return m_hasData; } virtual bool ready() { return m_hasData; }
}; };

View file

@ -8,7 +8,7 @@ DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLC
m_strings = NULL; m_strings = NULL;
} }
void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes) void DLCLocalisationFile::addData(uint8_t *pbData, DWORD dwBytes)
{ {
m_strings = new StringTable(pbData, dwBytes); m_strings = new StringTable(pbData, dwBytes);
} }

View file

@ -10,9 +10,9 @@ private:
public: public:
DLCLocalisationFile(const std::wstring &path); DLCLocalisationFile(const std::wstring &path);
DLCLocalisationFile(PBYTE pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++ DLCLocalisationFile(uint8_t *pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(uint8_t *pbData, DWORD dwBytes);
StringTable *getStringTable() { return m_strings; } StringTable *getStringTable() { return m_strings; }
}; };

View file

@ -16,7 +16,7 @@ DLCSkinFile::DLCSkinFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy
m_uiAnimOverrideBitmask=0L; m_uiAnimOverrideBitmask=0L;
} }
void DLCSkinFile::addData(PBYTE pbData, DWORD dwBytes) void DLCSkinFile::addData(uint8_t *pbData, DWORD dwBytes)
{ {
app.AddMemoryTextureFile(m_path,pbData,dwBytes); app.AddMemoryTextureFile(m_path,pbData,dwBytes);
} }

View file

@ -17,7 +17,7 @@ public:
DLCSkinFile(const std::wstring &path); DLCSkinFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(uint8_t *pbData, DWORD dwBytes);
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type);

View file

@ -11,14 +11,14 @@ DLCTextureFile::DLCTextureFile(const std::wstring &path) : DLCFile(DLCManager::e
m_dwBytes = 0; m_dwBytes = 0;
} }
void DLCTextureFile::addData(PBYTE pbData, DWORD dwBytes) void DLCTextureFile::addData(uint8_t *pbData, DWORD dwBytes)
{ {
//app.AddMemoryTextureFile(m_path,pbData,dwBytes); //app.AddMemoryTextureFile(m_path,pbData,dwBytes);
m_pbData = pbData; m_pbData = pbData;
m_dwBytes = dwBytes; m_dwBytes = dwBytes;
} }
PBYTE DLCTextureFile::getData(DWORD &dwBytes) uint8_t *DLCTextureFile::getData(DWORD &dwBytes)
{ {
dwBytes = m_dwBytes; dwBytes = m_dwBytes;
return m_pbData; return m_pbData;
@ -56,4 +56,4 @@ bool DLCTextureFile::getParameterAsBool(DLCManager::EDLCParameterType type)
default: default:
return false; return false;
} }
} }

View file

@ -8,17 +8,17 @@ private:
bool m_bIsAnim; bool m_bIsAnim;
std::wstring m_animString; std::wstring m_animString;
PBYTE m_pbData; uint8_t *m_pbData;
DWORD m_dwBytes; DWORD m_dwBytes;
public: public:
DLCTextureFile(const std::wstring &path); DLCTextureFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(uint8_t *pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes); virtual uint8_t *getData(DWORD &dwBytes);
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type);
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
}; };

View file

@ -18,15 +18,15 @@ DLCUIDataFile::~DLCUIDataFile()
} }
} }
void DLCUIDataFile::addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData) void DLCUIDataFile::addData(uint8_t *pbData, DWORD dwBytes,bool canDeleteData)
{ {
m_pbData = pbData; m_pbData = pbData;
m_dwBytes = dwBytes; m_dwBytes = dwBytes;
m_canDeleteData = canDeleteData; m_canDeleteData = canDeleteData;
} }
PBYTE DLCUIDataFile::getData(DWORD &dwBytes) uint8_t *DLCUIDataFile::getData(DWORD &dwBytes)
{ {
dwBytes = m_dwBytes; dwBytes = m_dwBytes;
return m_pbData; return m_pbData;
} }

View file

@ -4,7 +4,7 @@
class DLCUIDataFile : public DLCFile class DLCUIDataFile : public DLCFile
{ {
private: private:
PBYTE m_pbData; uint8_t *m_pbData;
DWORD m_dwBytes; DWORD m_dwBytes;
bool m_canDeleteData; bool m_canDeleteData;
@ -15,6 +15,6 @@ public:
using DLCFile::addData; using DLCFile::addData;
using DLCFile::addParameter; using DLCFile::addParameter;
virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false); virtual void addData(uint8_t *pbData, DWORD dwBytes,bool canDeleteData = false);
virtual PBYTE getData(DWORD &dwBytes); virtual uint8_t *getData(DWORD &dwBytes);
}; };