From 52c24c633b70244f6216b44d6edd5ee8bedb075c Mon Sep 17 00:00:00 2001 From: Philippe Symons Date: Wed, 29 Apr 2026 00:07:14 +0200 Subject: [PATCH] Add EON Ticket for Ruby Sapphire to dbg menu --- include/dbg/debug_menu_functions.h | 1 + include/dbg/debug_mode.h | 4 +- include/dbg/eon_ticket_rs.h | 70 +++++++++++++++++++++++++++++ source/dbg/debug_menu_entries.cpp | 4 +- source/dbg/debug_menu_functions.cpp | 26 +++++++++++ 5 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 include/dbg/eon_ticket_rs.h diff --git a/include/dbg/debug_menu_functions.h b/include/dbg/debug_menu_functions.h index d7a1b58..77de95f 100644 --- a/include/dbg/debug_menu_functions.h +++ b/include/dbg/debug_menu_functions.h @@ -43,5 +43,6 @@ void dbg_inject_pkmn(void *context, unsigned user_param); void dbg_unlock_mystery(void *context, unsigned user_param); void dbg_inject_wc3(void *context, unsigned user_param); +void dbg_inject_me3(void *context, unsigned user_param); #endif \ No newline at end of file diff --git a/include/dbg/debug_mode.h b/include/dbg/debug_mode.h index b7eb639..89a3107 100644 --- a/include/dbg/debug_mode.h +++ b/include/dbg/debug_mode.h @@ -109,8 +109,8 @@ extern debug_options g_debug_options; #define POKEMON_INDEX_TO_SKIP 5 // not sure if we want these in the debug menu. -#define DEBUG_GAME EMERALD_ID -#define DEBUG_VERS VERS_1_0 +#define DEBUG_GAME RUBY_ID +#define DEBUG_VERS VERS_1_1 #define DEBUG_LANG LANG_ENG // Compile time options diff --git a/include/dbg/eon_ticket_rs.h b/include/dbg/eon_ticket_rs.h new file mode 100644 index 0000000..6d90f0c --- /dev/null +++ b/include/dbg/eon_ticket_rs.h @@ -0,0 +1,70 @@ +#include "typeDefs.h" + +// array size is 1012 +// Downloaded from the projectpokemon.org website +static const u8 RS_Item_Eon_Ticket_e_Card_ENG_US_[] = { + 0x10, 0xea, 0x00, 0x00, 0x33, 0x08, 0x01, 0x01, 0xb8, 0x61, 0x00, 0x00, 0x02, 0x47, 0x13, 0x01, + 0x01, 0x00, 0x21, 0x0d, 0x80, 0x01, 0x00, 0xbb, 0x01, 0xbf, 0x00, 0x00, 0x02, 0x4a, 0x13, 0x01, + 0x01, 0x00, 0x21, 0x0d, 0x80, 0x01, 0x00, 0xbb, 0x01, 0xbf, 0x00, 0x00, 0x02, 0x2b, 0xce, 0x00, + 0xbb, 0x01, 0xbf, 0x00, 0x00, 0x02, 0x6a, 0x5a, 0xbd, 0xc9, 0x00, 0x00, 0x02, 0x66, 0x6d, 0x46, + 0x13, 0x01, 0x01, 0x00, 0x21, 0x0d, 0x80, 0x00, 0x00, 0xbb, 0x01, 0xc0, 0x00, 0x00, 0x02, 0x1a, + 0x00, 0x80, 0x13, 0x01, 0x1a, 0x01, 0x80, 0x01, 0x00, 0x09, 0x00, 0x29, 0x53, 0x08, 0xbd, 0x04, + 0x01, 0x00, 0x02, 0x66, 0x6d, 0x6c, 0x0d, 0xbd, 0x83, 0x01, 0x00, 0x02, 0x66, 0x6d, 0x6c, 0x02, + 0xbe, 0xbb, 0xbe, 0xb1, 0xfd, 0x01, 0xab, 0x00, 0xc1, 0xe3, 0xe3, 0xd8, 0x00, 0xe8, 0xe3, 0x00, + 0xe7, 0xd9, 0xd9, 0x00, 0xed, 0xe3, 0xe9, 0xab, 0xfe, 0xce, 0xdc, 0xd9, 0xe6, 0xd9, 0xb4, 0xe7, + 0x00, 0xd5, 0x00, 0xe0, 0xd9, 0xe8, 0xe8, 0xd9, 0xe6, 0x00, 0xdc, 0xd9, 0xe6, 0xd9, 0x00, 0xda, + 0xe3, 0xe6, 0x00, 0xed, 0xe3, 0xe9, 0xb8, 0xfd, 0x01, 0xad, 0xff, 0xbe, 0xbb, 0xbe, 0xb1, 0xc3, + 0xe8, 0x00, 0xd5, 0xe4, 0xe4, 0xd9, 0xd5, 0xe6, 0xe7, 0x00, 0xe8, 0xe3, 0x00, 0xd6, 0xd9, 0x00, + 0xd5, 0x00, 0xda, 0xd9, 0xe6, 0xe6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 0xd9, 0xdf, 0xd9, 0xd9, 0xe4, 0xdd, 0xe2, 0xdb, 0xfe, + 0xdd, 0xe2, 0x00, 0xed, 0xe3, 0xe9, 0xe6, 0x00, 0xca, 0xbd, 0xb4, 0x00, 0xe8, 0xdc, 0xd9, 0xe2, + 0x00, 0xd7, 0xe3, 0xe1, 0xd9, 0x00, 0xe7, 0xd9, 0xd9, 0x00, 0xe1, 0xd9, 0xad, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x01, 0x1e, 0x13, 0x01 +}; \ No newline at end of file diff --git a/source/dbg/debug_menu_entries.cpp b/source/dbg/debug_menu_entries.cpp index 491a68f..7de4c20 100644 --- a/source/dbg/debug_menu_entries.cpp +++ b/source/dbg/debug_menu_entries.cpp @@ -9,6 +9,7 @@ #if ENABLE_MYSTERY_GIFT #include "dbg/old_sea_map.h" +#include "dbg/eon_ticket_rs.h" #endif static const option_data toggle_options[2] = { @@ -148,7 +149,8 @@ static void fill_debug_menu_with_injection_entries(vertical_menu &menu, u16 *cha #if ENABLE_MYSTERY_GIFT define_executable_row(charset, "Unlock MystE", dbg_unlock_mystery, 0, nullptr), define_executable_row(charset, "Unlock MystG", dbg_unlock_mystery, 1, nullptr), - define_executable_row(charset, "Inj OldSeaMap", dbg_inject_wc3, sizeof(OldSeaMap_E_custom), const_cast(OldSeaMap_E_custom)), + define_executable_row(charset, "Inj OldSeaMap(E)", dbg_inject_wc3, sizeof(OldSeaMap_E_custom), const_cast(OldSeaMap_E_custom)), + define_executable_row(charset, "Inj Eon Ticket(RS)", dbg_inject_me3, sizeof(RS_Item_Eon_Ticket_e_Card_ENG_US_), const_cast(RS_Item_Eon_Ticket_e_Card_ENG_US_)), #endif }; diff --git a/source/dbg/debug_menu_functions.cpp b/source/dbg/debug_menu_functions.cpp index 8e71f15..f52c582 100644 --- a/source/dbg/debug_menu_functions.cpp +++ b/source/dbg/debug_menu_functions.cpp @@ -342,6 +342,32 @@ void dbg_inject_wc3(void *context, unsigned user_param) save_manager.setMysteryGiftUnlocked(user_param != 0); save_manager.injectMysteryGift(wc3_data_ptr, wc3_data_size); + save_manager.finishSave(); + reader.flush(); +} + +void dbg_inject_me3(void *context, unsigned user_param) +{ + const u8* me3_data_ptr = reinterpret_cast(context); + size_t me3_data_size = user_param; + if(me3_data_ptr == nullptr) + { + return; + } + + const Game game_type = convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode); + if(game_type != RUBY && game_type != SAPPHIRE) + { + return; + } + + const Language game_lang = convert_rom_lang_to_ptgb_lang(curr_GBA_rom.language); + Gen3CartridgeSaveReader reader(global_memory_buffer); + Gen3SaveManager save_manager(game_type, game_lang, reader); + + save_manager.setMysteryEventUnlocked(true); + save_manager.injectMysteryEvent(me3_data_ptr, me3_data_size); + save_manager.finishSave(); reader.flush(); } \ No newline at end of file