Decompiled sub_81C7360

This commit is contained in:
Phlosioneer 2019-02-12 02:59:17 -05:00
parent aa61e105e0
commit 5441d80ebc
2 changed files with 30 additions and 33 deletions

View File

@ -5,30 +5,6 @@
.text .text
thumb_func_start sub_81C7360
sub_81C7360: @ 81C7360
push {r4,r5,lr}
adds r5, r0, 0
movs r2, 0
movs r1, 0x12
adds r0, 0x58
_081C736A:
str r2, [r0]
subs r0, 0x4
subs r1, 0x1
cmp r1, 0
bge _081C736A
movs r4, 0
strh r4, [r5, 0x8]
str r4, [r5, 0x4]
bl sub_81C7388
str r0, [r5, 0xC]
str r4, [r5]
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81C7360
thumb_func_start sub_81C7388 thumb_func_start sub_81C7388
sub_81C7388: @ 81C7388 sub_81C7388: @ 81C7388
push {r4-r6,lr} push {r4-r6,lr}

View File

@ -6,26 +6,28 @@
#include "field_weather.h" #include "field_weather.h"
#include "palette.h" #include "palette.h"
// Can confirm the size is correct on line 287 of the generated pokenav_main.s
// file. The expected size is 0x5C.
struct UnknownStruct_0203CF40 { struct UnknownStruct_0203CF40 {
u8 data1[8]; u32 field_0;
u16 field_0; u32 field_1;
u8 data[0x52]; u16 field_2;
u32 field_3;
u32 field_4;
u32 field_5[18];
}; };
extern struct UnknownStruct_0203CF40 *gUnknown_0203CF40; extern struct UnknownStruct_0203CF40 *gUnknown_0203CF40;
extern u8 gUnknown_0203CF3C; extern u8 gUnknown_0203CF3C;
extern void sub_81C7360(void);
extern void sub_81C742C(u8 taskId); extern void sub_81C742C(u8 taskId);
extern void sub_81C7400(void); extern void sub_81C7400(void);
extern void sub_81C7418(void); extern void sub_81C7418(void);
extern void sub_81C7170(u8 a0); extern void sub_81C7170(u8 a0);
extern void sub_81C71E4(u8 a0); extern void sub_81C71E4(u8 a0);
extern void sub_81C7650(s32 a0); extern void sub_81C7650(s32 a0);
extern u32 sub_81C7388(void);
void sub_81C72BC(void); void sub_81C72BC(void);
void sub_81C7360(struct UnknownStruct_0203CF40 *a0);
u32 sub_81C7078(u32 (*a0)(u32), u32 a1) u32 sub_81C7078(u32 (*a0)(u32), u32 a1)
{ {
@ -140,7 +142,7 @@ void CB2_PokeNav(void)
if (gUnknown_0203CF40 == NULL) { if (gUnknown_0203CF40 == NULL) {
SetMainCallback2(CB2_ReturnToFieldWithOpenMenu); SetMainCallback2(CB2_ReturnToFieldWithOpenMenu);
} else { } else {
sub_81C7360(); sub_81C7360(gUnknown_0203CF40);
ResetTasks(); ResetTasks();
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
CreateTask(sub_81C742C, 0); CreateTask(sub_81C742C, 0);
@ -161,8 +163,8 @@ void sub_81C72BC() {
if (gUnknown_0203CF40 == NULL) { if (gUnknown_0203CF40 == NULL) {
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
} else { } else {
sub_81C7360(); sub_81C7360(gUnknown_0203CF40);
gUnknown_0203CF40->field_0 = 1; gUnknown_0203CF40->field_2 = 1;
ResetTasks(); ResetTasks();
ResetSpriteData(); ResetSpriteData();
FreeAllSpritePalettes(); FreeAllSpritePalettes();
@ -183,4 +185,23 @@ void sub_81C7334() {
Free(gUnknown_0203CF40); Free(gUnknown_0203CF40);
gUnknown_0203CF40 = NULL; gUnknown_0203CF40 = NULL;
InitKeys(); InitKeys();
}
// Clears UnknownStruct_0203CF40
void sub_81C7360(struct UnknownStruct_0203CF40 *a0) {
s32 i;
u32 *arrayPtr;
s32 fill;
fill = 0;
i = 18;
arrayPtr = &(a0->field_5[17]);
for (i; i >= 0; i--) {
*arrayPtr = fill;
arrayPtr -= 1;
}
a0->field_2 = 0;
a0->field_1 = 0;
a0->field_3 = sub_81C7388();
a0->field_0 = 0;
} }