diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-04-01 21:07:55 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-04-01 21:07:55 -0400 |
commit | b74fb2562faee0317013ec9b1ea50032973508ef (patch) | |
tree | 1e5a17e011324de0e43287a10d12117f9056e36e | |
parent | af04028ecebcc5631987699b399f745550794db2 (diff) |
through debug_sub_815FC94
-rw-r--r-- | asm/nakamura_debug_menu.s | 342 | ||||
-rw-r--r-- | include/decoration_inventory.h | 3 | ||||
-rw-r--r-- | include/roamer.h | 7 | ||||
-rw-r--r-- | src/debug/nakamura_debug_menu.c | 312 |
4 files changed, 165 insertions, 499 deletions
diff --git a/asm/nakamura_debug_menu.s b/asm/nakamura_debug_menu.s index 408fa7a4e..76db41a4d 100644 --- a/asm/nakamura_debug_menu.s +++ b/asm/nakamura_debug_menu.s @@ -5,348 +5,6 @@ .text - thumb_func_start debug_sub_815FA38 -debug_sub_815FA38: - push {r4, lr} - ldr r0, ._139 @ gMain - ldrh r1, [r0, #0x2e] - mov r0, #0x40 - and r0, r0, r1 - cmp r0, #0 - beq ._137 @cond_branch - mov r0, #0x2 - neg r0, r0 - b ._138 -._140: - .align 2, 0 -._139: - .word gMain -._137: - mov r0, #0x80 - and r0, r0, r1 - cmp r0, #0 - beq ._141 @cond_branch - mov r0, #0x2 -._138: - bl Menu_MoveCursor -._161: - mov r0, #0x0 - b ._142 -._141: - mov r0, #0x20 - and r0, r0, r1 - lsl r0, r0, #0x10 - lsr r2, r0, #0x10 - cmp r2, #0 - beq ._143 @cond_branch - ldr r1, ._146 @ _nakamuraData0 - ldrb r0, [r1] - cmp r0, #0 - bne ._144 @cond_branch - mov r0, #0x13 - b ._148 -._147: - .align 2, 0 -._146: - .word _nakamuraData0 -._144: - sub r0, r0, #0x1 - b ._148 -._143: - mov r0, #0x10 - and r0, r0, r1 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 - cmp r4, #0 - beq ._149 @cond_branch - ldr r1, ._152 @ _nakamuraData0 - ldrb r0, [r1] - cmp r0, #0x13 - bne ._150 @cond_branch - strb r2, [r1] - b ._151 -._153: - .align 2, 0 -._152: - .word _nakamuraData0 -._150: - add r0, r0, #0x1 -._148: - strb r0, [r1] -._151: - bl debug_sub_815F72C - b ._161 -._149: - mov r0, #0x1 - and r0, r0, r1 - cmp r0, #0 - beq ._155 @cond_branch - ldr r1, ._159 @ _nakamuraData0 - ldrb r0, [r1] - cmp r0, #0 - beq ._161 @cond_branch - ldr r2, ._159 + 4 @ gSaveBlock1 - add r1, r0, #0 - lsl r0, r1, #0x2 - add r0, r0, r1 - lsl r0, r0, #0x5 - add r0, r0, r2 - ldr r1, ._159 + 8 @ 0x1a08 - add r0, r0, r1 - ldrb r0, [r0] - cmp r0, #0 - beq ._161 @cond_branch - bl Menu_GetCursorPos - ldr r1, ._159 + 12 @ _nakamuraData1 - strb r0, [r1] - ldr r0, ._159 + 16 @ _nakamuraData2 - strb r4, [r0] - bl debug_sub_815F788 - bl debug_sub_815F7B4 - ldr r1, ._159 + 20 @ gMenuCallback - ldr r0, ._159 + 24 @ debug_sub_815F930 - str r0, [r1] - b ._161 -._160: - .align 2, 0 -._159: - .word _nakamuraData0 - .word gSaveBlock1 - .word 0x1a08 - .word _nakamuraData1 - .word _nakamuraData2 - .word gMenuCallback - .word debug_sub_815F930+1 -._155: - mov r0, #0x2 - and r0, r0, r1 - cmp r0, #0 - beq ._161 @cond_branch - bl CloseMenu - mov r0, #0x1 -._142: - pop {r4} - pop {r1} - bx r1 - - thumb_func_end debug_sub_815FA38 - - thumb_func_start debug_sub_815FB1C -debug_sub_815FB1C: - push {lr} - add sp, sp, #0xfffffff8 - ldr r0, ._162 @ _nakamuraData0 - mov r1, #0x0 - strb r1, [r0] - ldr r0, ._162 + 4 @ _nakamuraData3 - strb r1, [r0] - ldr r1, ._162 + 8 @ gMenuCallback - ldr r0, ._162 + 12 @ debug_sub_815FA38 - str r0, [r1] - mov r0, #0x0 - mov r1, #0x0 - mov r2, #0x1d - mov r3, #0x13 - bl Menu_EraseWindowRect - mov r0, #0x0 - mov r1, #0x0 - mov r2, #0xc - mov r3, #0xb - bl Menu_DrawStdWindowFrame - bl debug_sub_815F72C - mov r0, #0x0 - str r0, [sp] - mov r0, #0xb - str r0, [sp, #0x4] - mov r0, #0x0 - mov r1, #0x1 - mov r2, #0x3 - mov r3, #0x3 - bl InitMenu - mov r0, #0x0 - add sp, sp, #0x8 - pop {r1} - bx r1 -._163: - .align 2, 0 -._162: - .word _nakamuraData0 - .word _nakamuraData3 - .word gMenuCallback - .word debug_sub_815FA38+1 - - thumb_func_end debug_sub_815FB1C - - thumb_func_start debug_sub_815FB78 -debug_sub_815FB78: - push {lr} - ldr r0, ._166 @ gMain - ldrh r1, [r0, #0x2e] - mov r0, #0x40 - and r0, r0, r1 - cmp r0, #0 - beq ._164 @cond_branch - mov r0, #0x1 - neg r0, r0 - b ._165 -._167: - .align 2, 0 -._166: - .word gMain -._164: - mov r0, #0x80 - and r0, r0, r1 - cmp r0, #0 - beq ._168 @cond_branch - mov r0, #0x1 -._165: - bl Menu_MoveCursor - mov r0, #0x0 - b ._177 -._168: - mov r0, #0x1 - and r0, r0, r1 - cmp r0, #0 - beq ._170 @cond_branch - bl CloseMenu - bl Menu_GetCursorPos - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - cmp r0, #0 - beq ._171 @cond_branch - cmp r0, #0x1 - beq ._172 @cond_branch - b ._175 -._171: - bl debug_sub_814A714 - b ._175 -._172: - bl ClearRoamerData - bl ClearRoamerLocationData - b ._175 -._170: - mov r0, #0x2 - and r0, r0, r1 - cmp r0, #0 - bne ._176 @cond_branch - mov r0, #0x0 - b ._177 -._176: - bl CloseMenu -._175: - mov r0, #0x1 -._177: - pop {r1} - bx r1 - - thumb_func_end debug_sub_815FB78 - - thumb_func_start debug_sub_815FBE8 -debug_sub_815FBE8: - push {r4, lr} - add sp, sp, #0xfffffff8 - ldr r1, ._178 @ gMenuCallback - ldr r0, ._178 + 4 @ debug_sub_815FB78 - str r0, [r1] - mov r0, #0x0 - mov r1, #0x0 - mov r2, #0x1d - mov r3, #0x13 - bl Menu_EraseWindowRect - ldr r4, ._178 + 8 @ gStringVar1 - add r0, r4, #0 - bl debug_sub_814A73C - mov r0, #0x0 - mov r1, #0x0 - mov r2, #0xb - mov r3, #0x9 - bl Menu_DrawStdWindowFrame - add r0, r4, #0 - mov r1, #0x1 - mov r2, #0x1 - bl Menu_PrintText - ldr r0, ._178 + 12 @ Str_843E580 - mov r1, #0x2 - mov r2, #0x3 - bl Menu_PrintText - mov r0, #0x0 - str r0, [sp] - mov r0, #0xa - str r0, [sp, #0x4] - mov r0, #0x0 - mov r1, #0x1 - mov r2, #0x3 - mov r3, #0x3 - bl InitMenu - mov r0, #0x0 - add sp, sp, #0x8 - pop {r4} - pop {r1} - bx r1 -._179: - .align 2, 0 -._178: - .word gMenuCallback - .word debug_sub_815FB78+1 - .word gStringVar1 - .word Str_843E580 - - thumb_func_end debug_sub_815FBE8 - - thumb_func_start debug_sub_815FC54 -debug_sub_815FC54: - push {r4, r5, r6, r7, lr} - mov r3, #0x0 - ldr r7, ._181 @ gSaveBlock1 - mov r6, #0xe8 - lsl r6, r6, #0x3 - ldr r5, ._181 + 4 @ 0x3e7 - ldr r4, ._181 + 8 @ 0x742 -._180: - lsl r1, r3, #0x2 - add r1, r1, r7 - add r2, r3, #0 - add r2, r2, #0x85 - add r0, r1, r6 - strh r2, [r0] - add r1, r1, r4 - strh r5, [r1] - add r0, r3, #1 - lsl r0, r0, #0x10 - lsr r3, r0, #0x10 - cmp r3, #0x2a - bls ._180 @cond_branch - bl CloseMenu - mov r0, #0x1 - pop {r4, r5, r6, r7} - pop {r1} - bx r1 -._182: - .align 2, 0 -._181: - .word gSaveBlock1 - .word 0x3e7 - .word 0x742 - - thumb_func_end debug_sub_815FC54 - - thumb_func_start debug_sub_815FC94 -debug_sub_815FC94: - push {lr} - bl ClearDecorationInventories - bl debug_sub_814A3A8 - mov r0, #0x0 - mov r1, #0x0 - mov r2, #0x1d - mov r3, #0x13 - bl Menu_EraseWindowRect - bl CloseMenu - mov r0, #0x1 - pop {r1} - bx r1 - - thumb_func_end debug_sub_815FC94 - thumb_func_start debug_sub_815FCB4 debug_sub_815FCB4: push {r4, r5, r6, r7, lr} diff --git a/include/decoration_inventory.h b/include/decoration_inventory.h index e59a23008..0772aacf6 100644 --- a/include/decoration_inventory.h +++ b/include/decoration_inventory.h @@ -8,5 +8,8 @@ u8 IsThereStorageSpaceForDecoration(u8); u8 sub_8134074(u8); s8 sub_81340A8(u8); u8 sub_8134194(u8); +#if DEBUG +void debug_sub_814A3A8(void); +#endif // DEBUG #endif // GUARD_DECORATION_INVENTORY_H diff --git a/include/roamer.h b/include/roamer.h index 86908bd00..c91742d44 100644 --- a/include/roamer.h +++ b/include/roamer.h @@ -10,4 +10,9 @@ u8 TryStartRoamerEncounter(void); void UpdateRoamerHPStatus(struct Pokemon *mon); void SetRoamerInactive(void); -#endif +#if DEBUG +void debug_sub_814A714(void); +void debug_sub_814A73C(u8 *); +#endif // DEBUG + +#endif // GUARD_ROAMER_H diff --git a/src/debug/nakamura_debug_menu.c b/src/debug/nakamura_debug_menu.c index 959b9eae3..e16f0332a 100644 --- a/src/debug/nakamura_debug_menu.c +++ b/src/debug/nakamura_debug_menu.c @@ -1,5 +1,6 @@ #if DEBUG #include "global.h" +#include "constants/items.h" #include "random.h" #include "palette.h" #include "main.h" @@ -9,6 +10,8 @@ #include "party_menu.h" #include "choose_party.h" #include "secret_base.h" +#include "roamer.h" +#include "decoration_inventory.h" #include "menu.h" typedef bool8 (*MenuFunc)(void); @@ -518,7 +521,6 @@ void debug_sub_815F86C(s8 a0) debug_sub_815F6E4(); } -#ifdef NONMATCHING bool8 debug_sub_815F930(void) { u32 r4 = _nakamuraData1 == 0 ? 7 : 10; @@ -529,206 +531,204 @@ bool8 debug_sub_815F930(void) debug_sub_815F7F0(1); else debug_sub_815F86C(1); + return FALSE; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (gMain.newAndRepeatedKeys & DPAD_DOWN) { if (_nakamuraData1) debug_sub_815F7F0(-1); else debug_sub_815F86C(-1); + return FALSE; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (gMain.newAndRepeatedKeys & DPAD_LEFT) { if (_nakamuraData2 == 0) _nakamuraData2 = r4 - 1; else _nakamuraData2--; debug_sub_815F788(); + return FALSE; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + if (gMain.newAndRepeatedKeys & DPAD_RIGHT) { if (_nakamuraData2 == r4 - 1) _nakamuraData2 = 0; else _nakamuraData2++; debug_sub_815F788(); + return FALSE; } - else if (gMain.newKeys & SELECT_BUTTON) + if (gMain.newKeys & SELECT_BUTTON) { if (_nakamuraData1 == 0) _nakamuraData3 = (_nakamuraData3 + 1) % 5; debug_sub_815F7B4(); + return FALSE; } - else if (gMain.newKeys & A_BUTTON) + if (gMain.newKeys & A_BUTTON) { Menu_BlankWindowRect(2, 5, 11, 6); Menu_BlankWindowRect(11, 1, 11, 2); gMenuCallback = debug_sub_815FA38; + return FALSE; } - else if (gMain.newKeys & B_BUTTON) + if (gMain.newKeys & B_BUTTON) { if (_nakamuraData1 == 0) debug_sub_815F86C(100); + return FALSE; + } + + return FALSE; +} + +bool8 debug_sub_815FA38(void) +{ + if (gMain.newKeys & DPAD_UP) + { + Menu_MoveCursor(-2); + return FALSE; + } + + if (gMain.newKeys & DPAD_DOWN) + { + Menu_MoveCursor(+2); + return FALSE; + } + + if (gMain.newKeys & DPAD_LEFT) + { + if (_nakamuraData0 == 0) + _nakamuraData0 = 19; + else + _nakamuraData0--; + debug_sub_815F72C(); + return FALSE; + } + + if (gMain.newKeys & DPAD_RIGHT) + { + if (_nakamuraData0 == 19) + _nakamuraData0 = 0; + else + _nakamuraData0++; + debug_sub_815F72C(); + return FALSE; + } + + if (gMain.newKeys & A_BUTTON) + { + if (_nakamuraData0 != 0 && gSaveBlock1.secretBases[_nakamuraData0].secretBaseId != 0) + { + _nakamuraData1 = Menu_GetCursorPos(); + _nakamuraData2 = 0; + debug_sub_815F788(); + debug_sub_815F7B4(); + gMenuCallback = debug_sub_815F930; + } + return FALSE; + } + + if (gMain.newKeys & B_BUTTON) + { + CloseMenu(); + return TRUE; + } + + return FALSE; +} + +bool8 debug_sub_815FB1C(void) +{ + _nakamuraData0 = 0; + _nakamuraData3 = 0; + gMenuCallback = debug_sub_815FA38; + Menu_EraseWindowRect(0, 0, 29, 19); + Menu_DrawStdWindowFrame(0, 0, 12, 11); + debug_sub_815F72C(); + InitMenu(0, 1, 3, 3, 0, 11); + return FALSE; +} + +bool8 debug_sub_815FB78(void) +{ + if (gMain.newKeys & DPAD_UP) + { + Menu_MoveCursor(-1); + return FALSE; } + if (gMain.newKeys & DPAD_DOWN) + { + Menu_MoveCursor(+1); + return FALSE; + } + + if (gMain.newKeys & A_BUTTON) + { + CloseMenu(); + switch (Menu_GetCursorPos()) + { + case 0: + debug_sub_814A714(); + break; + case 1: + ClearRoamerData(); + ClearRoamerLocationData(); + break; + } + return TRUE; + } + + if (gMain.newKeys & B_BUTTON) + { + CloseMenu(); + return TRUE; + } + + return FALSE; +} + +bool8 debug_sub_815FBE8(void) +{ + gMenuCallback = debug_sub_815FB78; + Menu_EraseWindowRect(0, 0, 29, 19); + debug_sub_814A73C(gStringVar1); + Menu_DrawStdWindowFrame(0, 0, 11, 9); + Menu_PrintText(gStringVar1, 1, 1); + Menu_PrintText(Str_843E580, 2, 3); + InitMenu(0, 1, 3, 3, 0, 10); return FALSE; } -#else -__attribute__((naked)) bool8 debug_sub_815F930(void) + +bool8 debug_sub_815FC54(void) +{ + u16 i; + + for (i = 0; i < 43; i++) + { + gSaveBlock1.bagPocket_Berries[i].itemId = ITEM_CHERI_BERRY + i; + gSaveBlock1.bagPocket_Berries[i].quantity = 999; + } + + CloseMenu(); + return TRUE; +} + +bool8 debug_sub_815FC94(void) { - asm("\tpush\t{r4, r5, lr}\n" - "\tldr\tr0, ._107 @ _nakamuraData1\n" - "\tldrb\tr2, [r0]\n" - "\tmov\tr4, #0xa\n" - "\tcmp\tr2, #0\n" - "\tbne\t._103\t@cond_branch\n" - "\tmov\tr4, #0x7\n" - "._103:\n" - "\tldr\tr5, ._107 + 4 @ gMain\n" - "\tldrh\tr1, [r5, #0x30]\n" - "\tmov\tr0, #0x40\n" - "\tand\tr0, r0, r1\n" - "\tcmp\tr0, #0\n" - "\tbeq\t._104\t@cond_branch\n" - "\tcmp\tr2, #0\n" - "\tbeq\t._105\t@cond_branch\n" - "\tmov\tr0, #0x1\n" - "\tbl\tdebug_sub_815F7F0\n" - "\tb\t._136\n" - "._108:\n" - "\t.align\t2, 0\n" - "._107:\n" - "\t.word\t_nakamuraData1\n" - "\t.word\tgMain\n" - "._105:\n" - "\tmov\tr0, #0x1\n" - "\tb\t._113\n" - "._104:\n" - "\tmov\tr0, #0x80\n" - "\tand\tr0, r0, r1\n" - "\tcmp\tr0, #0\n" - "\tbeq\t._110\t@cond_branch\n" - "\tcmp\tr2, #0\n" - "\tbeq\t._111\t@cond_branch\n" - "\tmov\tr0, #0x1\n" - "\tneg\tr0, r0\n" - "\tbl\tdebug_sub_815F7F0\n" - "\tb\t._136\n" - "._111:\n" - "\tmov\tr0, #0x1\n" - "\tneg\tr0, r0\n" - "\tb\t._113\n" - "._110:\n" - "\tmov\tr0, #0x20\n" - "\tand\tr0, r0, r1\n" - "\tlsl\tr0, r0, #0x10\n" - "\tlsr\tr3, r0, #0x10\n" - "\tcmp\tr3, #0\n" - "\tbeq\t._114\t@cond_branch\n" - "\tldr\tr1, ._117 @ _nakamuraData2\n" - "\tldrb\tr0, [r1]\n" - "\tcmp\tr0, #0\n" - "\tbne\t._115\t@cond_branch\n" - "\tsub\tr0, r4, #1\n" - "\tb\t._116\n" - "._118:\n" - "\t.align\t2, 0\n" - "._117:\n" - "\t.word\t_nakamuraData2\n" - "._115:\n" - "\tsub\tr0, r0, #0x1\n" - "._116:\n" - "\tstrb\tr0, [r1]\n" - "._125:\n" - "\tbl\tdebug_sub_815F788\n" - "\tb\t._136\n" - "._114:\n" - "\tmov\tr0, #0x10\n" - "\tand\tr0, r0, r1\n" - "\tcmp\tr0, #0\n" - "\tbeq\t._120\t@cond_branch\n" - "\tldr\tr2, ._123 @ _nakamuraData2\n" - "\tldrb\tr1, [r2]\n" - "\tsub\tr0, r4, #1\n" - "\tcmp\tr1, r0\n" - "\tbne\t._121\t@cond_branch\n" - "\tstrb\tr3, [r2]\n" - "\tb\t._125\n" - "._124:\n" - "\t.align\t2, 0\n" - "._123:\n" - "\t.word\t_nakamuraData2\n" - "._121:\n" - "\tadd\tr0, r1, #1\n" - "\tstrb\tr0, [r2]\n" - "\tb\t._125\n" - "._120:\n" - "\tldrh\tr1, [r5, #0x2e]\n" - "\tmov\tr0, #0x4\n" - "\tand\tr0, r0, r1\n" - "\tcmp\tr0, #0\n" - "\tbeq\t._126\t@cond_branch\n" - "\tcmp\tr2, #0\n" - "\tbne\t._127\t@cond_branch\n" - "\tldr\tr4, ._129 @ _nakamuraData3\n" - "\tldrb\tr0, [r4]\n" - "\tadd\tr0, r0, #0x1\n" - "\tmov\tr1, #0x5\n" - "\tbl\t__modsi3\n" - "\tstrb\tr0, [r4]\n" - "._127:\n" - "\tbl\tdebug_sub_815F7B4\n" - "\tb\t._136\n" - "._130:\n" - "\t.align\t2, 0\n" - "._129:\n" - "\t.word\t_nakamuraData3\n" - "._126:\n" - "\tmov\tr0, #0x1\n" - "\tand\tr0, r0, r1\n" - "\tcmp\tr0, #0\n" - "\tbeq\t._131\t@cond_branch\n" - "\tmov\tr0, #0x2\n" - "\tmov\tr1, #0x5\n" - "\tmov\tr2, #0xb\n" - "\tmov\tr3, #0x6\n" - "\tbl\tMenu_BlankWindowRect\n" - "\tmov\tr0, #0xb\n" - "\tmov\tr1, #0x1\n" - "\tmov\tr2, #0xb\n" - "\tmov\tr3, #0x2\n" - "\tbl\tMenu_BlankWindowRect\n" - "\tldr\tr1, ._133 @ gMenuCallback\n" - "\tldr\tr0, ._133 + 4 @ debug_sub_815FA38\n" - "\tstr\tr0, [r1]\n" - "\tb\t._136\n" - "._134:\n" - "\t.align\t2, 0\n" - "._133:\n" - "\t.word\tgMenuCallback\n" - "\t.word\tdebug_sub_815FA38+1\n" - "._131:\n" - "\tmov\tr0, #0x2\n" - "\tand\tr0, r0, r1\n" - "\tcmp\tr0, #0\n" - "\tbeq\t._136\t@cond_branch\n" - "\tcmp\tr2, #0\n" - "\tbne\t._136\t@cond_branch\n" - "\tmov\tr0, #0x64\n" - "._113:\n" - "\tbl\tdebug_sub_815F86C\n" - "._136:\n" - "\tmov\tr0, #0x0\n" - "\tpop\t{r4, r5}\n" - "\tpop\t{r1}\n" - "\tbx\tr1"); + ClearDecorationInventories(); + debug_sub_814A3A8(); + Menu_EraseWindowRect(0, 0, 29, 19); + CloseMenu(); + return TRUE; } -#endif // NONMATCHING #endif // DEBUG |