diff --git a/bemani/format/ifs.py b/bemani/format/ifs.py index 33b0215..a8a773b 100644 --- a/bemani/format/ifs.py +++ b/bemani/format/ifs.py @@ -196,6 +196,11 @@ class IFS: name = subchild.attribute('name') if name is None: raise Exception(f"Texture entry {subchild} has no name!") + if ' ' in name: + # Certain files that were corrupted on create or copy + # seem to have spaces in the name which shouldn't be + # allowed. Lob them off. + name = name[:name.find(' ')] md5sum = hashlib.md5(name.encode(encoding)).hexdigest() oldname = os.path.join(texdir, md5sum) newname = os.path.join(texdir, name) diff --git a/bemani/protocol/binary.py b/bemani/protocol/binary.py index 0ec6ac3..49d181d 100644 --- a/bemani/protocol/binary.py +++ b/bemani/protocol/binary.py @@ -422,7 +422,7 @@ class BinaryDecoder: # Need to convert this from encoding to standard string. # Also, need to lob off the trailing null. try: - val = val[:-1].decode(self.encoding) + val = val[:-1].decode(self.encoding, 'replace') except UnicodeDecodeError: # Nothing we can do here pass