Added support for Big-Endian DLCs (#1291)

* Added support for Big-Endian DLCs

* Remove unused variable

* Remove the things made for other PR
This commit is contained in:
Sestain
2026-03-27 21:59:35 +02:00
committed by GitHub
parent 0d4874dea5
commit 3c1166c45e
2 changed files with 58 additions and 9 deletions

View File

@@ -94,6 +94,30 @@ public:
bool readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DLCPack *pack, bool fromArchive = false);
DWORD retrievePackIDFromDLCDataFile(const string &path, DLCPack *pack);
static unsigned short SwapInt16(unsigned short value) {
return (value >> 8) | (value << 8);
}
static unsigned int SwapInt32(unsigned int value) {
return ((value & 0xFF) << 24) |
((value & 0xFF00) << 8) |
((value & 0xFF0000) >> 8) |
((value & 0xFF000000) >> 24);
}
static void SwapUTF16Bytes(char16_t* buffer, size_t count) {
for (size_t i = 0; i < count; ++i) {
char16_t& c = buffer[i];
c = (c >> 8) | (c << 8);
}
}
static unsigned int readUInt32(unsigned char* ptr, bool endian) {
unsigned int val = *(unsigned int*)ptr;
if (endian) val = SwapInt32(val);
return val;
}
private:
bool processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack);