diff options
-rw-r--r-- | asm/tomomichi_debug_menu.s | 142 | ||||
-rw-r--r-- | src/debug/tomomichi_debug_menu.c | 63 |
2 files changed, 50 insertions, 155 deletions
diff --git a/asm/tomomichi_debug_menu.s b/asm/tomomichi_debug_menu.s index 065c8d05a..db5247be4 100644 --- a/asm/tomomichi_debug_menu.s +++ b/asm/tomomichi_debug_menu.s @@ -3,148 +3,6 @@ .include "constants/gba_constants.inc" .include "include/macros.inc" - thumb_func_start debug_sub_808D2BC -debug_sub_808D2BC: - push {r4, r5, lr} - bl Menu_ProcessInput - add r4, r0, #0 - lsl r4, r4, #0x18 - lsr r4, r4, #0x18 - bl Menu_GetCursorPos - add r1, r0, #0 - ldr r5, ._294 @ gDebug_0300070F - ldrb r0, [r5] - lsl r1, r1, #0x18 - lsr r1, r1, #0x18 - bl debug_sub_808D308 - ldrb r0, [r5] - bl debug_sub_808D358 - lsl r4, r4, #0x18 - asr r4, r4, #0x18 - mov r0, #0x2 - neg r0, r0 - cmp r4, r0 - beq ._291 @cond_branch - mov r0, #0x1 - neg r0, r0 - cmp r4, r0 - beq ._292 @cond_branch -._291: - mov r0, #0x0 - b ._293 -._295: - .align 2, 0 -._294: - .word gDebug_0300070F -._292: - bl CloseMenu - mov r0, #0x1 -._293: - pop {r4, r5} - pop {r1} - bx r1 - - thumb_func_end debug_sub_808D2BC - - thumb_func_start debug_sub_808D308 -debug_sub_808D308: - push {r4, lr} - lsl r0, r0, #0x18 - lsr r2, r0, #0x18 - lsl r1, r1, #0x18 - lsr r3, r1, #0x18 - ldr r0, ._299 @ gMain - ldrh r1, [r0, #0x2e] - mov r0, #0x80 - lsl r0, r0, #0x1 - and r0, r0, r1 - cmp r0, #0 - beq ._298 @cond_branch - ldr r0, ._299 + 4 @ gUnknown_Debug_083C19C6 - lsl r1, r2, #0x3 - add r1, r1, r2 - add r1, r1, r3 - lsl r1, r1, #0x1 - add r1, r1, r0 - ldrh r4, [r1] - add r0, r4, #0 - bl FlagGet - lsl r0, r0, #0x18 - cmp r0, #0 - bne ._297 @cond_branch - add r0, r4, #0 - bl FlagSet - b ._298 -._300: - .align 2, 0 -._299: - .word gMain - .word gUnknown_Debug_083C19C6 -._297: - add r0, r4, #0 - bl FlagClear -._298: - pop {r4} - pop {r0} - bx r0 - - thumb_func_end debug_sub_808D308 - - thumb_func_start debug_sub_808D358 -debug_sub_808D358: - push {r4, r5, r6, r7, lr} - mov r7, r8 - push {r7} - lsl r0, r0, #0x18 - lsr r1, r0, #0x18 - mov r5, #0x0 - ldr r0, ._303 @ gUnknown_Debug_083C19BC - add r0, r1, r0 - ldrb r2, [r0] - cmp r5, r2 - bcs ._301 @cond_branch - ldr r0, ._303 + 4 @ gUnknown_Debug_083C19C6 - mov r8, r0 - lsl r0, r1, #0x3 - add r0, r0, r1 - lsl r7, r0, #0x1 - add r6, r2, #0 -._302: - lsl r0, r5, #0x1 - add r4, r0, #1 - lsl r4, r4, #0x18 - lsr r4, r4, #0x18 - add r0, r0, r7 - add r0, r0, r8 - ldrh r0, [r0] - bl FlagGet - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - neg r2, r0 - orr r2, r2, r0 - lsr r2, r2, #0x1f - mov r0, #0x1c - add r1, r4, #0 - bl debug_sub_808F2E0 - add r0, r5, #1 - lsl r0, r0, #0x18 - lsr r5, r0, #0x18 - cmp r5, r6 - bcc ._302 @cond_branch -._301: - pop {r3} - mov r8, r3 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 -._304: - .align 2, 0 -._303: - .word gUnknown_Debug_083C19BC - .word gUnknown_Debug_083C19C6 - - thumb_func_end debug_sub_808D358 - thumb_func_start debug_sub_808D3BC debug_sub_808D3BC: push {lr} diff --git a/src/debug/tomomichi_debug_menu.c b/src/debug/tomomichi_debug_menu.c index 93b17a1f8..4d2d234bf 100644 --- a/src/debug/tomomichi_debug_menu.c +++ b/src/debug/tomomichi_debug_menu.c @@ -162,9 +162,11 @@ bool8 debug_sub_808CCC4(void); bool8 debug_sub_808CE10(void); void debug_sub_808CC10(u8); void debug_sub_808CE5C(u8, u8); -void debug_sub_808CEAC(u8); bool8 debug_sub_808CF60(void); bool8 debug_sub_808D2BC(void); +void debug_sub_808CEAC(u8); +void debug_sub_808D308(u8, u8); +void debug_sub_808D358(u8); extern const u8 DebugScript_081C1CFE[]; extern const u8 DebugScript_081C1D07[]; @@ -2504,11 +2506,10 @@ void debug_sub_808C714(u8 whichMenu, u8 cursorPos) { if (gMain.newKeys & R_BUTTON) { - u16 flag = gUnknown_Debug_83C31E6[whichMenu][cursorPos]; - if (!FlagGet(flag)) - FlagSet(flag); + if (!FlagGet(gUnknown_Debug_83C31E6[whichMenu][cursorPos])) + FlagSet(gUnknown_Debug_83C31E6[whichMenu][cursorPos]); else - FlagClear(flag); + FlagClear(gUnknown_Debug_83C31E6[whichMenu][cursorPos]); } } @@ -2667,11 +2668,10 @@ void debug_sub_808CBC0(u8 whichMenu, u8 cursorPos) { if (gMain.newKeys & R_BUTTON) { - u16 flag = gUnknown_Debug_083C271A[whichMenu][cursorPos]; - if (!FlagGet(flag)) - FlagSet(flag); + if (!FlagGet(gUnknown_Debug_083C271A[whichMenu][cursorPos])) + FlagSet(gUnknown_Debug_083C271A[whichMenu][cursorPos]); else - FlagClear(flag); + FlagClear(gUnknown_Debug_083C271A[whichMenu][cursorPos]); } } @@ -2764,11 +2764,10 @@ void debug_sub_808CE5C(u8 whichMenu, u8 cursorPos) { if (gMain.newKeys & R_BUTTON) { - u16 flag = gUnknown_Debug_083C1C38[whichMenu][cursorPos]; - if (!FlagGet(flag)) - FlagSet(flag); + if (!FlagGet(gUnknown_Debug_083C1C38[whichMenu][cursorPos])) + FlagSet(gUnknown_Debug_083C1C38[whichMenu][cursorPos]); else - FlagClear(flag); + FlagClear(gUnknown_Debug_083C1C38[whichMenu][cursorPos]); } } @@ -2906,4 +2905,42 @@ bool8 debug_sub_808D264(void) return FALSE; } +bool8 debug_sub_808D2BC(void) +{ + s8 input = Menu_ProcessInput(); + s8 cursorPos = Menu_GetCursorPos(); + + debug_sub_808D308(gDebug_0300070F, cursorPos); + debug_sub_808D358(gDebug_0300070F); + if (input == -2) + return FALSE; + if (input == -1) + { + CloseMenu(); + return TRUE; + } + return FALSE; +} + +void debug_sub_808D308(u8 whichMenu, u8 cursorPos) +{ + if (gMain.newKeys & R_BUTTON) + { + if (!FlagGet(gUnknown_Debug_083C19C6[whichMenu][cursorPos])) + FlagSet(gUnknown_Debug_083C19C6[whichMenu][cursorPos]); + else + FlagClear(gUnknown_Debug_083C19C6[whichMenu][cursorPos]); + } +} + +void debug_sub_808D358(u8 whichMenu) +{ + u8 i; + + for (i = 0; i < gUnknown_Debug_083C19BC[whichMenu]; i++) + { + debug_sub_808F2E0(28, 2 * i + 1, FlagGet(gUnknown_Debug_083C19C6[whichMenu][i]) ? TRUE : FALSE); + } +} + #endif |