diff --git a/include/global.h b/include/global.h index 3e6930539..28b12f55c 100644 --- a/include/global.h +++ b/include/global.h @@ -230,9 +230,6 @@ struct Pokedex /*0x03*/ u8 nationalMagic; // set to 0xB9 when national dex is first enabled /*0x04*/ u32 unownPersonality; // set when you first see Unown /*0x08*/ u32 spindaPersonality; // set when you first see Spinda - /*0x0C*/ u32 unknown3; - /*0x10*/ u8 owned[DEX_FLAGS_NO]; - /*0x44*/ u8 filler1[DEX_FLAGS_NO]; }; struct PokemonJumpRecords @@ -374,7 +371,6 @@ struct SaveBlock2 u16 optionsBattleSceneOff:1; // whether battle animations are disabled u16 regionMapZoom:1; // whether the map is zoomed in /*0x018*/ struct Pokedex pokedex; - /*0x090*/ u8 filler_90[0x8]; /*0x098*/ struct Time localTimeOffset; /*0x0A0*/ struct Time lastBerryTreeUpdate; /*0x0A8*/ u32 gcnLinkFlags; // Read by Pokemon Colosseum/XD @@ -386,6 +382,7 @@ struct SaveBlock2 /*0xAF0*/ struct BerryCrush berryCrush; /*0xB00*/ struct PokemonJumpRecords pokeJump; /*0xB10*/ struct BerryPickingResults berryPick; + /*0x???*/ u8 filler_90[0x4D4]; }; // size: 0xF24 extern struct SaveBlock2 *gSaveBlock2Ptr; @@ -810,11 +807,9 @@ struct SaveBlock1 /*0x0430*/ struct ItemSlot bagPocket_PokeBalls[BAG_POKEBALLS_COUNT]; /*0x0464*/ struct ItemSlot bagPocket_TMHM[BAG_TMHM_COUNT]; /*0x054c*/ struct ItemSlot bagPocket_Berries[BAG_BERRIES_COUNT]; - /*0x05F8*/ u8 seen1[DEX_FLAGS_NO]; /*0x062C*/ u16 berryBlenderRecords[3]; // unused - /*0x0632*/ u8 unused_632[6]; /*0x0638*/ u16 trainerRematchStepCounter; - /*0x063A*/ u8 ALIGNED(2) trainerRematches[MAX_REMATCH_ENTRIES]; + /*0x063A*/ u8 trainerRematches[MAX_REMATCH_ENTRIES]; /*0x06A0*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT]; /*0x08E0*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT]; /*0x0EE0*/ u8 flags[NUM_FLAG_BYTES]; @@ -836,19 +831,18 @@ struct SaveBlock1 /*0x30D0*/ struct Roamer roamer; /*0x30EC*/ struct EnigmaBerry enigmaBerry; /*0x3120*/ struct MysteryGiftSave mysteryGift; - // /*0x348C*/ u8 unused_348C[400]; + /*0x????*/ u8 dexSeen[DEX_FLAGS_NO]; + u8 dexCaught[DEX_FLAGS_NO]; /*0x361C*/ struct RamScript ramScript; /*0x3A08*/ struct RecordMixingGift recordMixingGift; // unused - /*0x3A18*/ u8 unused_3A18[DEX_FLAGS_NO]; /*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH + 1]; /*0x3A54*/ struct FameCheckerSaveData fameChecker[NUM_FAMECHECKER_PERSONS]; - // /*0x3A94*/ u8 unused_3A94[64]; /*0x3AD4*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21]; /*0x3BA8*/ struct TrainerNameRecord trainerNameRecords[20]; /*0x3C98*/ struct DaycareMon route5DayCareMon; - /*0x3D24*/ u8 unused_3D24[16]; /*0x3D34*/ u32 towerChallengeId; /*0x3D38*/ struct TrainerTower trainerTower[NUM_TOWER_CHALLENGE_TYPES]; + /*0x3D24*/ u8 unusedSB1[0x1C]; }; // size: 0x3D68 struct MapPosition diff --git a/src/debug.c b/src/debug.c index bc5aa6274..7396388a7 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2649,8 +2649,8 @@ static void DebugAction_FlagsVars_PokedexFlags_Reset(u8 taskId) u16 species; // Reset Pokedex to emtpy - memset(&gSaveBlock2Ptr->pokedex.owned, 0, sizeof(gSaveBlock2Ptr->pokedex.owned)); - memset(&gSaveBlock1Ptr->seen1, 0, sizeof(gSaveBlock1Ptr->seen1)); + memset(&gSaveBlock1Ptr->dexCaught, 0, sizeof(gSaveBlock1Ptr->dexCaught)); + memset(&gSaveBlock1Ptr->dexSeen, 0, sizeof(gSaveBlock1Ptr->dexSeen)); // Add party Pokemon to Pokedex for (partyId = 0; partyId < PARTY_SIZE; partyId++) diff --git a/src/load_save.c b/src/load_save.c index ef53c6836..2db27db11 100644 --- a/src/load_save.c +++ b/src/load_save.c @@ -16,6 +16,8 @@ #include "trainer_tower.h" #include "constants/event_objects.h" +char (*abc)[sizeof(struct QuestLogScene)] = 1; + struct LoadedSaveData { /*0x0000*/ struct ItemSlot items[BAG_ITEMS_COUNT]; diff --git a/src/new_game.c b/src/new_game.c index 9683cbeaa..b7daac7d9 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -73,8 +73,8 @@ static void SetDefaultOptions(void) static void ClearPokedexFlags(void) { - memset(&gSaveBlock2Ptr->pokedex.owned, 0, sizeof(gSaveBlock2Ptr->pokedex.owned)); - memset(&gSaveBlock1Ptr->seen1, 0, sizeof(gSaveBlock1Ptr->seen1)); + memset(&gSaveBlock1Ptr->dexCaught, 0, sizeof(gSaveBlock1Ptr->dexCaught)); + memset(&gSaveBlock1Ptr->dexSeen, 0, sizeof(gSaveBlock1Ptr->dexSeen)); } static void ClearBattleTower(void) @@ -120,6 +120,7 @@ void NewGameInitData(void) ZeroEnemyPartyMons(); ClearBattleTower(); ClearSav1(); + ClearSav3(); ClearMailData(); gSaveBlock2Ptr->specialSaveWarpFlags = 0; gSaveBlock2Ptr->gcnLinkFlags = 0; diff --git a/src/pokedex_screen.c b/src/pokedex_screen.c index 76d8fbb1b..2feb98c36 100644 --- a/src/pokedex_screen.c +++ b/src/pokedex_screen.c @@ -2299,16 +2299,16 @@ s8 DexScreen_GetSetPokedexFlag(u16 nationalDexNo, u8 caseId, bool8 indexIsSpecie switch (caseId) { case FLAG_GET_SEEN: - retVal = ((gSaveBlock1Ptr->seen1[index] & mask) != 0); + retVal = ((gSaveBlock1Ptr->dexSeen[index] & mask) != 0); break; case FLAG_GET_CAUGHT: - retVal = ((gSaveBlock2Ptr->pokedex.owned[index] & mask) != 0); + retVal = ((gSaveBlock1Ptr->dexCaught[index] & mask) != 0); break; case FLAG_SET_SEEN: - gSaveBlock1Ptr->seen1[index] |= mask; + gSaveBlock1Ptr->dexSeen[index] |= mask; break; case FLAG_SET_CAUGHT: - gSaveBlock2Ptr->pokedex.owned[index] |= mask; + gSaveBlock1Ptr->dexCaught[index] |= mask; break; } return retVal; diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index 601fa9038..bcf1addb2 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -109,8 +109,8 @@ static const struct GFRomHeader sGFRomHeader = { .flagsOffset = offsetof(struct SaveBlock1, flags), .varsOffset = offsetof(struct SaveBlock1, vars), .pokedexOffset = offsetof(struct SaveBlock2, pokedex), - .seen1Offset = offsetof(struct SaveBlock1, seen1), - .seen2Offset = offsetof(struct SaveBlock1, seen1), + .seen1Offset = offsetof(struct SaveBlock1, dexSeen), + .seen2Offset = offsetof(struct SaveBlock1, dexSeen), .pokedexVar = VAR_0x403C - VARS_START, .pokedexFlag = FLAG_0x838, .mysteryGiftFlag = FLAG_SYS_MYSTERY_GIFT_ENABLED,