Fix Caught Pokemon Pokedex Crash

This commit is contained in:
Skeli 2019-12-03 14:50:55 +02:00
parent e8ce326bd0
commit eb7d17e173
5 changed files with 42 additions and 14 deletions

View File

@ -1,6 +1,28 @@
.thumb
.align 2
@0x81025E8 with r0
PokedexMemoryAllocationHook:
ldr r0, [r5]
strb r4, [r0]
bl IsInBattle
cmp r0, #0x0
bne RegularPokedexMemoryAlloc
ldr r0, .ExpandedPokedexSize
b PokedexMemoryAllocReturn
RegularPokedexMemoryAlloc:
ldr r0, .RegularPokedexSize
PokedexMemoryAllocReturn:
ldr r1, =0x81025F0 | 1
bx r1
.align 2
.RegularPokedexSize: .word 0xC10
.ExpandedPokedexSize: .word 999 * 8
.pool
@0x8103530 with r1
PrepareDexListViewsHook:
cmp r0, #0x0

View File

@ -22,8 +22,8 @@
080971DA C0 46
#Update Pokedex
081025EC FA
081025EE 40 01
#081025EC FA
#081025EE 40 01
08104B00 C0 46
08104B02 C0 46
08104B16 C0 46

1
hooks
View File

@ -10,6 +10,7 @@ GetEggMoves 8045C28 2
CreateMonSprite_PicBoxHook 808398C 1
GenderedMonIconHook 8096E38 2
GetIconSpecies 8096F5C 2
PokedexMemoryAllocationHook 81025E8 0
PrepareDexListViewsHook 8103530 1
AlphabeticalDexHook 8103684 1
AlternateDexEntriesHook 8105CBC 0

View File

@ -6,8 +6,8 @@
.equ EVOS_PER_MON, 16
.equ NUM_DEX_ENTRIES, 809
.equ SEEN_DEX_FLAGS, 0x203C700
.equ CAUGHT_DEX_FLAGS, (SEEN_DEX_FLAGS + (NUM_DEX_ENTRIES / 8) + 1)
@;.equ SEEN_DEX_FLAGS, 0x202583C
@;.equ CAUGHT_DEX_FLAGS, (SEEN_DEX_FLAGS + (NUM_DEX_ENTRIES / 8) + 1)
@@Fix Num Evolutions@@
.org 0x4598A, 0xFF
@ -35,8 +35,8 @@ add r3, #EVOS_PER_MON * 8
mov r1, #0x0
mov r2, #(NUM_DEX_ENTRIES / 8) + 1
.org 0x549D0, 0xFF
.word SEEN_DEX_FLAGS
@;.org 0x549D0, 0xFF
@;.word SEEN_DEX_FLAGS
@@Fix Dex Views@@
.org 0x88EA4, 0xFF @Pokedex Count
@ -51,17 +51,17 @@ add r3, #EVOS_PER_MON * 8
.org 0x103920, 0xFF @General
.word NUM_DEX_ENTRIES - 1
.org 0x104B10, 0xFF
.word SEEN_DEX_FLAGS
@;.org 0x104B10, 0xFF
@;.word SEEN_DEX_FLAGS
.org 0x104B5C, 0xFF
.word CAUGHT_DEX_FLAGS
@;.org 0x104B5C, 0xFF
@;.word CAUGHT_DEX_FLAGS
.org 0x104B94, 0xFF
.word SEEN_DEX_FLAGS
@;.org 0x104B94, 0xFF
@;.word SEEN_DEX_FLAGS
.org 0x104BB8, 0xFF
.word CAUGHT_DEX_FLAGS
@;.org 0x104BB8, 0xFF
@;.word CAUGHT_DEX_FLAGS
.org 0x104C28, 0xFF
.word NUM_DEX_ENTRIES - 1

View File

@ -172,3 +172,8 @@ u16 GetIconSpecies(u16 species, u32 personality)
return result;
}
bool8 IsInBattle(void)
{
return gMain.inBattle;
}