More pokemav, massive clean-up, seriously who the left the file in this state???

This commit is contained in:
DizzyEggg 2019-08-04 19:09:12 +02:00
parent ce941e6f56
commit c8cc39cb57
5 changed files with 830 additions and 1102 deletions

View File

@ -5,206 +5,7 @@
@ File centered around AllocSubstruct(9)
thumb_func_start sub_81CF9BC
sub_81CF9BC: @ 81CF9BC
push {r4,lr}
movs r0, 0x9
movs r1, 0x20
bl AllocSubstruct
adds r4, r0, 0
cmp r4, 0
beq _081CF9FC
ldr r1, =0x000006ac
movs r0, 0x12
bl AllocSubstruct
str r0, [r4, 0x1C]
cmp r0, 0
beq _081CF9FC
ldr r0, =sub_81CFA68
str r0, [r4]
ldr r0, =sub_81CFB74
movs r1, 0x1
bl CreateLoopedTask
str r0, [r4, 0x4]
movs r0, 0
str r0, [r4, 0x14]
movs r0, 0x1
b _081CF9FE
.pool
_081CF9FC:
movs r0, 0
_081CF9FE:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81CF9BC
thumb_func_start sub_81CFA04
sub_81CFA04: @ 81CFA04
push {r4,lr}
movs r0, 0x9
movs r1, 0x20
bl AllocSubstruct
adds r4, r0, 0
cmp r4, 0
beq _081CFA2C
movs r0, 0x12
bl GetSubstructPtr
str r0, [r4, 0x1C]
ldr r0, =sub_81CFA88
str r0, [r4]
movs r0, 0x1
str r0, [r4, 0x14]
b _081CFA2E
.pool
_081CFA2C:
movs r0, 0
_081CFA2E:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81CFA04
thumb_func_start sub_81CFA34
sub_81CFA34: @ 81CFA34
push {lr}
movs r0, 0x9
bl GetSubstructPtr
ldr r1, [r0]
bl _call_via_r1
pop {r1}
bx r1
thumb_func_end sub_81CFA34
thumb_func_start sub_81CFA48
sub_81CFA48: @ 81CFA48
push {lr}
movs r0, 0x9
bl GetSubstructPtr
ldr r0, [r0, 0x18]
cmp r0, 0
bne _081CFA5C
movs r0, 0x12
bl FreePokenavSubstruct
_081CFA5C:
movs r0, 0x9
bl FreePokenavSubstruct
pop {r0}
bx r0
thumb_func_end sub_81CFA48
thumb_func_start sub_81CFA68
sub_81CFA68: @ 81CFA68
push {r4,lr}
adds r4, r0, 0
ldr r0, [r4, 0x4]
bl IsLoopedTaskActive
cmp r0, 0
bne _081CFA7A
ldr r0, =sub_81CFA88
str r0, [r4]
_081CFA7A:
movs r0, 0
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_81CFA68
thumb_func_start sub_81CFA88
sub_81CFA88: @ 81CFA88
push {r4,r5,lr}
adds r4, r0, 0
ldr r2, =gMain
ldrh r1, [r2, 0x30]
movs r0, 0x40
ands r0, r1
cmp r0, 0
beq _081CFAA0
movs r0, 0x1
b _081CFAFE
.pool
_081CFAA0:
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _081CFAAC
movs r0, 0x2
b _081CFAFE
_081CFAAC:
ldrh r1, [r2, 0x2E]
movs r0, 0x20
ands r0, r1
cmp r0, 0
beq _081CFABA
movs r0, 0x3
b _081CFAFE
_081CFABA:
movs r0, 0x10
ands r0, r1
lsls r0, 16
lsrs r2, r0, 16
cmp r2, 0
beq _081CFACA
movs r0, 0x4
b _081CFAFE
_081CFACA:
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _081CFAE0
str r2, [r4, 0x18]
ldr r0, =sub_81CFB08
str r0, [r4]
movs r0, 0x5
b _081CFAFE
.pool
_081CFAE0:
movs r5, 0x1
adds r0, r5, 0
ands r0, r1
cmp r0, 0
bne _081CFAEE
movs r0, 0
b _081CFAFE
_081CFAEE:
bl GetSelectedMatchCall
ldr r1, [r4, 0x1C]
strh r0, [r1, 0x2]
str r5, [r4, 0x18]
ldr r0, =sub_81CFB10
str r0, [r4]
movs r0, 0x6
_081CFAFE:
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_81CFA88
thumb_func_start sub_81CFB08
sub_81CFB08: @ 81CFB08
ldr r0, =0x000186a5
bx lr
.pool
thumb_func_end sub_81CFB08
thumb_func_start sub_81CFB10
sub_81CFB10: @ 81CFB10
ldr r0, =0x000186ad
bx lr
.pool
thumb_func_end sub_81CFB10
thumb_func_start sub_81CFB18
sub_81CFB18: @ 81CFB18
push {lr}
movs r0, 0x9
bl GetSubstructPtr
ldr r0, [r0, 0x14]
pop {r1}
bx r1
thumb_func_end sub_81CFB18
thumb_func_start sub_81CFB28
sub_81CFB28: @ 81CFB28

