mirror of
https://github.com/notwa/mm
synced 2024-11-05 01:29:03 -08:00
add actor file heuristics
This commit is contained in:
parent
2a7310c344
commit
17453757e4
1 changed files with 16 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
|||
from util import *
|
||||
|
||||
def try_makerom(f):
|
||||
f.seek(0)
|
||||
if f.read(12) == b'\x80\x37\x12\x40\x00\x00\x00\x0f\x80\x00\x04\x00':
|
||||
|
@ -11,10 +13,20 @@ def try_dmadata(f):
|
|||
return False
|
||||
|
||||
def try_actor(f):
|
||||
# actors are just object files really,
|
||||
# so anything we can detect with
|
||||
# would just detect code or inconsistent data.
|
||||
# maybe there's some common-looking function between them.
|
||||
f.seek(-4, 2)
|
||||
section_size = R4(f.read(4))
|
||||
file_size = f.tell()
|
||||
if section_size > 0x4000 or section_size == 0:
|
||||
# assume this section isn't larger than 16KiB
|
||||
# (that's 4 times larger than the largest one in OoT)
|
||||
return False
|
||||
f.seek(-section_size, 2)
|
||||
section_start = f.tell()
|
||||
data_offset = R4(f.read(4))
|
||||
data_size = R4(f.read(4))
|
||||
misc_size = R4(f.read(4))
|
||||
if section_start == data_offset + data_size + misc_size:
|
||||
return True
|
||||
return False
|
||||
|
||||
def try_scene_or_room(f, bank=2):
|
||||
|
|
Loading…
Reference in a new issue