through sub_81C99FC

This commit is contained in:
PikalaxALT 2019-05-02 14:27:59 -04:00
parent 901a83d249
commit 9b40cdaeb9
6 changed files with 175 additions and 204 deletions

View File

@ -5,167 +5,6 @@
@ File centered around AllocSubstruct(2)
thumb_func_start sub_81C98D4
sub_81C98D4: @ 81C98D4
push {r4,lr}
movs r4, 0
_081C98D8:
adds r0, r4, 0
bl sub_81CB0C8
ldr r1, =gMapHeader
lsls r0, 24
lsrs r0, 24
ldrb r1, [r1, 0x14]
cmp r0, r1
bne _081C9914
adds r0, r4, 0
bl sub_81CAE08
cmp r0, 0
beq _081C9914
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, =0x000009ca
adds r0, r1
adds r0, r4
ldrb r0, [r0]
cmp r0, 0
beq _081C9914
movs r0, 0x1
b _081C991C
.pool
_081C9914:
adds r4, 0x1
cmp r4, 0x4D
ble _081C98D8
movs r0, 0
_081C991C:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81C98D4
thumb_func_start sub_81C9924
sub_81C9924: @ 81C9924
push {lr}
bl sub_81C9958
adds r1, r0, 0
cmp r1, 0
beq _081C9938
movs r0, 0
strb r0, [r1, 0xD]
movs r0, 0x1
b _081C993A
_081C9938:
movs r0, 0
_081C993A:
pop {r1}
bx r1
thumb_func_end sub_81C9924
thumb_func_start sub_81C9940
sub_81C9940: @ 81C9940
push {lr}
bl sub_81C9958
adds r1, r0, 0
cmp r1, 0
beq _081C9952
movs r0, 0x1
strb r0, [r1, 0xD]
b _081C9954
_081C9952:
movs r0, 0
_081C9954:
pop {r1}
bx r1
thumb_func_end sub_81C9940
thumb_func_start sub_81C9958
sub_81C9958: @ 81C9958
push {r4,lr}
ldr r1, =0x0000088c
movs r0, 0x2
bl AllocSubstruct
adds r4, r0, 0
cmp r4, 0
beq _081C997A
movs r0, 0
strb r0, [r4, 0xC]
ldr r0, =sub_81C9A10
movs r1, 0x1
bl CreateLoopedTask
str r0, [r4, 0x4]
ldr r0, =sub_81C99FC
str r0, [r4]
_081C997A:
adds r0, r4, 0
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_81C9958
thumb_func_start sub_81C9990
sub_81C9990: @ 81C9990
push {r4,r5,lr}
adds r4, r0, 0
movs r0, 0x2
bl GetSubstructPtr
adds r5, r0, 0
ldr r0, =gUnknown_086201A0
lsls r4, 2
adds r4, r0
ldr r0, [r4]
movs r1, 0x1
bl CreateLoopedTask
str r0, [r5, 0x4]
ldr r0, =sub_81C99FC
str r0, [r5]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C9990
thumb_func_start sub_81C99C0
sub_81C99C0: @ 81C99C0
push {lr}
movs r0, 0x2
bl GetSubstructPtr
ldr r0, [r0]
bl _call_via_r0
pop {r1}
bx r1
thumb_func_end sub_81C99C0
thumb_func_start sub_81C99D4
sub_81C99D4: @ 81C99D4
push {r4,lr}
movs r0, 0x2
bl GetSubstructPtr
adds r4, r0, 0
bl sub_81CA7F4
ldrb r0, [r4, 0x8]
bl RemoveWindow
bl sub_81C9FEC
bl sub_81CA994
movs r0, 0x2
bl FreePokenavSubstruct
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81C99D4
thumb_func_start sub_81C99FC
sub_81C99FC: @ 81C99FC
push {lr}
movs r0, 0x2
bl GetSubstructPtr
ldr r0, [r0, 0x4]
bl IsLoopedTaskActive
pop {r1}
bx r1
thumb_func_end sub_81C99FC
thumb_func_start sub_81C9A10
sub_81C9A10: @ 81C9A10
push {r4,r5,lr}

