diff --git a/include/pokenav.h b/include/pokenav.h index 87d4e3e5c..db32e3029 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -144,13 +144,17 @@ void sub_81C7E14(u32 arg0); void sub_81C7FC4(u32 arg0, bool32 arg1); void sub_81C7880(void); void sub_81C7990(u32 a0, u16 a1); +u32 PokenavMainMenuLoopedTaskIsActive(void); +bool32 WaitForPokenavShutdownFade(void); +void sub_81C7834(void *func1, void *func2); +void ShutdownPokenav(void); // pokenav_unk_1.c -bool32 sub_81C9298(void); -bool32 sub_81C92CC(void); -bool32 sub_81C9304(void); -bool32 sub_81C9338(void); -bool32 sub_81C9368(void); +bool32 PokenavCallback_Init_0(void); +bool32 PokenavCallback_Init_4(void); +bool32 PokenavCallback_Init_5(void); +bool32 PokenavCallback_Init_2(void); +bool32 PokenavCallback_Init_3(void); u32 sub_81C941C(void); void sub_81C9430(void); int sub_81C9894(void); @@ -168,7 +172,7 @@ void sub_81C99D4(void); void sub_81CAADC(void); // pokenav_unk_3.c -bool32 sub_81CAAE8(void); +bool32 PokenavCallback_Init_11(void); u32 sub_81CAB24(void); void sub_81CAB38(void); int sub_81CAE28(void); @@ -195,7 +199,7 @@ void sub_81CB2E0(void); void sub_81CBD48(u16 windowId, u32 a1); // pokenav_unk_5.c -u32 sub_81CC4D4(void); +u32 PokenavCallback_Init_6(void); void sub_81CC524(void); u32 sub_81CC554(void); bool32 sub_81CC5F4(void); @@ -204,6 +208,10 @@ u32 sub_81CC65C(void); void sub_81CC670(void); // pokenav_unk_6.c +u32 PokenavCallback_Init_7(void); +u32 PokenavCallback_Init_9(void); +u32 sub_81CD070(void); +void sub_81CD1C0(void); bool32 sub_81CD3C4(void); bool32 sub_81CDD5C(void); struct UnknownStruct_81D1ED4 *sub_81CDC70(void); @@ -219,6 +227,41 @@ void *sub_81CDCB4(u8 id); void *sub_81CDCD4(u8 id); // pokenav_unk_7.c +bool32 sub_81CDDD4(void); +void sub_81CDE2C(s32); +u32 sub_81CDE64(void); +void sub_81CECA0(void); u8 sub_81CEF14(void); +// pokenav_unk_8.c +u32 PokenavCallback_Init_8(void); +u32 PokenavCallback_Init_10(void); +u32 sub_81CEFDC(void); +void sub_81CEFF0(void); +bool32 sub_81CF330(void); +bool32 sub_81CF368(void); +void sub_81CF3A0(s32); +u32 sub_81CF3D0(void); +void sub_81CF3F8(void); + +// pokenav_unk_9.c +u32 PokenavCallback_Init_12(void); +u32 PokenavCallback_Init_14(void); +u32 sub_81CFA34(void); +void sub_81CFA48(void); +bool32 sub_81CFDD0(void); +bool32 sub_81CFE08(void); +void sub_81CFE40(s32); +u32 sub_81CFE70(void); +void sub_81CFE98(void); + +// pokenav_unk_10.c +u32 PokenavCallback_Init_13(void); +u32 sub_81D04A0(void); +void sub_81D04B8(void); +bool32 sub_81D0978(void); +void sub_81D09B0(s32); +u32 sub_81D09E0(void); +void sub_81D09F4(void); + #endif // GUARD_POKENAV_H diff --git a/src/pokenav.c b/src/pokenav.c index afa110e4b..a5bb51789 100644 --- a/src/pokenav.c +++ b/src/pokenav.c @@ -37,67 +37,24 @@ struct UnknownPokenavCallbackStruct void (*unk18)(void); }; -// TODO: Move these to pokenav.h -extern bool32 sub_81C9924(void); -extern u32 sub_81C99C0(void); -extern void sub_81C9990(s32); -extern bool32 sub_81C9940(void); -extern u32 sub_81CCFD8(void); -extern u32 sub_81CD070(void); -extern bool32 sub_81CDDD4(void); -extern void sub_81CDE2C(s32); -extern u32 sub_81CDE64(void); -extern void sub_81CD1C0(void); -extern void sub_81CECA0(void); -extern u32 sub_81CEF3C(void); -extern u32 sub_81CEFDC(void); -extern bool32 sub_81CF330(void); -extern void sub_81CF3A0(s32); -extern u32 sub_81CF3D0(void); -extern void sub_81CEFF0(void); -extern void sub_81CF3F8(void); -extern u32 sub_81CD024(void); -extern u32 sub_81CEF98(void); -extern bool32 sub_81CF368(void); -extern u32 sub_81CF9BC(void); -extern u32 sub_81CFA34(void); -extern bool32 sub_81CFDD0(void); -extern void sub_81CFE40(s32); -extern u32 sub_81CFE70(void); -extern void sub_81CFA48(void); -extern void sub_81CFE98(void); -extern u32 sub_81D0450(void); -extern u32 sub_81D04A0(void); -extern bool32 sub_81D0978(void); -extern void sub_81D09B0(s32); -extern u32 sub_81D09E0(void); -extern void sub_81D04B8(void); -extern void sub_81D09F4(void); -extern u32 sub_81CFA04(void); -extern bool32 sub_81CFE08(void); - +static u32 sub_81C75E0(void); +static u32 sub_81C75D4(void); static bool32 SetActivePokenavMenu(u32 menuId); static bool32 AnyMonHasRibbon(void); -u32 sub_81C75E0(void); -u32 sub_81C75D4(void); -u32 PokenavMainMenuLoopedTaskIsActive(void); -bool32 WaitForPokenavShutdownFade(void); -void sub_81C7834(void *func1, void *func2); static void InitPokenavResources(struct PokenavResources *a0); -void Task_RunLoopedTask_LinkMode(u8 a0); -void Task_RunLoopedTask(u8 taskId); -void sub_81C742C(u8 taskId); -void ShutdownPokenav(void); static void InitKeys_(void); static void FreePokenavResources(void); static void VBlankCB_Pokenav(void); static void CB2_Pokenav(void); -void sub_81C72BC(void); +static void Task_RunLoopedTask_LinkMode(u8 a0); +static void Task_RunLoopedTask(u8 taskId); +static void sub_81C742C(u8 taskId); +static void sub_81C72BC(void); const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = { { - .unk0 = sub_81C9298, + .unk0 = PokenavCallback_Init_0, .unk4 = sub_81C941C, .unk8 = sub_81C9924, .unkC = sub_81C9990, @@ -106,7 +63,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81C99D4, }, { - .unk0 = sub_81C9298, + .unk0 = PokenavCallback_Init_0, .unk4 = sub_81C941C, .unk8 = sub_81C9940, .unkC = sub_81C9990, @@ -115,7 +72,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81C99D4, }, { - .unk0 = sub_81C9338, + .unk0 = PokenavCallback_Init_2, .unk4 = sub_81C941C, .unk8 = sub_81C9940, .unkC = sub_81C9990, @@ -124,7 +81,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81C99D4, }, { - .unk0 = sub_81C9368, + .unk0 = PokenavCallback_Init_3, .unk4 = sub_81C941C, .unk8 = sub_81C9940, .unkC = sub_81C9990, @@ -133,16 +90,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81C99D4, }, { - .unk0 = sub_81C92CC, - .unk4 = sub_81C941C, - .unk8 = sub_81C9940, - .unkC = sub_81C9990, - .unk10 =sub_81C99C0, - .unk14 = sub_81C9430, - .unk18 = sub_81C99D4, - }, - { - .unk0 = sub_81C9304, + .unk0 = PokenavCallback_Init_4, .unk4 = sub_81C941C, .unk8 = sub_81C9940, .unkC = sub_81C9990, @@ -151,7 +99,16 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81C99D4, }, { - .unk0 = sub_81CC4D4, + .unk0 = PokenavCallback_Init_5, + .unk4 = sub_81C941C, + .unk8 = sub_81C9940, + .unkC = sub_81C9990, + .unk10 = sub_81C99C0, + .unk14 = sub_81C9430, + .unk18 = sub_81C99D4, + }, + { + .unk0 = PokenavCallback_Init_6, .unk4 = sub_81CC554, .unk8 = sub_81CC5F4, .unkC = sub_81CC62C, @@ -160,7 +117,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81CC670, }, { - .unk0 = sub_81CCFD8, + .unk0 = PokenavCallback_Init_7, .unk4 = sub_81CD070, .unk8 = sub_81CDDD4, .unkC = sub_81CDE2C, @@ -169,7 +126,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81CECA0, }, { - .unk0 = sub_81CEF3C, + .unk0 = PokenavCallback_Init_8, .unk4 = sub_81CEFDC, .unk8 = sub_81CF330, .unkC = sub_81CF3A0, @@ -178,7 +135,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81CF3F8, }, { - .unk0 = sub_81CD024, + .unk0 = PokenavCallback_Init_9, .unk4 = sub_81CD070, .unk8 = sub_81CDDD4, .unkC = sub_81CDE2C, @@ -187,7 +144,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81CECA0, }, { - .unk0 = sub_81CEF98, + .unk0 = PokenavCallback_Init_10, .unk4 = sub_81CEFDC, .unk8 = sub_81CF368, .unkC = sub_81CF3A0, @@ -196,7 +153,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81CF3F8, }, { - .unk0 = sub_81CAAE8, + .unk0 = PokenavCallback_Init_11, .unk4 = sub_81CAB24, .unk8 = sub_81CB260, .unkC = sub_81CB29C, @@ -205,7 +162,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81CB2E0, }, { - .unk0 = sub_81CF9BC, + .unk0 = PokenavCallback_Init_12, .unk4 = sub_81CFA34, .unk8 = sub_81CFDD0, .unkC = sub_81CFE40, @@ -214,7 +171,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81CFE98, }, { - .unk0 = sub_81D0450, + .unk0 = PokenavCallback_Init_13, .unk4 = sub_81D04A0, .unk8 = sub_81D0978, .unkC = sub_81D09B0, @@ -223,7 +180,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] = .unk18 = sub_81D09F4, }, { - .unk0 = sub_81CFA04, + .unk0 = PokenavCallback_Init_14, .unk4 = sub_81CFA34, .unk8 = sub_81CFE08, .unkC = sub_81CFE40, @@ -278,7 +235,7 @@ bool32 FuncIsActiveLoopedTask(LoopedTask func) return FALSE; } -void Task_RunLoopedTask(u8 taskId) +static void Task_RunLoopedTask(u8 taskId) { LoopedTask loopedTask = (LoopedTask)GetWordTaskArg(taskId, 1); s16 *state = &gTasks[taskId].data[0]; @@ -311,7 +268,7 @@ void Task_RunLoopedTask(u8 taskId) } // Every "Continue" action pauses instead. -void Task_RunLoopedTask_LinkMode(u8 taskId) +static void Task_RunLoopedTask_LinkMode(u8 taskId) { LoopedTask task; s16 *state; @@ -366,7 +323,7 @@ void sub_81C72A4(void) FadeScreen(1, 0); } -void sub_81C72BC(void) +static void sub_81C72BC(void) { UpdatePaletteFade(); if (gPaletteFade.active) @@ -459,7 +416,7 @@ static void VBlankCB_Pokenav(void) ProcessSpriteCopyRequests(); } -void sub_81C742C(u8 taskId) +static void sub_81C742C(u8 taskId) { u32 v1; s16 *data = gTasks[taskId].data; @@ -545,12 +502,12 @@ static bool32 SetActivePokenavMenu(u32 menuId) return TRUE; } -u32 sub_81C75D4(void) +static u32 sub_81C75D4(void) { return sub_81C786C(); } -u32 sub_81C75E0(void) +static u32 sub_81C75E0(void) { return gPokenavResources->currentMenuCb1(); } diff --git a/src/pokenav_unk_1.c b/src/pokenav_unk_1.c index 336cf49f2..b5bbc4b74 100644 --- a/src/pokenav_unk_1.c +++ b/src/pokenav_unk_1.c @@ -55,7 +55,7 @@ static u8 GetPokenavMainMenuType(void) return retVal; } -bool32 sub_81C9298(void) +bool32 PokenavCallback_Init_0(void) { struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct)); if (!state) @@ -69,7 +69,7 @@ bool32 sub_81C9298(void) return TRUE; } -bool32 sub_81C92CC(void) +bool32 PokenavCallback_Init_4(void) { struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct)); if (!state) @@ -83,7 +83,7 @@ bool32 sub_81C92CC(void) return TRUE; } -bool32 sub_81C9304(void) +bool32 PokenavCallback_Init_5(void) { struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct)); if (!state) @@ -96,7 +96,7 @@ bool32 sub_81C9304(void) return TRUE; } -bool32 sub_81C9338(void) +bool32 PokenavCallback_Init_2(void) { struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct)); if (!state) @@ -110,7 +110,7 @@ bool32 sub_81C9338(void) return TRUE; } -bool32 sub_81C9368(void) +bool32 PokenavCallback_Init_3(void) { struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct)); if (!state) diff --git a/src/pokenav_unk_10.c b/src/pokenav_unk_10.c index 51dcd3687..cd2920c30 100644 --- a/src/pokenav_unk_10.c +++ b/src/pokenav_unk_10.c @@ -158,7 +158,7 @@ static const LoopedTask gUnknown_08624BA0[] = }; // code -bool32 sub_81D0450(void) +bool32 PokenavCallback_Init_13(void) { struct PokenavSub13 *structPtr = AllocSubstruct(13, sizeof(struct PokenavSub13)); if (structPtr == NULL) @@ -235,7 +235,7 @@ u32 sub_81D0548(struct PokenavSub13 *structPtr) u32 sub_81D05D4(struct PokenavSub13 *structPtr) { - return 0x186ae; + return 100014; } bool32 sub_81D05DC(struct PokenavSub13 *structPtr) diff --git a/src/pokenav_unk_3.c b/src/pokenav_unk_3.c index e44a6563a..ffb1e0a4a 100755 --- a/src/pokenav_unk_3.c +++ b/src/pokenav_unk_3.c @@ -42,7 +42,7 @@ static bool32 sub_81CB1D0(void); const u8 gUnknown_08622508[] = {0, 2}; const u8 gUnknown_0862250A[] = {0, 1, 2}; -bool32 sub_81CAAE8(void) +bool32 PokenavCallback_Init_11(void) { struct Pokenav3Struct *state = AllocSubstruct(5, sizeof(struct Pokenav3Struct)); if (!state) diff --git a/src/pokenav_unk_5.c b/src/pokenav_unk_5.c index 5226a34b3..03ac05d4d 100755 --- a/src/pokenav_unk_5.c +++ b/src/pokenav_unk_5.c @@ -166,7 +166,7 @@ const struct SpriteTemplate gUnknown_086231D0 = .callback = sub_81CCEF4, }; -u32 sub_81CC4D4(void) +u32 PokenavCallback_Init_6(void) { struct Pokenav5Struct *state = AllocSubstruct(3, sizeof(struct Pokenav5Struct)); if (!state) diff --git a/src/pokenav_unk_6.c b/src/pokenav_unk_6.c index 7b357ffb4..ac8237793 100644 --- a/src/pokenav_unk_6.c +++ b/src/pokenav_unk_6.c @@ -47,7 +47,7 @@ void sub_81CDA1C(s16 arg0, u8 arg1); void sub_81CDB98(s16 arg0, u8 arg1); // code -bool32 sub_81CCFD8(void) +bool32 PokenavCallback_Init_7(void) { struct PokenavSub11 *structPtr = AllocSubstruct(11, sizeof(struct PokenavSub11)); @@ -61,7 +61,7 @@ bool32 sub_81CCFD8(void) return TRUE; } -bool32 sub_81CD024(void) +bool32 PokenavCallback_Init_9(void) { struct PokenavSub11 *structPtr = AllocSubstruct(11, sizeof(struct PokenavSub11)); @@ -147,9 +147,9 @@ u32 sub_81CD110(struct PokenavSub11 *structPtr) u32 sub_81CD19C(struct PokenavSub11 *structPtr) { if (structPtr->unk6300 == 0) - return 0x186A2; + return 100002; else - return 0x186AA; + return 100010; } void sub_81CD1C0(void) diff --git a/src/pokenav_unk_8.c b/src/pokenav_unk_8.c index e07cba97c..888e344f1 100644 --- a/src/pokenav_unk_8.c +++ b/src/pokenav_unk_8.c @@ -117,7 +117,7 @@ static const u8 gUnknown_086235BC[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHI static const u8 gUnknown_086235C8[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}"); static const u8 gUnknown_086235D4[] = _("{UNK_SPACER}"); -bool32 sub_81CEF3C(void) +bool32 PokenavCallback_Init_8(void) { struct PokenavSub7 *structPtr = AllocSubstruct(7, sizeof(struct PokenavSub7)); if (structPtr == NULL) @@ -134,7 +134,7 @@ bool32 sub_81CEF3C(void) return TRUE; } -bool32 sub_81CEF98(void) +bool32 PokenavCallback_Init_10(void) { struct PokenavSub7 *structPtr = AllocSubstruct(7, sizeof(struct PokenavSub7)); if (structPtr == NULL) @@ -197,12 +197,12 @@ static u32 sub_81CF030(struct PokenavSub7 *structPtr) static u32 sub_81CF0B0(struct PokenavSub7 *structPtr) { - return 0x186A3; + return 100003; } static u32 sub_81CF0B8(struct PokenavSub7 *structPtr) { - return 0x186A9; + return 100009; } static u32 sub_81CF0C0(void) diff --git a/src/pokenav_unk_9.c b/src/pokenav_unk_9.c index fdc4a3328..f635b26c7 100644 --- a/src/pokenav_unk_9.c +++ b/src/pokenav_unk_9.c @@ -111,7 +111,7 @@ static const u8 gUnknown_086237DC[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHI static const u8 gUnknown_086237E8[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}"); static const u8 gUnknown_086237F4[] = _("{UNK_SPACER}"); -bool32 sub_81CF9BC(void) +bool32 PokenavCallback_Init_12(void) { struct PokenavSub9 *structPtr = AllocSubstruct(9, sizeof(struct PokenavSub9)); if (structPtr == NULL) @@ -127,7 +127,7 @@ bool32 sub_81CF9BC(void) return TRUE; } -bool32 sub_81CFA04(void) +bool32 PokenavCallback_Init_14(void) { struct PokenavSub9 *structPtr = AllocSubstruct(9, sizeof(struct PokenavSub9)); if (structPtr == NULL) @@ -188,12 +188,12 @@ static u32 sub_81CFA88(struct PokenavSub9 *structPtr) static u32 sub_81CFB08(struct PokenavSub9 *structPtr) { - return 0x186a5; + return 100005; } static u32 sub_81CFB10(struct PokenavSub9 *structPtr) { - return 0x186ad; + return 100013; } static u32 sub_81CFB18(void)