Start decompiling pokenav_unk_4.c

This commit is contained in:
Marcus Huderle 2019-04-15 17:51:11 -05:00 committed by huderlem
parent f40f2c5e9c
commit 394c0f5546
5 changed files with 80 additions and 103 deletions

View File

@ -5,99 +5,6 @@
@ File centered around AllocSubstruct(6)
thumb_func_start sub_81CB260
sub_81CB260: @ 81CB260
push {r4,lr}
ldr r1, =0x00002048
movs r0, 0x6
bl AllocSubstruct
adds r4, r0, 0
cmp r4, 0
beq _081CB294
movs r0, 0
strb r0, [r4, 0x19]
ldr r0, =sub_81CB324
movs r1, 0x1
bl CreateLoopedTask
str r0, [r4, 0x4]
ldr r0, =sub_81CB310
str r0, [r4]
movs r0, 0x1
b _081CB296
.pool
_081CB294:
movs r0, 0
_081CB296:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81CB260
thumb_func_start sub_81CB29C
sub_81CB29C: @ 81CB29C
push {r4,r5,lr}
adds r4, r0, 0
movs r0, 0x6
bl GetSubstructPtr
adds r5, r0, 0
ldr r0, =gUnknown_08622798
lsls r4, 2
adds r4, r0
ldr r0, [r4]
movs r1, 0x1
bl CreateLoopedTask
str r0, [r5, 0x4]
ldr r0, =sub_81CB310
str r0, [r5]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81CB29C
thumb_func_start sub_81CB2CC
sub_81CB2CC: @ 81CB2CC
push {lr}
movs r0, 0x6
bl GetSubstructPtr
ldr r0, [r0]
bl _call_via_r0
pop {r1}
bx r1
thumb_func_end sub_81CB2CC
thumb_func_start sub_81CB2E0
sub_81CB2E0: @ 81CB2E0
push {r4,lr}
movs r0, 0x6
bl GetSubstructPtr
adds r4, r0, 0
bl sub_81CC2B4
bl sub_81CBC1C
ldrb r0, [r4, 0x12]
bl RemoveWindow
ldrb r0, [r4, 0x10]
bl RemoveWindow
ldrb r0, [r4, 0x14]
bl RemoveWindow
movs r0, 0x6
bl FreePokenavSubstruct
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81CB2E0
thumb_func_start sub_81CB310
sub_81CB310: @ 81CB310
push {lr}
movs r0, 0x6
bl GetSubstructPtr
ldr r0, [r0, 0x4]
bl IsLoopedTaskActive
pop {r1}
bx r1
thumb_func_end sub_81CB310
thumb_func_start sub_81CB324
sub_81CB324: @ 81CB324
push {r4,r5,lr}

View File

@ -87,7 +87,7 @@ int sub_81C9894(void);
const u8 *sub_81CAF78(int index, u8 *arg1);
// pokenav_unk_2.c
u32 sub_81C99D4(void);
void sub_81C99D4(void);
void sub_81CAADC(void);
// pokenav_unk_3.c
@ -115,4 +115,9 @@ int sub_81CB0C8(int rematchIndex);
int sub_81CB0E4(int index);
bool32 sub_81CAE08(int);
// pokenav_unk_4.c
u32 sub_81CB260(void);
u32 sub_81CB2CC(void);
void sub_81CB2E0(void);
#endif //GUARD_POKENAV_H

View File

