From b7739a449b39fa1294cfb6590bf3686188c1a4a4 Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Thu, 13 Dec 2018 15:48:04 +0800 Subject: [PATCH] Stop polluting stdout. --- GreggBits.py | 8 ++++---- ResDecompress.py | 11 +++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/GreggBits.py b/GreggBits.py index 86be828..fdcff8a 100644 --- a/GreggBits.py +++ b/GreggBits.py @@ -100,9 +100,9 @@ def GreggDecompress(src, dst, unpackSize, pos=0): hasDynamicTab = comprFlags & 1 isBitmapped = comprFlags & 2 - print("tabSize: %d" % tabSize) - print("comprFlags: 0x%X, dynamic table: %s, bitmap data: %s" % (comprFlags, - "yes" if hasDynamicTab else "no", "yes" if isBitmapped else "no")) + # print("tabSize: %d" % tabSize) + # print("comprFlags: 0x%X, dynamic table: %s, bitmap data: %s" % (comprFlags, + # "yes" if hasDynamicTab else "no", "yes" if isBitmapped else "no")) if hasDynamicTab: nEntries = tabSize + 1 @@ -223,4 +223,4 @@ def GreggCompress(src, dst, customTab='auto', isBitmapped='auto'): if len(src) & 1: # copy over last byte in the case of odd length dst.append(src[-1]) else: - print("Non-bitmapped compression not yet implemented") + raise ValueError("Non-bitmapped compression not yet implemented") diff --git a/ResDecompress.py b/ResDecompress.py index d3a4b97..93095ea 100644 --- a/ResDecompress.py +++ b/ResDecompress.py @@ -10,20 +10,19 @@ from .GreggBits import GreggDecompress, GreggCompress def GetEncoding(dat): sig, hdrlen, vers, attrs, biglen = struct.unpack_from(">IHBBI", dat) if sig != 0xA89F6572: - print("Invalid extended resource header sig: 0x%X" % sig) + # print("Invalid extended resource header sig: 0x%X" % sig) return 'UnknownCompression' if vers not in (8, 9): - print("Unknown ext res header format: %d" % vers) + # print("Unknown ext res header format: %d" % vers) return 'UnknownCompression' if attrs & 1 == 0: - print("extAttributes,bit0 isn't set. Treat this res as uncompressed.") + # print("extAttributes,bit0 isn't set. Treat this res as uncompressed.") return 'UnknownCompression' - print("Uncompressed length: %d" % biglen) + # print("Uncompressed length: %d" % biglen) if vers == 8: - print('Donn unimplemented!'); return 'UnknownCompression' - return 'DonnBits' + return 'UnknownCompression' # return 'DonnBits' elif vers == 9: if dat[12:14] == b'\x00\x02': return 'GreggyBits'