From b32413d11e3554adfb8ba13320e001d0cf92a220 Mon Sep 17 00:00:00 2001 From: tustin2121 Date: Wed, 2 Nov 2022 12:44:59 -0400 Subject: [PATCH] Restoring the GFHeader - Also adding comment about what the header does and how to maintain it. --- src/rom_header_gf.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index d769d47f8..8c6fcd75a 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -6,6 +6,13 @@ #include "item.h" #include "pokeball.h" +// Note: Do not change the layout of this struct. Consider it an external API. +// If there's a compilation problem below, just comment out the assignment. +// +// The purpose of this struct is for outside applications to be +// able to access parts of the ROM or its save file, and if this struct +// is rearranged in any way, it defeats the purpose of having it at all. +// Applications like PKHex or streaming HUDs may find these values useful. struct GFRomHeader { u32 version; @@ -24,7 +31,8 @@ struct GFRomHeader u32 flagsOffset; u32 varsOffset; u32 pokedexOffset; - u32 seenOffset; + u32 seen1Offset; + u32 seen2Offset; u32 pokedexVar; u32 pokedexFlag; u32 mysteryEventFlag; @@ -103,7 +111,8 @@ static const struct GFRomHeader sGFRomHeader = { .flagsOffset = offsetof(struct SaveBlock1, flags), .varsOffset = offsetof(struct SaveBlock1, vars), .pokedexOffset = offsetof(struct SaveBlock2, pokedex), - .seenOffset = offsetof(struct SaveBlock1, dexSeen), + .seen1Offset = offsetof(struct SaveBlock1, dexSeen), + .seen2Offset = offsetof(struct SaveBlock1, dexSeen), // dex flags are combined, just provide the same pointer .pokedexVar = VAR_NATIONAL_DEX - VARS_START, .pokedexFlag = FLAG_RECEIVED_POKEDEX_FROM_BIRCH, .mysteryEventFlag = FLAG_SYS_MYSTERY_EVENT_ENABLE,