diff --git a/Makefile b/Makefile index cffbcf87fc..b23b278be4 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ ROM := pokeemerald.gba OBJ_DIR := build/emerald else CC1 := $(shell $(PREFIX)gcc --print-prog-name=cc1) -override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -quiet -fno-toplevel-reorder -Wno-aggressive-loop-optimizations +override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -quiet -fno-toplevel-reorder -Wno-aggressive-loop-optimizations -Wno-pointer-to-int-cast ROM := pokeemerald_modern.gba OBJ_DIR := build/modern endif diff --git a/include/gba/defines.h b/include/gba/defines.h index b95946b15d..9bd695aaac 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -7,11 +7,7 @@ #define FALSE 0 #define BSS_DATA __attribute__((section(".bss"))) -#if MODERN -#define IWRAM_DATA -#else #define IWRAM_DATA __attribute__((section("iwram_data"))) -#endif #define EWRAM_DATA __attribute__((section("ewram_data"))) #if MODERN diff --git a/src/battle_factory.c b/src/battle_factory.c index 1a150db1e7..6c249bccc5 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -16,7 +16,7 @@ #include "constants/moves.h" // IWRAM bss -static IWRAM_DATA bool8 sPerformedRentalSwap; +static bool8 sPerformedRentalSwap; // This file's functions. static void InitFactoryChallenge(void); diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 280b65dc8c..f564424329 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -227,9 +227,9 @@ static EWRAM_DATA u8 *sSwapMenuTilemapBuffer = NULL; static EWRAM_DATA u8 *sSwapMonCardBgTilemapBuffer = NULL; // IWRAM bss -static IWRAM_DATA struct FactorySelectMonsStruct *sFactorySelectScreen; -static IWRAM_DATA void (*sSwap_CurrentTableFunc)(u8 taskId); -static IWRAM_DATA struct FactorySwapMonsStruct *sFactorySwapScreen; +static struct FactorySelectMonsStruct *sFactorySelectScreen; +static void (*sSwap_CurrentTableFunc)(u8 taskId); +static struct FactorySwapMonsStruct *sFactorySwapScreen; // IWRAM common u8 (*gUnknown_030062E8)(void); diff --git a/src/battle_pike.c b/src/battle_pike.c index 7fdb0a07cf..8846e2d1a8 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -53,11 +53,11 @@ struct PikeWildMon }; // IWRAM bss -static IWRAM_DATA u8 sRoomType; -static IWRAM_DATA u8 sStatusMon; -static IWRAM_DATA bool8 sUnknown_0300128E; -static IWRAM_DATA u32 sStatusFlags; -static IWRAM_DATA u8 sNpcId; +static u8 sRoomType; +static u8 sStatusMon; +static bool8 sUnknown_0300128E; +static u32 sStatusFlags; +static u8 sNpcId; // This file's functions. static void SetRoomType(void); diff --git a/src/battle_tent.c b/src/battle_tent.c index 85194417fb..34e3e9628a 100644 --- a/src/battle_tent.c +++ b/src/battle_tent.c @@ -44,7 +44,7 @@ static void sub_81BA040(void); static void sub_81B9EC0(void); // IWRAM bss -static IWRAM_DATA u16 sRandMonSetId; +static u16 sRandMonSetId; // const rom data void static (*const gUnknown_086160B4[])(void) = diff --git a/src/battle_transition.c b/src/battle_transition.c index 7edb1bd936..3e86fcf513 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -262,10 +262,10 @@ static bool8 sub_814842C(struct Sprite *sprite); static bool8 sub_8148458(struct Sprite *sprite); // iwram bss vars -IWRAM_DATA static s16 sUnusedRectangularSpiralVar; -IWRAM_DATA static u8 sTestingTransitionId; -IWRAM_DATA static u8 sTestingTransitionState; -IWRAM_DATA static struct StructRectangularSpiral sRectangularSpiralTransition[4]; +static s16 sUnusedRectangularSpiralVar; +static u8 sTestingTransitionId; +static u8 sTestingTransitionState; +static struct StructRectangularSpiral sRectangularSpiralTransition[4]; // ewram vars EWRAM_DATA static struct TransitionData *sTransitionStructPtr = NULL; diff --git a/src/berry_blender.c b/src/berry_blender.c index d6a7879f42..03764b2f8c 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -194,10 +194,10 @@ EWRAM_DATA static s32 sUnknown_020322BC[5] = {0}; EWRAM_DATA static u32 sUnknown_020322D0 = 0; // IWRAM bss -IWRAM_DATA static s16 sUnknown_03000DE8[8]; -IWRAM_DATA static s16 sUnknown_03000DF8[6]; -IWRAM_DATA static s16 sUnknown_03000E04; -IWRAM_DATA static s16 sUnknown_03000E06; +static s16 sUnknown_03000DE8[8]; +static s16 sUnknown_03000DF8[6]; +static s16 sUnknown_03000E04; +static s16 sUnknown_03000E06; // IWRAM common u8 gInGameOpponentsNo; diff --git a/src/bg.c b/src/bg.c index abeb493065..43570f5ebc 100644 --- a/src/bg.c +++ b/src/bg.c @@ -37,9 +37,9 @@ struct BgConfig2 s32 bg_y; }; -static IWRAM_DATA struct BgControl sGpuBgConfigs; -static IWRAM_DATA struct BgConfig2 sGpuBgConfigs2[4]; -static IWRAM_DATA u32 sDmaBusyBitfield[4]; +static struct BgControl sGpuBgConfigs; +static struct BgConfig2 sGpuBgConfigs2[4]; +static u32 sDmaBusyBitfield[4]; u32 gUnneededFireRedVariable; diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 605cd0366c..835141ef28 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -73,7 +73,7 @@ static void CreateRandomEggShardSprite(void); static void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8 spriteAnimIndex); // IWRAM bss -static IWRAM_DATA struct EggHatchData *sEggHatchData; +static struct EggHatchData *sEggHatchData; // rom data static const u16 sEggPalette[] = INCBIN_U16("graphics/pokemon/egg/normal.gbapal"); diff --git a/src/field_camera.c b/src/field_camera.c index b976cf2ff1..7f294afdb7 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -36,11 +36,11 @@ static void DrawMetatile(s32 a, u16 *b, u16 c); static void CameraPanningCB_PanAhead(void); // IWRAM bss vars -static IWRAM_DATA struct FieldCameraOffset sFieldCameraOffset; -static IWRAM_DATA s16 sHorizontalCameraPan; -static IWRAM_DATA s16 sVerticalCameraPan; -static IWRAM_DATA u8 gUnknown_03000E2C; -static IWRAM_DATA void (*sFieldCameraPanningCallback)(void); +static struct FieldCameraOffset sFieldCameraOffset; +static s16 sHorizontalCameraPan; +static s16 sVerticalCameraPan; +static u8 gUnknown_03000E2C; +static void (*sFieldCameraPanningCallback)(void); struct CameraObject gFieldCamera; u16 gTotalCameraPixelOffsetY; diff --git a/src/field_effect.c b/src/field_effect.c index 22bf44f281..7569bdc75d 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -232,7 +232,7 @@ static void Fldeff_MoveDeoxysRock_Step(u8 taskId); // Static RAM declarations -static IWRAM_DATA u8 sActiveList[32]; +static u8 sActiveList[32]; // External declarations extern struct CompressedSpritePalette gMonPaletteTable[]; // GF made a mistake and did not extern it as const. diff --git a/src/field_weather.c b/src/field_weather.c index 814e85ef47..024b6631fe 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -68,7 +68,7 @@ static u8 None_Finish(void); EWRAM_DATA struct Weather gWeather = {0}; EWRAM_DATA static u8 sFieldEffectPaletteGammaTypes[32] = {0}; -IWRAM_DATA static const u8 *sPaletteGammaTypes; +static const u8 *sPaletteGammaTypes; // The drought weather effect uses a precalculated color lookup table. Presumably this // is because the underlying color shift calculation is slow. diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index 68c50cae78..3115ff2318 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -59,11 +59,11 @@ static void CutGrassSpriteCallbackEnd(struct Sprite *); static void HandleLongGrassOnHyper(u8, s16, s16); // IWRAM variables -static IWRAM_DATA u8 sCutSquareSide; -static IWRAM_DATA u8 sTileCountFromPlayer_X; -static IWRAM_DATA u8 sTileCountFromPlayer_Y; -static IWRAM_DATA u32 sUnused; -static IWRAM_DATA bool8 sHyperCutTiles[CUT_HYPER_AREA]; +static u8 sCutSquareSide; +static u8 sTileCountFromPlayer_X; +static u8 sTileCountFromPlayer_Y; +static u32 sUnused; +static bool8 sHyperCutTiles[CUT_HYPER_AREA]; // EWRAM variables static EWRAM_DATA u8 *sCutGrassSpriteArrayPtr = NULL; diff --git a/src/load_save.c b/src/load_save.c index 150c557c64..5857f2b463 100644 --- a/src/load_save.c +++ b/src/load_save.c @@ -42,10 +42,10 @@ EWRAM_DATA struct LoadedSaveData gLoadedSaveData = {0}; EWRAM_DATA u32 gLastEncryptionKey = 0; // IWRAM common -IWRAM_DATA bool32 gFlashMemoryPresent; -IWRAM_DATA struct SaveBlock1 *gSaveBlock1Ptr; -IWRAM_DATA struct SaveBlock2 *gSaveBlock2Ptr; -IWRAM_DATA struct PokemonStorage *gPokemonStoragePtr; +bool32 gFlashMemoryPresent; +struct SaveBlock1 *gSaveBlock1Ptr; +struct SaveBlock2 *gSaveBlock2Ptr; +struct PokemonStorage *gPokemonStoragePtr; // code void CheckForFlashMemory(void) diff --git a/src/main.c b/src/main.c index d0c9ff7b4b..47a957ce0c 100644 --- a/src/main.c +++ b/src/main.c @@ -85,7 +85,14 @@ void EnableVCountIntrAtLine150(void); void AgbMain() { - RegisterRamReset(MODERN ? RESET_ALL & ~RESET_IWRAM : RESET_ALL); +#if MODERN + // Modern compilers are liberal with the stack on entry to this function, + // so RegisterRamReset may crash if it resets IWRAM. + RegisterRamReset(RESET_ALL & ~RESET_IWRAM); + DmaFill32(3, 0, IWRAM_START, 0x7E00); +#else + RegisterRamReset(RESET_ALL); +#endif //MODERN *(vu16 *)BG_PLTT = 0x7FFF; InitGpuRegManager(); REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3; diff --git a/src/main_menu.c b/src/main_menu.c index bc509c70df..6a0bd9e2dc 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -176,7 +176,7 @@ static EWRAM_DATA u8 gUnknown_02022D04 = 0; static EWRAM_DATA u16 sCurrItemAndOptionMenuCheck = 0; -static IWRAM_DATA u8 sBirchSpeechMainTaskId; +static u8 sBirchSpeechMainTaskId; // Static ROM declarations diff --git a/src/menu_helpers.c b/src/menu_helpers.c index 801e2546b3..cb0d621c6f 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -27,7 +27,7 @@ EWRAM_DATA static struct YesNoFuncTable gUnknown_0203A138 = {0}; EWRAM_DATA static u8 gUnknown_0203A140 = 0; // IWRAM bss vars -IWRAM_DATA static TaskFunc gUnknown_0300117C; +static TaskFunc gUnknown_0300117C; // const rom data static const struct OamData sOamData_859F4E8 = diff --git a/src/mirage_tower.c b/src/mirage_tower.c index 269f8ea1b1..e398c23344 100644 --- a/src/mirage_tower.c +++ b/src/mirage_tower.c @@ -258,7 +258,7 @@ EWRAM_DATA static struct Struct203CF10 *sUnknown_0203CF10 = NULL; EWRAM_DATA static struct BgRegOffsets *sBgShakeOffsets = NULL; EWRAM_DATA struct MirageTowerPulseBlend *sMirageTowerPulseBlend = NULL; -IWRAM_DATA static u16 gUnknown_030012A8[8]; +static u16 gUnknown_030012A8[8]; bool8 IsMirageTowerVisible(void) { diff --git a/src/multiboot.c b/src/multiboot.c index 5cc3ad17eb..c7e14392e8 100644 --- a/src/multiboot.c +++ b/src/multiboot.c @@ -1,7 +1,7 @@ #include "gba/gba.h" #include "multiboot.h" -IWRAM_DATA static u16 MultiBoot_required_data[MULTIBOOT_NCHILD]; +static u16 MultiBoot_required_data[MULTIBOOT_NCHILD]; static int MultiBootSend(struct MultiBootParam *mp, u16 data); static int MultiBootHandShake(struct MultiBootParam *mp); diff --git a/src/overworld.c b/src/overworld.c index 4356752c17..2097abc533 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -186,15 +186,15 @@ static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStr static u16 GetCenterScreenMetatileBehavior(void); // IWRAM bss vars -IWRAM_DATA static void *sUnusedOverworldCallback; -IWRAM_DATA static u8 sPlayerTradingStates[4]; +static void *sUnusedOverworldCallback; +static u8 sPlayerTradingStates[4]; // This callback is called with a player's key code. It then returns an // adjusted key code, effectively intercepting the input before anything // can process it. -IWRAM_DATA static u16 (*sPlayerKeyInterceptCallback)(u32); -IWRAM_DATA static bool8 sUnknown_03000E18; -IWRAM_DATA static u8 sRfuKeepAliveTimer; -IWRAM_DATA static u32 sUnusedVar; +static u16 (*sPlayerKeyInterceptCallback)(u32); +static bool8 sUnknown_03000E18; +static u8 sRfuKeepAliveTimer; +static u32 sUnusedVar; // IWRAM common u16 *gBGTilemapBuffers1; diff --git a/src/party_menu.c b/src/party_menu.c index f20bdff517..ad5807ce42 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1596,8 +1596,8 @@ static void InitPartyMenu(u8 a, u8 b, u8 c, u8 d, u8 messageId, TaskFunc task, M gUnknown_0203CEC4->task = task; gUnknown_0203CEC4->exitCallback = NULL; gUnknown_0203CEC4->unk8_1 = 0; - gUnknown_0203CEC4->unk8_2 = 0xFF; - gUnknown_0203CEC4->unk9_0 = 0xFF; + gUnknown_0203CEC4->unk8_2 = 0x7F; + gUnknown_0203CEC4->unk9_0 = 0x7F; if (a == 4) gUnknown_0203CEC4->unk8_0 = TRUE; diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index 1eb8c09532..dc69b5d540 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -763,11 +763,11 @@ static void sub_813D6B4(void) static void CreateAreaMarkerSprites(void) { u8 spriteId; - static IWRAM_DATA s16 x; - static IWRAM_DATA s16 y; - static IWRAM_DATA s16 i; - static IWRAM_DATA s16 mapSecId; - static IWRAM_DATA s16 numSprites; + static s16 x; + static s16 y; + static s16 i; + static s16 mapSecId; + static s16 numSprites; LoadSpriteSheet(&sAreaMarkerSpriteSheet); LoadSpritePalette(&sAreaMarkerSpritePalette); diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 52fa6db51c..0929dfa449 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -177,9 +177,9 @@ static void SpriteCB_SetDummyOnAnimEnd(struct Sprite *sprite); #define STRUCT_COUNT 4 // IWRAM bss -static IWRAM_DATA struct UnkAnimStruct sUnknown_03001240[STRUCT_COUNT]; -static IWRAM_DATA u8 sUnknown_03001270; -static IWRAM_DATA bool32 sUnknown_03001274; +static struct UnkAnimStruct sUnknown_03001240[STRUCT_COUNT]; +static u8 sUnknown_03001270; +static bool32 sUnknown_03001274; // const rom data static const u8 sSpeciesToBackAnimSet[] = diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 0ddad55a61..49b171ec05 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -443,7 +443,7 @@ enum #define TAG_TILE_1 0x1 // IWRAM bss -IWRAM_DATA static u32 gUnknown_03000F78[98]; +static u32 gUnknown_03000F78[98]; // EWRAM DATA EWRAM_DATA static u8 sPreviousBoxOption = 0; diff --git a/src/random.c b/src/random.c index f0b2d9e5f5..b570a7bc33 100644 --- a/src/random.c +++ b/src/random.c @@ -8,8 +8,8 @@ EWRAM_DATA static u8 sUnknown = 0; EWRAM_DATA static u32 sRandCount = 0; // IWRAM common -IWRAM_DATA u32 gRngValue; -IWRAM_DATA u32 gRng2Value; +u32 gRngValue; +u32 gRng2Value; u16 Random(void) { diff --git a/src/record_mixing.c b/src/record_mixing.c index 85b52e478b..6cb145c80b 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -82,21 +82,21 @@ union PlayerRecords // Static RAM declarations -static IWRAM_DATA bool8 gUnknown_03001130; -static IWRAM_DATA struct SecretBase *sSecretBasesSave; -static IWRAM_DATA TVShow *sTvShowsSave; -static IWRAM_DATA PokeNews *sPokeNewsSave; -static IWRAM_DATA OldMan *sOldManSave; -static IWRAM_DATA struct EasyChatPair *sEasyChatPairsSave; -static IWRAM_DATA struct RecordMixingDayCareMail *gUnknown_03001148; -static IWRAM_DATA void *sBattleTowerSave; -static IWRAM_DATA LilycoveLady *sLilycoveLadySave; -static IWRAM_DATA void *sApprenticesSave; -static IWRAM_DATA void *sBattleTowerSave_Duplicate; -static IWRAM_DATA u32 sRecordStructSize; -static IWRAM_DATA u8 gUnknown_03001160; -static IWRAM_DATA u32 filler_03001164; -static IWRAM_DATA struct PlayerHallRecords *gUnknown_03001168[3]; +static bool8 gUnknown_03001130; +static struct SecretBase *sSecretBasesSave; +static TVShow *sTvShowsSave; +static PokeNews *sPokeNewsSave; +static OldMan *sOldManSave; +static struct EasyChatPair *sEasyChatPairsSave; +static struct RecordMixingDayCareMail *gUnknown_03001148; +static void *sBattleTowerSave; +static LilycoveLady *sLilycoveLadySave; +static void *sApprenticesSave; +static void *sBattleTowerSave_Duplicate; +static u32 sRecordStructSize; +static u8 gUnknown_03001160; +static u32 filler_03001164; +static struct PlayerHallRecords *gUnknown_03001168[3]; static EWRAM_DATA struct RecordMixingDayCareMail gUnknown_02039F9C = {0}; static EWRAM_DATA union PlayerRecords *sReceivedRecords = NULL; diff --git a/src/recorded_battle.c b/src/recorded_battle.c index ac97dfcd67..9e03d57f67 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -100,8 +100,8 @@ EWRAM_DATA static u8 sApprenticeId = 0; EWRAM_DATA static u16 sEasyChatSpeech[6] = {0}; EWRAM_DATA static u8 sBattleOutcome = 0; -IWRAM_DATA static u8 sRecordMixFriendLanguage; -IWRAM_DATA static u8 sApprenticeLanguage; +static u8 sRecordMixFriendLanguage; +static u8 sApprenticeLanguage; // this file's functions static u8 sub_8185278(u8 *arg0, u8 *arg1, u8 *arg2); diff --git a/src/reset_save_heap.c b/src/reset_save_heap.c index 95d63a3233..beba742f56 100644 --- a/src/reset_save_heap.c +++ b/src/reset_save_heap.c @@ -14,7 +14,7 @@ void sub_81700F8(void) imeBackup = REG_IME; REG_IME = 0; - RegisterRamReset(0x00000001); + RegisterRamReset(RESET_EWRAM); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_FORCED_BLANK); REG_IME = imeBackup; gMain.inBattle = FALSE; diff --git a/src/rom_8034C54.c b/src/rom_8034C54.c index a3707017e8..42817fc2b4 100644 --- a/src/rom_8034C54.c +++ b/src/rom_8034C54.c @@ -43,9 +43,9 @@ static bool32 SharesPalWithAnyActive(u32 id); static void sub_8035648(void); // iwram -static IWRAM_DATA s32 gUnknown_03000DD4; -static IWRAM_DATA s32 gUnknown_03000DD8; -static IWRAM_DATA s32 gUnknown_03000DDC; +static s32 gUnknown_03000DD4; +static s32 gUnknown_03000DD8; +static s32 gUnknown_03000DDC; // ewram static EWRAM_DATA struct UnkStruct1 *gUnknown_02022E10 = {0}; diff --git a/src/roulette_util.c b/src/roulette_util.c index 16c3e81507..f1f04a73a5 100755 --- a/src/roulette_util.c +++ b/src/roulette_util.c @@ -408,8 +408,8 @@ void UpdatePulseBlend(struct PulseBlend *pulseBlend) } } break; - case 2: // Flip back and forth - // This code is never reached + case (MODERN ? -2 : 2): // Flip back and forth + // This code is never reached in vanilla if (pulseBlendPalette->fadeDirection) pulseBlendPalette->blendCoeff = 0; else diff --git a/src/rtc.c b/src/rtc.c index 37a06fe7ea..b135a675a8 100644 --- a/src/rtc.c +++ b/src/rtc.c @@ -4,10 +4,10 @@ #include "text.h" // iwram bss -IWRAM_DATA static u16 sErrorStatus; -IWRAM_DATA static struct SiiRtcInfo sRtc; -IWRAM_DATA static u8 sProbeResult; -IWRAM_DATA static u16 sSavedIme; +static u16 sErrorStatus; +static struct SiiRtcInfo sRtc; +static u8 sProbeResult; +static u16 sSavedIme; // iwram common struct Time gLocalTime; diff --git a/src/script.c b/src/script.c index 27476dba36..34484561cc 100644 --- a/src/script.c +++ b/src/script.c @@ -10,12 +10,12 @@ extern const u8* gUnknown_020375C0; // ewram bss -IWRAM_DATA static u8 sScriptContext1Status; -IWRAM_DATA static u32 sUnusedVariable1; -IWRAM_DATA static struct ScriptContext sScriptContext1; -IWRAM_DATA static u32 sUnusedVariable2; -IWRAM_DATA static struct ScriptContext sScriptContext2; -IWRAM_DATA static bool8 sScriptContext2Enabled; +static u8 sScriptContext1Status; +static u32 sUnusedVariable1; +static struct ScriptContext sScriptContext1; +static u32 sUnusedVariable2; +static struct ScriptContext sScriptContext2; +static bool8 sScriptContext2Enabled; extern ScrCmdFunc gScriptCmdTable[]; extern ScrCmdFunc gScriptCmdTableEnd[]; diff --git a/src/slot_machine.c b/src/slot_machine.c index b853daa390..003ac3327c 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -350,7 +350,7 @@ static EWRAM_DATA struct SpriteSheet *sUnknown_0203AB30 = NULL; static EWRAM_DATA struct SlotMachineEwramStruct *sSlotMachine = NULL; // IWRAM bss -static IWRAM_DATA struct SpriteFrameImage *gUnknown_03001188[26]; +static struct SpriteFrameImage *gUnknown_03001188[26]; // Const rom data. extern const struct UnkStruct1 *const gUnknown_083ED048[]; diff --git a/src/sound.c b/src/sound.c index 16f024858f..dba4354dfe 100644 --- a/src/sound.c +++ b/src/sound.c @@ -19,11 +19,11 @@ EWRAM_DATA struct MusicPlayerInfo* gMPlay_PokemonCry = NULL; EWRAM_DATA u8 gPokemonCryBGMDuckingCounter = 0; // iwram bss -IWRAM_DATA static u16 sCurrentMapMusic; -IWRAM_DATA static u16 sNextMapMusic; -IWRAM_DATA static u8 sMapMusicState; -IWRAM_DATA static u8 sMapMusicFadeInSpeed; -IWRAM_DATA static u16 sFanfareCounter; +static u16 sCurrentMapMusic; +static u16 sNextMapMusic; +static u8 sMapMusicState; +static u8 sMapMusicFadeInSpeed; +static u16 sFanfareCounter; // iwram common bool8 gDisableMusic; diff --git a/src/sprite.c b/src/sprite.c index d2ea7889c1..e25eac62e4 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -285,10 +285,10 @@ static const struct OamDimensions sOamDimensions[3][4] = }; // iwram bss -IWRAM_DATA static u16 sSpriteTileRangeTags[MAX_SPRITES]; -IWRAM_DATA static u16 sSpriteTileRanges[MAX_SPRITES * 2]; -IWRAM_DATA static struct AffineAnimState sAffineAnimStates[OAM_MATRIX_COUNT]; -IWRAM_DATA static u16 sSpritePaletteTags[16]; +static u16 sSpriteTileRangeTags[MAX_SPRITES]; +static u16 sSpriteTileRanges[MAX_SPRITES * 2]; +static struct AffineAnimState sAffineAnimStates[OAM_MATRIX_COUNT]; +static u16 sSpritePaletteTags[16]; // iwram common u32 gOamMatrixAllocBitmap; diff --git a/src/starter_choose.c b/src/starter_choose.c index 886daa45a3..5524d407b0 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -51,7 +51,7 @@ void sub_81346DC(struct Sprite *sprite); void sub_813473C(struct Sprite *sprite); void StarterPokemonSpriteCallback(struct Sprite *sprite); -static IWRAM_DATA u16 sStarterChooseWindowId; +static u16 sStarterChooseWindowId; // .rodata const u16 gBirchBagGrassPal[][16] =