mirror of
https://github.com/elliotnunn/macresources.git
synced 2024-12-12 03:29:15 +00:00
Stop polluting stdout.
This commit is contained in:
parent
08b64758d4
commit
b7739a449b
@ -100,9 +100,9 @@ def GreggDecompress(src, dst, unpackSize, pos=0):
|
|||||||
|
|
||||||
hasDynamicTab = comprFlags & 1
|
hasDynamicTab = comprFlags & 1
|
||||||
isBitmapped = comprFlags & 2
|
isBitmapped = comprFlags & 2
|
||||||
print("tabSize: %d" % tabSize)
|
# print("tabSize: %d" % tabSize)
|
||||||
print("comprFlags: 0x%X, dynamic table: %s, bitmap data: %s" % (comprFlags,
|
# print("comprFlags: 0x%X, dynamic table: %s, bitmap data: %s" % (comprFlags,
|
||||||
"yes" if hasDynamicTab else "no", "yes" if isBitmapped else "no"))
|
# "yes" if hasDynamicTab else "no", "yes" if isBitmapped else "no"))
|
||||||
|
|
||||||
if hasDynamicTab:
|
if hasDynamicTab:
|
||||||
nEntries = tabSize + 1
|
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
|
if len(src) & 1: # copy over last byte in the case of odd length
|
||||||
dst.append(src[-1])
|
dst.append(src[-1])
|
||||||
else:
|
else:
|
||||||
print("Non-bitmapped compression not yet implemented")
|
raise ValueError("Non-bitmapped compression not yet implemented")
|
||||||
|
@ -10,20 +10,19 @@ from .GreggBits import GreggDecompress, GreggCompress
|
|||||||
def GetEncoding(dat):
|
def GetEncoding(dat):
|
||||||
sig, hdrlen, vers, attrs, biglen = struct.unpack_from(">IHBBI", dat)
|
sig, hdrlen, vers, attrs, biglen = struct.unpack_from(">IHBBI", dat)
|
||||||
if sig != 0xA89F6572:
|
if sig != 0xA89F6572:
|
||||||
print("Invalid extended resource header sig: 0x%X" % sig)
|
# print("Invalid extended resource header sig: 0x%X" % sig)
|
||||||
return 'UnknownCompression'
|
return 'UnknownCompression'
|
||||||
if vers not in (8, 9):
|
if vers not in (8, 9):
|
||||||
print("Unknown ext res header format: %d" % vers)
|
# print("Unknown ext res header format: %d" % vers)
|
||||||
return 'UnknownCompression'
|
return 'UnknownCompression'
|
||||||
if attrs & 1 == 0:
|
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'
|
return 'UnknownCompression'
|
||||||
|
|
||||||
print("Uncompressed length: %d" % biglen)
|
# print("Uncompressed length: %d" % biglen)
|
||||||
|
|
||||||
if vers == 8:
|
if vers == 8:
|
||||||
print('Donn unimplemented!'); return 'UnknownCompression'
|
return 'UnknownCompression' # return 'DonnBits'
|
||||||
return 'DonnBits'
|
|
||||||
elif vers == 9:
|
elif vers == 9:
|
||||||
if dat[12:14] == b'\x00\x02':
|
if dat[12:14] == b'\x00\x02':
|
||||||
return 'GreggyBits'
|
return 'GreggyBits'
|
||||||
|
Loading…
Reference in New Issue
Block a user