From d65414ab67d3f7336b6bc6e46f63fc3229f2cd32 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 12 Oct 2024 09:38:32 +0100 Subject: [PATCH] Reduce CLX header size from 10 to 6 --- source/d1formats/d1cl2.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/d1formats/d1cl2.cpp b/source/d1formats/d1cl2.cpp index 166bf0e3..41d5f51d 100644 --- a/source/d1formats/d1cl2.cpp +++ b/source/d1formats/d1cl2.cpp @@ -379,10 +379,12 @@ static quint8 *writeFrameData(D1GfxFrame *frame, quint8 *pBuf, bool isClx, int s quint16 *pHeader = reinterpret_cast(pBuf); // add CL2 FRAME HEADER pHeader[0] = SwapLE16(subHeaderSize); // SUB_HEADER_SIZE - pHeader[1] = 0; // row -32 - pHeader[2] = 0; // row -64 - pHeader[3] = 0; // row -96 - pHeader[4] = 0; // row -128 + if (!isClx) { + pHeader[1] = 0; // row -32 + pHeader[2] = 0; // row -64 + pHeader[3] = 0; // row -96 + pHeader[4] = 0; // row -128 + } pBuf += subHeaderSize; unsigned transparentRunWidth = 0; @@ -443,7 +445,7 @@ bool D1Cl2::writeFileData(D1Gfx &gfx, QFile &outFile, bool isClx, const QString } // calculate sub header size - int subHeaderSize = SUB_HEADER_SIZE; + int subHeaderSize = isClx ? SUB_HEADER_SIZE : 6; if (!isClx) { for (int n = 0; n < numFrames; n++) { D1GfxFrame *frame = gfx.getFrame(n);