aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/DLC/DLCManager.h
diff options
context:
space:
mode:
authorSestain <35299377+sestain@users.noreply.github.com>2026-03-27 21:59:35 +0200
committerGitHub <noreply@github.com>2026-03-27 15:59:35 -0400
commit3c1166c45e3be1dc44f0ea83accb0408a24b2751 (patch)
tree5f40c11210b43c95dae4d6726dd0cc44f555345e /Minecraft.Client/Common/DLC/DLCManager.h
parent0d4874dea5ce5cfd31a67f6b1d5e38c271a4308b (diff)
Added support for Big-Endian DLCs (#1291)
* Added support for Big-Endian DLCs * Remove unused variable * Remove the things made for other PR
Diffstat (limited to 'Minecraft.Client/Common/DLC/DLCManager.h')
-rw-r--r--Minecraft.Client/Common/DLC/DLCManager.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/DLC/DLCManager.h b/Minecraft.Client/Common/DLC/DLCManager.h
index d4dd2508..7191ab0b 100644
--- a/Minecraft.Client/Common/DLC/DLCManager.h
+++ b/Minecraft.Client/Common/DLC/DLCManager.h
@@ -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);