View File

@ -4,49 +4,10 @@
.section .rodata
// pokenav_unk_2.s
gUnknown_0861FC78:: @ 861FC78
.incbin "graphics/pokenav/bg.gbapal"
gUnknown_0861FC98:: @ 861FC98
.incbin "graphics/pokenav/bg.4bpp.lz"
gUnknown_0861FCAC:: @ 861FCAC
.incbin "graphics/pokenav/bg.bin.lz"
gUnknown_0861FD4C:: @ 861FD4C
.incbin "graphics/pokenav/outline.gbapal"
gUnknown_0861FD6C:: @ 861FD6C
.incbin "graphics/pokenav/outline.4bpp.lz"
gUnknown_0861FFF4:: @ 861FFF4
.incbin "graphics/pokenav/outline_map.bin.lz"
gUnknown_08620104:: @ 8620104
.incbin "graphics/pokenav/blue_light.gbapal"
gUnknown_08620124:: @ 8620124
.incbin "graphics/pokenav/blue_light.4bpp.lz"
gUnknown_08620194:: @ 8620194
.byte 0xF5, 0x10, 0, 0, 0x7A, 0x21, 0, 0, 0xFF, 0x31, 0, 0
gUnknown_086201A0:: @ 86201A0
.4byte NULL
.4byte sub_81C9C6C
.4byte sub_81C9CA8
.4byte sub_81C9D44
.4byte sub_81C9DD8
.4byte sub_81C9E58
.4byte sub_81C9EC8
.4byte sub_81C9EF8
.4byte sub_81C9F28
gUnknown_086201C4:: @ 86201C4
.4byte gPokenavOptions_Gfx
.byte 0, 0x34, 3, 0
.4byte gUnknown_08620124
.byte 0, 1, 1, 0
obj_tiles gPokenavOptions_Gfx, 0x3400, 0x0003
obj_tiles gUnknown_08620124, 0x0100, 0x0001
gUnknown_086201D4:: @ 86201D4
.4byte gPokenavOptions_Pal + 0x0, 4

View File

@ -162,7 +162,7 @@ const u8 *sub_81CAFD8(int index, int textType);
u16 sub_81CB01C(void);
u16 sub_81CB02C(int arg0);
void sub_81CB050(u32 arg0, u8 *str);
int sub_81CB0C8(int rematchIndex);
u8 sub_81CB0C8(int rematchIndex);
int sub_81CB0E4(int index);
bool32 sub_81CAE08(int);
int sub_81CB128(int index);

View File

