Skip to content

Commit

Permalink
Fix #6 (double battle crash)
Browse files Browse the repository at this point in the history
The party table I was using to find values to call
GetMainBattleData_GetAdrOfPkmnInParty with contains `6`s for blank
slots. Real hardware and accurate emulators do not like it when I call
it with those!
  • Loading branch information
TheGag96 committed Jun 13, 2022
1 parent 6c8f20b commit 7c1f3f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Hijack_PersonalityTableBuild.s
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ Hijack_PersonalityTableBuild: @ hook at overlay 12, 0x39F4 (0x02223614)
@ get pokemon-in-party index from active party member table
ldrb r2, [r1, r4]

@ skip if invalid/blank ID
@ may not need this? not sure, but copying this from Hijack_PersonalityTableBuild2 just in case
cmp r2, #6
beq .end

@ load loop variable as party index
@ note about the party index:
@ 0 and 2 are either the player or partner pokemon, and 1 and 3 are enemy trainer(s).
Expand Down
6 changes: 6 additions & 0 deletions Hijack_PersonalityTableBuild2.s
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Hijack_PersonalityTableBuild2: @ hook at overlay 16, 0x26E8 (0x0223D828)
@ get pokemon-in-party index from active party member table
ldrb r2, [r6, r5]

@ skip if invalid/blank ID
cmp r2, #6
beq .loop_check

@ load loop variable as party index
@ note about the party index:
@ 0 and 2 are either the player or partner pokemon, and 1 and 3 are enemy trainer(s).
Expand All @@ -46,6 +50,8 @@ Hijack_PersonalityTableBuild2: @ hook at overlay 16, 0x26E8 (0x0223D828)
lsl r1, r5, #2
str r0, [r3, r1]

.loop_check:

add r5, r5, #1
cmp r5, #4
bls .loop
Expand Down

0 comments on commit 7c1f3f3

Please sign in to comment.