summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/credits.s4
-rw-r--r--include/battle.h48
-rwxr-xr-xinclude/ewram.h21
-rw-r--r--shared_syms.txt27
-rw-r--r--src/battle/battle_2.c6
-rw-r--r--src/battle/battle_3.c4
-rw-r--r--src/battle/battle_7.c10
-rw-r--r--src/battle/calculate_base_damage.c4
-rw-r--r--src/de_rom_8040FE0.c5
-rw-r--r--src/engine/link.c3
-rw-r--r--src/engine/record_mixing.c36
-rw-r--r--src/engine/save.c22
-rw-r--r--src/field/fldeff_cut.c11
-rw-r--r--src/field/player_pc.c65
-rw-r--r--src/pokemon/pokedex_cry_screen.c5
-rw-r--r--src/pokemon/pokemon_2.c28
-rw-r--r--src/pokemon/pokemon_summary_screen.c5
-rw-r--r--src/rom_8077ABC.c59
-rw-r--r--src/scene/contest_painting.c9
-rw-r--r--src/scene/credits.c2
-rw-r--r--src/scene/evolution_scene.c11
21 files changed, 180 insertions, 205 deletions
diff --git a/data/credits.s b/data/credits.s
index fe82968c0..72a7b22ac 100644
--- a/data/credits.s
+++ b/data/credits.s
@@ -120,11 +120,11 @@ gSpriteAnimTable_0840CA94:: @ 840CA94
gUnknown_0840CAA0:: @ 840CAA0
- obj_tiles gHallOfFame, 6144, 1001
+ obj_tiles 0x201E000, 6144, 1001 @ can't believe im making this a pointer again... this should be eHallOfFame, when represented in the original C file again. Please fix this by migrating data/credits.s to credits.c.
null_obj_tiles
gUnknown_0840CAB0:: @ 840CAB0
- obj_pal unk_201f800, 1001
+ obj_pal 0x201F800, 1001 @ same as above. When this is in credits.c, it will be able to proper see its definition in ewram.h, which is EWRAM_1F800.
null_obj_pal
.align 2
diff --git a/include/battle.h b/include/battle.h
index c2e1063d3..d576e92f4 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -539,6 +539,16 @@ struct Struct2017100
u32 arr[4];
};
+struct Struct2019348
+{
+ u16 unk0;
+ u16 unk2;
+ u8 unk4;
+ u32 unk8;
+ u32 unkC;
+ u32 unk10;
+};
+
struct Struct2017800
{
u8 invisible:1;
@@ -551,25 +561,25 @@ struct Struct2017800
struct Struct2017810
{
- u8 unk0_0:1;
- u8 unk0_1:1;
- u8 unk0_2:1;
- u8 unk0_3:1;
- u8 unk0_4:1;
- u8 unk0_5:1;
- u8 unk0_6:1;
- u8 unk0_7:1;
- u8 unk1_0:1;
- u8 unk1_1:5;
- u8 unk2;
- u8 unk3;
- u8 unk4;
- u8 unk5;
- u8 unk6;
- u8 unk7;
- u8 unk8;
- u8 unk9;
- u8 fillerA[2];
+ /*0x00*/ u8 unk0_0:1;
+ /*0x00*/ u8 unk0_1:1;
+ /*0x00*/ u8 unk0_2:1;
+ /*0x00*/ u8 unk0_3:1;
+ /*0x00*/ u8 unk0_4:1;
+ /*0x00*/ u8 unk0_5:1;
+ /*0x00*/ u8 unk0_6:1;
+ /*0x00*/ u8 unk0_7:1;
+ /*0x01*/ u8 unk1_0:1;
+ /*0x01*/ u8 unk1_1:5;
+ /*0x02*/ u8 unk2;
+ /*0x03*/ u8 unk3;
+ /*0x04*/ u8 unk4;
+ /*0x05*/ u8 unk5;
+ /*0x06*/ u8 unk6;
+ /*0x07*/ u8 unk7;
+ /*0x08*/ u8 unk8;
+ /*0x09*/ u8 unk9;
+ /*0x0A*/ u8 fillerA[2];
};
struct Struct2017840
diff --git a/include/ewram.h b/include/ewram.h
index 341f23432..051b9eac1 100755
--- a/include/ewram.h
+++ b/include/ewram.h
@@ -2,6 +2,7 @@
#define GUARD_EWRAM_H
extern u8 ewram[];
+#define ewram_addr 0x02000000 // used in ewram addr hacks
// Note: we have duplicate ewram labels because its clear some memory
// regions overlap others but have different definitions. Until some
@@ -18,6 +19,7 @@ extern u8 ewram[];
#define eBrendanSprite (ewram + 0x0)
#define ewram0_6 (u32)(&ewram[0])
#define ewram0_7 (&ewram[0])
+#define eSaveSection (struct SaveSection *)(ewram + 0x0)
#define ewram4 (*(struct UnknownStruct8 *)(ewram + 0x4))
#define ewram520 ((struct UnknownStruct7 *)(ewram + 0x00520))
#define eMaySprite (ewram + 0x800)
@@ -31,13 +33,15 @@ extern u8 ewram[];
#define gUnk2002694 (u8 *)(&ewram[0x2694])
#define gUnk20026A6 (u8 *)(&ewram[0x26A6])
#define gUnk20026e4 (u8 *)(&ewram[0x26E4])
+#define ewram4000 (ewram + 0x4000)
#define gUnknown_02007000 (*(ewramStruct_02007000 *)(ewram + 0x7000))
#define ARRAY_2007800 ((struct EasyChatPair *)(ewram + 0x7800))
#define ARRAY_2007900 ((struct EasyChatPair *)(ewram + 0x7900))
-#define unk_2008000 (*(struct PlayerRecords *)(ewram + 0x08000))
+#define ewram_2008000 (*(struct PlayerRecords *)(ewram + 0x08000))
#define ewram8000 (&ewram[0x8000])
#define ewram8800 (&ewram[0x8800])
#define ewram9000 (&ewram[0x9000])
+#define ewram9000_hack (void *)(ewram_addr + 0x9000) // TODO: Fix this.
#define ewram9800 (&ewram[0x9800])
#define ewramA000 (&ewram[0xA000])
#define ewramA800 (&ewram[0xA800])
@@ -73,6 +77,8 @@ extern u8 ewram[];
#define ewram15800 (&ewram[0x15800])
#define ewram15DDE (ewram[0x15DDE])
#define ewram15DDF (ewram[0x15DDF])
+#define ewram15DE0 ((*(struct ContestEntry*)(ewram + 0x15DE0)))
+#define ewram15E00 ((*(struct Unk2015E00*)(ewram + 0x15E00)))
#define ewram16000 (ewram[0x16000])
#define ewram16001 (ewram[0x16001])
#define ewram16002 (ewram[0x16002])
@@ -157,22 +163,26 @@ extern u8 ewram[];
#define AI_STACK ((struct AI_Stack *) (ewram + 0x16C00))
#define AI_ARRAY_160CC(i) (ewram[0x160CC + i * 2])
#define eLearnMoveStruct (struct LearnMoveStruct *)(ewram + 0x17000)
+#define eSecretBaseRecord ((struct SecretBaseRecord *)(ewram + 0x17000))
#define ewram17002 (&ewram[0x17002])
-#define ewram17100 (*(struct Struct2017100 *)(ewram + 0x17100))
+#define eFlashFireArr (*(struct Struct2017100 *)(ewram + 0x17100))
#define B_BATTLESCRIPTS_STACK ((struct scriptsStack *) (ewram + 0x17110))
#define ewram17130 (ewram[0x17130])
#define B_FUNCTION_STACK ((struct funcStack *) (ewram + 0x17140))
#define ewram17160 (ewram[0x17160])
#define ewram17800 ((struct Struct2017800 *) (ewram + 0x17800))
#define EWRAM_17800 ((struct UnknownStruct1 *)(ewram + 0x17800))
+#define eTransformStatuses ((struct TransformStatus *)(ewram + 0x17800))
#define ewram17810 ((struct Struct2017810 *) (ewram + 0x17810))
#define EWRAM_17810 ((struct UnknownStruct3 *)(ewram + 0x17810))
#define ewram17840 (*(struct Struct2017840 *) (ewram + 0x17840))
#define ewram17850 ((struct UnknownStruct5 *)(ewram + 0x17850))
-#define unk_2018000 (*(struct PlayerRecords *)(ewram + 0x18000))
+#define ewram_2018000 (*(struct PlayerRecords *)(ewram + 0x18000))
#define EWRAM_18000 ((u16 *)(ewram + 0x18000))
#define ewram18000 ((u16 *)(ewram + 0x18000))
#define ewram18000_2 (&ewram[0x18000])
+// extern struct Pokemon *unk_2018000;
+#define ewram18000_3 *(struct Pokemon **)(ewram + 0x18000)
#define eBerryBlenderData (struct BerryBlenderData*)(&ewram[0x18000])
#define eEggHatchData (struct EggHatchData*)(&ewram[0x18000])
#define UNK_2018000_STRUCT (*(struct UnknownStruct2018000 *)(ewram + 0x18000))
@@ -190,12 +200,15 @@ extern u8 ewram[];
#define ewram1C000 (*(struct Unk201C000 *)(ewram + 0x1C000))
#define ewram1c000 (*(struct Unk201C000 *)(ewram + 0x1C000)) // FIXME, names too similar
#define eHallOfFameMons1 (struct HallofFameMons*)(&ewram[0x1C000])
+#define EWRAM_1C800 (*(struct Unk201C800 *)(ewram + 0x1C800))
#define ewram1D000 ((struct Pokemon *)(ewram + 0x1D000))
#define ewram1D000_2 ((u16 *)(ewram + 0x1D000))
#define ewram1D400 ((u16 *)(ewram + 0x1D400))
#define ewramSavedItemsPocket ((struct ItemSlot *)(ewram + 0x1E000)) // saved items pocket (for Wally battle)
#define ewram1E000(i) (ewram[0x1E000 + i])
#define eHallOfFameMons2 (struct HallofFameMons*)(&ewram[0x1E000])
+// extern struct HallOfFame gHallOfFame;
+#define eHallOfFame (struct HallOfFame *)(ewram + 0x1E000)
#define HALL_OF_FAME_SHEET_0 ((u8 *)(ewram + 0x1E000))
#define HALL_OF_FAME_SHEET_1 ((u8 *)(ewram + 0x1E800))
#define ewram_1f000 (*(struct DecoPCPointers *)(ewram + 0x1f000))
@@ -203,6 +216,8 @@ extern u8 ewram[];
#define HALL_OF_FAME_SHEET_2 ((u8 *)(ewram + 0x1F000))
#define EWRAM_1F800 ((u16 *)(ewram + 0x1F800))
#define ewram1FE00 (*(struct Unk201FE00 *)(ewram + 0x1FE00))
+#define eMailboxInfo (*(struct MailboxStruct *)(ewram + 0x1FE00))
+#define eCutGrassSpriteArray (ewram + 0x1FFF0) // 8 sprite IDs
#define ewram1FFFC (ewram[0x1FFFC])
#define ewram1FFFD (ewram[0x1FFFD])
#define gHelperState (ewram[0x1FFFE])
diff --git a/shared_syms.txt b/shared_syms.txt
index 5ed4186c6..1422fe418 100644
--- a/shared_syms.txt
+++ b/shared_syms.txt
@@ -1,26 +1 @@
-ewram = 0x2000000;
-unk_2004000 = 0x2004000;
-gUnk_2009000 = 0x2009000;
-unk_2007800 = 0x2007800;
-unk_2007900 = 0x2007900;
-unk_2008000 = 0x2008000;
-unk_2015de0 = 0x2015de0;
-unk_2015e00 = 0x2015e00;
-unk_2016000 = 0x2016000;
-unk_201606C = 0x201606C;
-unk_20160BC = 0x20160BC;
-unk_2016A00 = 0x2016A00;
-unk_2016C00 = 0x2016C00;
-gTransformStatuses = 0x2017800;
-unk_2017810 = 0x2017810;
-gMailboxInfo = 0x201FE00;
-gSecretBaseRecord = 0x2017000;
-dword_2017100 = 0x2017100;
-unk_2018000 = 0x2018000;
-unk_2019348 = 0x2019348;
-unk_201B260 = 0x201b260;
-unk_201B264 = 0x201B264;
-unk_201C000 = 0x201C000;
-gHallOfFame = 0x201E000;
-unk_201f800 = 0x201F800;
-gCutGrassSpriteArray = 0x201FFF0;
+ewram = 0x2000000; \ No newline at end of file
diff --git a/src/battle/battle_2.c b/src/battle/battle_2.c
index 8d27750bd..4b75818b6 100644
--- a/src/battle/battle_2.c
+++ b/src/battle/battle_2.c
@@ -1537,7 +1537,7 @@ void sub_8010874(void)
gUnknown_02024C5C[i] = 0xFF;
gLockedMove[i] = 0;
gUnknown_02024C2C[i] = 0;
- ewram17100.arr[i] = 0;
+ eFlashFireArr.arr[i] = 0;
}
for (i = 0; i < 2; i++)
@@ -1699,7 +1699,7 @@ void SwitchInClearStructs(void)
ewram160E8arr2(0, gActiveBank) = 0;
ewram160E8arr2(1, gActiveBank) = 0;
- ewram17100.arr[gActiveBank] = 0;
+ eFlashFireArr.arr[gActiveBank] = 0;
gCurrentMove = 0;
}
@@ -1763,7 +1763,7 @@ void UndoEffectsAfterFainting(void)
ewram16100arr2(2, gActiveBank) = 0;
ewram16100arr2(3, gActiveBank) = 0;
- ewram17100.arr[gActiveBank] = 0;
+ eFlashFireArr.arr[gActiveBank] = 0;
gBattleMons[gActiveBank].type1 = gBaseStats[gBattleMons[gActiveBank].species].type1;
gBattleMons[gActiveBank].type2 = gBaseStats[gBattleMons[gActiveBank].species].type2;
diff --git a/src/battle/battle_3.c b/src/battle/battle_3.c
index 1d6784297..f37111af5 100644
--- a/src/battle/battle_3.c
+++ b/src/battle/battle_3.c
@@ -1718,14 +1718,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
case ABILITY_FLASH_FIRE:
if (moveType == TYPE_FIRE && !(gBattleMons[bank].status1 & STATUS_FREEZE))
{
- if (!(ewram17100.arr[bank] & 1))
+ if (!(eFlashFireArr.arr[bank] & 1))
{
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
if (gProtectStructs[gBankAttacker].notFirstStrike)
gBattlescriptCurrInstr = BattleScript_FlashFireBoost;
else
gBattlescriptCurrInstr = BattleScript_FlashFireBoost_PPLoss;
- ewram17100.arr[bank] |= 1;
+ eFlashFireArr.arr[bank] |= 1;
effect = 2;
}
else
diff --git a/src/battle/battle_7.c b/src/battle/battle_7.c
index 4ca1baa53..2a335ea63 100644
--- a/src/battle/battle_7.c
+++ b/src/battle/battle_7.c
@@ -20,16 +20,6 @@
#include "gba/m4a_internal.h"
#include "ewram.h"
-struct Struct2019348
-{
- u8 filler0[2];
- u16 unk2;
- u8 filler4[4];
- u32 unk8;
- u32 unkC;
- u32 unk10;
-};
-
extern u8 gBattleBufferA[][0x200];
extern u8 gActiveBank;
extern u8 gNoOfAllBanks;
diff --git a/src/battle/calculate_base_damage.c b/src/battle/calculate_base_damage.c
index f5c679876..42c26dee0 100644
--- a/src/battle/calculate_base_damage.c
+++ b/src/battle/calculate_base_damage.c
@@ -11,8 +11,8 @@
#include "species.h"
#include "moves.h"
#include "battle_move_effects.h"
+#include "ewram.h"
-extern u32 dword_2017100[];
extern u16 gBattleTypeFlags;
extern struct BattlePokemon gBattleMons[4];
extern u16 gCurrentMove;
@@ -301,7 +301,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
}
// flash fire triggered
- if ((dword_2017100[bankAtk] & 1) && type == TYPE_FIRE)
+ if ((eFlashFireArr.arr[bankAtk] & 1) && type == TYPE_FIRE)
damage = (15 * damage) / 10;
}
diff --git a/src/de_rom_8040FE0.c b/src/de_rom_8040FE0.c
index 8cf510d6f..8adad3245 100644
--- a/src/de_rom_8040FE0.c
+++ b/src/de_rom_8040FE0.c
@@ -1,6 +1,7 @@
#include "global.h"
#include "battle.h"
#include "battle_tower.h"
+#include "ewram.h"
#if GERMAN
@@ -21,8 +22,6 @@ enum {
TRAINER_CLASS_MAY_3 = 63,
};
-extern struct SecretBaseRecord gSecretBaseRecord;
-
extern u8 gTrainerClassNames[][13];
extern struct Trainer gTrainers[];
@@ -70,7 +69,7 @@ u8 *de_sub_8041024(s32 arg0, u32 arg1) {
{
case 0x400:
nameIndex = GetSecretBaseTrainerNameIndex();
- gender = gSecretBaseRecord.gender;
+ gender = eSecretBaseRecord.gender;
if (nameIndex == TRAINER_CLASS_NAME_SCHOOL_KID)
{
return de_sub_8040FE0(gender);
diff --git a/src/engine/link.c b/src/engine/link.c
index 504b828a1..c526baec7 100644
--- a/src/engine/link.c
+++ b/src/engine/link.c
@@ -36,7 +36,6 @@ struct LinkTestBGInfo
u32 dummy_C;
};
-extern u8 unk_2004000[];
extern u16 gBattleTypeFlags;
extern u16 word_3004858;
@@ -404,7 +403,7 @@ static void LinkTestProcessKeyInput(void)
if (gMain.newKeys & A_BUTTON)
gShouldAdvanceLinkState = 1;
if (gMain.heldKeys & B_BUTTON)
- InitBlockSend(unk_2004000, 0x2004);
+ InitBlockSend(ewram4000, 0x2004);
if (gMain.newKeys & L_BUTTON)
BeginNormalPaletteFade(-1, 0, 0x10, 0, 2);
if (gMain.newKeys & START_BUTTON)
diff --git a/src/engine/record_mixing.c b/src/engine/record_mixing.c
index 27992bf1f..3ae0c4ea3 100644
--- a/src/engine/record_mixing.c
+++ b/src/engine/record_mixing.c
@@ -66,31 +66,31 @@ void RecordMixing_PrepareExchangePacket(void)
sub_80BC300();
sub_80C045C();
- memcpy(unk_2018000.secretBases, recordMixingSecretBases, sizeof(unk_2018000.secretBases));
- memcpy(unk_2018000.tvShows, recordMixingTvShows, sizeof(unk_2018000.tvShows));
- memcpy(unk_2018000.filler1004, gUnknown_083D0274, sizeof(unk_2008000.filler1004));
- memcpy(unk_2018000.filler1044, gUnknown_083D0278, sizeof(unk_2008000.filler1044));
- memcpy(unk_2018000.easyChatPairs, recordMixingEasyChatPairs, sizeof(unk_2018000.easyChatPairs));
+ memcpy(ewram_2018000.secretBases, recordMixingSecretBases, sizeof(ewram_2018000.secretBases));
+ memcpy(ewram_2018000.tvShows, recordMixingTvShows, sizeof(ewram_2018000.tvShows));
+ memcpy(ewram_2018000.filler1004, gUnknown_083D0274, sizeof(ewram_2008000.filler1004));
+ memcpy(ewram_2018000.filler1044, gUnknown_083D0278, sizeof(ewram_2008000.filler1044));
+ memcpy(ewram_2018000.easyChatPairs, recordMixingEasyChatPairs, sizeof(ewram_2018000.easyChatPairs));
gUnknown_02038738.mail[0] = gSaveBlock1.daycareData.misc.mail[0];
gUnknown_02038738.mail[1] = gSaveBlock1.daycareData.misc.mail[1];
sub_8041324(gSaveBlock1.daycareData.mons, &gUnknown_02038738);
- memcpy(&unk_2018000.filler10AC, gUnknown_083D0280, sizeof(struct RecordMixingDayCareMail));
- memcpy(&unk_2018000.battleTowerRecord, gBattleTowerPlayerRecord, sizeof(struct BattleTowerRecord));
+ memcpy(&ewram_2018000.filler10AC, gUnknown_083D0280, sizeof(struct RecordMixingDayCareMail));
+ memcpy(&ewram_2018000.battleTowerRecord, gBattleTowerPlayerRecord, sizeof(struct BattleTowerRecord));
if (GetMultiplayerId() == 0)
- unk_2018000.filler11C8[0] = GetRecordMixingGift();
+ ewram_2018000.filler11C8[0] = GetRecordMixingGift();
}
void RecordMixing_ReceiveExchangePacket(u32 a)
{
- sub_80BD674(unk_2008000.secretBases, sizeof(struct PlayerRecords), a);
- sub_80BFD44((u8 *)unk_2008000.tvShows, sizeof(struct PlayerRecords), a);
- sub_80C0514(unk_2008000.filler1004, sizeof(struct PlayerRecords), a);
- sub_80B9B1C(unk_2008000.filler1044, sizeof(struct PlayerRecords), a);
- sub_80FA4E4(unk_2008000.easyChatPairs, sizeof(struct PlayerRecords), a);
- sub_80B9C6C((u8 *)&unk_2008000.filler10AC, sizeof(struct PlayerRecords), a, unk_2008000.tvShows);
- sub_80B9B70(&unk_2008000.battleTowerRecord, sizeof(struct PlayerRecords), a);
- sub_80B9F3C(unk_2008000.filler11C8, a);
+ sub_80BD674(ewram_2008000.secretBases, sizeof(struct PlayerRecords), a);
+ sub_80BFD44((u8 *)ewram_2008000.tvShows, sizeof(struct PlayerRecords), a);
+ sub_80C0514(ewram_2008000.filler1004, sizeof(struct PlayerRecords), a);
+ sub_80B9B1C(ewram_2008000.filler1044, sizeof(struct PlayerRecords), a);
+ sub_80FA4E4(ewram_2008000.easyChatPairs, sizeof(struct PlayerRecords), a);
+ sub_80B9C6C((u8 *)&ewram_2008000.filler10AC, sizeof(struct PlayerRecords), a, ewram_2008000.tvShows);
+ sub_80B9B70(&ewram_2008000.battleTowerRecord, sizeof(struct PlayerRecords), a);
+ sub_80B9F3C(ewram_2008000.filler11C8, a);
}
#define tCounter data[0]
@@ -247,11 +247,11 @@ void sub_80B95F0(u8 taskId)
task->tState = 0;
task->data[5] = GetMultiplayerId_();
task->func = Task_RecordMixing_SendPacket;
- StorePtrInTaskData(&unk_2018000, &task->data[2]);
+ StorePtrInTaskData(&ewram_2018000, &task->data[2]);
subTaskId = CreateTask(Task_RecordMixing_CopyReceiveBuffer, 0x50);
task->data[10] = subTaskId;
gTasks[subTaskId].data[0] = taskId;
- StorePtrInTaskData((u8 *)&unk_2008000, &gTasks[subTaskId].data[5]);
+ StorePtrInTaskData((u8 *)&ewram_2008000, &gTasks[subTaskId].data[5]);
}
break;
case 5: // wait 60 frames
diff --git a/src/engine/save.c b/src/engine/save.c
index 57678dd8f..d5de2e408 100644
--- a/src/engine/save.c
+++ b/src/engine/save.c
@@ -5,14 +5,13 @@
#include "load_save.h"
#include "overworld.h"
#include "save_failed_screen.h"
+#include "ewram.h"
#define GETVALIDSTATUSBITFIELD ((1 << ARRAY_COUNT(gSaveSectionLocations)) - 1)
#define GETCHUNKSIZE(chunk, n) ((sizeof(chunk) - (0xF80 * (n - 1))) >= 0xF80 ? 0xF80 : (sizeof(chunk) - (0xF80 * (n - 1))))
#define GETBLOCKOFFSET(n) (0xF80 * (n - 1))
#define TOTALNUMSECTORS ((ARRAY_COUNT(gSaveSectionLocations) * 2) + (ARRAY_COUNT(gHallOfFameSaveSectionLocations) * 2)) // there are 2 slots, so double each array count and get the sum.
-extern struct SaveSection ewram; // slow save RAM
-
u16 gLastWrittenSector;
u32 gLastSaveCounter;
u16 gLastKnownGoodSector;
@@ -24,7 +23,6 @@ u16 gSaveFileStatus;
u32 gGameContinueCallback;
extern struct PokemonStorage gPokemonStorage;
-extern struct HallOfFame gHallOfFame;
static EWRAM_DATA u32 gLastSaveSectorStatus = 0; // used but in an unferenced function, so unused
@@ -48,8 +46,8 @@ const struct SaveSectionLocation gSaveSectionLocations[] =
const struct SaveSectionLocation gHallOfFameSaveSectionLocations[] =
{
- {((u8 *) &gHallOfFame) + GETBLOCKOFFSET(1), GETCHUNKSIZE(struct HallOfFame, 1)}, // gHallOfFame is not a proper sym, so the struct must be used.
- {((u8 *) &gHallOfFame) + GETBLOCKOFFSET(2), GETCHUNKSIZE(struct HallOfFame, 2)}
+ {((u8 *) eHallOfFame) + GETBLOCKOFFSET(1), GETCHUNKSIZE(struct HallOfFame, 1)}, // eHallOfFame is not a proper sym, so the struct must be used.
+ {((u8 *) eHallOfFame) + GETBLOCKOFFSET(2), GETCHUNKSIZE(struct HallOfFame, 2)}
};
const u8 gFlashSectors[] = { 0x1E, 0x1F };
@@ -95,7 +93,7 @@ u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location)
u32 retVal;
u16 i;
- gFastSaveSection = &ewram;
+ gFastSaveSection = eSaveSection;
if (a1 != 0xFFFF) // for link
{
@@ -156,7 +154,7 @@ u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location)
u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size)
{
u16 i;
- struct SaveSection *section = &ewram;
+ struct SaveSection *section = eSaveSection;
for (i = 0; i < sizeof(struct SaveSection); i++)
((char *)section)[i] = 0;
@@ -186,7 +184,7 @@ u8 TryWriteSector(u8 sector, u8 *data)
u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location) // location is unused
{
- gFastSaveSection = &ewram;
+ gFastSaveSection = eSaveSection;
gLastKnownGoodSector = gLastWrittenSector;
gLastSaveCounter = gSaveCounter;
gLastWrittenSector++;
@@ -199,7 +197,7 @@ u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location
u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location) // only ever called once, and gSaveBlock2 is passed to this function. location is unused
{
- gFastSaveSection = &ewram;
+ gFastSaveSection = eSaveSection;
gLastKnownGoodSector = gLastWrittenSector;
gLastSaveCounter = gSaveCounter;
gUnknown_03005EB4 = 0;
@@ -369,7 +367,7 @@ u8 sub_81257F0(u16 a1, const struct SaveSectionLocation *location)
u8 sub_812587C(u16 a1, const struct SaveSectionLocation *location)
{
u8 retVal;
- gFastSaveSection = &ewram;
+ gFastSaveSection = eSaveSection;
if (a1 != 0xFFFF)
{
retVal = 0xFF;
@@ -537,7 +535,7 @@ u8 GetSaveValidStatus(const struct SaveSectionLocation *location)
u8 sub_8125B88(u8 a1, u8 *data, u16 size)
{
u16 i;
- struct SaveSection *section = &ewram;
+ struct SaveSection *section = eSaveSection;
DoReadFlashWholeSection(a1, section);
if (section->security == UNKNOWN_CHECK_VALUE)
{
@@ -764,7 +762,7 @@ u8 unref_sub_8125FA0(void)
u8 unref_sub_8125FF0(u8 *data, u16 size)
{
u16 i;
- struct UnkSaveSection *section = (struct UnkSaveSection *)&ewram;
+ struct UnkSaveSection *section = (struct UnkSaveSection *)eSaveSection;
for (i = 0; i < sizeof(struct SaveSection); i++)
((char *)section)[i] = 0;
diff --git a/src/field/fldeff_cut.c b/src/field/fldeff_cut.c
index 00643a979..00cabe5c0 100644
--- a/src/field/fldeff_cut.c
+++ b/src/field/fldeff_cut.c
@@ -16,8 +16,7 @@
#include "sprite.h"
#include "task.h"
#include "trig.h"
-
-extern u8 gCutGrassSpriteArray[8]; // seems to be an array of 8 sprite IDs
+#include "ewram.h"
extern void (*gFieldCallback)(void);
extern void (*gUnknown_03005CE4)(void);
@@ -135,9 +134,9 @@ bool8 FldEff_CutGrass(void)
// populate sprite ID array
for(i = 0; i < 8; i++)
{
- gCutGrassSpriteArray[i] = CreateSprite((struct SpriteTemplate *)&gSpriteTemplate_CutGrass,
+ eCutGrassSpriteArray[i] = CreateSprite((struct SpriteTemplate *)&gSpriteTemplate_CutGrass,
gSprites[gPlayerAvatar.spriteId].oam.x + 8, gSprites[gPlayerAvatar.spriteId].oam.y + 20, 0);
- gSprites[gCutGrassSpriteArray[i]].data2 = 32 * i;
+ gSprites[eCutGrassSpriteArray[i]].data2 = 32 * i;
}
return 0;
}
@@ -273,8 +272,8 @@ void sub_80A2AB8(void)
u8 i;
for (i = 1; i < 8; i++)
- DestroySprite(&gSprites[gCutGrassSpriteArray[i]]);
- FieldEffectStop(&gSprites[gCutGrassSpriteArray[0]], FLDEFF_CUT_GRASS);
+ DestroySprite(&gSprites[eCutGrassSpriteArray[i]]);
+ FieldEffectStop(&gSprites[eCutGrassSpriteArray[0]], FLDEFF_CUT_GRASS);
sub_8064E2C();
ScriptContext2_Disable();
}
diff --git a/src/field/player_pc.c b/src/field/player_pc.c
index d01829266..ce78a88d8 100644
--- a/src/field/player_pc.c
+++ b/src/field/player_pc.c
@@ -20,6 +20,7 @@
#include "mail.h"
#include "overworld.h"
#include "player_pc.h"
+#include "ewram.h"
extern void DisplayItemMessageOnField(u8, const u8*, TaskFunc, u16);
extern void DoPlayerPCDecoration(u8);
@@ -271,14 +272,14 @@ static void PlayerPC_ItemStorage(u8 taskId)
static void PlayerPC_Mailbox(u8 taskId)
{
MenuZeroFillWindowRect(0, 0, 10, 9);
- gMailboxInfo.count = GetMailboxMailCount();
+ eMailboxInfo.count = GetMailboxMailCount();
- if (gMailboxInfo.count == 0)
+ if (eMailboxInfo.count == 0)
DisplayItemMessageOnField(taskId, gOtherText_NoMailHere, ReshowPlayerPC, 0);
else
{
- gMailboxInfo.cursorPos = 0;
- gMailboxInfo.itemsAbove = 0;
+ eMailboxInfo.cursorPos = 0;
+ eMailboxInfo.itemsAbove = 0;
Mailbox_UpdateMailList();
ItemStorage_SetItemAndMailCount(taskId);
Mailbox_DrawMailboxMenu(taskId);
@@ -442,10 +443,10 @@ static void ItemStorage_SetItemAndMailCount(u8 taskId)
else
NUM_PAGE_ITEMS = NUM_ITEMS + 1; // there are not enough items to fill a full page; take the # of items and add 1 for the cancel button.
- if (gMailboxInfo.count > 7)
- gMailboxInfo.pageItems = 8;
+ if (eMailboxInfo.count > 7)
+ eMailboxInfo.pageItems = 8;
else
- gMailboxInfo.pageItems = gMailboxInfo.count + 1;
+ eMailboxInfo.pageItems = eMailboxInfo.count + 1;
}
static void ItemStorage_ProcessInput(u8 taskId)
@@ -1048,8 +1049,8 @@ static void Mailbox_UpdateMailList(void)
static void Mailbox_DrawMailList(u8 taskId) // taskId is unused
{
u16 yCoord = 0;
- u16 i = gMailboxInfo.itemsAbove;
- register struct MailboxStruct *tempMailbox asm("r1") = &gMailboxInfo;
+ u16 i = eMailboxInfo.itemsAbove;
+ register struct MailboxStruct *tempMailbox asm("r1") = &eMailboxInfo;
register struct MailboxStruct *mailbox asm("r6");
if(i < i + tempMailbox->pageItems)
@@ -1076,10 +1077,10 @@ static void Mailbox_DrawMailList(u8 taskId) // taskId is unused
}
beforeLabel:
- if(i - gMailboxInfo.itemsAbove != 8)
+ if(i - eMailboxInfo.itemsAbove != 8)
MenuFillWindowRectWithBlankTile(0x15, yCoord + 4, 0x1C, 0x12);
- switch(gMailboxInfo.itemsAbove)
+ switch(eMailboxInfo.itemsAbove)
{
default:
CreateVerticalScrollIndicators(0, 0xC8, 8);
@@ -1092,7 +1093,7 @@ weirdCase:
break;
}
- if(gMailboxInfo.itemsAbove + gMailboxInfo.pageItems <= gMailboxInfo.count)
+ if(eMailboxInfo.itemsAbove + eMailboxInfo.pageItems <= eMailboxInfo.count)
CreateVerticalScrollIndicators(1, 0xC8, 0x98);
else
DestroyVerticalScrollIndicator(1);
@@ -1107,7 +1108,7 @@ static void Mailbox_DrawMailboxMenu(u8 taskId)
MenuPrint(gPCText_Mailbox, 1, 1);
MenuDrawTextWindow(0x14, 0, 0x1D, 0x13);
Mailbox_DrawMailList(taskId);
- InitMenu(0, 0x15, 2, gMailboxInfo.pageItems, gMailboxInfo.cursorPos, 8);
+ InitMenu(0, 0x15, 2, eMailboxInfo.pageItems, eMailboxInfo.cursorPos, 8);
}
// Mailbox_ProcessInput
@@ -1117,29 +1118,29 @@ static void Mailbox_ProcessInput(u8 taskId)
{
if(gMain.newAndRepeatedKeys & DPAD_UP)
{
- if(gMailboxInfo.cursorPos != 0)
+ if(eMailboxInfo.cursorPos != 0)
{
PlaySE(SE_SELECT);
- gMailboxInfo.cursorPos = MoveMenuCursor(-1);
+ eMailboxInfo.cursorPos = MoveMenuCursor(-1);
}
- else if(gMailboxInfo.itemsAbove != 0)
+ else if(eMailboxInfo.itemsAbove != 0)
{
PlaySE(SE_SELECT);
- gMailboxInfo.itemsAbove--;
+ eMailboxInfo.itemsAbove--;
Mailbox_DrawMailList(taskId);
}
}
else if(gMain.newAndRepeatedKeys & DPAD_DOWN)
{
- if(gMailboxInfo.cursorPos != gMailboxInfo.pageItems - 1)
+ if(eMailboxInfo.cursorPos != eMailboxInfo.pageItems - 1)
{
PlaySE(SE_SELECT);
- gMailboxInfo.cursorPos = MoveMenuCursor(1);
+ eMailboxInfo.cursorPos = MoveMenuCursor(1);
}
- else if(gMailboxInfo.itemsAbove + gMailboxInfo.cursorPos != gMailboxInfo.count)
+ else if(eMailboxInfo.itemsAbove + eMailboxInfo.cursorPos != eMailboxInfo.count)
{
PlaySE(SE_SELECT);
- gMailboxInfo.itemsAbove++;
+ eMailboxInfo.itemsAbove++;
Mailbox_DrawMailList(taskId);
}
}
@@ -1148,7 +1149,7 @@ static void Mailbox_ProcessInput(u8 taskId)
HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
- if(gMailboxInfo.itemsAbove + gMailboxInfo.cursorPos == gMailboxInfo.count)
+ if(eMailboxInfo.itemsAbove + eMailboxInfo.cursorPos == eMailboxInfo.count)
{
Mailbox_TurnOff(taskId);
}
@@ -1177,7 +1178,7 @@ static void Mailbox_CloseScrollIndicators(void)
static void Mailbox_PrintWhatToDoWithPlayerMailText(u8 taskId)
{
MenuZeroFillWindowRect(0, 0, 0x1D, 0x13);
- StringCopy(gStringVar1, gSaveBlock1.mail[gMailboxInfo.itemsAbove + 6 + gMailboxInfo.cursorPos].playerName);
+ StringCopy(gStringVar1, gSaveBlock1.mail[eMailboxInfo.itemsAbove + 6 + eMailboxInfo.cursorPos].playerName);
SanitizeNameString(gStringVar1);
StringExpandPlaceholders(gStringVar4, gOtherText_WhatWillYouDoMail);
DisplayItemMessageOnField(taskId, gStringVar4, Mailbox_PrintMailOptions, 0);
@@ -1237,7 +1238,7 @@ static void Mailbox_FadeAndReadMail(u8 taskId)
{
if(!gPaletteFade.active)
{
- HandleReadMail(&gSaveBlock1.mail[gMailboxInfo.itemsAbove + 6 + gMailboxInfo.cursorPos], Mailbox_ReturnToFieldFromReadMail, 1);
+ HandleReadMail(&gSaveBlock1.mail[eMailboxInfo.itemsAbove + 6 + eMailboxInfo.cursorPos], Mailbox_ReturnToFieldFromReadMail, 1);
DestroyTask(taskId);
}
}
@@ -1276,7 +1277,7 @@ static void Mailbox_DrawYesNoBeforeMove(u8 taskId)
static void Mailbox_DoMailMoveToBag(u8 taskId)
{
- struct MailStruct *mail = &gSaveBlock1.mail[gMailboxInfo.itemsAbove + 6 + gMailboxInfo.cursorPos];
+ struct MailStruct *mail = &gSaveBlock1.mail[eMailboxInfo.itemsAbove + 6 + eMailboxInfo.cursorPos];
MenuZeroFillWindowRect(0x14, 8, 0x1A, 0xD);
@@ -1290,10 +1291,10 @@ static void Mailbox_DoMailMoveToBag(u8 taskId)
ClearMailStruct(mail);
Mailbox_UpdateMailList();
- gMailboxInfo.count--;
+ eMailboxInfo.count--;
- if(gMailboxInfo.count < gMailboxInfo.pageItems + gMailboxInfo.itemsAbove && gMailboxInfo.itemsAbove != 0)
- gMailboxInfo.itemsAbove--;
+ if(eMailboxInfo.count < eMailboxInfo.pageItems + eMailboxInfo.itemsAbove && eMailboxInfo.itemsAbove != 0)
+ eMailboxInfo.itemsAbove--;
ItemStorage_SetItemAndMailCount(taskId);
}
@@ -1329,13 +1330,13 @@ static void Mailbox_DoGiveMailPokeMenu(u8 taskId) // Mailbox_DoGiveMailPokeMenu
static void Mailbox_UpdateMailListAfterDeposit(void)
{
u8 taskId = CreateTask(Mailbox_HandleReturnToProcessInput, 0);
- u8 oldCount = gMailboxInfo.count;
+ u8 oldCount = eMailboxInfo.count;
- gMailboxInfo.count = GetMailboxMailCount();
+ eMailboxInfo.count = GetMailboxMailCount();
Mailbox_UpdateMailList();
- if(oldCount != gMailboxInfo.count && gMailboxInfo.count < gMailboxInfo.pageItems + gMailboxInfo.itemsAbove && gMailboxInfo.itemsAbove != 0) // did the count update?
- gMailboxInfo.itemsAbove--;
+ if(oldCount != eMailboxInfo.count && eMailboxInfo.count < eMailboxInfo.pageItems + eMailboxInfo.itemsAbove && eMailboxInfo.itemsAbove != 0) // did the count update?
+ eMailboxInfo.itemsAbove--;
ItemStorage_SetItemAndMailCount(taskId);
Mailbox_DrawMailboxMenu(taskId);
diff --git a/src/pokemon/pokedex_cry_screen.c b/src/pokemon/pokedex_cry_screen.c
index ad7029f59..912b9aabd 100644
--- a/src/pokemon/pokedex_cry_screen.c
+++ b/src/pokemon/pokedex_cry_screen.c
@@ -2,6 +2,7 @@
#include "pokedex_cry_screen.h"
#include "palette.h"
#include "sprite.h"
+#include "ewram.h"
struct Unk201C800 {
u8 unk_0;
@@ -11,10 +12,6 @@ struct Unk201C800 {
u16 unk_4;
};
-#define EWRAM_1C800 (*(struct Unk201C800 *)(unk_201C000 + 0x800))
-
-extern u8 unk_201C000[];
-
extern u8 gUnknown_03005E98;
// data/pokedex_cry_screen.o
diff --git a/src/pokemon/pokemon_2.c b/src/pokemon/pokemon_2.c
index d3bdf3a13..68923a16e 100644
--- a/src/pokemon/pokemon_2.c
+++ b/src/pokemon/pokemon_2.c
@@ -12,13 +12,11 @@
#include "strings2.h"
#include "text.h"
#include "util.h"
+#include "ewram.h"
extern u8 gPlayerPartyCount;
extern u8 gEnemyPartyCount;
-extern u16 unk_20160BC[];
-extern struct SecretBaseRecord gSecretBaseRecord;
-extern u32 dword_2017100[];
extern u16 gBattleTypeFlags;
extern u8 gActiveBank;
extern struct BattlePokemon gBattleMons[4];
@@ -1062,31 +1060,31 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord)
s32 i, j;
ZeroEnemyPartyMons();
- memcpy(&gSecretBaseRecord, secretBaseRecord, sizeof(*secretBaseRecord));
+ memcpy(eSecretBaseRecord, secretBaseRecord, sizeof(*secretBaseRecord));
for (i = 0; i < 6; i++)
{
- if (gSecretBaseRecord.partySpecies[i])
+ if (eSecretBaseRecord->partySpecies[i])
{
CreateMon(&gEnemyParty[i],
- gSecretBaseRecord.partySpecies[i],
- gSecretBaseRecord.partyLevels[i],
+ eSecretBaseRecord->partySpecies[i],
+ eSecretBaseRecord->partyLevels[i],
15,
1,
- gSecretBaseRecord.partyPersonality[i],
+ eSecretBaseRecord->partyPersonality[i],
2,
0);
// these two SetMonData calls require the (u8 *) cast since SetMonData is declared in this function.
- SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, (u8 *)&gSecretBaseRecord.partyHeldItems[i]);
+ SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, (u8 *)&eSecretBaseRecord->partyHeldItems[i]);
for (j = 0; j < 6; j++)
- SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &gSecretBaseRecord.partyEVs[i]);
+ SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &eSecretBaseRecord->partyEVs[i]);
for (j = 0; j < 4; j++)
{
- SetMonData(&gEnemyParty[i], MON_DATA_MOVE1 + j, (u8 *)&gSecretBaseRecord.partyMoves[i * 4 + j]);
- SetMonData(&gEnemyParty[i], MON_DATA_PP1 + j, &gBattleMoves[gSecretBaseRecord.partyMoves[i * 4 + j]].pp);
+ SetMonData(&gEnemyParty[i], MON_DATA_MOVE1 + j, (u8 *)&eSecretBaseRecord->partyMoves[i * 4 + j]);
+ SetMonData(&gEnemyParty[i], MON_DATA_PP1 + j, &gBattleMoves[eSecretBaseRecord->partyMoves[i * 4 + j]].pp);
}
}
}
@@ -1097,13 +1095,13 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord)
u8 GetSecretBaseTrainerPicIndex(void)
{
- u8 trainerClass = gSecretBaseTrainerClasses[gSecretBaseRecord.gender][gSecretBaseRecord.trainerId[0] % 5];
+ u8 trainerClass = gSecretBaseTrainerClasses[eSecretBaseRecord->gender][eSecretBaseRecord->trainerId[0] % 5];
return gTrainerClassToPicIndex[trainerClass];
}
u8 GetSecretBaseTrainerNameIndex(void)
{
- u8 trainerClass = gSecretBaseTrainerClasses[gSecretBaseRecord.gender][gSecretBaseRecord.trainerId[0] % 5];
+ u8 trainerClass = gSecretBaseTrainerClasses[eSecretBaseRecord->gender][eSecretBaseRecord->trainerId[0] % 5];
return gTrainerClassToNameIndex[trainerClass];
}
@@ -1208,7 +1206,7 @@ void CopyPlayerPartyMonToBattleData(u8 battleIndex, u8 partyIndex)
GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname);
StringCopy10(gBattleMons[battleIndex].nickname, nickname);
GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_NAME, gBattleMons[battleIndex].otName);
- *(unk_20160BC + GetBankSide(battleIndex)) = gBattleMons[battleIndex].hp;
+ ewram160BC[GetBankSide(battleIndex)] = gBattleMons[battleIndex].hp;
for (i = 0; i < 8; i++)
gBattleMons[battleIndex].statStages[i] = 6;
diff --git a/src/pokemon/pokemon_summary_screen.c b/src/pokemon/pokemon_summary_screen.c
index 00a0bea29..d1d226b80 100644
--- a/src/pokemon/pokemon_summary_screen.c
+++ b/src/pokemon/pokemon_summary_screen.c
@@ -7,14 +7,13 @@
#include "string_util.h"
#include "strings2.h"
#include "tv.h"
-
-extern struct Pokemon *unk_2018000;
+#include "ewram.h"
bool8 PokemonSummaryScreen_CheckOT(struct Pokemon *mon)
{
u32 trainerId;
- if (unk_2018000 == gEnemyParty)
+ if (ewram18000_3 == gEnemyParty)
{
u8 enemyId = GetMultiplayerId() ^ 1;
trainerId = gLinkPlayers[enemyId].trainerId & 0xFFFF;
diff --git a/src/rom_8077ABC.c b/src/rom_8077ABC.c
index 285c992ca..10d58dcb5 100644
--- a/src/rom_8077ABC.c
+++ b/src/rom_8077ABC.c
@@ -12,6 +12,7 @@
#include "task.h"
#include "trig.h"
#include "util.h"
+#include "ewram.h"
#define GET_UNOWN_LETTER(personality) ((\
(((personality & 0x03000000) >> 24) << 6) \
@@ -94,8 +95,6 @@ extern struct OamData gOamData_837DF9C[];
extern const union AnimCmd *const gDummySpriteAnimTable[];
extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[];
-extern struct Struct_unk_2019348 unk_2019348;
-extern struct TransformStatus gTransformStatuses[];
extern u16 gBattleMonPartyPositions[];
extern u16 gBattleTypeFlags;
extern u32 gTransformPersonalities[NUM_BATTLE_SLOTS];
@@ -204,21 +203,21 @@ u8 sub_8077ABC(u8 slot, u8 a2) {
case 4:
default:
if (NotInBattle()) {
- if (unk_2019348.field_4 & 1) {
- species = unk_2019348.field_2;
+ if (ewram19348.unk4 & 1) {
+ species = ewram19348.unk2;
} else {
- species = unk_2019348.field_0;
+ species = ewram19348.unk0;
}
} else {
if (GetBankSide(slot)) {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
species = GetMonData(&gEnemyParty[gBattleMonPartyPositions[slot]], MON_DATA_SPECIES);
} else {
species = transform->species;
}
} else {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
species = GetMonData(&gPlayerParty[gBattleMonPartyPositions[slot]], MON_DATA_SPECIES);
} else {
@@ -246,13 +245,13 @@ u8 sub_8077BFC(u8 slot, u16 species) {
if (!GetBankSide(slot) || NotInBattle()) {
if (species == SPECIES_UNOWN) {
if (NotInBattle()) {
- if (unk_2019348.field_4 & 1) {
- personality = unk_2019348.field_10;
+ if (ewram19348.unk4 & 1) {
+ personality = ewram19348.unk10;
} else {
- personality = unk_2019348.field_8;
+ personality = ewram19348.unk8;
}
} else {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
personality = GetMonData(&gPlayerParty[gBattleMonPartyPositions[slot]], MON_DATA_PERSONALITY);
} else {
@@ -275,7 +274,7 @@ u8 sub_8077BFC(u8 slot, u16 species) {
}
} else {
if (species == SPECIES_UNOWN) {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
personality = GetMonData(&gEnemyParty[gBattleMonPartyPositions[slot]], MON_DATA_PERSONALITY);
} else {
@@ -339,13 +338,13 @@ u8 sub_8077EE4(u8 slot, u8 a2) {
struct TransformStatus *transform;
if (a2 == 3 || a2 == 4) {
if (NotInBattle()) {
- if (unk_2019348.field_4 & 1) {
- species = unk_2019348.field_2;
+ if (ewram19348.unk4 & 1) {
+ species = ewram19348.unk2;
} else {
- species = unk_2019348.field_0;
+ species = ewram19348.unk0;
}
} else {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
species = gUnknown_0202F7CA[slot];
} else {
@@ -383,14 +382,14 @@ u8 sub_8077FC0(u8 slot) {
r6 = sub_8077ABC(slot, 1);
if (!NotInBattle()) {
if (GetBankSide(slot)) {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
var = GetMonData(&gEnemyParty[gBattleMonPartyPositions[slot]], MON_DATA_SPECIES);
} else {
var = transform->species;
}
} else {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
var = GetMonData(&gPlayerParty[gBattleMonPartyPositions[slot]], MON_DATA_SPECIES);
} else {
@@ -1035,7 +1034,6 @@ bool8 sub_8078E38() {
}
void sub_8078E70(u8 sprite, u8 a2) {
- struct Struct_2017810 *unk;
u8 r7 = gSprites[sprite].data0;
if (NotInBattle() || IsAnimBankSpriteVisible(r7)) {
gSprites[sprite].invisible = FALSE;
@@ -1043,8 +1041,7 @@ void sub_8078E70(u8 sprite, u8 a2) {
gSprites[sprite].oam.objMode = a2;
gSprites[sprite].affineAnimPaused = TRUE;
if (!NotInBattle() && !gSprites[sprite].oam.affineMode) {
- unk = &unk_2017810[r7];
- gSprites[sprite].oam.matrixNum = unk->field_6;
+ gSprites[sprite].oam.matrixNum = ewram17810[r7].unk6;
}
gSprites[sprite].oam.affineMode = 3;
CalcCenterToCornerVec(&gSprites[sprite], gSprites[sprite].oam.shape, gSprites[sprite].oam.size, gSprites[sprite].oam.affineMode);
@@ -1541,11 +1538,11 @@ u16 sub_8079B10(u8 sprite) {
for (i = 0; i < (sizeof(gBattleMonSprites) / sizeof(u8)); i++) {
if (gBattleMonSprites[i] == sprite) {
if (NotInBattle()) {
- species = unk_2019348.field_0;
+ species = ewram19348.unk0;
return gMonBackPicCoords[species].y_offset;
} else {
if (!GetBankSide(i)) {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
species = GetMonData(&gPlayerParty[gBattleMonPartyPositions[i]], MON_DATA_SPECIES);
} else {
@@ -1553,7 +1550,7 @@ u16 sub_8079B10(u8 sprite) {
}
return gMonBackPicCoords[species].y_offset;
} else {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
species = GetMonData(&gEnemyParty[gBattleMonPartyPositions[i]], MON_DATA_SPECIES);
} else {
@@ -1764,12 +1761,12 @@ int sub_807A100(u8 slot, u8 a2) {
const struct MonCoords *coords;
struct TransformStatus *transform;
if (NotInBattle()) {
- if (unk_2019348.field_4 & 1) {
- species = unk_2019348.field_2;
- personality = unk_2019348.field_10;
+ if (ewram19348.unk4 & 1) {
+ species = ewram19348.unk2;
+ personality = ewram19348.unk10;
} else {
- species = unk_2019348.field_0;
- personality = unk_2019348.field_8;
+ species = ewram19348.unk0;
+ personality = ewram19348.unk8;
}
if (species == SPECIES_UNOWN) {
letter = GET_UNOWN_LETTER(personality);
@@ -1788,7 +1785,7 @@ int sub_807A100(u8 slot, u8 a2) {
}
} else {
if (!GetBankSide(slot)) {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
species = GetMonData(&gPlayerParty[gBattleMonPartyPositions[slot]], MON_DATA_SPECIES);
personality = GetMonData(&gPlayerParty[gBattleMonPartyPositions[slot]], MON_DATA_PERSONALITY);
@@ -1810,7 +1807,7 @@ int sub_807A100(u8 slot, u8 a2) {
coords = &gMonBackPicCoords[species];
}
} else {
- transform = &gTransformStatuses[slot];
+ transform = &eTransformStatuses[slot];
if (!transform->species) {
species = GetMonData(&gEnemyParty[gBattleMonPartyPositions[slot]], MON_DATA_SPECIES);
personality = GetMonData(&gEnemyParty[gBattleMonPartyPositions[slot]], MON_DATA_PERSONALITY);
diff --git a/src/scene/contest_painting.c b/src/scene/contest_painting.c
index 9df2d56da..0f745b391 100644
--- a/src/scene/contest_painting.c
+++ b/src/scene/contest_painting.c
@@ -25,9 +25,6 @@ u8 gUnknown_03005E40[0x4C];
struct ContestEntry *gUnknown_03005E8C;
u16 (*gUnknown_03005E90)[];
-extern struct ContestEntry unk_2015de0;
-extern struct Unk2015E00 unk_2015e00;
-
static const u16 gPictureFramePalettes[][16] =
{
INCBIN_U16("graphics/picture_frame/bg0.gbapal"),
@@ -152,7 +149,7 @@ static void ShowContestPainting(void)
case 0:
remove_some_task();
SetVBlankCallback(NULL);
- gUnknown_03005E8C = &unk_2015de0;
+ gUnknown_03005E8C = &ewram15DE0;
ContestPaintingInitVars(TRUE);
ContestPaintingInitBG();
gMain.state++;
@@ -752,8 +749,8 @@ static u8 sub_8106EE0(u8 arg0)
static void sub_8106F4C(void)
{
- gUnknown_03005E90 = &unk_2015e00.unk2017e00;
- gUnknown_03005E10 = &unk_2015e00.unk2015e00;
+ gUnknown_03005E90 = &ewram15E00.unk2017e00;
+ gUnknown_03005E10 = &ewram15E00.unk2015e00;
}
static void sub_8106F6C(u8 arg0)
diff --git a/src/scene/credits.c b/src/scene/credits.c
index 882dc557f..d9e97c570 100644
--- a/src/scene/credits.c
+++ b/src/scene/credits.c
@@ -163,10 +163,8 @@ struct CreditsEntry
u8 *text;
};
-extern struct HallOfFame gHallOfFame;
extern u8 unk_201e800[0x800];
extern u8 unk_201f000[0x800];
-extern u16 unk_201f800[];
extern struct SpriteTemplate gUnknown_02024E8C;
diff --git a/src/scene/evolution_scene.c b/src/scene/evolution_scene.c
index 73cb7e5e7..c68acafc4 100644
--- a/src/scene/evolution_scene.c
+++ b/src/scene/evolution_scene.c
@@ -77,7 +77,6 @@ extern u8 gBattleTerrain;
extern u8 gReservedSpritePaletteCount;
extern u16 gMoveToLearn;
extern struct SpriteTemplate gUnknown_02024E8C;
-extern u8 gUnk_2009000[]; // won't match if I 'ewram' it
extern bool8 gAffineAnimsDisabled;
extern u8 gDisplayedStringBattle[];
extern u8 gBattleTextBuff2[];
@@ -179,6 +178,10 @@ void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStop
SetMainCallback2(CB2_BeginEvolutionScene);
}
+struct Struct2009000 {
+ u16 pal[0x30];
+};
+
void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID)
{
u8 name[20];
@@ -275,7 +278,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo,
gTasks[ID].tEvoWasStopped = FALSE;
gTasks[ID].tPartyID = partyID;
- memcpy(gUnk_2009000, &gPlttBufferUnfaded[0x20], 0x60);
+ memcpy(ewram9000_hack, &gPlttBufferUnfaded[0x20], 0x60);
REG_DISPCNT = DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP;
SetHBlankCallback(EvoDummyFunc);
@@ -638,7 +641,7 @@ static void Task_EvolutionScene(u8 taskID)
{
m4aMPlayAllStop();
PlayCry1(gTasks[taskID].tPostEvoSpecies, 0);
- memcpy(&gPlttBufferUnfaded[0x20], gUnk_2009000, 0x60);
+ memcpy(&gPlttBufferUnfaded[0x20], ewram9000_hack, 0x60);
BeginNormalPaletteFade(0x1C, 0, 0x10, 0, 0);
gTasks[taskID].tState++;
}
@@ -980,7 +983,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (IsSEPlaying())
{
PlayCry1(gTasks[taskID].tPostEvoSpecies, 0);
- memcpy(&gPlttBufferUnfaded[0x20], gUnk_2009000, 0x60);
+ memcpy(&gPlttBufferUnfaded[0x20], ewram9000_hack, 0x60);
BeginNormalPaletteFade(1, 0, 0x10, 0, 0);
gTasks[taskID].tState++;
}