@ -306,6 +306,7 @@ SECTIONS {
src/pokenav_unk_1.o(.text);
asm/pokenav_unk_2.o(.text);
src/pokenav_unk_3.o(.text);
src/pokenav_unk_4.o(.text);
asm/pokenav_unk_4.o(.text);
asm/pokenav_unk_5.o(.text);
asm/pokenav_unk_6.o(.text);

View File

@ -34,7 +34,7 @@ struct UnknownPokenavCallbackStruct
u32 (*unkC)(void);
u32 (*unk10)(void);
void (*unk14)(void);
u32 (*unk18)(void);
void (*unk18)(void);
};
extern u32 sub_81C9924(void);
@ -47,42 +47,39 @@ extern u32 sub_81CC5F4(void);
extern u32 sub_81CC62C(void);
extern u32 sub_81CC65C(void);
extern void sub_81CC524(void);
extern u32 sub_81CC670(void);
extern void sub_81CC670(void);
extern u32 sub_81CCFD8(void);
extern u32 sub_81CD070(void);
extern u32 sub_81CDDD4(void);
extern u32 sub_81CDE2C(void);
extern u32 sub_81CDE64(void);
extern void sub_81CD1C0(void);
extern u32 sub_81CECA0(void);
extern void sub_81CECA0(void);
extern u32 sub_81CEF3C(void);
extern u32 sub_81CEFDC(void);
extern u32 sub_81CF330(void);
extern u32 sub_81CF3A0(void);
extern u32 sub_81CF3D0(void);
extern void sub_81CEFF0(void);
extern u32 sub_81CF3F8(void);
extern void sub_81CF3F8(void);
extern u32 sub_81CD024(void);
extern u32 sub_81CEF98(void);
extern u32 sub_81CF368(void);
extern u32 sub_81CB260(void);
extern u32 sub_81CB29C(void);
extern u32 sub_81CB2CC(void);
extern u32 sub_81CB2E0(void);
extern u32 sub_81CF9BC(void);
extern u32 sub_81CFA34(void);
extern u32 sub_81CFDD0(void);
extern u32 sub_81CFE40(void);
extern u32 sub_81CFE70(void);
extern void sub_81CFA48(void);
extern u32 sub_81CFE98(void);
extern void sub_81CFE98(void);
extern u32 sub_81D0450(void);
extern u32 sub_81D04A0(void);
extern u32 sub_81D0978(void);
extern u32 sub_81D09B0(void);
extern u32 sub_81D09E0(void);
extern void sub_81D04B8(void);
extern u32 sub_81D09F4(void);
extern void sub_81D09F4(void);
extern u32 sub_81CFA04(void);
extern u32 sub_81CFE08(void);

67
src/pokenav_unk_4.c Executable file
View File

@ -0,0 +1,67 @@
#include "global.h"
#include "pokenav.h"
#include "window.h"
struct Pokenav4Struct
{
u32 (*unk0)(void);
u32 unk4;
u8 filler8[0x8];
u8 unk10;
u8 filler11[0x1];
u8 unk12;
u8 filler13[0x1];
u8 unk14;
u8 filler15[0x4];
u8 unk19;
u8 filler1A[0x202E];
};
static bool32 sub_81CB310(void);
u32 sub_81CB324(int);
void sub_81CBC1C(void);
void sub_81CC2B4(void);
extern const LoopedTask gUnknown_08622798[];
bool32 sub_81CB260(void)
{
struct Pokenav4Struct *state = AllocSubstruct(6, sizeof(struct Pokenav4Struct));
if (!state)
return FALSE;
state->unk19 = 0;
state->unk4 = CreateLoopedTask(sub_81CB324, 1);
state->unk0 = sub_81CB310;
return TRUE;
}
void sub_81CB29C(int index)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
state->unk4 = CreateLoopedTask(gUnknown_08622798[index], 1);
state->unk0 = sub_81CB310;
}
u32 sub_81CB2CC(void)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
return state->unk0();
}
void sub_81CB2E0(void)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
sub_81CC2B4();
sub_81CBC1C();
RemoveWindow(state->unk12);
RemoveWindow(state->unk10);
RemoveWindow(state->unk14);
FreePokenavSubstruct(6);
}
static bool32 sub_81CB310(void)
{
struct Pokenav4Struct *state = GetSubstructPtr(6);
return IsLoopedTaskActive(state->unk4);
}