@ -304,6 +304,7 @@ SECTIONS {
src/pokenav_main_menu.o(.text);
src/pokenav_match_call_ui.o(.text);
src/pokenav_unk_1.o(.text);
src/pokenav_unk_2.o(.text);
asm/pokenav_unk_2.o(.text);
src/pokenav_unk_3.o(.text);
src/pokenav_unk_4.o(.text);
@ -633,6 +634,7 @@ SECTIONS {
src/pokenav_main_menu.o(.rodata);
src/pokenav_match_call_ui.o(.rodata);
src/pokenav_unk_1.o(.rodata);
src/pokenav_unk_2.o(.rodata);
data/pokenav.o(.rodata);
src/pokenav_match_call_data.o(.rodata);
src/menu_specialized.o(.rodata);

169
src/pokenav_unk_2.c Normal file
View File

@ -0,0 +1,169 @@
#include "global.h"
#include "alloc.h"
#include "bg.h"
#include "window.h"
#include "pokenav.h"
// Match Call
struct Pokenav2Struct
{
bool32 (*callback)(void);
u32 loopedTaskId;
u8 field_008;
u8 field_009;
u8 field_00a;
u8 field_00b;
u8 field_00c;
u8 field_00d;
u8 filler_00e[0x87E];
};
struct Pokenav2Struct * sub_81C9958(void);
bool32 sub_81C99FC(void);
u32 sub_81C9A10(int state);
u32 sub_81C9C6C(int state);
u32 sub_81C9CA8(int state);
u32 sub_81C9D44(int state);
u32 sub_81C9DD8(int state);
u32 sub_81C9E58(int state);
u32 sub_81C9EC8(int state);
u32 sub_81C9EF8(int state);
u32 sub_81C9F28(int state);
void sub_81CA7F4(void);
void sub_81C9FEC(void);
void sub_81CA994(void);
const u16 gUnknown_0861FC78[] = INCBIN_U16("graphics/pokenav/bg.gbapal");
const u32 gUnknown_0861FC98[] = INCBIN_U32("graphics/pokenav/bg.4bpp.lz");
const u32 gUnknown_0861FCAC[] = INCBIN_U32("graphics/pokenav/bg.bin.lz");
const u16 gUnknown_0861FD4C[] = INCBIN_U16("graphics/pokenav/outline.gbapal");
const u32 gUnknown_0861FD6C[] = INCBIN_U32("graphics/pokenav/outline.4bpp.lz");
const u32 gUnknown_0861FFF4[] = INCBIN_U32("graphics/pokenav/outline_map.bin.lz");
const u16 gUnknown_08620104[] = INCBIN_U16("graphics/pokenav/blue_light.gbapal");
const u32 gUnknown_08620124[] = INCBIN_U32("graphics/pokenav/blue_light.4bpp.lz");
const struct BgTemplate gUnknown_08620194[] = {
{
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 15,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0x000
}, {
.bg = 2,
.charBaseIndex = 2,
.mapBaseIndex = 23,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0x000
}, {
.bg = 3,
.charBaseIndex = 3,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 3,
.baseTile = 0x000
}
};
const LoopedTask gUnknown_086201A0[] = {
NULL,
sub_81C9C6C,
sub_81C9CA8,
sub_81C9D44,
sub_81C9DD8,
sub_81C9E58,
sub_81C9EC8,
sub_81C9EF8,
sub_81C9F28
};
bool32 sub_81C98D4(void)
{
s32 i;
for (i = 0; i < 78; i++)
{
if (sub_81CB0C8(i) == gMapHeader.regionMapSectionId
&& sub_81CAE08(i)
&& gSaveBlock1Ptr->trainerRematches[i])
return TRUE;
}
return FALSE;
}
bool32 sub_81C9924(void)
{
struct Pokenav2Struct * unk = sub_81C9958();
if (unk == NULL)
return FALSE;
unk->field_00d = 0;
return TRUE;
}
bool32 sub_81C9940(void)
{
struct Pokenav2Struct * unk = sub_81C9958();
if (unk == NULL)
return FALSE;
unk->field_00d = 1;
return TRUE;
}
struct Pokenav2Struct * sub_81C9958(void)
{
struct Pokenav2Struct * unk = AllocSubstruct(2, sizeof(struct Pokenav2Struct));
if (unk != NULL)
{
unk->field_00c = 0;
unk->loopedTaskId = CreateLoopedTask(sub_81C9A10, 1);
unk->callback = sub_81C99FC;
}
return unk;
}
void sub_81C9990(s32 ltIdx)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
unk->loopedTaskId = CreateLoopedTask(gUnknown_086201A0[ltIdx], 1);
unk->callback = sub_81C99FC;
}
bool32 sub_81C99C0(void)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
return unk->callback();
}
void sub_81C99D4(void)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
sub_81CA7F4();
RemoveWindow(unk->field_008);
sub_81C9FEC();
sub_81CA994();
FreePokenavSubstruct(2);
}
bool32 sub_81C99FC(void)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
return IsLoopedTaskActive(unk->loopedTaskId);
}

View File

@ -411,7 +411,7 @@ void sub_81CB050(u32 arg0, u8 *str)
}
}
int sub_81CB0C8(int rematchIndex)
u8 sub_81CB0C8(int rematchIndex)
{
int mapGroup = gRematchTable[rematchIndex].mapGroup;
int mapNum = gRematchTable[rematchIndex].mapNum;