mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-06 19:07:15 +00:00
Remove Win32 byte pointers from DLC file interfaces
This commit is contained in:
parent
b02bcd27f5
commit
66538b67f2
|
|
@ -12,7 +12,7 @@ DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLC
|
|||
m_dwBytes = 0;
|
||||
}
|
||||
|
||||
void DLCAudioFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCAudioFile::addData(uint8_t *pbData, DWORD dwBytes)
|
||||
{
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
|
|
@ -20,7 +20,7 @@ void DLCAudioFile::addData(PBYTE pbData, DWORD dwBytes)
|
|||
processDLCDataFile(pbData,dwBytes);
|
||||
}
|
||||
|
||||
PBYTE DLCAudioFile::getData(DWORD &dwBytes)
|
||||
uint8_t *DLCAudioFile::getData(DWORD &dwBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
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;
|
||||
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);
|
||||
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];
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
|
|
@ -213,4 +213,4 @@ std::wstring &DLCAudioFile::GetSoundName(int iIndex)
|
|||
iWorldType++;
|
||||
}
|
||||
return m_parameters[iWorldType].at(iIndex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,17 +32,17 @@ public:
|
|||
|
||||
DLCAudioFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
virtual void addData(uint8_t *pbData, 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);
|
||||
std::wstring &GetSoundName(int iIndex);
|
||||
|
||||
private:
|
||||
using DLCFile::addParameter;
|
||||
|
||||
PBYTE m_pbData;
|
||||
uint8_t *m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
static const int CURRENT_AUDIO_VERSION_NUM=1;
|
||||
//std::unordered_map<int, std::wstring> m_parameters;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile
|
|||
public:
|
||||
DLCCapeFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
};
|
||||
virtual void addData(uint8_t *pbData, DWORD dwBytes);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
m_colourTable = new ColourTable(defaultColourTable, pbData, dwBytes);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public:
|
|||
DLCColourTableFile(const std::wstring &path);
|
||||
~DLCColourTableFile();
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual void addData(uint8_t *pbData, DWORD dwBytes);
|
||||
|
||||
ColourTable *getColourTable() { return m_colourTable; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "DLCManager.h"
|
||||
|
||||
class DLCFile
|
||||
|
|
@ -16,10 +17,10 @@ public:
|
|||
std::wstring getPath() { return m_path; }
|
||||
DWORD getSkinID() { return m_dwSkinId; }
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes) {}
|
||||
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; }
|
||||
virtual void addData(uint8_t *pbData, DWORD dwBytes) {}
|
||||
virtual uint8_t *getData(DWORD &dwBytes) { dwBytes = 0; return NULL; }
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {}
|
||||
|
||||
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; }
|
||||
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCM
|
|||
m_dwBytes = 0;
|
||||
}
|
||||
|
||||
void DLCGameRulesFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCGameRulesFile::addData(uint8_t *pbData, DWORD dwBytes)
|
||||
{
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
}
|
||||
|
||||
PBYTE DLCGameRulesFile::getData(DWORD &dwBytes)
|
||||
uint8_t *DLCGameRulesFile::getData(DWORD &dwBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
return m_pbData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
class DLCGameRulesFile : public DLCGameRules
|
||||
{
|
||||
private:
|
||||
PBYTE m_pbData;
|
||||
uint8_t *m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
|
||||
public:
|
||||
DLCGameRulesFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
};
|
||||
virtual void addData(uint8_t *pbData, DWORD dwBytes);
|
||||
virtual uint8_t *getData(DWORD &dwBytes);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(
|
|||
lgo = NULL;
|
||||
}
|
||||
|
||||
void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCGameRulesHeader::addData(uint8_t *pbData, DWORD dwBytes)
|
||||
{
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
|
|
@ -73,13 +73,13 @@ void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
|
|||
#endif
|
||||
}
|
||||
|
||||
PBYTE DLCGameRulesHeader::getData(DWORD &dwBytes)
|
||||
uint8_t *DLCGameRulesHeader::getData(DWORD &dwBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
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)
|
||||
{
|
||||
|
|
@ -89,4 +89,4 @@ void DLCGameRulesHeader::setGrfData(PBYTE fData, DWORD fSize, StringTable *st)
|
|||
|
||||
app.m_gameRules.readRuleFile(lgo, fData, fSize, st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class DLCGameRulesHeader : public DLCGameRules, public JustGrSource
|
|||
private:
|
||||
|
||||
// GR-Header
|
||||
PBYTE m_pbData;
|
||||
uint8_t *m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
|
||||
bool m_hasData;
|
||||
|
|
@ -33,10 +33,10 @@ public:
|
|||
public:
|
||||
DLCGameRulesHeader(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
virtual void addData(uint8_t *pbData, 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; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLC
|
|||
m_strings = NULL;
|
||||
}
|
||||
|
||||
void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCLocalisationFile::addData(uint8_t *pbData, DWORD dwBytes)
|
||||
{
|
||||
m_strings = new StringTable(pbData, dwBytes);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ private:
|
|||
|
||||
public:
|
||||
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; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ DLCSkinFile::DLCSkinFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy
|
|||
m_uiAnimOverrideBitmask=0L;
|
||||
}
|
||||
|
||||
void DLCSkinFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCSkinFile::addData(uint8_t *pbData, DWORD dwBytes)
|
||||
{
|
||||
app.AddMemoryTextureFile(m_path,pbData,dwBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
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 std::wstring getParameterAsString(DLCManager::EDLCParameterType type);
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ DLCTextureFile::DLCTextureFile(const std::wstring &path) : DLCFile(DLCManager::e
|
|||
m_dwBytes = 0;
|
||||
}
|
||||
|
||||
void DLCTextureFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCTextureFile::addData(uint8_t *pbData, DWORD dwBytes)
|
||||
{
|
||||
//app.AddMemoryTextureFile(m_path,pbData,dwBytes);
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
}
|
||||
|
||||
PBYTE DLCTextureFile::getData(DWORD &dwBytes)
|
||||
uint8_t *DLCTextureFile::getData(DWORD &dwBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
return m_pbData;
|
||||
|
|
@ -56,4 +56,4 @@ bool DLCTextureFile::getParameterAsBool(DLCManager::EDLCParameterType type)
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ private:
|
|||
bool m_bIsAnim;
|
||||
std::wstring m_animString;
|
||||
|
||||
PBYTE m_pbData;
|
||||
uint8_t *m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
|
||||
public:
|
||||
DLCTextureFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
virtual void addData(uint8_t *pbData, DWORD dwBytes);
|
||||
virtual uint8_t *getData(DWORD &dwBytes);
|
||||
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
|
||||
|
||||
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type);
|
||||
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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_dwBytes = dwBytes;
|
||||
m_canDeleteData = canDeleteData;
|
||||
}
|
||||
|
||||
PBYTE DLCUIDataFile::getData(DWORD &dwBytes)
|
||||
uint8_t *DLCUIDataFile::getData(DWORD &dwBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
return m_pbData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
class DLCUIDataFile : public DLCFile
|
||||
{
|
||||
private:
|
||||
PBYTE m_pbData;
|
||||
uint8_t *m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
bool m_canDeleteData;
|
||||
|
||||
|
|
@ -15,6 +15,6 @@ public:
|
|||
using DLCFile::addData;
|
||||
using DLCFile::addParameter;
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
virtual void addData(uint8_t *pbData, DWORD dwBytes,bool canDeleteData = false);
|
||||
virtual uint8_t *getData(DWORD &dwBytes);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue