From 7a051b44868edab869b755173eaf517c755236ef Mon Sep 17 00:00:00 2001 From: techmetx11 Date: Fri, 12 Apr 2024 13:09:18 +0000 Subject: [PATCH] RLE bug squashed, now the modules that couldn't load can load now --- src/engine/fileOps/tfm.cpp | 43 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/engine/fileOps/tfm.cpp b/src/engine/fileOps/tfm.cpp index d53e51925..7d9a8687e 100644 --- a/src/engine/fileOps/tfm.cpp +++ b/src/engine/fileOps/tfm.cpp @@ -38,20 +38,27 @@ class TFMRLEReader { int tagLenLeft; signed char tagChar; - void decodeRLE(signed char prevChar) { + void decodeRLE(unsigned char prevChar) { int lenShift=0; tagLenLeft=0; - signed char rleTag=0; + unsigned char rleTag=0; + do { - rleTag=readC(); + rleTag=readCNoRLE(); tagLenLeft|=(rleTag&0x7F)<len) throw TFMEndOfFileException(this,len); + if (curSeek>len) throw TFMEndOfFileException(this,len); return buf[curSeek++]; }