decompile more rom4.s functions

This commit is contained in:
YamaArashi 2016-10-08 22:08:38 -07:00
parent cd9f796a03
commit b2acbe1d80
3 changed files with 121 additions and 283 deletions

View File

@ -5,289 +5,6 @@
.text
thumb_func_start sub_8054BA8
sub_8054BA8: @ 8054BA8
push {r4-r7,lr}
sub sp, 0x4
movs r0, 0x80
lsls r0, 19
movs r4, 0
strh r4, [r0]
bl remove_some_task
ldr r2, _08054C1C
mov r0, sp
strh r4, [r0]
ldr r1, _08054C20
str r0, [r1]
str r2, [r1, 0x4]
ldr r0, _08054C24
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
movs r2, 0xC0
lsls r2, 19
movs r3, 0xC0
lsls r3, 9
mov r4, sp
movs r6, 0
movs r5, 0x80
lsls r5, 5
ldr r7, _08054C28
movs r0, 0x81
lsls r0, 24
mov r12, r0
_08054BE2:
strh r6, [r4]
mov r0, sp
str r0, [r1]
str r2, [r1, 0x4]
str r7, [r1, 0x8]
ldr r0, [r1, 0x8]
adds r2, r5
subs r3, r5
cmp r3, r5
bhi _08054BE2
strh r6, [r4]
mov r0, sp
str r0, [r1]
str r2, [r1, 0x4]
lsrs r0, r3, 1
mov r2, r12
orrs r0, r2
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
movs r0, 0
movs r1, 0x80
bl ResetOamRange
bl LoadOam
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08054C1C: .4byte 0x05000002
_08054C20: .4byte 0x040000d4
_08054C24: .4byte 0x810001ff
_08054C28: .4byte 0x81000800
thumb_func_end sub_8054BA8
thumb_func_start sub_8054C2C
sub_8054C2C: @ 8054C2C
push {lr}
bl sub_8054814
bl sub_8054C54
ldr r0, _08054C4C
bl SetUpWindowConfig
ldr r0, _08054C50
bl InitMenuWindow
bl mapdata_load_assets_to_gpu_and_full_redraw
pop {r0}
bx r0
.align 2, 0
_08054C4C: .4byte gWindowConfig_81E6C3C
_08054C50: .4byte gWindowConfig_81E6CE4
thumb_func_end sub_8054C2C
thumb_func_start sub_8054C54
sub_8054C54: @ 8054C54
push {r4-r6,lr}
ldr r0, _08054D08
movs r3, 0
strh r3, [r0]
ldr r1, _08054D0C
ldr r2, _08054D10
adds r0, r2, 0
strh r0, [r1]
adds r1, 0x2
ldr r4, _08054D14
adds r0, r4, 0
strh r0, [r1]
ldr r0, _08054D18
movs r1, 0xFF
strh r1, [r0]
adds r0, 0x4
strh r1, [r0]
subs r0, 0x2
ldr r6, _08054D1C
adds r1, r6, 0
strh r1, [r0]
adds r0, 0x4
strh r1, [r0]
ldr r4, _08054D20
ldr r1, _08054D24
ldrh r0, [r1, 0x2]
ldrh r2, [r1, 0x4]
orrs r0, r2
ldrh r1, [r1, 0x6]
orrs r0, r1
movs r2, 0x82
lsls r2, 5
adds r1, r2, 0
orrs r0, r1
strh r0, [r4]
ldr r1, _08054D28
ldr r4, _08054D2C
adds r0, r4, 0
strh r0, [r1]
ldr r5, _08054D30
ldr r0, [r5]
strh r3, [r0]
ldr r4, _08054D34
ldr r0, [r4]
strh r3, [r0]
ldr r2, _08054D38
ldr r0, [r2]
strh r3, [r0]
ldr r0, [r5, 0x4]
strh r3, [r0]
ldr r0, [r4, 0x4]
strh r3, [r0]
ldr r1, [r2, 0x4]
ldr r6, _08054D3C
adds r0, r6, 0
strh r0, [r1]
ldr r0, [r5, 0x8]
strh r3, [r0]
ldr r0, [r4, 0x8]
strh r3, [r0]
ldr r1, [r2, 0x8]
subs r6, 0xFF
adds r0, r6, 0
strh r0, [r1]
ldr r0, [r5, 0xC]
strh r3, [r0]
ldr r0, [r4, 0xC]
strh r3, [r0]
ldr r1, [r2, 0xC]
ldr r2, _08054D40
adds r0, r2, 0
strh r0, [r1]
movs r3, 0x80
lsls r3, 19
ldr r2, _08054D44
ldrh r0, [r2, 0x2]
ldr r4, _08054D48
adds r1, r4, 0
orrs r0, r1
ldrh r1, [r2, 0x4]
orrs r0, r1
ldrh r1, [r2]
orrs r0, r1
ldrh r1, [r2, 0x6]
orrs r0, r1
strh r0, [r3]
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08054D08: .4byte REG_MOSAIC
_08054D0C: .4byte REG_WININ
_08054D10: .4byte 0x00001f1f
_08054D14: .4byte 0x00000101
_08054D18: .4byte REG_WIN0H
_08054D1C: .4byte 0x0000ffff
_08054D20: .4byte REG_BLDCNT
_08054D24: .4byte gUnknown_081E29E0
_08054D28: .4byte REG_BLDALPHA
_08054D2C: .4byte 0x0000070d
_08054D30: .4byte gBGHOffsetRegs
_08054D34: .4byte gBGVOffsetRegs
_08054D38: .4byte gBGControlRegs
_08054D3C: .4byte 0x00001d41
_08054D40: .4byte 0x00001e43
_08054D44: .4byte gUnknown_081E29D8
_08054D48: .4byte 0x00007060
thumb_func_end sub_8054C54
thumb_func_start sub_8054D4C
sub_8054D4C: @ 8054D4C
push {r4,lr}
adds r4, r0, 0
bl ResetTasks
bl ResetSpriteData
bl ResetPaletteFade
bl dp12_8087EA4
bl ResetCameraUpdateInfo
bl InstallCameraPanAheadCallback
movs r0, 0
bl sub_805C7C4
bl FieldEffectActiveListClear
bl InitFieldMessageBox
bl sub_807C828
bl sub_8080750
cmp r4, 0
bne _08054D86
bl overworld_ensure_per_step_coros_running
_08054D86:
bl mapheader_run_script_with_tag_x5
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8054D4C
thumb_func_start sub_8054D90
sub_8054D90: @ 8054D90
push {lr}
ldr r0, _08054DB0
movs r1, 0
strh r1, [r0]
ldr r0, _08054DB4
strh r1, [r0]
bl sub_805AA98
movs r0, 0
movs r1, 0
bl sub_805B55C
bl mapheader_run_first_tag4_script_list_match
pop {r0}
bx r0
.align 2, 0
_08054DB0: .4byte gUnknown_0300489C
_08054DB4: .4byte gUnknown_03004898
thumb_func_end sub_8054D90
thumb_func_start mli4_mapscripts_and_other
mli4_mapscripts_and_other: @ 8054DB8
push {r4,r5,lr}
sub sp, 0x4
ldr r0, _08054E14
movs r1, 0
strh r1, [r0]
ldr r0, _08054E18
strh r1, [r0]
bl sub_805AA98
mov r4, sp
adds r4, 0x2
mov r0, sp
adds r1, r4, 0
bl sav1_camera_get_focus_coords
bl sub_8053AA8
adds r5, r0, 0
mov r0, sp
movs r1, 0
ldrsh r0, [r0, r1]
movs r2, 0
ldrsh r1, [r4, r2]
ldrb r2, [r5, 0x1]
ldr r3, _08054E1C
ldrb r3, [r3, 0x8]
bl InitPlayerAvatar
ldrb r0, [r5]
bl SetPlayerAvatarTransitionFlags
bl player_avatar_init_params_reset
movs r0, 0
movs r1, 0
bl sub_805B55C
bl ResetBerryTreeSparkleFlags
bl mapheader_run_first_tag4_script_list_match
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_08054E14: .4byte gUnknown_0300489C
_08054E18: .4byte gUnknown_03004898
_08054E1C: .4byte gSaveBlock2
thumb_func_end mli4_mapscripts_and_other
thumb_func_start sub_8054E20
sub_8054E20: @ 8054E20
push {lr}

