changeset 2152:44d7e8e2483c

Add in some fixups that the original CDHM decoder does, although these seem to be unnecessary.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 04 Jun 2019 15:21:35 +0300
parents 0a7ebb7198e3
children 7652b3fe8f30
files tools/lib64fmts.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Tue Jun 04 15:05:53 2019 +0300
+++ b/tools/lib64fmts.c	Tue Jun 04 15:21:35 2019 +0300
@@ -1047,6 +1047,16 @@
 
 finish:
 
+    // Fixups that the original decoder does, not necessary really
+    dstBuf[0x7ff0 - baseAddr] = 0x03;
+    dstBuf[0x7ffe - baseAddr] = dstBuf[4];
+
+    for (size_t n = 0; n < 0x40; n++)
+        dstBuf[n] = 0xff;
+
+    for (size_t n = 0; n < 0x100; n++)
+        dstBuf[0x40 + n] = 0x00;
+
     dmGrowBufConstCreateFrom(&tmp, dstBuf, dstSize);
     res = dmC64DecodeGenericBMP(img, &tmp, fmt);