From 940b7547c4f19e0982c463bb81dac2fb03f1e3c9 Mon Sep 17 00:00:00 2001 From: The Gears of Progress Date: Sun, 12 Oct 2025 16:59:17 -0400 Subject: [PATCH 1/2] Disabling debug mode --- include/debug_mode.h | 2 +- include/gb_rom_values/base_gb_rom_struct.h | 109 +++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 include/gb_rom_values/base_gb_rom_struct.h diff --git a/include/debug_mode.h b/include/debug_mode.h index 753096e..1ed3aa0 100644 --- a/include/debug_mode.h +++ b/include/debug_mode.h @@ -4,7 +4,7 @@ #define VERSION "v1.2.0" #define PTGB_BUILD_LANGUAGE 2 -#define DEBUG_MODE true +#define DEBUG_MODE false #define PRINT_LINK_DATA (true && DEBUG_MODE) #define INSTANT_TEXT_SPEED (false && DEBUG_MODE) diff --git a/include/gb_rom_values/base_gb_rom_struct.h b/include/gb_rom_values/base_gb_rom_struct.h new file mode 100644 index 0000000..c65a249 --- /dev/null +++ b/include/gb_rom_values/base_gb_rom_struct.h @@ -0,0 +1,109 @@ +#ifndef PAYLOAD_H +#define PAYLOAD_H + +#include + +#if defined(__arm__) +#include "debug_mode.h" +#endif + +#if PAYLOAD_EXPORT_TEST || !defined(__arm__) +typedef uint8_t u8, byte, uchar, echar; +typedef uint16_t u16, hword, ushort, eshort; +typedef uint32_t u32, word, uint, eint; +typedef unsigned long long u64; +typedef int32_t i32; +#else +extern "C" +{ +#include +} +#endif + +#define JPN_ID 1 +#define ENG_ID 2 +#define FRE_ID 3 +#define ITA_ID 4 +#define GER_ID 5 +#define SPA_ID 7 +#define KOR_ID 8 + +#define GREEN_ID 0 +#define RED_ID 1 +#define BLUE_ID 2 +#define YELLOW_ID 3 +#define GOLD_ID 4 +#define SILVER_ID 5 +#define CRYSTAL_ID 6 + +#define METHOD_NEWLINE 0 +#define METHOD_MEW 1 +#define METHOD_GEN2 2 + +#define PAYLOAD_SIZE 672 + +#define GB_TILE_WIDTH 20 + +// TODO? : Since we moved payload_builder into data-generator, we no longer need most of the fields of GB_ROM in our PTGB rom. +// It might be better to split it up into a struct that contains everything for data-generator and a separate one that gets +// included into the ptgb rom, which only includes whatever PTGB needs at runtime. (which is probably a fraction of the data) +// However, right now the compressed gb_rom_values_eng file is only 353 bytes and the gb_rom_values_fre is only 351 bytes. +// Therefore we'd save at most about 0,5 KB if we do this optimization. So it might not be worth it right now. +// If we expand the data at some point, however, it might be! + +// WARNING: We must be explicit in the type declarations of the struct members here. +// After all: data-generator runs on x86 and the structs will be read by the GBA's ARM processor. +// So we must ensure the sizes of the struct members, as well as padding, remains consistent across platforms. +// So please make sure to use data types which are explicit in their size. (such as uint32_t, uint8_t, etc.) +// Because the regular "int", "bool", "char" etc are platform-dependent in size. +struct GB_ROM +{ +public: + int32_t language; + int32_t version; + int32_t generation; + int32_t method; + int32_t payload_size; + int32_t box_data_size; + + u16 print_string_start; // Start of where text is written in VRAM + u16 stack_overwrite_location; // The part of the stack that we're overwriting + u8 short_pkmn_name; // The name of the Pokemon that moves us through RAM + u8 pointer_pkmn_name; // The name of the Pokemon that overwrites the stack + u16 padding_1; + + u32 clearScreen; // location of the clearScreen function in the ROM + u32 CableClub_TextBoxBorder; // location of the CableClub_TextBoxBorder function in the ROM + u32 placeString; // location of the placeString function in the ROM + u32 Serial_ExchangeBytes; // location of the Serial_ExchangeBytes function in the ROM + u32 _RemovePokemon; // location of the _RemovePokemon function in the ROM + u32 SaveSAVtoSRAM1; // location of the SaveSAVtoSRAM1 function in the ROM + u32 SaveSAVtoSRAM2; // location of the SaveSAVtoSRAM2 function in the ROM + u32 LoadCurrentBoxData; // location of the LoadCurrentBoxData function in the ROM + u32 OpenSRAM; // location of the OpenSRAM function in the ROM + u32 SaveBox; // location of the SaveBox function in the ROM + u32 Bankswitch; // location of the BankswitchCommon function in the ROM + u32 SoftReset; // location of the SoftReset function in the ROM + u32 CloseSRAM; // location of the OpenSRAM function in the ROM + u32 garbageDataLocation; // location of random data starting with 0xFD in the ROM + + u32 wRemoveMonFromBox; // location of wRemoveMonFromBox in RAM + u32 wBoxCount; // location of wBoxCount in RAM + u32 wWhichPokemon; // location of wWhichPokemon in RAM + u32 wBoxDataStart; // location of wBoxDataStart in RAM + u32 wBoxDataEnd; // location of wBoxDataEnd in RAM + u32 wSerialEnemyDataBlock; // location of wSerialEnemyDataBlock in RAM + u32 wEnemyMonSpecies; // location of wEnemyMonSpecies in RAM + + u32 wSerialEnemyMonsPatchList; // location of wSerialEnemyMonsPatchList in RAM + u32 wSerialOtherGameboyRandomNumberListBlock; // location of wSerialOtherGameboyRandomNumberListBlock in RAM + u32 hSerialConnectionStatus; // location of hSerialConnectionStatus in RAM + + u16 transferStringLocation; // location in VRAM to start writing the transfer string to + u16 textBorderUppLeft; // location in VRAM to put the upper left corner of the border + u8 textBorderWidth; // the width of the text box border + u8 textBorderHeight; // the height of the text box border + u16 padding_2; +}; + +#endif \ No newline at end of file From b6be0aedeb264274a7d27a1c2bdd377d6e3cd7c3 Mon Sep 17 00:00:00 2001 From: The Gears of Progress Date: Sun, 12 Oct 2025 17:46:59 -0400 Subject: [PATCH 2/2] Enabling release build --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f3f3e73..22047ab 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Build configuration (set to either 'debug' or 'release') -BUILD_TYPE := debug +BUILD_TYPE := release #--------------------------------------------------------------------------------- .SUFFIXES: