Extract exit lists

This commit is contained in:
octorock
2021-10-24 13:21:52 +02:00
parent fdfd43d0d3
commit a924f2821b
7 changed files with 3656 additions and 3223 deletions
+2 -2
View File
@@ -3065,12 +3065,12 @@ _080AF26C: .4byte gArea
_080AF270: .4byte 0x0000085C
_080AF274: .4byte gUnk_08135190
_080AF278:
ldr r0, _080AF280 @ =gUnk_08135168
ldr r0, _080AF280 @ =gExitList_RoyalValley_ForestMaze
_080AF27A:
str r0, [r1, #0x18]
pop {r4, pc}
.align 2, 0
_080AF280: .4byte gUnk_08135168
_080AF280: .4byte gExitList_RoyalValley_ForestMaze
thumb_func_start sub_080AF284
sub_080AF284: @ 0x080AF284
+1257 -838
View File
File diff suppressed because it is too large Load Diff
+232 -232
View File
File diff suppressed because it is too large Load Diff
+2120 -2149
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -1376,5 +1376,3 @@ const Song gSongTable[] = {
[SFX_220] = { &sfx220, MUSIC_PLAYER_18, MUSIC_PLAYER_18 },
[SFX_221] = { &sfx221, MUSIC_PLAYER_17, MUSIC_PLAYER_17 },
};
+4
View File
@@ -11,6 +11,7 @@ from assets.fixed_type_gfx import FixedTypeGfx
from assets.frame_obj_lists import FrameObjLists
from assets.extra_frame_offsets import ExtraFrameOffsets
from assets.animation import Animation
from assets.exit_list import ExitList
verbose = False
@@ -130,6 +131,9 @@ def extract_assets(variant, assets_folder):
elif mode == 'animation':
animation = Animation(path, start, size, options)
animation.extract_binary(baserom)
elif mode == 'exit_list':
exit_list = ExitList(path, start, size, options)
exit_list.extract_binary(baserom)
elif mode != '':
print(f'Asset type {mode} not yet implemented')
+41
View File
@@ -0,0 +1,41 @@
from assets.base import BaseAsset, Reader
class ExitList(BaseAsset):
def __init__(self, path: str, addr: int, size: int, options: any) -> None:
super().__init__(path, addr, size, options)
def extract_binary(self, rom: bytearray) -> None:
reader = Reader(rom[self.addr:self.addr+self.size])
lines = []
while reader.cursor < self.size:
transition_type = reader.read_u16()
x_pos = reader.read_u16()
y_pos = reader.read_u16()
dest_x = reader.read_u16()
dest_y = reader.read_u16()
screen_edge = reader.read_u8()
dest_area = reader.read_u8()
dest_room = reader.read_u8()
unknown_2 = reader.read_u8()
unknown_3 = reader.read_u8()
unknown_4 = reader.read_u8()
unknown_5 = reader.read_u16()
padding_1 = reader.read_u16()
if transition_type == 0xffff:
lines.append(f'\t.2byte 0xffff, 0, 0, 0,0,0,0,0,0,0 @ terminator\n')
break
lines.append(f'\t.2byte {transition_type} @ transition_type\n')
lines.append(f'\t.2byte {x_pos}, {y_pos} @ pos\n')
lines.append(f'\t.2byte {dest_x}, {dest_y} @ dest\n')
lines.append(f'\t.byte {screen_edge} @ screen edge\n')
lines.append(f'\t.byte {dest_area} @ screen edge\n')
lines.append(f'\t.byte {dest_room} @ screen edge\n')
lines.append(f'\t.byte {unknown_2}, {unknown_3}, {unknown_4} @ unknown\n')
lines.append(f'\t.2byte {unknown_5}, {padding_1} @ unknown\n')
assert(self.path.endswith('.bin'))
path = self.path[0:-4] + '.s'
with open(path, 'w') as file:
file.writelines(lines)