Merge pull request #2426 from tustin2121-2/patch-linker

GF Header and Modern Builds
This commit is contained in:
Eduardo Quezada D'Ottone 2022-11-04 12:27:13 -03:00 committed by GitHub
commit 2b5aff2764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View File

@ -17,7 +17,7 @@ SECTIONS {
gflib/*.o(ewram_data); gflib/*.o(ewram_data);
. = 0x40000; . = 0x40000;
} }
. = 0x3000000; . = 0x3000000;
@ -49,8 +49,11 @@ SECTIONS {
ALIGN(4) ALIGN(4)
{ {
src/rom_header.o(.text*); src/rom_header.o(.text*);
src/*.o(.text*); src/rom_header_gf.o(.text.*);
src/crt0.o(.text);
src/main.o(.text);
gflib/*.o(.text*); gflib/*.o(.text*);
src/*.o(.text*);
asm/*.o(.text*); asm/*.o(.text*);
} =0 } =0

View File

@ -6,6 +6,13 @@
#include "item.h" #include "item.h"
#include "pokeball.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 struct GFRomHeader
{ {
u32 version; u32 version;
@ -24,7 +31,8 @@ struct GFRomHeader
u32 flagsOffset; u32 flagsOffset;
u32 varsOffset; u32 varsOffset;
u32 pokedexOffset; u32 pokedexOffset;
u32 seenOffset; u32 seen1Offset;
u32 seen2Offset;
u32 pokedexVar; u32 pokedexVar;
u32 pokedexFlag; u32 pokedexFlag;
u32 mysteryEventFlag; u32 mysteryEventFlag;
@ -103,7 +111,8 @@ static const struct GFRomHeader sGFRomHeader = {
.flagsOffset = offsetof(struct SaveBlock1, flags), .flagsOffset = offsetof(struct SaveBlock1, flags),
.varsOffset = offsetof(struct SaveBlock1, vars), .varsOffset = offsetof(struct SaveBlock1, vars),
.pokedexOffset = offsetof(struct SaveBlock2, pokedex), .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, .pokedexVar = VAR_NATIONAL_DEX - VARS_START,
.pokedexFlag = FLAG_RECEIVED_POKEDEX_FROM_BIRCH, .pokedexFlag = FLAG_RECEIVED_POKEDEX_FROM_BIRCH,
.mysteryEventFlag = FLAG_SYS_MYSTERY_EVENT_ENABLE, .mysteryEventFlag = FLAG_SYS_MYSTERY_EVENT_ENABLE,