diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-04-14 21:34:03 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-04-14 21:34:03 -0400 |
commit | 7ce151910a3075757813ae3a870f30b5809e669c (patch) | |
tree | d59c0c4e7376f532dd0788fb253deb901fa08b5e | |
parent | 21e006d680b2cf3b511e2f346cf997ab2fbbee47 (diff) |
through debug_80C43A8
-rw-r--r-- | Makefile | 20 | ||||
-rw-r--r-- | asm/pokemon_storage_system.s | 6 | ||||
-rw-r--r-- | asm/watanabe_debug_menu.s | 215 | ||||
-rw-r--r-- | include/pokemon_storage_system.h | 2 | ||||
-rw-r--r-- | src/debug/watanabe_debug_menu.c | 52 | ||||
-rw-r--r-- | src/pokemon_storage_system_2.c | 8 |
6 files changed, 73 insertions, 230 deletions
@@ -1,23 +1,27 @@ include config.mk +ifeq ($(OS),Windows_NT) +EXE := .exe +endif + #### Tools #### SHELL := /bin/bash -o pipefail AS := $(DEVKITARM)/bin/arm-none-eabi-as -CC1 := tools/agbcc/bin/agbcc +CC1 := tools/agbcc/bin/agbcc$(EXE) CPP := $(DEVKITARM)/bin/arm-none-eabi-cpp LD := $(DEVKITARM)/bin/arm-none-eabi-ld OBJCOPY := $(DEVKITARM)/bin/arm-none-eabi-objcopy SHA1SUM := sha1sum -c -GBAGFX := tools/gbagfx/gbagfx -RSFONT := tools/rsfont/rsfont -AIF2PCM := tools/aif2pcm/aif2pcm -MID2AGB := tools/mid2agb/mid2agb -PREPROC := tools/preproc/preproc -SCANINC := tools/scaninc/scaninc -RAMSCRGEN := tools/ramscrgen/ramscrgen +GBAGFX := tools/gbagfx/gbagfx$(EXE) +RSFONT := tools/rsfont/rsfont$(EXE) +AIF2PCM := tools/aif2pcm/aif2pcm$(EXE) +MID2AGB := tools/mid2agb/mid2agb$(EXE) +PREPROC := tools/preproc/preproc$(EXE) +SCANINC := tools/scaninc/scaninc$(EXE) +RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE) ASFLAGS := -mcpu=arm7tdmi -I include --defsym $(GAME_VERSION)=1 --defsym REVISION=$(GAME_REVISION) --defsym $(GAME_LANGUAGE)=1 --defsym DEBUG=$(DEBUG) CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Wunused -Werror -O2 -fhex-asm diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index cee93a9e4..357fe9a49 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -582,8 +582,8 @@ sub_809CB74: @ 809CB74 _0809CB90: .4byte gPokemonStorageSystemPtr thumb_func_end sub_809CB74 - thumb_func_start unref_sub_809CB94 -unref_sub_809CB94: @ 809CB94 + thumb_func_start debug_sub_809CB94 +debug_sub_809CB94: @ 809CB94 push {r4,lr} adds r4, r0, 0 ldr r0, _0809CBBC @ =gUnknown_020384E4 @@ -636,7 +636,7 @@ _0809CBF6: .align 2, 0 _0809CBFC: .4byte gPokemonStorage _0809CC00: .4byte gUnknown_020384E5 - thumb_func_end unref_sub_809CB94 + thumb_func_end debug_sub_809CB94 thumb_func_start sub_809CC04 sub_809CC04: @ 809CC04 diff --git a/asm/watanabe_debug_menu.s b/asm/watanabe_debug_menu.s index cb8a10520..b552678bc 100644 --- a/asm/watanabe_debug_menu.s +++ b/asm/watanabe_debug_menu.s @@ -5,221 +5,6 @@ .text - thumb_func_start debug_80C4348 -debug_80C4348: - push {r4, lr} - add sp, sp, #0xfffffffc - add r4, r0, #0 - lsl r4, r4, #0x18 - lsr r4, r4, #0x18 - ldr r0, ._154 @ gUnknown_Debug_2038A0C - ldrb r0, [r0, #0x1] - lsl r0, r0, #0x19 - mov r1, #0xc0 - lsl r1, r1, #0x12 - add r0, r0, r1 - lsr r0, r0, #0x18 - mov r1, #0x1 - str r1, [sp] - mov r2, #0x1 - mov r3, #0xe - bl debug_80C38E4 - ldr r1, ._154 + 4 @ 0x4000042 - ldr r2, ._154 + 8 @ 0x177 - add r0, r2, #0 - strh r0, [r1] - add r1, r1, #0x4 - add r2, r2, #0x8 - add r0, r2, #0 - strh r0, [r1] - ldr r1, ._154 + 12 @ gTasks - lsl r0, r4, #0x2 - add r0, r0, r4 - lsl r0, r0, #0x3 - add r0, r0, r1 - ldr r1, ._154 + 16 @ debug_80C43A8 - str r1, [r0] - add sp, sp, #0x4 - pop {r4} - pop {r0} - bx r0 -._155: - .align 2, 0 -._154: - .word gUnknown_Debug_2038A0C - .word 0x4000042 - .word 0x177 - .word gTasks - .word debug_80C43A8+1 - - thumb_func_end debug_80C4348 - - thumb_func_start debug_80C43A8 -debug_80C43A8: - push {r4, r5, lr} - add sp, sp, #0xfffffffc - lsl r0, r0, #0x18 - lsr r4, r0, #0x18 - ldr r1, ._158 @ gMain - ldrh r2, [r1, #0x2e] - mov r0, #0x1 - and r0, r0, r2 - add r3, r1, #0 - cmp r0, #0 - beq ._156 @cond_branch - mov r0, #0x5 - bl PlaySE - ldr r0, ._158 + 4 @ gUnknown_Debug_2038A0C - ldrb r1, [r0, #0x1] - mov r0, #0x64 - mul r0, r0, r1 - ldr r1, ._158 + 8 @ gPlayerParty - add r0, r0, r1 - ldr r1, ._158 + 12 @ debug_80C41D4 - bl debug_sub_80A433C - add r0, r4, #0 - bl DestroyTask - b ._180 -._159: - .align 2, 0 -._158: - .word gMain - .word gUnknown_Debug_2038A0C - .word gPlayerParty - .word debug_80C41D4+1 -._156: - mov r0, #0x2 - and r0, r0, r2 - cmp r0, #0 - beq ._160 @cond_branch - ldr r0, ._162 @ gTasks - lsl r1, r4, #0x2 - add r1, r1, r4 - lsl r1, r1, #0x3 - add r1, r1, r0 - ldr r0, ._162 + 4 @ debug_80C4F48 - str r0, [r1] - b ._180 -._163: - .align 2, 0 -._162: - .word gTasks - .word debug_80C4F48+1 -._160: - mov r0, #0x8 - and r0, r0, r2 - lsl r0, r0, #0x10 - lsr r1, r0, #0x10 - cmp r1, #0 - beq ._164 @cond_branch - bl debug_80C4774 - lsl r0, r0, #0x18 - cmp r0, #0 - beq ._180 @cond_branch - mov r0, #0x5 - bl PlaySE - bl CalculatePlayerPartyCount - bl CalculateEnemyPartyCount - ldr r0, ._167 @ gTasks - lsl r1, r4, #0x2 - add r1, r1, r4 - lsl r1, r1, #0x3 - add r1, r1, r0 - ldr r0, ._167 + 4 @ debug_80C4D14 - str r0, [r1] - b ._180 -._168: - .align 2, 0 -._167: - .word gTasks - .word debug_80C4D14+1 -._164: - mov r0, #0x88 - lsl r0, r0, #0x1 - and r0, r0, r2 - cmp r0, #0 - beq ._169 @cond_branch - str r1, [sp] - mov r0, #0x0 - mov r1, #0x1 - mov r2, #0x1 - mov r3, #0xe - bl debug_80C38E4 - ldr r0, ._171 @ gTasks - lsl r1, r4, #0x2 - add r1, r1, r4 - lsl r1, r1, #0x3 - add r1, r1, r0 - ldr r0, ._171 + 4 @ debug_80C44EC - str r0, [r1] - b ._180 -._172: - .align 2, 0 -._171: - .word gTasks - .word debug_80C44EC+1 -._169: - ldrh r1, [r3, #0x30] - mov r0, #0x40 - and r0, r0, r1 - cmp r0, #0 - beq ._174 @cond_branch - ldr r1, ._176 @ gUnknown_Debug_2038A0C - ldrb r0, [r1, #0x1] - cmp r0, #0 - beq ._174 @cond_branch - sub r0, r0, #0x1 - strb r0, [r1, #0x1] - b ._175 -._177: - .align 2, 0 -._176: - .word gUnknown_Debug_2038A0C -._174: - ldrh r1, [r3, #0x30] - mov r0, #0x80 - and r0, r0, r1 - cmp r0, #0 - beq ._180 @cond_branch - ldr r5, ._181 @ gUnknown_Debug_2038A0C - ldrb r0, [r5, #0x1] - cmp r0, #0x4 - bhi ._180 @cond_branch - add r1, r0, #0 - mov r0, #0x64 - mul r0, r0, r1 - ldr r1, ._181 + 4 @ gPlayerParty - add r0, r0, r1 - mov r1, #0xb - bl GetMonData - cmp r0, #0 - beq ._180 @cond_branch - ldrb r0, [r5, #0x1] - add r0, r0, #0x1 - strb r0, [r5, #0x1] -._175: - ldr r1, ._181 + 8 @ gTasks - lsl r0, r4, #0x2 - add r0, r0, r4 - lsl r0, r0, #0x3 - add r0, r0, r1 - ldr r1, ._181 + 12 @ debug_80C4348 - str r1, [r0] -._180: - add sp, sp, #0x4 - pop {r4, r5} - pop {r0} - bx r0 -._182: - .align 2, 0 -._181: - .word gUnknown_Debug_2038A0C - .word gPlayerParty - .word gTasks - .word debug_80C4348+1 - - thumb_func_end debug_80C43A8 - thumb_func_start debug_80C44EC debug_80C44EC: push {r4, lr} diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index c6c37c123..9c8fbdc13 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -300,4 +300,6 @@ void sub_809D104(void *dest, u16 dLeft, u16 dTop, const void *src, u16 sLeft, u1 void sub_809D16C(void *dest, u16 dLeft, u16 dTop, u16 width, u16 height); void ShowPokemonStorageSystem(void); +void debug_sub_80A433C(struct Pokemon *pokemon, void (*func)(void)); + #endif // GUARD_POKEMON_STORAGE_SYSTEM_H diff --git a/src/debug/watanabe_debug_menu.c b/src/debug/watanabe_debug_menu.c index a75ee16f1..672b28e71 100644 --- a/src/debug/watanabe_debug_menu.c +++ b/src/debug/watanabe_debug_menu.c @@ -19,6 +19,7 @@ #include "sound.h" #include "pokedex.h" #include "load_save.h" +#include "pokemon_storage_system.h" EWRAM_DATA u8 gUnknown_Debug_20389EC[0x20] = { 0 }; EWRAM_DATA u8 gUnknown_Debug_2038A0C[0x10] = { 0 }; @@ -32,10 +33,14 @@ void debug_80C3D2C(u8 taskId); void debug_80C4214(u8); void debug_80C42B8(u8 taskId); void debug_80C4348(u8 taskId); +void debug_80C43A8(u8 taskId); void debug_80C44EC(u8 taskId); void debug_80C4694(void); void debug_80C4704(void); +bool8 debug_80C4774(void); void debug_80C47BC(u8 taskId); +void debug_80C4D14(u8 taskId); +void debug_80C4F48(u8 taskId); void debug_80C68CC(u16, u8, u8, u8); extern const u8 gUnknown_Debug_083F7FD4[2]; // = _("▶"); @@ -939,4 +944,51 @@ void debug_80C42B8(u8 taskId) gTasks[taskId].func = debug_80C4348; } +void debug_80C4348(u8 taskId) +{ + debug_80C38E4(gUnknown_Debug_2038A0C[1] * 2 + 3, 1, 1, 14, 1); + REG_WIN1H = 0x0177; + REG_WIN1V = 0x017F; + gTasks[taskId].func = debug_80C43A8; +} + +void debug_80C43A8(u8 taskId) +{ + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + debug_sub_80A433C(gPlayerParty + gUnknown_Debug_2038A0C[1], debug_80C41D4); + DestroyTask(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + gTasks[taskId].func = debug_80C4F48; + } + else if (gMain.newKeys & START_BUTTON) + { + if (debug_80C4774()) + { + PlaySE(SE_SELECT); + CalculatePlayerPartyCount(); + CalculateEnemyPartyCount(); + gTasks[taskId].func = debug_80C4D14; + } + } + else if (gMain.newKeys & (R_BUTTON | DPAD_RIGHT)) + { + debug_80C38E4(0, 1, 1, 14, 0); + gTasks[taskId].func = debug_80C44EC; + } + else if (gMain.newAndRepeatedKeys & DPAD_UP && gUnknown_Debug_2038A0C[1] != 0) + { + gUnknown_Debug_2038A0C[1]--; + gTasks[taskId].func = debug_80C4348; + } + else if (gMain.newAndRepeatedKeys & DPAD_DOWN && gUnknown_Debug_2038A0C[1] < 5 && GetMonData(gPlayerParty + gUnknown_Debug_2038A0C[1], MON_DATA_SPECIES) != SPECIES_NONE) + { + gUnknown_Debug_2038A0C[1]++; + gTasks[taskId].func = debug_80C4348; + } +} + #endif // DEBUG diff --git a/src/pokemon_storage_system_2.c b/src/pokemon_storage_system_2.c index 0905c185b..762850e06 100644 --- a/src/pokemon_storage_system_2.c +++ b/src/pokemon_storage_system_2.c @@ -335,11 +335,11 @@ void debug_sub_80A4300(void) } extern void (*unk_2038794)(void); -extern u32 unk_2038798; +extern struct Pokemon * unk_2038798; -extern void unref_sub_809CB94(); +extern void debug_sub_809CB94(struct Pokemon *); -void debug_sub_80A433C(u32 a, void (*b)(void)) +void debug_sub_80A433C(struct Pokemon * a, void (*b)(void)) { unk_2038794 = b; unk_2038798 = a; @@ -351,7 +351,7 @@ void debug_sub_80A435C(void) switch (gPokemonStorageSystemPtr->unk_0004) { case 0: - unref_sub_809CB94(unk_2038798); + debug_sub_809CB94(unk_2038798); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); gPokemonStorageSystemPtr->unk_0004++; break; |