diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-04-01 16:05:19 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-04-01 16:05:19 -0400 |
commit | cd0a93d88b8f05db0e4b68490392186c918cad57 (patch) | |
tree | 6b36a9bdc43c6de673c56b4b3f33a29cd073bf13 | |
parent | 6725a429fe84f0b024695c4fa176f1c6f8b842e5 (diff) |
through debug_sub_815F5C4
-rw-r--r-- | asm/nakamura_debug_menu.s | 227 | ||||
-rw-r--r-- | include/secret_base.h | 1 | ||||
-rw-r--r-- | src/debug/nakamura_debug_menu.c | 233 |
3 files changed, 157 insertions, 304 deletions
diff --git a/asm/nakamura_debug_menu.s b/asm/nakamura_debug_menu.s index 7e6feb25c..6ddce1855 100644 --- a/asm/nakamura_debug_menu.s +++ b/asm/nakamura_debug_menu.s @@ -5,233 +5,6 @@ .text - thumb_func_start debug_sub_815F470 -debug_sub_815F470: - push {r4, r5, r6, r7, lr} - add r6, r0, #0 - add r7, r1, #0 - mov ip, r2 - ldr r2, ._39 @ gSaveBlock1 - ldr r0, ._39 + 4 @ _nakamuraData0 - ldrb r1, [r0] - lsl r0, r1, #0x2 - add r0, r0, r1 - lsl r0, r0, #0x5 - add r0, r0, r2 - ldr r1, ._39 + 8 @ 0x1a08 - add r0, r0, r1 - ldrb r4, [r0] - mov r2, #0x0 - ldr r3, ._39 + 12 @ _843E424 - add r5, r3, #0 -._41: - lsl r1, r2, #0x2 - add r0, r1, r5 - ldrb r0, [r0] - cmp r0, r4 - bne ._37 @cond_branch - add r0, r1, #1 - add r0, r0, r3 - ldrb r0, [r0] - strb r0, [r6] - add r0, r1, #2 - add r0, r0, r3 - ldrb r0, [r0] - strb r0, [r7] - add r0, r1, #3 - add r0, r0, r3 - ldrb r0, [r0] - mov r1, ip - strb r0, [r1] - b ._38 -._40: - .align 2, 0 -._39: - .word gSaveBlock1 - .word _nakamuraData0 - .word 0x1a08 - .word _843E424 -._37: - add r0, r2, #1 - lsl r0, r0, #0x18 - lsr r2, r0, #0x18 - cmp r2, #0x4a - bls ._41 @cond_branch -._38: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - - thumb_func_end debug_sub_815F470 - - thumb_func_start debug_sub_815F4D8 -debug_sub_815F4D8: - push {r4, r5, r6, r7, lr} - add sp, sp, #0xfffffffc - mov r0, #0x1 - mov r1, #0x1 - mov r2, #0xa - mov r3, #0xa - bl Menu_BlankWindowRect - ldr r6, ._43 @ gStringVar1 - ldr r7, ._43 + 4 @ _nakamuraData0 - ldrb r1, [r7] - add r0, r6, #0 - mov r2, #0x0 - mov r3, #0x2 - bl ConvertIntToDecimalStringN - add r0, r6, #0 - mov r1, #0x1 - mov r2, #0x1 - bl Menu_PrintText - ldr r2, ._43 + 8 @ gSaveBlock1 - ldrb r1, [r7] - lsl r0, r1, #0x2 - add r0, r0, r1 - lsl r0, r0, #0x5 - add r0, r0, r2 - ldr r1, ._43 + 12 @ 0x1a08 - add r0, r0, r1 - ldrb r0, [r0] - cmp r0, #0 - beq ._42 @cond_branch - mov r4, sp - add r4, r4, #0x1 - mov r5, sp - add r5, r5, #0x2 - mov r0, sp - add r1, r4, #0 - add r2, r5, #0 - bl debug_sub_815F470 - ldrb r1, [r7] - add r0, r6, #0 - bl sub_80BC190 - add r0, r6, #0 - mov r1, #0x1 - mov r2, #0x3 - bl Menu_PrintText - ldr r0, ._43 + 16 @ Str_843E550 - mov r1, #0x1 - mov r2, #0x5 - bl Menu_PrintText - mov r0, sp - ldrb r1, [r0] - add r0, r6, #0 - mov r2, #0x0 - mov r3, #0x3 - bl ConvertIntToDecimalStringN - add r0, r6, #0 - mov r1, #0x2 - mov r2, #0x5 - bl Menu_PrintText - ldr r0, ._43 + 20 @ Str_843E552 - mov r1, #0x1 - mov r2, #0x7 - bl Menu_PrintText - ldrb r1, [r4] - add r0, r6, #0 - mov r2, #0x0 - mov r3, #0x3 - bl ConvertIntToDecimalStringN - add r0, r6, #0 - mov r1, #0x3 - mov r2, #0x7 - bl Menu_PrintText - ldr r0, ._43 + 24 @ Str_843E554 - mov r1, #0x1 - mov r2, #0x9 - bl Menu_PrintText - ldrb r1, [r5] - add r0, r6, #0 - mov r2, #0x0 - mov r3, #0x3 - bl ConvertIntToDecimalStringN - add r0, r6, #0 - mov r1, #0x3 - mov r2, #0x9 - bl Menu_PrintText -._42: - add sp, sp, #0x4 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 -._44: - .align 2, 0 -._43: - .word gStringVar1 - .word _nakamuraData0 - .word gSaveBlock1 - .word 0x1a08 - .word Str_843E550 - .word Str_843E552 - .word Str_843E554 - - thumb_func_end debug_sub_815F4D8 - - thumb_func_start debug_sub_815F5C4 -debug_sub_815F5C4: - push {lr} - ldr r0, ._48 @ gMain - ldrh r1, [r0, #0x2e] - mov r0, #0x20 - and r0, r0, r1 - lsl r0, r0, #0x10 - lsr r2, r0, #0x10 - cmp r2, #0 - beq ._45 @cond_branch - ldr r1, ._48 + 4 @ _nakamuraData0 - ldrb r0, [r1] - cmp r0, #0 - bne ._46 @cond_branch - mov r0, #0x13 - b ._50 -._49: - .align 2, 0 -._48: - .word gMain - .word _nakamuraData0 -._46: - sub r0, r0, #0x1 - b ._50 -._45: - mov r0, #0x10 - and r0, r0, r1 - cmp r0, #0 - beq ._51 @cond_branch - ldr r1, ._54 @ _nakamuraData0 - ldrb r0, [r1] - cmp r0, #0x13 - bne ._52 @cond_branch - strb r2, [r1] - b ._53 -._55: - .align 2, 0 -._54: - .word _nakamuraData0 -._52: - add r0, r0, #0x1 -._50: - strb r0, [r1] -._53: - bl debug_sub_815F4D8 - mov r0, #0x0 - b ._58 -._51: - mov r0, #0x2 - and r0, r0, r1 - cmp r0, #0 - bne ._57 @cond_branch - mov r0, #0x0 - b ._58 -._57: - bl CloseMenu - mov r0, #0x1 -._58: - pop {r1} - bx r1 - - thumb_func_end debug_sub_815F5C4 - thumb_func_start debug_sub_815F62C debug_sub_815F62C: push {lr} diff --git a/include/secret_base.h b/include/secret_base.h index 7f60e0f79..450850155 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -22,6 +22,7 @@ void sub_80BCF1C(u8 taskId); void sub_80BD674(void *playerRecords, u32 size, u8 c); #if DEBUG void unref_sub_80BCD7C(u8 secretBaseIndex); +u8 *sub_80BC190(u8 *dest, u8 arg1); #endif #endif // GUARD_SECRET_BASE_H diff --git a/src/debug/nakamura_debug_menu.c b/src/debug/nakamura_debug_menu.c index 6d5a27a30..623294254 100644 --- a/src/debug/nakamura_debug_menu.c +++ b/src/debug/nakamura_debug_menu.c @@ -3,6 +3,7 @@ #include "random.h" #include "palette.h" #include "main.h" +#include "string_util.h" #include "overworld.h" #include "start_menu.h" #include "party_menu.h" @@ -64,82 +65,82 @@ const struct MenuAction _843E3DC[] = { { Str_843E3AF, debug_sub_8160D98 }, }; -const u8 _843E424[][4] = { - { 1, 118, 47, 14 }, - { 2, 125, 53, 10 }, - { 3, 113, 49, 8 }, - { 0xB, 118, 67, 6 }, - { 0xC, 121, 40, 11 }, - { 0xD, 111, 35, 1 }, - { 0x15, 115, 20, 53 }, - { 0x16, 121, 18, 13 }, - { 0x17, 119, 26, 81 }, - { 0x1F, 127, 59, 67 }, - { 0x20, 125, 55, 11 }, - { 0x21, 111, 27, 27 }, - { 0x29, 114, 9, 47 }, - { 0x2A, 115, 32, 39 }, - { 0x2B, 115, 23, 8 }, - { 0x33, 114, 30, 51 }, - { 0x34, 115, 26, 15 }, - { 0x35, 115, 32, 46 }, - { 0x3D, 114, 11, 62 }, - { 0x3E, 115, 21, 18 }, - { 0x3F, 115, 25, 24 }, - { 0x47, 114, 19, 70 }, - { 0x48, 115, 32, 6 }, - { 0x49, 114, 32, 57 }, - { 0x51, 116, 71, 4 }, - { 0x52, 123, 47, 3 }, - { 0x53, 123, 57, 5 }, - { 0x5B, 116, 79, 11 }, - { 0x5C, 123, 49, 3 }, - { 0x5D, 120, 18, 12 }, - { 0x65, 120, 28, 62 }, - { 0x66, 116, 56, 6 }, - { 0x67, 119, 16, 81 }, - { 0x6F, 120, 30, 62 }, - { 0x70, 116, 55, 15 }, - { 0x71, 119, 16, 28 }, - { 0x79, 111, 33, 34 }, - { 0x7A, 118, 29, 5 }, - { 0x7B, 127, 45, 24 }, - { 0x83, 111, 24, 36 }, - { 0x84, 125, 7, 25 }, - { 0x85, 115, 8, 30 }, - { 0x8D, 111, 34, 50 }, - { 0x8E, 127, 59, 72 }, - { 0x8F, 127, 61, 21 }, - { 0x97, 127, 67, 63 }, - { 0x98, 125, 24, 32 }, - { 0x99, 111, 35, 31 }, - { 0xA1, 111, 13, 19 }, - { 0xA2, 121, 43, 7 }, - { 0xA3, 118, 47, 5 }, - { 0xA4, 111, 14, 19 }, - { 0xAB, 118, 46, 5 }, - { 0xAC, 121, 42, 7 }, - { 0xAD, 119, 19, 76 }, - { 0xAE, 115, 7, 20 }, - { 0xB5, 110, 16, 25 }, - { 0xB6, 114, 11, 27 }, - { 0xB7, 115, 8, 20 }, - { 0xBF, 110, 17, 25 }, - { 0xC0, 114, 12, 27 }, - { 0xC1, 119, 18, 76 }, - { 0xC9, 119, 5, 2 }, - { 0xCA, 119, 4, 89 }, - { 0xCB, 120, 38, 54 }, - { 0xCC, 120, 5, 76 }, - { 0xD3, 119, 5, 15 }, - { 0xD4, 119, 7, 101 }, - { 0xD5, 120, 31, 23 }, - { 0xDD, 119, 34, 24 }, - { 0xDE, 120, 26, 10 }, - { 0xDF, 119, 4, 15 }, - { 0xE7, 119, 31, 73 }, - { 0xE8, 120, 29, 85 }, - { 0xE9, 119, 6, 2 }, +const u8 _843E424[] = { + 1, 118, 47, 14 , + 2, 125, 53, 10 , + 3, 113, 49, 8 , + 0xB, 118, 67, 6 , + 0xC, 121, 40, 11 , + 0xD, 111, 35, 1 , + 0x15, 115, 20, 53 , + 0x16, 121, 18, 13 , + 0x17, 119, 26, 81 , + 0x1F, 127, 59, 67 , + 0x20, 125, 55, 11 , + 0x21, 111, 27, 27 , + 0x29, 114, 9, 47 , + 0x2A, 115, 32, 39 , + 0x2B, 115, 23, 8 , + 0x33, 114, 30, 51 , + 0x34, 115, 26, 15 , + 0x35, 115, 32, 46 , + 0x3D, 114, 11, 62 , + 0x3E, 115, 21, 18 , + 0x3F, 115, 25, 24 , + 0x47, 114, 19, 70 , + 0x48, 115, 32, 6 , + 0x49, 114, 32, 57 , + 0x51, 116, 71, 4 , + 0x52, 123, 47, 3 , + 0x53, 123, 57, 5 , + 0x5B, 116, 79, 11 , + 0x5C, 123, 49, 3 , + 0x5D, 120, 18, 12 , + 0x65, 120, 28, 62 , + 0x66, 116, 56, 6 , + 0x67, 119, 16, 81 , + 0x6F, 120, 30, 62 , + 0x70, 116, 55, 15 , + 0x71, 119, 16, 28 , + 0x79, 111, 33, 34 , + 0x7A, 118, 29, 5 , + 0x7B, 127, 45, 24 , + 0x83, 111, 24, 36 , + 0x84, 125, 7, 25 , + 0x85, 115, 8, 30 , + 0x8D, 111, 34, 50 , + 0x8E, 127, 59, 72 , + 0x8F, 127, 61, 21 , + 0x97, 127, 67, 63 , + 0x98, 125, 24, 32 , + 0x99, 111, 35, 31 , + 0xA1, 111, 13, 19 , + 0xA2, 121, 43, 7 , + 0xA3, 118, 47, 5 , + 0xA4, 111, 14, 19 , + 0xAB, 118, 46, 5 , + 0xAC, 121, 42, 7 , + 0xAD, 119, 19, 76 , + 0xAE, 115, 7, 20 , + 0xB5, 110, 16, 25 , + 0xB6, 114, 11, 27 , + 0xB7, 115, 8, 20 , + 0xBF, 110, 17, 25 , + 0xC0, 114, 12, 27 , + 0xC1, 119, 18, 76 , + 0xC9, 119, 5, 2 , + 0xCA, 119, 4, 89 , + 0xCB, 120, 38, 54 , + 0xCC, 120, 5, 76 , + 0xD3, 119, 5, 15 , + 0xD4, 119, 7, 101 , + 0xD5, 120, 31, 23 , + 0xDD, 119, 34, 24 , + 0xDE, 120, 26, 10 , + 0xDF, 119, 4, 15 , + 0xE7, 119, 31, 73 , + 0xE8, 120, 29, 85 , + 0xE9, 119, 6, 2 , }; const u8 Str_843E550[] = _("R"); @@ -285,7 +286,7 @@ bool8 debug_sub_815F2F4(void) do { - gSaveBlock1.secretBases[i].secretBaseId = _843E424[Random() % ARRAY_COUNT(_843E424)][0]; + gSaveBlock1.secretBases[i].secretBaseId = _843E424[(Random() % (ARRAY_COUNT(_843E424) / 4)) * 4]; for (j = 0; j < i; j++) { @@ -314,4 +315,82 @@ bool8 debug_sub_815F2F4(void) return TRUE; } +void debug_sub_815F470(u8 * a0, u8 * a1, u8 * a2) +{ + u8 i; + u8 sbId = gSaveBlock1.secretBases[_nakamuraData0].secretBaseId; + + for (i = 0; i < ARRAY_COUNT(_843E424) / 4; i++) + { + if (_843E424[i * 4] == sbId) + { + *a0 = _843E424[i * 4 + 1]; + *a1 = _843E424[i * 4 + 2]; + *a2 = _843E424[i * 4 + 3]; + break; + } + } +} + +void debug_sub_815F4D8(void) +{ + Menu_BlankWindowRect(1, 1, 10, 10); + ConvertIntToDecimalStringN(gStringVar1, _nakamuraData0, STR_CONV_MODE_LEFT_ALIGN, 2); + Menu_PrintText(gStringVar1, 1, 1); + + if (gSaveBlock1.secretBases[_nakamuraData0].secretBaseId != 0) + { + u8 a0; + u8 a1; + u8 a2; + debug_sub_815F470(&a0, &a1, &a2); + + sub_80BC190(gStringVar1, _nakamuraData0); + Menu_PrintText(gStringVar1, 1, 3); + + Menu_PrintText(Str_843E550, 1, 5); + ConvertIntToDecimalStringN(gStringVar1, a0, STR_CONV_MODE_LEFT_ALIGN, 3); + Menu_PrintText(gStringVar1, 2, 5); + + Menu_PrintText(Str_843E552, 1, 7); + ConvertIntToDecimalStringN(gStringVar1, a1, STR_CONV_MODE_LEFT_ALIGN, 3); + Menu_PrintText(gStringVar1, 3, 7); + + Menu_PrintText(Str_843E554, 1, 9); + ConvertIntToDecimalStringN(gStringVar1, a2, STR_CONV_MODE_LEFT_ALIGN, 3); + Menu_PrintText(gStringVar1, 3, 9); + } +} + +bool8 debug_sub_815F5C4(void) +{ + if (gMain.newKeys & DPAD_LEFT) + { + if (_nakamuraData0 == 0) + _nakamuraData0 = 19; + else + _nakamuraData0--; + debug_sub_815F4D8(); + return FALSE; + } + + if (gMain.newKeys & DPAD_RIGHT) + { + if (_nakamuraData0 == 19) + _nakamuraData0 = 0; + else + _nakamuraData0++; + debug_sub_815F4D8(); + return FALSE; + } + + if (gMain.newKeys & B_BUTTON) + { + CloseMenu(); + return TRUE; + } + + return FALSE; +} + #endif // DEBUG |