diff --git a/tools/patcher/DiabloUI/patcher.cpp b/tools/patcher/DiabloUI/patcher.cpp index 68ee68722d9..b8bb6966509 100644 --- a/tools/patcher/DiabloUI/patcher.cpp +++ b/tools/patcher/DiabloUI/patcher.cpp @@ -3954,7 +3954,24 @@ static BYTE* patchFile(int index, size_t *dwLen) } break; case FILE_CATHEDRAL_SCEL: { // patch pSpecialsCel - L1S.CEL - buf = DRLP_L1_PatchSpec(buf, dwLen); + size_t minLen; + BYTE* minBuf = LoadFileInMem(filesToPatch[FILE_CATHEDRAL_MIN], &minLen); + if (minBuf == NULL) { + mem_free_dbg(buf); + app_warn("Unable to open file %s in the mpq.", filesToPatch[FILE_CATHEDRAL_MIN]); + return NULL; + } + size_t celLen; + BYTE* celBuf = LoadFileInMem(filesToPatch[FILE_CATHEDRAL_CEL], &celLen); + if (celBuf == NULL) { + mem_free_dbg(minBuf); + mem_free_dbg(buf); + app_warn("Unable to open file %s in the mpq.", filesToPatch[FILE_CATHEDRAL_CEL]); + return NULL; + } + buf = DRLP_L1_PatchSpec(minBuf, minLen, celBuf, celLen, buf, dwLen); + mem_free_dbg(celBuf); + mem_free_dbg(minBuf); } break; case FILE_CATHEDRAL_CEL: { // patch dMicroCels - L1.CEL diff --git a/tools/patcher/drlp_l1.cpp b/tools/patcher/drlp_l1.cpp index fbcd853bd09..346f48aa548 100644 --- a/tools/patcher/drlp_l1.cpp +++ b/tools/patcher/drlp_l1.cpp @@ -142,7 +142,7 @@ BYTE* DRLP_L1_PatchDoors(BYTE* celBuf, size_t* celLen) return resCelBuf; } -BYTE* DRLP_L1_PatchSpec(BYTE* sCelBuf, size_t* sCelLen) +BYTE* DRLP_L1_PatchSpec(const BYTE* minBuf, size_t minLen, const BYTE* celBuf, size_t celLen, BYTE* sCelBuf, size_t* sCelLen) { constexpr BYTE TRANS_COLOR = 128; constexpr BYTE SUB_HEADER_SIZE = 10; diff --git a/tools/patcher/drlp_l1.h b/tools/patcher/drlp_l1.h index aee68466bad..7153d3ed63f 100644 --- a/tools/patcher/drlp_l1.h +++ b/tools/patcher/drlp_l1.h @@ -15,7 +15,7 @@ extern "C" { #define BLOCK_SIZE_L1 10 BYTE* DRLP_L1_PatchDoors(BYTE* celBuf, size_t* celLen); -BYTE* DRLP_L1_PatchSpec(BYTE* sCelBuf, size_t* sCelLen); +BYTE* DRLP_L1_PatchSpec(const BYTE* minBuf, size_t minLen, const BYTE* celBuf, size_t celLen, BYTE* sCelBuf, size_t* sCelLen); BYTE* DRLP_L1_PatchCel(const BYTE* minBuf, size_t minLen, BYTE* celBuf, size_t* celLen); void DRLP_L1_PatchMin(BYTE* minBuf); void DRLP_L1_PatchTil(BYTE* tilBuf);