diff --git a/bemani/format/afp.py b/bemani/format/afp.py index c3ca23a..036ece6 100644 --- a/bemani/format/afp.py +++ b/bemani/format/afp.py @@ -1026,14 +1026,22 @@ class SWF: raise Exception(f"Unrecognzied magic {magic}!") if length != len(data): raise Exception(f"Unexpected length in AFP header, {length} != {len(data)}!") + if ap2_data_version != 8: + raise Exception(f"Unsupported AP2 container version {ap2_data_version}!") + if version != 0x200: + raise Exception(f"Unsupported AP2 version {version}!") if flags & 0x1: - # I have no idea what this is, but its treated as 4 bytes and something - # happens if they aren't all 0xFF. It looks like this is an animation - # background color. - unknown_bytes = struct.unpack("<4B", data[28:32]) + # This appears to be the animation background color. + rgba = struct.unpack("> 8) & 0xFF) / 255.0, + b=((rgba >> 16) & 0xFF) / 255.0, + a=((rgba >> 24) & 0xFF) / 255.0, + ) else: - unknown_bytes = None + swf_color = None add_coverage(28, 4) if flags & 0x2: @@ -1045,11 +1053,11 @@ class SWF: if flags & 0x4: # This seems related to imported tags. - imported_tag_something_offset = struct.unpack("