Skip to content
Snippets Groups Projects
Commit f0ae5eba authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

comparators.ppu: Use file_header to simplify magic detection and version parsing.

parent f581b2dd
No related branches found
No related tags found
No related merge requests found
......@@ -65,11 +65,12 @@ class PpuFile(File):
def recognizes(cls, file):
if not super().recognizes(file):
return False
with open(file.path, 'rb') as f:
magic = f.read(3)
if magic != b"PPU":
return False
ppu_version = f.read(3).decode('ascii', errors='ignore')
if file.file_header.startswith(b'PPU'):
return False
ppu_version = f.file_header[3:6].decode('ascii', errors='ignore')
if not hasattr(PpuFile, 'ppu_version'):
try:
with profile('command', 'ppudump'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment