Use fixed-width pack IDs in DLC packs

This commit is contained in:
notmatthewbeshay 2026-03-11 02:54:11 +11:00
parent 80d035d137
commit 3c2669b2a7
5 changed files with 20 additions and 20 deletions

View file

@ -5211,7 +5211,7 @@ int CMinecraftApp::DLCMountedCallback(void *pParam,int iPad,DWORD dwErr,DWORD dw
if(( GetFileAttributes( szFullFilename ) & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
{
#ifdef _XBOX
DWORD dwPackID=m_dlcManager.retrievePackIDFromDLCDataFile(szFullFilename,pack);
std::uint32_t dwPackID=m_dlcManager.retrievePackIDFromDLCDataFile(szFullFilename,pack);
// Do we need to override the TexturePack.pck with an updated version in a TU?
std::wstring wsTemp=getFilePath(dwPackID, std::wstring(L"TexturePack.pck"),false );

View file

@ -587,9 +587,9 @@ bool DLCManager::processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t
return true;
}
DWORD DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack)
std::uint32_t DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack)
{
DWORD packId = 0;
std::uint32_t packId = 0;
unsigned int bytesRead = 0;
std::uint8_t *pbData = NULL;
@ -603,9 +603,9 @@ DWORD DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack
return packId;
}
DWORD DLCManager::retrievePackID(std::uint8_t *pbData, DWORD dwLength, DLCPack *pack)
std::uint32_t DLCManager::retrievePackID(std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack)
{
DWORD packId=0;
std::uint32_t packId=0;
bool bPackIDSet=false;
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte=0;
@ -650,7 +650,7 @@ DWORD DLCManager::retrievePackID(std::uint8_t *pbData, DWORD dwLength, DLCPack *
uiCurrentByte+=sizeof(int);
C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
DWORD dwTemp=uiCurrentByte;
unsigned int dwTemp=uiCurrentByte;
for(unsigned int i=0;i<uiFileCount;i++)
{
dwTemp+=DLC_DETAIL_ADV(pFile->dwWchCount);

View file

@ -91,10 +91,10 @@ public:
bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false);
bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false);
DWORD retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack);
std::uint32_t retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack);
private:
bool processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack);
DWORD retrievePackID(std::uint8_t *pbData, DWORD dwLength, DLCPack *pack);
std::uint32_t retrievePackID(std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack);
};

View file

@ -101,9 +101,9 @@ XCONTENTDEVICEID DLCPack::GetDLCDeviceID()
void DLCPack::addChildPack(DLCPack *childPack)
{
int packId = childPack->GetPackId();
const std::uint32_t packId = childPack->GetPackId();
#ifndef _CONTENT_PACKAGE
if(packId < 0 || packId > 15)
if(packId > 15)
{
__debugbreak();
}
@ -125,7 +125,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstrin
{
case DLCManager::e_DLCParamType_PackId:
{
DWORD packId = 0;
std::uint32_t packId = 0;
std::wstringstream ss;
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually
@ -137,7 +137,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstrin
break;
case DLCManager::e_DLCParamType_PackVersion:
{
DWORD version = 0;
std::uint32_t version = 0;
std::wstringstream ss;
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually

View file

@ -26,8 +26,8 @@ private:
ULONGLONG m_ullFullOfferId;
#endif
bool m_isCorrupt;
DWORD m_packId;
DWORD m_packVersion;
std::uint32_t m_packId;
std::uint32_t m_packVersion;
std::uint8_t *m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
public:
@ -45,14 +45,14 @@ public:
bool IsCorrupt() { return m_isCorrupt; }
void SetIsCorrupt(bool val) { m_isCorrupt = val; }
void SetPackId(DWORD id) { m_packId = id; }
DWORD GetPackId() { return m_packId; }
void SetPackId(std::uint32_t id) { m_packId = id; }
std::uint32_t GetPackId() { return m_packId; }
void SetPackVersion(DWORD version) { m_packVersion = version; }
DWORD GetPackVersion() { return m_packVersion; }
void SetPackVersion(std::uint32_t version) { m_packVersion = version; }
std::uint32_t GetPackVersion() { return m_packVersion; }
DLCPack * GetParentPack() { return m_parentPack; }
DWORD GetParentPackId() { return m_parentPack->m_packId; }
std::uint32_t GetParentPackId() { return m_parentPack->m_packId; }
void SetDLCMountIndex(DWORD id) { m_dlcMountIndex = id; }
DWORD GetDLCMountIndex();
@ -82,7 +82,7 @@ public:
DWORD getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All);
DWORD getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found);
bool doesPackContainFile(DLCManager::EDLCType type, const std::wstring &path);
DWORD GetPackID() {return m_packId;}
std::uint32_t GetPackID() {return m_packId;}
DWORD getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); }
DWORD getSkinIndexAt(const std::wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); }