View File

@ -27,13 +27,13 @@ enum
struct BgTemplate
{
u32 bg:2; // 0x1, 0x2 -> 0x3
u32 charBaseIndex:2; // 0x4, 0x8 -> 0xC
u32 mapBaseIndex:5; // 0x10, 0x20, 0x40, 0x80, 0x100 -> 0x1F0
u32 screenSize:2; // 0x200, 0x400 -> 0x600
u32 paletteMode:1; // 0x800
u32 priority:2; // 0x1000, 0x2000 > 0x3000
u32 baseTile:10;
u16 bg:2; // 0x1, 0x2 -> 0x3
u16 charBaseIndex:2; // 0x4, 0x8 -> 0xC
u16 mapBaseIndex:5; // 0x10, 0x20, 0x40, 0x80, 0x100 -> 0x1F0
u16 screenSize:2; // 0x200, 0x400 -> 0x600
u16 paletteMode:1; // 0x800
u16 priority:2; // 0x1000, 0x2000 > 0x3000
u16 baseTile:10;
};
void ResetBgs(void);

View File

@ -319,6 +319,7 @@ SECTIONS {
src/pokenav_unk_7.o(.text*);
src/pokenav_unk_8.o(.text*);
asm/pokenav_unk_8.o(.text*);
src/pokenav_unk_9.o(.text*);
asm/pokenav_unk_9.o(.text*);
asm/pokenav_unk_10.o(.text*);
src/pokenav_unk_10.o(.text*);

File diff suppressed because it is too large Load Diff

View File

@ -3,17 +3,32 @@
#include "bg.h"
#include "window.h"
struct PokenavSub9
{
u32 (*unk0)(struct PokenavSub9*);
u32 loopedTaskId;
u8 filler[0xC];
u32 unk14;
u32 unk18;
struct PokenavSub18 *unk1C;
};
u32 sub_81CFA68(struct PokenavSub9 *structPtr);
u32 sub_81CFA88(struct PokenavSub9 *structPtr);
u32 sub_81CFB08(struct PokenavSub9 *structPtr);
u32 sub_81CFB10(struct PokenavSub9 *structPtr);
u32 sub_81CFB8C(void);
u32 sub_81CFC2C(void);
u32 sub_81CFC40(void);
u32 sub_81CFFFC(s32);
u32 sub_81D0074(s32);
u32 sub_81D00EC(s32);
u32 sub_81D0164(s32);
u32 sub_81D01DC(s32);
u32 sub_81D021C(s32);
u32 sub_81CFB74(s32 state);
u32 sub_81CFFFC(s32 state);
u32 sub_81D0074(s32 state);
u32 sub_81D00EC(s32 state);
u32 sub_81D0164(s32 state);
u32 sub_81D01DC(s32 state);
u32 sub_81D021C(s32 state);
u32 (*const gUnknown_086235D8[])(void) =
u32 (*const gUnknown_086235D8[])(void) =
{
sub_81CFB8C,
sub_81CFC2C,
@ -25,7 +40,7 @@ const u32 gUnknown_08623604[] = INCBIN_U32("graphics/pokenav/ui_ribbons.4bpp.lz"
const u32 gUnknown_086236CC[] = INCBIN_U32("graphics/pokenav/ui_ribbons.bin.lz");
const u16 gUnknown_08623790[] = INCBIN_U16("graphics/pokenav/8623790.gbapal");
const struct BgTemplate gUnknown_086237B0 =
const struct BgTemplate gUnknown_086237B0 =
{
.bg = 1,
.charBaseIndex = 1,
@ -36,7 +51,7 @@ const struct BgTemplate gUnknown_086237B0 =
.baseTile = 0
};
const struct BgTemplate gUnknown_086237B4 =
const struct BgTemplate gUnknown_086237B4 =
{
.bg = 2,
.charBaseIndex = 2,
@ -47,7 +62,7 @@ const struct BgTemplate gUnknown_086237B4 =
.baseTile = 0
};
const LoopedTask gUnknown_086237B8[] =
const LoopedTask gUnknown_086237B8[] =
{
NULL,
sub_81CFFFC,
@ -58,7 +73,7 @@ const LoopedTask gUnknown_086237B8[] =
sub_81D021C
};
const struct WindowTemplate gUnknown_086237D4 =
const struct WindowTemplate gUnknown_086237D4 =
{
.bg = 1,
.tilemapLeft = 1,
@ -72,3 +87,94 @@ const struct WindowTemplate gUnknown_086237D4 =
const u8 gUnknown_086237DC[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GREEN}♂{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
const u8 gUnknown_086237E8[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
const u8 gUnknown_086237F4[] = _("{UNK_SPACER}");
bool32 sub_81CF9BC(void)
{
struct PokenavSub9 *structPtr = AllocSubstruct(9, sizeof(struct PokenavSub9));
if (structPtr == NULL)
return FALSE;
structPtr->unk1C = AllocSubstruct(18, sizeof(struct PokenavSub18));
if (structPtr->unk1C == NULL)
return FALSE;
structPtr->unk0 = sub_81CFA68;
structPtr->loopedTaskId = CreateLoopedTask(sub_81CFB74, 1);
structPtr->unk14 = 0;
return TRUE;
}
bool32 sub_81CFA04(void)
{
struct PokenavSub9 *structPtr = AllocSubstruct(9, sizeof(struct PokenavSub9));
if (structPtr == NULL)
return FALSE;
structPtr->unk1C = GetSubstructPtr(18);
structPtr->unk0 = sub_81CFA88;
structPtr->unk14 = 1;
return TRUE;
}
u32 sub_81CFA34(void)
{
struct PokenavSub9 *structPtr = GetSubstructPtr(9);
return structPtr->unk0(structPtr);
}
void sub_81CFA48(void)
{
struct PokenavSub9 *structPtr = GetSubstructPtr(9);
if (!structPtr->unk18)
FreePokenavSubstruct(18);
FreePokenavSubstruct(9);
}
u32 sub_81CFA68(struct PokenavSub9 *structPtr)
{
if (!IsLoopedTaskActive(structPtr->loopedTaskId))
structPtr->unk0 = sub_81CFA88;
return 0;
}
u32 sub_81CFA88(struct PokenavSub9 *structPtr)
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
return 1;
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
return 2;
if (gMain.newKeys & DPAD_LEFT)
return 3;
if (gMain.newKeys & DPAD_RIGHT)
return 4;
if (gMain.newKeys & B_BUTTON)
{
structPtr->unk18 = 0;
structPtr->unk0 = sub_81CFB08;
return 5;
}
if (gMain.newKeys & A_BUTTON)
{
structPtr->unk1C->unk2 = GetSelectedMatchCall();
structPtr->unk18 = 1;
structPtr->unk0 = sub_81CFB10;
return 6;
}
return 0;
}
u32 sub_81CFB08(struct PokenavSub9 *structPtr)
{
return 0x186a5;
}
u32 sub_81CFB10(struct PokenavSub9 *structPtr)
{
return 0x186ad;
}
u32 sub_81CFB18(void)
{
struct PokenavSub9 *structPtr = GetSubstructPtr(9);
return structPtr->unk14;
}