From 2a57c4249d7b9382b53cde85c5089e3d2ebcc641 Mon Sep 17 00:00:00 2001 From: Philippe Symons Date: Thu, 13 Aug 2026 11:39:18 +0200 Subject: [PATCH] Attempt to fix the lockup when transferring pokemon using the new gameboy-payload-update code Free up some IWRAM by eliminating PokemonTables from the constructor of PokeBox and GenXPokemon/GBPokemon. --- PCCS | 2 +- source/box_menu.cpp | 3 ++- source/dbg/debug_menu_functions.cpp | 2 +- source/mystery_gift_builder.cpp | 4 +--- source/script_array.cpp | 3 +-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/PCCS b/PCCS index 31ec2e6..8ab65c8 160000 --- a/PCCS +++ b/PCCS @@ -1 +1 @@ -Subproject commit 31ec2e656888d7a99e99f67972b2516fa2ed126c +Subproject commit 8ab65c81df1fea33a0ecc3e0cfef953d249cc4c2 diff --git a/source/box_menu.cpp b/source/box_menu.cpp index d9cdac2..8c61c77 100644 --- a/source/box_menu.cpp +++ b/source/box_menu.cpp @@ -16,6 +16,7 @@ Box_Menu::Box_Menu() {}; int Box_Menu::box_main(PokeBox* box) { + PokemonTables pkmnTables; u8 names_decompression_buffer[2048]; u8 single_name_buffer[16]; const u8 **chunkList; @@ -143,7 +144,7 @@ int Box_Menu::box_main(PokeBox* box) u32 nameEntryIndex = curr_pkmn->getSpeciesIndexNumber(); tte_set_pos(6, 88); - curr_pkmn->externalConvertNickname(val); + curr_pkmn->externalConvertNickname(&pkmnTables, val); ptgb_write_simple(val, true); if (curr_pkmn->getIsShiny()) { diff --git a/source/dbg/debug_menu_functions.cpp b/source/dbg/debug_menu_functions.cpp index bc1fc6c..381426b 100644 --- a/source/dbg/debug_menu_functions.cpp +++ b/source/dbg/debug_menu_functions.cpp @@ -233,7 +233,7 @@ void dbg_inject_pkmn(void *context, unsigned user_param) PokemonTables tables; tables.load_gen3_charset(game_lang); - Gen3Pokemon celebi(&tables); + Gen3Pokemon celebi; celebi.loadData(RSEFL_10_ANIV_Celebi_0BF5_ENG_, false); // front_sprite_tile_id is reserved behind the box sprites diff --git a/source/mystery_gift_builder.cpp b/source/mystery_gift_builder.cpp index 5953bb4..b1932f5 100644 --- a/source/mystery_gift_builder.cpp +++ b/source/mystery_gift_builder.cpp @@ -339,9 +339,7 @@ void mystery_gift_script::build_script(PokeBox *box) // it won't get called automatically because it's part of the union (and neither will the destructor) new (&decompressed_store.tables.data) PokemonTables(); - // TODO make it so that the table is added here(?) - box->setTable(&decompressed_store.tables.data); - box->convertAll(); + box->convertAll(&decompressed_store.tables.data); for (int i = 0; i < box->getNumInBox(); i++) // Add in the Pokemon data { Gen3Pokemon *curr_pkmn = box->getGen3Pokemon(i); diff --git a/source/script_array.cpp b/source/script_array.cpp index 66de159..db519c1 100644 --- a/source/script_array.cpp +++ b/source/script_array.cpp @@ -17,8 +17,7 @@ #include int last_error; -PokemonTables pokeTable; -PokeBox box(&pokeTable); +PokeBox box; Select_Menu langs(false, LANG_MENU, 18, 0); Select_Menu games(false, CART_MENU, 18, 0);