From 92ac6147a1b85c71b3393e099e290b7f215561f1 Mon Sep 17 00:00:00 2001 From: Sestain Date: Mon, 16 Mar 2026 05:08:13 +0200 Subject: [PATCH 1/4] Fix game crashing if DLC has XMLVERSION paramater --- Minecraft.Client/Common/DLC/DLCManager.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 931b0e1d9d..31e72b9823 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -400,6 +400,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD unsigned int uiParameterCount=*(unsigned int *)&pbData[uiCurrentByte]; uiCurrentByte+=sizeof(int); C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; + bool bXMLVersion = false; //DWORD dwwchCount=0; for(unsigned int i=0;idwType] = type; } + + if (parameterName == L"XMLVERSION") + { + bXMLVersion = true; + } + uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR)); pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; } //ulCurrentByte+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); + if (bXMLVersion) + { + uiCurrentByte += sizeof(int); + } + unsigned int uiFileCount=*(unsigned int *)&pbData[uiCurrentByte]; uiCurrentByte+=sizeof(int); C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; From 39995c59efedae0eed8d005712c6bec3b5f44ded Mon Sep 17 00:00:00 2001 From: Sestain Date: Fri, 27 Mar 2026 07:56:43 +0200 Subject: [PATCH 2/4] Better implementation of XMLVersion check --- Minecraft.Client/Common/DLC/DLCManager.cpp | 8 ++++---- Minecraft.Client/Common/DLC/DLCManager.h | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 31e72b9823..3ce1d15aa2 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -410,11 +410,11 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD if( type != e_DLCParamType_Invalid ) { parameterMapping[pParams->dwType] = type; - } - if (parameterName == L"XMLVERSION") - { - bXMLVersion = true; + if (type == e_DLCParamType_XMLVersion) + { + bXMLVersion = true; + } } uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR)); diff --git a/Minecraft.Client/Common/DLC/DLCManager.h b/Minecraft.Client/Common/DLC/DLCManager.h index d4dd2508ec..3ee7671c50 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.h +++ b/Minecraft.Client/Common/DLC/DLCManager.h @@ -31,7 +31,8 @@ class DLCManager { e_DLCParamType_Invalid = -1, - e_DLCParamType_DisplayName = 0, + e_DLCParamType_XMLVersion = 0, + e_DLCParamType_DisplayName, e_DLCParamType_ThemeName, e_DLCParamType_Free, // identify free skins e_DLCParamType_Credit, // legal credits for DLC From 0e7f86891c4a35cd1a83cb13928a21c9abde3f21 Mon Sep 17 00:00:00 2001 From: Sestain Date: Fri, 27 Mar 2026 18:08:16 +0200 Subject: [PATCH 3/4] Forgot to add type name to the list --- Minecraft.Client/Common/DLC/DLCManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 3ce1d15aa2..0405ce01b7 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -10,6 +10,7 @@ const WCHAR *DLCManager::wchTypeNamesA[]= { + L"XMLVERSION", L"DISPLAYNAME", L"THEMENAME", L"FREE", From 682c323ebecdfd3e70e7eb7bb12a93cbbdab48d5 Mon Sep 17 00:00:00 2001 From: Sestain Date: Fri, 27 Mar 2026 18:09:23 +0200 Subject: [PATCH 4/4] Removed extra newline --- Minecraft.Client/Common/DLC/DLCManager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 0405ce01b7..1355282ae7 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -417,7 +417,6 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD bXMLVersion = true; } } - uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR)); pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; }