diff --git a/bwmap.py b/bwmap.py index 7792520..3db4e6b 100644 --- a/bwmap.py +++ b/bwmap.py @@ -21,8 +21,10 @@ scmdraft_req = b"ERA ~DIM ~TILE~UNIT~PUNI~IOWN~THG2~SPRP~WAV ~MASK~STR ~OWNR~SID # STR kinda (can be empty for melee) melee_req = b"VER ~TYPE~VCOD~OWNR~SIDE~COLR~ERA ~DIM ~MTXM~UNIT~THG2~STR ~SPRP~FORC".split(b"~") -#both_req = set(melee_req + scmdraft_req) -#print(b"~".join(both_req)) +# TODO: try more things to add to this list. +ums_req = melee_req + b"MRGN~PTEx~PUPx~TECx~TRIG~UNIx~UPGx~UPRP".split(b"~") + +both_req = set(melee_req + scmdraft_req) known_keys = [ # in the order we want to write them. # boring filetype stuff @@ -79,15 +81,7 @@ known_keys = [ # in the order we want to write them. b"STR ", # string data ] -skippable_keys = [ - b"ISOM", - b"PTEC", - b"SWNM", - b"TECS", - b"UNIS", - b"UPGR", - b"UPGS", -] +skippable_keys = set(known_keys).symmetric_difference(both_req) vcod_valid = b"\ \x34\x19\xCA\x77\x99\xDC\x68\x71\x0A\x60\xBF\xC3\xA7\xE7\x75\xA7\ @@ -175,7 +169,7 @@ def readit(f): k = f.read(4) try: - name = k.decode('utf-8')#, errors="replace") + name = k.decode('ascii') except UnicodeDecodeError: print("! skipping invalid section name:", k) size = U("