diff options
author | tom-overton <tom.overton@outlook.com> | 2021-04-13 04:15:53 -0700 |
---|---|---|
committer | tom-overton <tom.overton@outlook.com> | 2021-04-13 04:15:59 -0700 |
commit | 8b73d32beb60bafcb88b526ebce458b0f3e63f5b (patch) | |
tree | b8c1d68b1f4e99adb77a36a4379ec9683d75aff7 /asm | |
parent | 9c8a8aa5cbd9514823028e0b8f54097c19af4b52 (diff) |
HGSS: Add custom patch to the catching tutorial code
This has the following ramifications:
- Lyra/Ethan's Marill will *always* be randomized according to their overworld sprite
- The enemy Pokemon will be randomized when Randomize Catching Tutorial is enabled
- The player Pokemon's level is raised to 10, preventing all softlocks (because leveling up is impossible)
Diffstat (limited to 'asm')
-rw-r--r-- | asm/hgss_catching_tutorialfix.asm | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/asm/hgss_catching_tutorialfix.asm b/asm/hgss_catching_tutorialfix.asm new file mode 100644 index 0000000..738dcac --- /dev/null +++ b/asm/hgss_catching_tutorialfix.asm @@ -0,0 +1,77 @@ + .nds + .thumb + .open "pkmnheartgold.bin", "pkmnheartgold_catching_tutorialfix.bin", 0x02000000 + + NEW_CATCHING_TUT_SUBR_HOOK equ 0x02051B68 + OLD_CATCHING_TUT_SUBR_CONTINUED equ 0x02051BB0 + + ALLOCATE_POKEMON_MEMORY equ 0x0206DD2C + INSTANTIATE_POKEMON equ 0x0206DE38 + ADD_POKEMON_TO_PARTY equ 0x02074524 + FREE_MEMORY equ 0x0201AB0C + + ITCM_SRC_START equ 0x02111860 + ITCM_DEST_START equ 0x01FF8000 + ITCM_OLD_SIZE equ 0x620 + + NEW_CATCHING_TUT_SUBR equ ITCM_SRC_START + ITCM_OLD_SIZE + NEW_CATCHING_TUT_SUBR_ITCM equ ITCM_DEST_START + ITCM_OLD_SIZE + BL_OFFSET equ (NEW_CATCHING_TUT_SUBR) - (NEW_CATCHING_TUT_SUBR_ITCM) + + ; Hook that jumps to our new subroutine + .org NEW_CATCHING_TUT_SUBR_HOOK + mov r1, r4 + bl org() + 6 + b OLD_CATCHING_TUT_SUBR_CONTINUED + ldr r2,=#(NEW_CATCHING_TUT_SUBR_ITCM + 1) + bx r2 + .pool + + ; New subroutine for setting up the player/enemy parties for the catching tutorial. + ; Most of this is copied from the original assembly, but modified to allow easy modification of + ; Marill/Rattata's species and Rattata's level. Marill is also level 10 to mitigate softocks. + ; r0 is param_1 from the original function (used as a parameter for some sort of allocator) + ; r1 is a pointer to a struct that stores the player and enemy parties + .org NEW_CATCHING_TUT_SUBR + .area 92 + + push { r4-r6, lr } + sub sp, #0x10 + mov r4, r1 + bl BL_OFFSET + ALLOCATE_POKEMON_MEMORY + mov r2, #0x0 + str r2, [sp] + str r2, [sp, #0x4] + mov r1, #0x2 + str r1, [sp, #0x8] + str r2, [sp, #0xC] + ldr r1,=#0xB7 ; Marill + mov r2, #0xA ; Level 10 + mov r3, #0x20 + add r6, r0, #0x0 + bl BL_OFFSET + INSTANTIATE_POKEMON + ldr r0, [r4, #0x4] ; Pointer to player party + add r1, r6, #0x0 + bl BL_OFFSET + ADD_POKEMON_TO_PARTY + mov r0, #0x0 + str r0, [sp] + str r0, [sp, #0x4] + mov r2, #0x2 + str r2, [sp, #0x8] + str r0, [sp, #0xC] + add r0, r6, #0x0 + ldr r1,=#0x13 ; Rattata + mov r2, #0x2 ; Level 2 + mov r3, #0x20 + bl BL_OFFSET + INSTANTIATE_POKEMON + ldr r0, [r4, #0x8] ; Pointer to enemy party + add r1, r6, #0x0 + bl BL_OFFSET + ADD_POKEMON_TO_PARTY + add r0, r6, #0x0 + bl BL_OFFSET + FREE_MEMORY + add sp, #0x10 + pop { r4-r6, pc } + .pool + .endarea + + .close
\ No newline at end of file |