From f44fe35c9210d41180bc7e6bd86cb1bc3a39e4e2 Mon Sep 17 00:00:00 2001 From: Skeli Date: Sun, 26 May 2019 04:52:31 -0400 Subject: [PATCH] Xerneas Form Change --- BPRE.ld | 2 ++ include/main.h | 63 ++++++++++++++++++++++++++++++++++++++++++++++ src/updated_code.c | 7 ++++-- 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 include/main.h diff --git a/BPRE.ld b/BPRE.ld index 5b83e07..6fb0963 100644 --- a/BPRE.ld +++ b/BPRE.ld @@ -7,6 +7,8 @@ __umodsi3 = 0x081E4684|1; memcpy_ = 0x081E5E78|1; memset_ = 0x081E5ED8|1; +gMain = 0x30030F0; + GetGenderFromSpeciesAndPersonality = 0x803F78C | 1; SpeciesToNationalPokedexNum = 0x8043298 | 1; DrawSpindaSpots = 0x8043458 | 1; diff --git a/include/main.h b/include/main.h new file mode 100644 index 0000000..47bc9f2 --- /dev/null +++ b/include/main.h @@ -0,0 +1,63 @@ +#pragma once + +typedef void (*MainCallback)(void); +typedef void (*IntrCallback)(void); +typedef void (*IntrFunc)(void); +typedef void (*EraseFlash)(u16); + +struct Main +{ + /*0x000*/ MainCallback callback1; + /*0x004*/ MainCallback callback2; + + /*0x008*/ MainCallback savedCallback; + + /*0x00C*/ IntrCallback vblankCallback; + /*0x010*/ IntrCallback hblankCallback; + /*0x014*/ IntrCallback vcountCallback; + /*0x018*/ IntrCallback serialCallback; + + /*0x01C*/ vu16 intrCheck; + + /*0x020*/ u32 *vblankCounter1; + /*0x024*/ u32 vblankCounter2; + + /*0x028*/ u16 heldKeysRaw; // held keys without L=A remapping + /*0x02A*/ u16 newKeysRaw; // newly pressed keys without L=A remapping + /*0x02C*/ u16 heldKeys; // held keys with L=A remapping + /*0x02E*/ u16 newKeys; // newly pressed keys with L=A remapping + /*0x030*/ u16 newAndRepeatedKeys; // newly pressed keys plus key repeat + /*0x032*/ u16 keyRepeatCounter; // counts down to 0, triggering key repeat + /*0x034*/ bool16 watchedKeysPressed; // whether one of the watched keys was pressed + /*0x036*/ u16 watchedKeysMask; // bit mask for watched keys + + /*0x038*/ struct OamData oamBuffer[128]; + + /*0x438*/ u8 state; + + /*0x439*/ u8 oamLoadDisabled:1; + /*0x439*/ u8 inBattle:1; + /*0x439*/ u8 field_439_x4:1; +}; + +extern u8 gUnknown_3001764; +extern struct Main gMain; +extern bool8 gSoftResetDisabled; +extern bool8 gLinkVSyncDisabled; + +extern const u8 gGameVersion; +extern const u8 gGameLanguage; + +void __attribute__((long_call)) SetMainCallback1(MainCallback callback); +void __attribute__((long_call)) SetMainCallback2(MainCallback callback); +/* +void AgbMain(void); +void InitKeys(void); +//void SetVBlankCallback(IntrCallback callback); +//void SetHBlankCallback(IntrCallback callback); +void SetVCountCallback(IntrCallback callback); +void SetSerialCallback(IntrCallback callback); +void InitFlashTimer(void); +void DoSoftReset(void); +void ClearPokemonCrySongs(void); +*/ diff --git a/src/updated_code.c b/src/updated_code.c index b9103c5..ed4c1b8 100644 --- a/src/updated_code.c +++ b/src/updated_code.c @@ -1,7 +1,8 @@ #include "defines.h" -#include "../include/pokedex.h" -#include "../include/graphics.h" #include "../include/evolution.h" +#include "../include/graphics.h" +#include "../include/main.h" +#include "../include/pokedex.h" //Backsprite battle start @@ -142,6 +143,8 @@ u16 TryGetFemaleGenderedSpecies(u16 species, u32 personality) break; } } + else if (species == SPECIES_XERNEAS && !gMain.inBattle) + species = SPECIES_XERNEAS_NATURAL; return species; } \ No newline at end of file