diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/link.c | 3 | ||||
-rw-r--r-- | src/engine/record_mixing.c | 36 | ||||
-rw-r--r-- | src/engine/save.c | 22 |
3 files changed, 29 insertions, 32 deletions
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; |