mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-10-23 16:03:34 -05:00
Formatting (again)
This commit is contained in:
@@ -25,14 +25,12 @@
|
||||
extern rom_data curr_GBA_rom;
|
||||
extern u32 global_tile_id_end;
|
||||
|
||||
static const byte RSEFL_10_ANIV_Celebi_0BF5_ENG_[] = {0xbe, 0x2b, 0x28, 0x78,
|
||||
0x0a, 0x00, 0x00, 0x00, 0xbd, 0xbf, 0xc6, 0xbf, 0xbc, 0xc3, 0xff, 0x34,
|
||||
0x01, 0x31, 0x02, 0x02, 0xa2, 0xa1, 0x00, 0xbb, 0xc8, 0xc3, 0xd0, 0x00,
|
||||
0x17, 0x35, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0x80, 0x43, 0x05, 0x00,
|
||||
0x00, 0x64, 0x00, 0x00, 0xf6, 0x00, 0xf8, 0x00, 0xe2, 0x00, 0xc3, 0x00,
|
||||
0x05, 0x0f, 0x28, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x46, 0x21, 0xe2, 0x31, 0xaf, 0x22,
|
||||
0x00, 0x00, 0x00, 0x00};
|
||||
static const byte RSEFL_10_ANIV_Celebi_0BF5_ENG_[] = {0xbe, 0x2b, 0x28, 0x78, 0x0a, 0x00, 0x00,
|
||||
0x00, 0xbd, 0xbf, 0xc6, 0xbf, 0xbc, 0xc3, 0xff, 0x34, 0x01, 0x31, 0x02, 0x02, 0xa2, 0xa1, 0x00,
|
||||
0xbb, 0xc8, 0xc3, 0xd0, 0x00, 0x17, 0x35, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0x80, 0x43, 0x05,
|
||||
0x00, 0x00, 0x64, 0x00, 0x00, 0xf6, 0x00, 0xf8, 0x00, 0xe2, 0x00, 0xc3, 0x00, 0x05, 0x0f, 0x28,
|
||||
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x46,
|
||||
0x21, 0xe2, 0x31, 0xaf, 0x22, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static Game convert_rom_game_id_to_ptgb_game(int game_id)
|
||||
{
|
||||
@@ -49,8 +47,7 @@ static Game convert_rom_game_id_to_ptgb_game(int game_id)
|
||||
case EMERALD_ID:
|
||||
return EMERALD;
|
||||
default:
|
||||
return GAME_UNKNOWN; // Default to unknown if the game ID is
|
||||
// unrecognized
|
||||
return GAME_UNKNOWN; // Default to unknown if the game ID is unrecognized
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,18 +68,15 @@ static Language convert_rom_lang_to_ptgb_lang(int rom_lang)
|
||||
case LANG_SPA:
|
||||
return SPANISH;
|
||||
default:
|
||||
return LANGUAGE_UNKNOWN; // Default to unknown if the language is
|
||||
// unrecognized
|
||||
return LANGUAGE_UNKNOWN; // Default to unknown if the language is unrecognized
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The trainer OT is encoded in the gen3 proprietary charset.
|
||||
* But if we want to print it with npf_snprintf, we need to convert it to UTF-8
|
||||
* first.
|
||||
* But if we want to print it with npf_snprintf, we need to convert it to UTF-8 first.
|
||||
*/
|
||||
static void convert_OT_to_utf8(
|
||||
const u8 *encoded_OT, u8 *output_buffer, const u16 *gen3_charset)
|
||||
static void convert_OT_to_utf8(const u8 *encoded_OT, u8 *output_buffer, const u16 *gen3_charset)
|
||||
{
|
||||
u16 current_char;
|
||||
u32 num_bytes;
|
||||
@@ -91,12 +85,11 @@ static void convert_OT_to_utf8(
|
||||
|
||||
for (u32 i = 0; i < 7 && encoded_OT[i] != 0xFF; ++i)
|
||||
{
|
||||
// the charset maps each gen 3 character (represented as a byte) to a
|
||||
// UTF-16 codepoint. So we first convert the encoded OT character to
|
||||
// UTF-16, and then convert that UTF-16 codepoint to UTF-8.
|
||||
// the charset maps each gen 3 character (represented as a byte) to a UTF-16 codepoint.
|
||||
// So we first convert the encoded OT character to UTF-16, and then convert that UTF-16
|
||||
// codepoint to UTF-8.
|
||||
current_char = convert_gen_3_char_to_utf16(gen3_charset, encoded_OT[i]);
|
||||
num_bytes =
|
||||
convert_utf16_to_utf8_char(current_char, utf8_codepoint_buffer);
|
||||
num_bytes = convert_utf16_to_utf8_char(current_char, utf8_codepoint_buffer);
|
||||
|
||||
memcpy(cur_out, utf8_codepoint_buffer, num_bytes);
|
||||
cur_out += num_bytes;
|
||||
@@ -107,8 +100,7 @@ static void convert_OT_to_utf8(
|
||||
void show_debug_menu_section(void *context, unsigned user_param)
|
||||
{
|
||||
(void)context; // unused
|
||||
const DebugMenuSection section_to_show =
|
||||
static_cast<DebugMenuSection>(user_param);
|
||||
const DebugMenuSection section_to_show = static_cast<DebugMenuSection>(user_param);
|
||||
push_debug_menu_section(section_to_show);
|
||||
}
|
||||
|
||||
@@ -145,8 +137,7 @@ void show_debug_info_screen(void *context, unsigned user_param)
|
||||
bool all_collected_flag = read_flag(curr_GBA_rom.all_collected_flag);
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
pkmn_flags |=
|
||||
(read_flag(curr_GBA_rom.pkmn_collected_flag_start + i) << i);
|
||||
pkmn_flags |= (read_flag(curr_GBA_rom.pkmn_collected_flag_start + i) << i);
|
||||
}
|
||||
|
||||
bool tutorial = get_tutorial_flag();
|
||||
@@ -181,10 +172,9 @@ void show_debug_info_screen(void *context, unsigned user_param)
|
||||
show_textbox();
|
||||
|
||||
npf_snprintf(text_buffer, sizeof(text_buffer),
|
||||
"Debug info:\n\nG: %d%s%d\nF: %d%d%d-%s\nS: %d-%s\n%s%s",
|
||||
curr_GBA_rom.language, game_code, curr_GBA_rom.version, e4_flag,
|
||||
mg_flag, all_collected_flag, flags_hex_str, tutorial, def_lang_hex_str,
|
||||
BUILD_INFO, get_treecko_enabled() ? ".T" : "");
|
||||
"Debug info:\n\nG: %d%s%d\nF: %d%d%d-%s\nS: %d-%s\n%s%s", curr_GBA_rom.language,
|
||||
game_code, curr_GBA_rom.version, e4_flag, mg_flag, all_collected_flag, flags_hex_str,
|
||||
tutorial, def_lang_hex_str, BUILD_INFO, get_treecko_enabled() ? ".T" : "");
|
||||
|
||||
ptgb_write_debug(charset, text_buffer, true);
|
||||
|
||||
@@ -218,10 +208,8 @@ void dbg_play_song(void *context, unsigned user_param)
|
||||
|
||||
void dbg_inject_pkmn(void *context, unsigned user_param)
|
||||
{
|
||||
const Game game_type =
|
||||
convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode);
|
||||
const Language game_lang =
|
||||
convert_rom_lang_to_ptgb_lang(curr_GBA_rom.language);
|
||||
const Game game_type = convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode);
|
||||
const Language game_lang = convert_rom_lang_to_ptgb_lang(curr_GBA_rom.language);
|
||||
u32 ret;
|
||||
char text_buffer[256];
|
||||
u8 encoded_OT[8];
|
||||
@@ -238,15 +226,12 @@ void dbg_inject_pkmn(void *context, unsigned user_param)
|
||||
celebi.loadData(RSEFL_10_ANIV_Celebi_0BF5_ENG_, false);
|
||||
|
||||
// front_sprite_tile_id is reserved behind the box sprites
|
||||
if (!g_debug_options.ignore_game_pak &&
|
||||
!g_debug_options.ignore_game_pak_sprites)
|
||||
if (!g_debug_options.ignore_game_pak && !g_debug_options.ignore_game_pak_sprites)
|
||||
{
|
||||
u32 front_sprite_tile_id = global_tile_id_end + (30 * 16);
|
||||
load_sprite_compressed(grabbed_front_sprite,
|
||||
(const unsigned int *)*(
|
||||
u32 *)(curr_GBA_rom.loc_gMonFrontPicTable + (0 * 8)),
|
||||
front_sprite_tile_id, PULLED_SPRITE_PAL, ATTR0_SQUARE,
|
||||
ATTR1_SIZE_64x64, 1);
|
||||
(const unsigned int *)*(u32 *)(curr_GBA_rom.loc_gMonFrontPicTable + (0 * 8)),
|
||||
front_sprite_tile_id, PULLED_SPRITE_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1);
|
||||
update_front_box_sprite(&celebi, false);
|
||||
obj_set_pos(grabbed_front_sprite, 88, 16);
|
||||
obj_unhide(grabbed_front_sprite, 0);
|
||||
@@ -267,8 +252,8 @@ void dbg_inject_pkmn(void *context, unsigned user_param)
|
||||
|
||||
if (ret == UINT32_MAX)
|
||||
{
|
||||
// Failed to inject the Pokémon, all boxes are full. You can handle this
|
||||
// case as needed (e.g., show an error message).
|
||||
// Failed to inject the Pokémon, all boxes are full. You can handle this case as needed
|
||||
// (e.g., show an error message).
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -284,14 +269,12 @@ void dbg_inject_pkmn(void *context, unsigned user_param)
|
||||
|
||||
convert_OT_to_utf8(encoded_OT, decoded_OT_utf8, tables.gen3_charset);
|
||||
npf_snprintf(text_buffer, sizeof(text_buffer),
|
||||
"%s received a Celebi!\n Celebi was sent to box %d!", decoded_OT_utf8,
|
||||
boxIndex);
|
||||
"%s received a Celebi!\n Celebi was sent to box %d!", decoded_OT_utf8, boxIndex);
|
||||
ptgb_write_debug(tables.gen3_charset, text_buffer, false);
|
||||
|
||||
wait_for_user_to_continue(H_MAX, V_MAX);
|
||||
|
||||
if (!g_debug_options.ignore_game_pak &&
|
||||
!g_debug_options.ignore_game_pak_sprites)
|
||||
if (!g_debug_options.ignore_game_pak && !g_debug_options.ignore_game_pak_sprites)
|
||||
{
|
||||
obj_hide(grabbed_front_sprite);
|
||||
}
|
||||
@@ -302,10 +285,8 @@ void dbg_inject_pkmn(void *context, unsigned user_param)
|
||||
|
||||
void dbg_unlock_mystery(void *context, unsigned user_param)
|
||||
{
|
||||
const Game game_type =
|
||||
convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode);
|
||||
const Language game_lang =
|
||||
convert_rom_lang_to_ptgb_lang(curr_GBA_rom.language);
|
||||
const Game game_type = convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode);
|
||||
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);
|
||||
|
||||
@@ -342,15 +323,13 @@ void dbg_inject_wc3(void *context, unsigned user_param)
|
||||
return;
|
||||
}
|
||||
|
||||
const Game game_type =
|
||||
convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode);
|
||||
const Game game_type = convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode);
|
||||
if (game_type != EMERALD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Language game_lang =
|
||||
convert_rom_lang_to_ptgb_lang(curr_GBA_rom.language);
|
||||
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);
|
||||
|
||||
@@ -370,15 +349,13 @@ void dbg_inject_me3(void *context, unsigned user_param)
|
||||
return;
|
||||
}
|
||||
|
||||
const Game game_type =
|
||||
convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode);
|
||||
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);
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user