diff options
-rw-r--r-- | asm/watanabe_debug_menu.s | 381 | ||||
-rw-r--r-- | src/debug/watanabe_debug_menu.c | 157 |
2 files changed, 155 insertions, 383 deletions
diff --git a/asm/watanabe_debug_menu.s b/asm/watanabe_debug_menu.s index 742dd66cd..cb8a10520 100644 --- a/asm/watanabe_debug_menu.s +++ b/asm/watanabe_debug_menu.s @@ -5,387 +5,6 @@ .text - thumb_func_start debug_80C405C -debug_80C405C: - push {r4, r5, lr} - add r4, r0, #0 - lsl r1, r1, #0x10 - lsr r5, r1, #0x10 - mov r2, #0x0 - mov r1, #0x0 -._122: - add r0, r4, r2 - strb r1, [r0] - add r0, r2, #1 - lsl r0, r0, #0x18 - lsr r2, r0, #0x18 - cmp r2, #0x9 - bls ._122 @cond_branch - add r0, r4, r2 - mov r1, #0xff - strb r1, [r0] - mov r0, #0xae - strb r0, [r4] - cmp r5, #0 - beq ._125 @cond_branch - mov r2, #0x0 - ldr r3, ._127 @ gSpeciesNames - mov r0, #0xb - add r1, r5, #0 - mul r1, r1, r0 - add r0, r1, r3 - ldrb r0, [r0] - cmp r0, #0xff - beq ._125 @cond_branch - add r5, r3, #0 - add r3, r1, #0 -._126: - add r1, r4, r2 - add r0, r2, r3 - add r0, r0, r5 - ldrb r0, [r0] - strb r0, [r1] - add r0, r2, #1 - lsl r0, r0, #0x18 - lsr r2, r0, #0x18 - add r0, r2, r3 - add r0, r0, r5 - ldrb r0, [r0] - cmp r0, #0xff - beq ._125 @cond_branch - cmp r2, #0x9 - bls ._126 @cond_branch -._125: - pop {r4, r5} - pop {r0} - bx r0 -._128: - .align 2, 0 -._127: - .word gSpeciesNames - - thumb_func_end debug_80C405C - - thumb_func_start debug_80C40C4 -debug_80C40C4: - push {r4, r5, r6, r7, lr} - add sp, sp, #0xfffffffc - lsl r0, r0, #0x18 - lsr r7, r0, #0x18 - mov r5, #0x0 - mov r6, sp -._135: - cmp r7, #0 - beq ._129 @cond_branch - mov r0, #0x64 - add r1, r5, #0 - mul r1, r1, r0 - ldr r0, ._132 @ gEnemyParty - add r4, r1, r0 - add r0, r4, #0 - mov r1, #0xb - bl GetMonData - cmp r0, #0 - beq ._134 @cond_branch - add r0, r4, #0 - bl CalculateMonStats - add r0, r4, #0 - mov r1, #0x3a - bl GetMonData - strh r0, [r6] - add r0, r4, #0 - mov r1, #0x39 - mov r2, sp - bl SetMonData - b ._134 -._133: - .align 2, 0 -._132: - .word gEnemyParty -._129: - mov r0, #0x64 - add r1, r5, #0 - mul r1, r1, r0 - ldr r0, ._136 @ gPlayerParty - add r4, r1, r0 - add r0, r4, #0 - mov r1, #0xb - bl GetMonData - cmp r0, #0 - beq ._134 @cond_branch - add r0, r4, #0 - bl CalculateMonStats - add r0, r4, #0 - mov r1, #0x3a - bl GetMonData - strh r0, [r6] - add r0, r4, #0 - mov r1, #0x39 - mov r2, sp - bl SetMonData -._134: - add r0, r5, #1 - lsl r0, r0, #0x18 - lsr r5, r0, #0x18 - cmp r5, #0x5 - bls ._135 @cond_branch - add sp, sp, #0x4 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 -._137: - .align 2, 0 -._136: - .word gPlayerParty - - thumb_func_end debug_80C40C4 - - thumb_func_start InitBattleForDebug -InitBattleForDebug: - push {lr} - bl SavePlayerParty - ldr r1, ._138 @ gUnknown_Debug_2038A0C - ldr r0, ._138 + 4 @ gSaveBlock2 - ldrb r2, [r0, #0x8] - mov r0, #0x0 - strb r2, [r1, #0xd] - strb r0, [r1] - strb r0, [r1, #0x1] - strb r0, [r1, #0x2] - strb r0, [r1, #0x3] - strb r0, [r1, #0x4] - strb r0, [r1, #0x5] - strb r0, [r1, #0x6] - strb r0, [r1, #0x7] - strb r0, [r1, #0x8] - strb r0, [r1, #0xc] - ldr r1, ._138 + 8 @ byte_3005E30 - str r0, [r1] - bl ZeroPlayerPartyMons - bl ZeroEnemyPartyMons - mov r0, #0x0 - bl debug_80C4214 - ldr r0, ._138 + 12 @ debug_80C47BC - mov r1, #0x0 - bl CreateTask - pop {r0} - bx r0 -._139: - .align 2, 0 -._138: - .word gUnknown_Debug_2038A0C - .word gSaveBlock2 - .word byte_3005E30 - .word debug_80C47BC+1 - - thumb_func_end InitBattleForDebug - - thumb_func_start debug_80C41A8 -debug_80C41A8: - push {lr} - ldr r1, ._140 @ gUnknown_Debug_2038A0C - mov r0, #0x0 - strb r0, [r1, #0x1] - strb r0, [r1, #0x2] - bl ZeroPlayerPartyMons - bl ZeroEnemyPartyMons - mov r0, #0x0 - bl debug_80C4214 - ldr r0, ._140 + 4 @ debug_80C47BC - mov r1, #0x0 - bl CreateTask - pop {r0} - bx r0 -._141: - .align 2, 0 -._140: - .word gUnknown_Debug_2038A0C - .word debug_80C47BC+1 - - thumb_func_end debug_80C41A8 - - thumb_func_start debug_80C41D4 -debug_80C41D4: - push {lr} - mov r0, #0x0 - bl debug_80C40C4 - mov r0, #0x0 - bl debug_80C4214 - ldr r0, ._142 @ debug_80C42B8 - mov r1, #0x0 - bl CreateTask - pop {r0} - bx r0 -._143: - .align 2, 0 -._142: - .word debug_80C42B8+1 - - thumb_func_end debug_80C41D4 - - thumb_func_start debug_80C41F4 -debug_80C41F4: - push {lr} - mov r0, #0x1 - bl debug_80C40C4 - mov r0, #0x1 - bl debug_80C4214 - ldr r0, ._144 @ debug_80C42B8 - mov r1, #0x0 - bl CreateTask - pop {r0} - bx r0 -._145: - .align 2, 0 -._144: - .word debug_80C42B8+1 - - thumb_func_end debug_80C41F4 - - thumb_func_start debug_80C4214 -debug_80C4214: - push {r4, r5, r6, lr} - bl debug_80C35DC - ldr r6, ._146 @ 0x4000040 - mov r4, #0x0 - strh r4, [r6] - ldr r5, ._146 + 4 @ 0x4000044 - strh r4, [r5] - ldr r0, ._146 + 8 @ 0x4000042 - strh r4, [r0] - add r0, r0, #0x4 - strh r4, [r0] - ldr r1, ._146 + 12 @ 0x4000048 - ldr r2, ._146 + 16 @ 0x1111 - add r0, r2, #0 - strh r0, [r1] - add r1, r1, #0x2 - mov r0, #0x31 - strh r0, [r1] - add r1, r1, #0x6 - mov r0, #0xe1 - strh r0, [r1] - ldr r0, ._146 + 20 @ 0x4000052 - strh r4, [r0] - add r1, r1, #0x4 - mov r0, #0x7 - strh r0, [r1] - ldr r3, ._146 + 24 @ 0x4000208 - ldrh r2, [r3] - strh r4, [r3] - ldr r4, ._146 + 28 @ 0x4000200 - ldrh r0, [r4] - mov r1, #0x1 - orr r0, r0, r1 - strh r0, [r4] - strh r2, [r3] - ldr r0, ._146 + 32 @ debug_80C3758 - bl SetVBlankCallback - ldr r0, ._146 + 36 @ debug_80C370C - bl SetMainCallback2 - mov r1, #0x80 - lsl r1, r1, #0x13 - ldr r2, ._146 + 40 @ 0x7140 - add r0, r2, #0 - strh r0, [r1] - ldr r1, ._146 + 44 @ 0x1ef - add r0, r1, #0 - strh r0, [r6] - ldr r2, ._146 + 48 @ 0x819f - add r0, r2, #0 - strh r0, [r5] - pop {r4, r5, r6} - pop {r0} - bx r0 -._147: - .align 2, 0 -._146: - .word 0x4000040 - .word 0x4000044 - .word 0x4000042 - .word 0x4000048 - .word 0x1111 - .word 0x4000052 - .word 0x4000208 - .word 0x4000200 - .word debug_80C3758+1 - .word debug_80C370C+1 - .word 0x7140 - .word 0x1ef - .word 0x819f - - thumb_func_end debug_80C4214 - - thumb_func_start debug_80C42B8 -debug_80C42B8: - push {r4, r5, lr} - add sp, sp, #0xffffffe4 - lsl r0, r0, #0x18 - lsr r5, r0, #0x18 - ldr r1, ._150 @ gUnknown_Debug_083F8194 - mov r0, sp - mov r2, #0xc - bl memcpy - add r4, sp, #0xc - ldr r1, ._150 + 4 @ gUnknown_Debug_083F81A0 - add r0, r4, #0 - mov r2, #0xd - bl memcpy - mov r0, #0x0 - mov r1, #0x10 - mov r2, #0x1d - mov r3, #0x13 - bl Menu_DrawStdWindowFrame - mov r0, sp - mov r1, #0x1 - mov r2, #0x11 - bl Menu_PrintText - add r0, r4, #0 - mov r1, #0x14 - mov r2, #0x11 - bl Menu_PrintText - bl debug_80C4694 - bl debug_80C4704 - ldr r0, ._150 + 8 @ gUnknown_Debug_2038A0C - ldrb r0, [r0] - cmp r0, #0 - beq ._148 @cond_branch - ldr r0, ._150 + 12 @ gTasks - lsl r1, r5, #0x2 - add r1, r1, r5 - lsl r1, r1, #0x3 - add r1, r1, r0 - ldr r0, ._150 + 16 @ debug_80C44EC - b ._149 -._151: - .align 2, 0 -._150: - .word gUnknown_Debug_083F8194 - .word gUnknown_Debug_083F81A0 - .word gUnknown_Debug_2038A0C - .word gTasks - .word debug_80C44EC+1 -._148: - ldr r0, ._152 @ gTasks - lsl r1, r5, #0x2 - add r1, r1, r5 - lsl r1, r1, #0x3 - add r1, r1, r0 - ldr r0, ._152 + 4 @ debug_80C4348 -._149: - str r0, [r1] - add sp, sp, #0x1c - pop {r4, r5} - pop {r0} - bx r0 -._153: - .align 2, 0 -._152: - .word gTasks - .word debug_80C4348+1 - - thumb_func_end debug_80C42B8 - thumb_func_start debug_80C4348 debug_80C4348: push {r4, lr} diff --git a/src/debug/watanabe_debug_menu.c b/src/debug/watanabe_debug_menu.c index 1f9bb8672..a75ee16f1 100644 --- a/src/debug/watanabe_debug_menu.c +++ b/src/debug/watanabe_debug_menu.c @@ -18,16 +18,24 @@ #include "save.h" #include "sound.h" #include "pokedex.h" +#include "load_save.h" EWRAM_DATA u8 gUnknown_Debug_20389EC[0x20] = { 0 }; EWRAM_DATA u8 gUnknown_Debug_2038A0C[0x10] = { 0 }; EWRAM_DATA u8 gUnknown_Debug_2038A1C[4] = { 0 }; EWRAM_DATA u8 gUnknown_Debug_2038A20[4] = { 0 }; -u8 byte_3005E30[0x20]; +u32 byte_3005E30; void debug_80C3A50(u8 taskId); void debug_80C3D2C(u8 taskId); +void debug_80C4214(u8); +void debug_80C42B8(u8 taskId); +void debug_80C4348(u8 taskId); +void debug_80C44EC(u8 taskId); +void debug_80C4694(void); +void debug_80C4704(void); +void debug_80C47BC(u8 taskId); void debug_80C68CC(u16, u8, u8, u8); extern const u8 gUnknown_Debug_083F7FD4[2]; // = _("▶"); @@ -42,6 +50,8 @@ extern const u8 gUnknown_Debug_083F800C[13]; // = _("Aボタン▶そうさき extern const u8 gUnknown_Debug_083F8019[9]; // = _("Bボタン▶やめる"); extern const u8 gUnknown_Debug_083F8022[6]; // = _("スタート:"); extern const u8 gUnknown_Debug_083F8028[6]; // = _(":セレクト"); +extern const u8 gUnknown_Debug_083F8194[12]; // = _("ポケモンを えらんでね"); +extern const u8 gUnknown_Debug_083F81A0[13]; // = _("{COLOR RED}START:つぎへ"); extern const struct SpriteSheet stru_83F8828[2]; extern const struct SpritePalette stru_83F8838[2]; @@ -209,7 +219,7 @@ u16 debug_80C38B4(u8 a0, u16 a1) void debug_80C38E4(u8 a0, u8 a1, u8 a2, u8 a3, u8 a4) { // u8 sp00[] = _("▶"); - u8 sp00[2]; + u8 sp00[sizeof(gUnknown_Debug_083F7FD4)]; memcpy(sp00, gUnknown_Debug_083F7FD4, ARRAY_COUNT(gUnknown_Debug_083F7FD4)); Menu_BlankWindowRect(a1, a2, a1, a3); @@ -786,4 +796,147 @@ void debug_80C3D2C(u8 taskId) } } +void debug_80C405C(u8 * dest, u16 species) +{ + u8 i; + + for (i = 0; i < 10; i++) + dest[i] = CHAR_SPACE; + dest[i] = EOS; + + dest[0] = CHAR_HYPHEN; + + if (species != SPECIES_NONE) + { + for (i = 0; gSpeciesNames[species][i] != EOS && i < 10; i++) + dest[i] = gSpeciesNames[species][i]; + } +} + +void debug_80C40C4(bool8 who) +{ + u8 i; + u16 maxHp; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (who) + { + struct Pokemon *pokemon = gEnemyParty + i; + if (GetMonData(pokemon, MON_DATA_SPECIES) != SPECIES_NONE) + { + CalculateMonStats(pokemon); + maxHp = GetMonData(pokemon, MON_DATA_MAX_HP); + SetMonData(pokemon, MON_DATA_HP, &maxHp); + } + } + else + { + struct Pokemon *pokemon = gPlayerParty + i; + if (GetMonData(pokemon, MON_DATA_SPECIES) != SPECIES_NONE) + { + CalculateMonStats(pokemon); + maxHp = GetMonData(pokemon, MON_DATA_MAX_HP); + SetMonData(pokemon, MON_DATA_HP, &maxHp); + } + } + } +} + +void InitBattleForDebug(void) +{ + SavePlayerParty(); + gUnknown_Debug_2038A0C[13] = gSaveBlock2.playerGender; + gUnknown_Debug_2038A0C[0] = 0; + gUnknown_Debug_2038A0C[1] = 0; + gUnknown_Debug_2038A0C[2] = 0; + gUnknown_Debug_2038A0C[3] = 0; + gUnknown_Debug_2038A0C[4] = 0; + gUnknown_Debug_2038A0C[5] = 0; + gUnknown_Debug_2038A0C[6] = 0; + gUnknown_Debug_2038A0C[7] = 0; + gUnknown_Debug_2038A0C[8] = 0; + gUnknown_Debug_2038A0C[12] = 0; + byte_3005E30 = 0; + ZeroPlayerPartyMons(); + ZeroEnemyPartyMons(); + debug_80C4214(0); + CreateTask(debug_80C47BC, 0); +} + +void debug_80C41A8(void) +{ + gUnknown_Debug_2038A0C[1] = 0; + gUnknown_Debug_2038A0C[2] = 0; + ZeroPlayerPartyMons(); + ZeroEnemyPartyMons(); + debug_80C4214(0); + CreateTask(debug_80C47BC, 0); +} + +void debug_80C41D4(void) +{ + debug_80C40C4(0); + debug_80C4214(0); + CreateTask(debug_80C42B8, 0); +} + +void debug_80C41F4(void) +{ + debug_80C40C4(1); + debug_80C4214(1); + CreateTask(debug_80C42B8, 0); +} + +void debug_80C4214(UNUSED u8 a0) +{ + debug_80C35DC(); + REG_WIN0H = 0; + REG_WIN0V = 0; + REG_WIN1H = 0; + REG_WIN1V = 0; + REG_WININ = 0x1111; + REG_WINOUT = 0x0031; + REG_BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BD | BLDCNT_EFFECT_DARKEN; + REG_BLDALPHA = 0; + REG_BLDY = 7; + + { + u16 imeBak = REG_IME; + REG_IME = 0; + REG_IE |= INTR_FLAG_VBLANK; + REG_IME = imeBak; + } + + SetVBlankCallback(debug_80C3758); + SetMainCallback2(debug_80C370C); + REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON; + REG_WIN0H = 0x01EF; + REG_WIN0V = 0x819F; +} + +void debug_80C42B8(u8 taskId) +{ + u8 sp00[sizeof(gUnknown_Debug_083F8194)]; + u8 sp0c[sizeof(gUnknown_Debug_083F81A0)]; + + memcpy(sp00, gUnknown_Debug_083F8194, sizeof(gUnknown_Debug_083F8194)); + memcpy(sp0c, gUnknown_Debug_083F81A0, sizeof(gUnknown_Debug_083F81A0)); + + // u8 sp00[] = _("ポケモンを えらんでね"); + // u8 sp0c[] = _("{COLOR RED}START:つぎへ"); + + Menu_DrawStdWindowFrame(0, 16, 29, 19); + Menu_PrintText(sp00, 1, 17); + Menu_PrintText(sp0c, 20, 17); + + debug_80C4694(); + debug_80C4704(); + + if (gUnknown_Debug_2038A0C[0]) + gTasks[taskId].func = debug_80C44EC; + else + gTasks[taskId].func = debug_80C4348; +} + #endif // DEBUG |