From f4f9329653611dcc6fff5568fe5fbf688e9c599e Mon Sep 17 00:00:00 2001 From: tustin2121 Date: Wed, 2 Nov 2022 12:39:32 -0400 Subject: [PATCH 1/3] Fix build of jsonproc - Changing uint to unsigned int, as uint is not standard. --- tools/jsonproc/jsonproc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/jsonproc/jsonproc.cpp b/tools/jsonproc/jsonproc.cpp index d58e23eb90..23056a5ff3 100755 --- a/tools/jsonproc/jsonproc.cpp +++ b/tools/jsonproc/jsonproc.cpp @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) env.add_callback("cleanString", 1, [](Arguments& args) { string badChars = ".'{} \n\t-\u00e9"; string str = args.at(0)->get(); - for (uint i = 0; i < str.length(); i++) { + for (unsigned int i = 0; i < str.length(); i++) { if (badChars.find(str[i]) != std::string::npos) { str[i] = '_'; } From 8ff5ae7eb4dfb43004d659a2df0a622b0ea758eb Mon Sep 17 00:00:00 2001 From: tustin2121 Date: Wed, 2 Nov 2022 12:42:26 -0400 Subject: [PATCH 2/3] Pinning the GF header to the front of modern - Pinning the GF Header, crt0, and main to the front of the ROM when building modern. - Moving the gflib before other source files, to make it closer to the non-modern linker script (and therefore smaller patches). --- ld_script.txt | 2 +- ld_script_modern.txt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ld_script.txt b/ld_script.txt index 904ca0fec1..bd9d7c4a35 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -27,7 +27,7 @@ SECTIONS { *libc.a:locale.o(.data); *libc.a:mallocr.o(.data); . = 0x40000; -} + } . = 0x3000000; diff --git a/ld_script_modern.txt b/ld_script_modern.txt index a988fe0cd5..549d040e1e 100644 --- a/ld_script_modern.txt +++ b/ld_script_modern.txt @@ -49,8 +49,11 @@ SECTIONS { ALIGN(4) { 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*); + src/*.o(.text*); asm/*.o(.text*); } =0 From fd87c97ef833d5f94f7c9dfdf0e5b76c0316fb9a Mon Sep 17 00:00:00 2001 From: tustin2121 Date: Wed, 2 Nov 2022 12:42:58 -0400 Subject: [PATCH 3/3] Adding documentation about GFHeader --- src/rom_header_gf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index 2723e1200e..472efe994a 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -6,6 +6,15 @@ #include "item.h" #include "pokeball.h" +// The purpose of this struct is for outside applications to be +// able to access parts of the ROM or its save file, like a public API. +// In vanilla, it was used by Colosseum and XD to access pokemon graphics. +// +// 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, so there's some potential benefit to keeping it. +// If there's a compilation problem below, just comment out the assignment +// instead of changing this struct. struct GFRomHeader { u32 version;