View File

@ -70,6 +70,10 @@ extern vu16 *const gBGControlRegs[];
extern vu16 *const gBGHOffsetRegs[];
extern vu16 *const gBGVOffsetRegs[];
extern const u16 gUnknown_081E29D8[];
extern const u16 gUnknown_081E29E0[];
extern const u16 gUnknown_081E29E8[];
extern const struct WindowConfig gWindowConfig_81E6C3C;
extern const struct WindowConfig gWindowConfig_81E6C58;
extern const struct WindowConfig gWindowConfig_81E6C74;

View File

@ -55,6 +55,9 @@ extern void (*gUnknown_0300485C)(void);
extern struct UnkTVStruct gUnknown_03004870;
extern u16 gUnknown_03004898;
extern u16 gUnknown_0300489C;
extern u8 gUnknown_0819FC74[];
extern u8 gUnknown_0819FC9F[];
@ -128,6 +131,12 @@ bool32 sub_805493C(u8 *, u32);
bool32 sub_8054A4C(u8 *);
bool32 sub_8054A9C(u8 *a1);
void do_load_map_stuff_loop(u8 *a1);
void sub_8054BA8(void);
void sub_8054C2C(void);
void sub_8054C54(void);
void sub_8054D4C(u32 a1);
void sub_8054D90(void);
void mli4_mapscripts_and_other(void);
void sub_8052F5C(void)
{
@ -1570,3 +1579,111 @@ void do_load_map_stuff_loop(u8 *a1)
while (!sub_805493C(a1, 0))
;
}
void sub_8054BA8(void)
{
u8 *addr;
u32 size;
REG_DISPCNT = 0;
remove_some_task();
DmaClear16(3, PLTT + 2, PLTT_SIZE - 2);
addr = (void *)VRAM;
size = 0x18000;
while(1)
{
DmaFill16(3, 0, addr, 0x1000);
addr += 0x1000;
size -= 0x1000;
if(size <= 0x1000)
{
DmaFill16(3, 0, addr, size);
break;
}
}
ResetOamRange(0, 128);
LoadOam();
}
void sub_8054C2C(void)
{
sub_8054814();
sub_8054C54();
SetUpWindowConfig(&gWindowConfig_81E6C3C);
InitMenuWindow(&gWindowConfig_81E6CE4);
mapdata_load_assets_to_gpu_and_full_redraw();
}
void sub_8054C54(void)
{
REG_MOSAIC = 0;
REG_WININ = 7967;
REG_WINOUT = 257;
REG_WIN0H = 255;
REG_WIN0V = 255;
REG_WIN1H = -1;
REG_WIN1V = -1;
REG_BLDCNT = gUnknown_081E29E0[1] | gUnknown_081E29E0[2] | gUnknown_081E29E0[3] | 0x1040;
REG_BLDALPHA = 1805;
*gBGHOffsetRegs[0] = 0;
*gBGVOffsetRegs[0] = 0;
*gBGControlRegs[0] = 0;
*gBGHOffsetRegs[1] = 0;
*gBGVOffsetRegs[1] = 0;
*gBGControlRegs[1] = 7489;
*gBGHOffsetRegs[2] = 0;
*gBGVOffsetRegs[2] = 0;
*gBGControlRegs[2] = 7234;
*gBGHOffsetRegs[3] = 0;
*gBGVOffsetRegs[3] = 0;
*gBGControlRegs[3] = 7747;
REG_DISPCNT = gUnknown_081E29D8[1] | 0x7060 | gUnknown_081E29D8[2] | gUnknown_081E29D8[0] | gUnknown_081E29D8[3];
}
void sub_8054D4C(u32 a1)
{
ResetTasks();
ResetSpriteData();
ResetPaletteFade();
dp12_8087EA4();
ResetCameraUpdateInfo();
InstallCameraPanAheadCallback();
sub_805C7C4(0);
FieldEffectActiveListClear();
InitFieldMessageBox();
sub_807C828();
sub_8080750();
if (!a1)
overworld_ensure_per_step_coros_running();
mapheader_run_script_with_tag_x5();
}
void sub_8054D90(void)
{
gUnknown_0300489C = 0;
gUnknown_03004898 = 0;
sub_805AA98();
sub_805B55C(0, 0);
mapheader_run_first_tag4_script_list_match();
}
void mli4_mapscripts_and_other(void)
{
s16 x, y;
struct UnkPlayerStruct *player;
gUnknown_0300489C = 0;
gUnknown_03004898 = 0;
sub_805AA98();
sav1_camera_get_focus_coords(&x, &y);
player = sub_8053AA8();
InitPlayerAvatar(x, y, player->player_field_1, gSaveBlock2.playerGender);
SetPlayerAvatarTransitionFlags(player->player_field_0);
player_avatar_init_params_reset();
sub_805B55C(0, 0);
ResetBerryTreeSparkleFlags();
mapheader_run_first_tag4_script_list_match();
}