- 37
- Posts
- 1
- Years
- Seen Apr 6, 2025
I've getting into decomp hacking due to the more options and fewer technical issues (like pointers and memory spaces and all that).
The first major change I want to work on is having encounters include Johto Pokémon (like the second half of Gen II). So, the National 'Dex is needed from the start.
I found the following chunk of code in src/event_data.c . I assume this would be what I want to change.
While I'm not entirely clueless on what to try, I would like some advice to help familiarize myself with this. Also, is this all I'd have to change to enable non-Kanto 'Mons to evolve from the start?
The first major change I want to work on is having encounters include Johto Pokémon (like the second half of Gen II). So, the National 'Dex is needed from the start.
I found the following chunk of code in src/event_data.c . I assume this would be what I want to change.
C-like:
// Unused
static void DisableNationalPokedex_RSE(void)
{
u16 *ptr = GetVarPointer(VAR_0x403C);
gSaveBlock2Ptr->pokedex.unused = 0;
*ptr = 0;
FlagClear(FLAG_0x838);
}
// The magic numbers used here (0xDA and 0x0302) correspond to those
// used in RSE for enabling the national Pokedex
void EnableNationalPokedex_RSE(void)
{
// Note: the var, struct member, and flag are never used
u16 *ptr = GetVarPointer(VAR_0x403C);
gSaveBlock2Ptr->pokedex.unused = 0xDA;
*ptr = 0x0302;
FlagSet(FLAG_0x838);
}
// Unused
static bool32 IsNationalPokedexEnabled_RSE(void)
{
if (gSaveBlock2Ptr->pokedex.unused == 0xDA
&& VarGet(VAR_0x403C) == 0x0302
&& FlagGet(FLAG_0x838))
return TRUE;
return FALSE;
}
void DisableNationalPokedex(void)
{
u16 *nationalDexVar = GetVarPointer(VAR_NATIONAL_DEX);
gSaveBlock2Ptr->pokedex.nationalMagic = 0;
*nationalDexVar = 0;
FlagClear(FLAG_SYS_NATIONAL_DEX);
}
void EnableNationalPokedex(void)
{
u16 *nationalDexVar = GetVarPointer(VAR_NATIONAL_DEX);
gSaveBlock2Ptr->pokedex.nationalMagic = 0xB9;
*nationalDexVar = 0x6258;
FlagSet(FLAG_SYS_NATIONAL_DEX);
}
bool32 IsNationalPokedexEnabled(void)
{
if (gSaveBlock2Ptr->pokedex.nationalMagic == 0xB9
&& VarGet(VAR_NATIONAL_DEX) == 0x6258
&& FlagGet(FLAG_SYS_NATIONAL_DEX))
return TRUE;
return FALSE;