From 7f48f7faf356947746fef065cfbec425011cbe29 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 25 Oct 2024 08:44:20 -0700 Subject: [PATCH 1/4] Identify unk_020021B0 -> charcode_util --- include/{unk_020021B0.h => charcode_util.h} | 6 +++--- platinum.us/main.lsf | 2 +- src/battle/battle_lib.c | 2 +- src/{unk_020021B0.c => charcode_util.c} | 2 +- src/meson.build | 2 +- src/overlay006/ov6_02246444.c | 2 +- src/overlay059/ov59_021D2B44.c | 2 +- src/overlay088/ov88_0223B140.c | 2 +- src/overlay094/ov94_022414B8.c | 2 +- src/overlay104/ov104_0222DCE0.c | 2 +- src/pokemon.c | 2 +- src/trainer_data.c | 2 +- src/trainer_info.c | 2 +- src/unk_0200C440.c | 2 +- src/unk_02027F84.c | 2 +- src/unk_02028124.c | 2 +- src/unk_0202B37C.c | 2 +- src/unk_0202E840.c | 2 +- src/unk_02030A80.c | 2 +- src/unk_02030CE8.c | 2 +- src/unk_02051D8C.c | 2 +- src/unk_0206CCB0.c | 2 +- src/unk_02071D40.c | 2 +- src/unk_0207A6DC.c | 2 +- src/unk_0208694C.c | 2 +- 25 files changed, 27 insertions(+), 27 deletions(-) rename include/{unk_020021B0.h => charcode_util.h} (79%) rename src/{unk_020021B0.c => charcode_util.c} (98%) diff --git a/include/unk_020021B0.h b/include/charcode_util.h similarity index 79% rename from include/unk_020021B0.h rename to include/charcode_util.h index bd34c16979..427cd969a1 100644 --- a/include/unk_020021B0.h +++ b/include/charcode_util.h @@ -1,5 +1,5 @@ -#ifndef POKEPLATINUM_UNK_020021B0_H -#define POKEPLATINUM_UNK_020021B0_H +#ifndef POKEPLATINUM_CHARCODE_UTIL_H +#define POKEPLATINUM_CHARCODE_UTIL_H u16 *GF_strcpy(u16 *param0, const u16 *param1); u16 *sub_020021D0(u16 *param0, const u16 *param1, u32 param2); @@ -10,4 +10,4 @@ u16 *sub_02002278(u16 *param0, u16 param1, u32 param2); u16 *sub_02002294(u16 *param0, u32 param1); u16 *sub_020022A4(u16 *param0, s32 param1, u32 param2, u32 param3); -#endif // POKEPLATINUM_UNK_020021B0_H +#endif // POKEPLATINUM_CHARCODE_UTIL_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index 81824aefbb..0b31872d59 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -19,7 +19,7 @@ Static main Object main.nef.p/src_unk_0200112C.c.o Object main.nef.p/src_game_version.c.o Object main.nef.p/src_unk_02001AF4.c.o - Object main.nef.p/src_unk_020021B0.c.o + Object main.nef.p/src_charcode_util.c.o Object main.nef.p/src_render_text.c.o Object main.nef.p/src_font.c.o Object main.nef.p/src_palette.c.o diff --git a/src/battle/battle_lib.c b/src/battle/battle_lib.c index 610a86d68e..c51ae692fe 100644 --- a/src/battle/battle_lib.c +++ b/src/battle/battle_lib.c @@ -31,6 +31,7 @@ #include "battle/scripts/sub_seq.naix" #include "battle/struct_ov16_0225BFFC_decl.h" +#include "charcode_util.h" #include "flags.h" #include "heap.h" #include "item.h" @@ -43,7 +44,6 @@ #include "strbuf.h" #include "trainer_data.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_020366A0.h" #include "unk_0208C098.h" diff --git a/src/unk_020021B0.c b/src/charcode_util.c similarity index 98% rename from src/unk_020021B0.c rename to src/charcode_util.c index 00e9204802..c0ac0ec81d 100644 --- a/src/unk_020021B0.c +++ b/src/charcode_util.c @@ -1,4 +1,4 @@ -#include "unk_020021B0.h" +#include "charcode_util.h" #include #include diff --git a/src/meson.build b/src/meson.build index 1e6448fcad..764ff7f956 100644 --- a/src/meson.build +++ b/src/meson.build @@ -17,7 +17,7 @@ pokeplatinum_c = files( 'strbuf.c', 'unk_0200112C.c', 'unk_02001AF4.c', - 'unk_020021B0.c', + 'charcode_util.c', 'render_text.c', 'font.c', 'palette.c', diff --git a/src/overlay006/ov6_02246444.c b/src/overlay006/ov6_02246444.c index d11f7c3ce7..b569a4638e 100644 --- a/src/overlay006/ov6_02246444.c +++ b/src/overlay006/ov6_02246444.c @@ -12,10 +12,10 @@ #include "overlay006/struct_ov6_022465F4_decl.h" #include "savedata/save_table.h" +#include "charcode_util.h" #include "heap.h" #include "save_player.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_0202E2CC.h" struct UnkStruct_ov6_022465F4_t { diff --git a/src/overlay059/ov59_021D2B44.c b/src/overlay059/ov59_021D2B44.c index 1a5bd13daf..b2561fc76b 100644 --- a/src/overlay059/ov59_021D2B44.c +++ b/src/overlay059/ov59_021D2B44.c @@ -9,12 +9,12 @@ #include "savedata/save_table.h" +#include "charcode_util.h" #include "communication_information.h" #include "heap.h" #include "save_player.h" #include "savedata.h" #include "trainer_info.h" -#include "unk_020021B0.h" __attribute__((aligned(4))) static const u8 Unk_ov59_021D33B0[] = { 0x2, diff --git a/src/overlay088/ov88_0223B140.c b/src/overlay088/ov88_0223B140.c index b9e3aeea94..5b45d6853b 100644 --- a/src/overlay088/ov88_0223B140.c +++ b/src/overlay088/ov88_0223B140.c @@ -25,6 +25,7 @@ #include "bag.h" #include "bg_window.h" #include "cell_actor.h" +#include "charcode_util.h" #include "communication_information.h" #include "communication_system.h" #include "core_sys.h" @@ -55,7 +56,6 @@ #include "trainer_info.h" #include "unk_0200112C.h" #include "unk_02001AF4.h" -#include "unk_020021B0.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_02006224.h" diff --git a/src/overlay094/ov94_022414B8.c b/src/overlay094/ov94_022414B8.c index 2dd54efbcc..0df655bea0 100644 --- a/src/overlay094/ov94_022414B8.c +++ b/src/overlay094/ov94_022414B8.c @@ -25,6 +25,7 @@ #include "overlay094/struct_ov94_02242AAC.h" #include "bg_window.h" +#include "charcode_util.h" #include "core_sys.h" #include "font.h" #include "game_options.h" @@ -40,7 +41,6 @@ #include "trainer_info.h" #include "unk_0200112C.h" #include "unk_02001AF4.h" -#include "unk_020021B0.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" diff --git a/src/overlay104/ov104_0222DCE0.c b/src/overlay104/ov104_0222DCE0.c index ed1b67ed4e..51cbf4fedc 100644 --- a/src/overlay104/ov104_0222DCE0.c +++ b/src/overlay104/ov104_0222DCE0.c @@ -15,6 +15,7 @@ #include "overlay104/struct_ov104_0223A348_sub2.h" #include "cell_actor.h" +#include "charcode_util.h" #include "communication_information.h" #include "communication_system.h" #include "flags.h" @@ -29,7 +30,6 @@ #include "strbuf.h" #include "string_template.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_0201D15C.h" #include "unk_0202C858.h" #include "unk_02038F8C.h" diff --git a/src/pokemon.c b/src/pokemon.c index bf44123e14..0a686ecf2b 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -33,6 +33,7 @@ #include "overlay005/struct_ov5_021DE5D0.h" #include "cell_actor.h" +#include "charcode_util.h" #include "flags.h" #include "heap.h" #include "inlines.h" @@ -48,7 +49,6 @@ #include "strbuf.h" #include "trainer_data.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_02005474.h" #include "unk_02006224.h" #include "unk_0200C6E4.h" diff --git a/src/trainer_data.c b/src/trainer_data.c index 020ec2490e..9c789603b8 100644 --- a/src/trainer_data.c +++ b/src/trainer_data.c @@ -10,6 +10,7 @@ #include "data/trainer_class_genders.h" #include "overlay006/battle_params.h" +#include "charcode_util.h" #include "heap.h" #include "message.h" #include "narc.h" @@ -19,7 +20,6 @@ #include "savedata_misc.h" #include "strbuf.h" #include "trainer_data.h" -#include "unk_020021B0.h" #include "unk_0201D15C.h" static void TrainerData_BuildParty(BattleParams *battleParams, int battler, int heapID); diff --git a/src/trainer_info.c b/src/trainer_info.c index 9897b2c704..6c119d9210 100644 --- a/src/trainer_info.c +++ b/src/trainer_info.c @@ -5,9 +5,9 @@ #include "constants/charcode.h" +#include "charcode_util.h" #include "heap.h" #include "strbuf.h" -#include "unk_020021B0.h" #define MONEY_MAX 999999 diff --git a/src/unk_0200C440.c b/src/unk_0200C440.c index 4479231297..c1e8114b3a 100644 --- a/src/unk_0200C440.c +++ b/src/unk_0200C440.c @@ -4,9 +4,9 @@ #include #include "bg_window.h" +#include "charcode_util.h" #include "graphics.h" #include "heap.h" -#include "unk_020021B0.h" typedef struct UnkStruct_0200C440_t { void *unk_00; diff --git a/src/unk_02027F84.c b/src/unk_02027F84.c index 7f64d73fce..11b68f53ef 100644 --- a/src/unk_02027F84.c +++ b/src/unk_02027F84.c @@ -5,9 +5,9 @@ #include "struct_defs/struct_02027F8C.h" +#include "charcode_util.h" #include "heap.h" #include "savedata.h" -#include "unk_020021B0.h" int PalPad_SaveSize(void) { diff --git a/src/unk_02028124.c b/src/unk_02028124.c index 3519c05dc6..c5a5650b97 100644 --- a/src/unk_02028124.c +++ b/src/unk_02028124.c @@ -9,6 +9,7 @@ #include "struct_defs/struct_02028430.h" #include "struct_defs/union_02028328.h" +#include "charcode_util.h" #include "heap.h" #include "party.h" #include "pokemon.h" @@ -16,7 +17,6 @@ #include "save_player.h" #include "savedata.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_02014A84.h" static int sub_020284E8(UnkStruct_0202818C *param0, int param1); diff --git a/src/unk_0202B37C.c b/src/unk_0202B37C.c index 6614be5d1b..cb2693a901 100644 --- a/src/unk_0202B37C.c +++ b/src/unk_0202B37C.c @@ -6,9 +6,9 @@ #include "struct_defs/struct_0202B4A0.h" #include "struct_defs/struct_0202B510.h" +#include "charcode_util.h" #include "savedata.h" #include "strbuf.h" -#include "unk_020021B0.h" #include "unk_0201D15C.h" UnkStruct_0202B4A0 *Unk_021C079C; diff --git a/src/unk_0202E840.c b/src/unk_0202E840.c index 597493e1a5..48030a426b 100644 --- a/src/unk_0202E840.c +++ b/src/unk_0202E840.c @@ -12,13 +12,13 @@ #include "struct_defs/struct_0202EA80.h" #include "struct_defs/struct_0202EE10.h" +#include "charcode_util.h" #include "game_records.h" #include "heap.h" #include "save_player.h" #include "savedata.h" #include "strbuf.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_0202B37C.h" #include "unk_0203061C.h" diff --git a/src/unk_02030A80.c b/src/unk_02030A80.c index f685cc483b..0b6b69a6b5 100644 --- a/src/unk_02030A80.c +++ b/src/unk_02030A80.c @@ -9,6 +9,7 @@ #include "struct_defs/struct_0202F298_sub1.h" #include "struct_defs/struct_02030A80.h" +#include "charcode_util.h" #include "heap.h" #include "pokemon.h" #include "save_player.h" @@ -16,7 +17,6 @@ #include "savedata_misc.h" #include "strbuf.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_02014A84.h" #include "unk_02014D38.h" #include "unk_02025CB0.h" diff --git a/src/unk_02030CE8.c b/src/unk_02030CE8.c index 95882e2184..4ffb47cf9d 100644 --- a/src/unk_02030CE8.c +++ b/src/unk_02030CE8.c @@ -8,10 +8,10 @@ #include "overlay096/struct_ov96_0223B574.h" +#include "charcode_util.h" #include "save_player.h" #include "savedata.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_0201D15C.h" #include "unk_0202C858.h" diff --git a/src/unk_02051D8C.c b/src/unk_02051D8C.c index 7108231549..924ecd37dd 100644 --- a/src/unk_02051D8C.c +++ b/src/unk_02051D8C.c @@ -22,6 +22,7 @@ #include "savedata/save_table.h" #include "bag.h" +#include "charcode_util.h" #include "communication_system.h" #include "core_sys.h" #include "field_overworld_state.h" @@ -40,7 +41,6 @@ #include "savedata.h" #include "strbuf.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_02025CB0.h" #include "unk_0202602C.h" #include "unk_0202631C.h" diff --git a/src/unk_0206CCB0.c b/src/unk_0206CCB0.c index 311b123395..9ff9f447f7 100644 --- a/src/unk_0206CCB0.c +++ b/src/unk_0206CCB0.c @@ -34,6 +34,7 @@ #include "savedata/save_table.h" #include "bag.h" +#include "charcode_util.h" #include "field_system.h" #include "heap.h" #include "inlines.h" @@ -48,7 +49,6 @@ #include "strbuf.h" #include "string_template.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_0201D15C.h" #include "unk_0202631C.h" #include "unk_02027B70.h" diff --git a/src/unk_02071D40.c b/src/unk_02071D40.c index 68987f541a..93c6c4daf2 100644 --- a/src/unk_02071D40.c +++ b/src/unk_02071D40.c @@ -14,6 +14,7 @@ #include "field/field_system.h" +#include "charcode_util.h" #include "field_system.h" #include "game_records.h" #include "heap.h" @@ -21,7 +22,6 @@ #include "save_player.h" #include "savedata.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_0202631C.h" #include "unk_0202854C.h" #include "unk_0202C7FC.h" diff --git a/src/unk_0207A6DC.c b/src/unk_0207A6DC.c index 7a83bd2c73..3127a43f87 100644 --- a/src/unk_0207A6DC.c +++ b/src/unk_0207A6DC.c @@ -19,13 +19,13 @@ #include "battle/battle_io.h" #include "battle/ov16_0223DF00.h" +#include "charcode_util.h" #include "communication_system.h" #include "heap.h" #include "party.h" #include "sys_task.h" #include "sys_task_manager.h" #include "trainer_info.h" -#include "unk_020021B0.h" #include "unk_02027F84.h" #include "unk_0202CC64.h" #include "unk_0202F1D4.h" diff --git a/src/unk_0208694C.c b/src/unk_0208694C.c index 1acb0fe762..082f4d1d06 100644 --- a/src/unk_0208694C.c +++ b/src/unk_0208694C.c @@ -12,6 +12,7 @@ #include "bg_window.h" #include "cell_actor.h" +#include "charcode_util.h" #include "core_sys.h" #include "font.h" #include "game_options.h" @@ -29,7 +30,6 @@ #include "string_template.h" #include "sys_task_manager.h" #include "text.h" -#include "unk_020021B0.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200679C.h" From c62458ab15ea6d98e98ad1d0514335f22b12a24a Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 25 Oct 2024 08:51:38 -0700 Subject: [PATCH 2/4] Identify extern functions -> charcode_util.h --- include/charcode_util.h | 16 ++++++++-------- src/battle/battle_lib.c | 4 ++-- src/charcode_util.c | 18 +++++++++--------- src/overlay006/ov6_02246444.c | 2 +- src/overlay059/ov59_021D2B44.c | 2 +- src/overlay088/ov88_0223B140.c | 2 +- src/overlay094/ov94_022414B8.c | 2 +- src/overlay104/ov104_0222DCE0.c | 2 +- src/pokemon.c | 4 ++-- src/trainer_data.c | 2 +- src/trainer_info.c | 6 +++--- src/unk_0200C440.c | 4 ++-- src/unk_02027F84.c | 2 +- src/unk_02028124.c | 4 ++-- src/unk_0202B37C.c | 6 +++--- src/unk_0202E840.c | 6 +++--- src/unk_02030A80.c | 2 +- src/unk_02030CE8.c | 2 +- src/unk_02051D8C.c | 4 ++-- src/unk_0206CCB0.c | 4 ++-- src/unk_02071D40.c | 2 +- src/unk_0207A6DC.c | 2 +- src/unk_0208694C.c | 10 +++++----- 23 files changed, 54 insertions(+), 54 deletions(-) diff --git a/include/charcode_util.h b/include/charcode_util.h index 427cd969a1..72ccc7e0db 100644 --- a/include/charcode_util.h +++ b/include/charcode_util.h @@ -1,13 +1,13 @@ #ifndef POKEPLATINUM_CHARCODE_UTIL_H #define POKEPLATINUM_CHARCODE_UTIL_H -u16 *GF_strcpy(u16 *param0, const u16 *param1); -u16 *sub_020021D0(u16 *param0, const u16 *param1, u32 param2); -u32 GF_strlen(const u16 *param0); -BOOL GF_strcmp(const u16 *param0, const u16 *param1); -BOOL GF_strncmp(const u16 *param0, const u16 *param1, u32 param2); -u16 *sub_02002278(u16 *param0, u16 param1, u32 param2); -u16 *sub_02002294(u16 *param0, u32 param1); -u16 *sub_020022A4(u16 *param0, s32 param1, u32 param2, u32 param3); +u16 *CharCode_Copy(u16 *param0, const u16 *param1); +u16 *CharCode_CopyNumChars(u16 *param0, const u16 *param1, u32 param2); +u32 CharCode_Length(const u16 *param0); +BOOL CharCode_Compare(const u16 *param0, const u16 *param1); +BOOL CharCode_CompareNumChars(const u16 *param0, const u16 *param1, u32 param2); +u16 *CharCode_FillWith(u16 *param0, u16 param1, u32 param2); +u16 *CharCode_FillWithEOS(u16 *param0, u32 param1); +u16 *CharCode_FromInt(u16 *param0, s32 param1, u32 param2, u32 param3); #endif // POKEPLATINUM_CHARCODE_UTIL_H diff --git a/src/battle/battle_lib.c b/src/battle/battle_lib.c index c51ae692fe..818a25eecd 100644 --- a/src/battle/battle_lib.c +++ b/src/battle/battle_lib.c @@ -6275,7 +6275,7 @@ BOOL BattleSystem_TrainerIsOT(BattleSystem *battleSys, BattleContext *battleCtx) if (trID == ATTACKING_MON.OTId && trGender == ATTACKING_MON.OTGender - && GF_strncmp(trName, ATTACKING_MON.OTName, TRAINER_NAME_LEN) == 0) { + && CharCode_CompareNumChars(trName, ATTACKING_MON.OTName, TRAINER_NAME_LEN) == 0) { return TRUE; } @@ -6294,7 +6294,7 @@ BOOL BattleSystem_PokemonIsOT(BattleSystem *battleSys, Pokemon *mon) if (trID == Pokemon_GetValue(mon, MON_DATA_OT_ID, NULL) && trGender == Pokemon_GetValue(mon, MON_DATA_OT_GENDER, NULL) - && GF_strncmp(trName, monOTName, TRAINER_NAME_LEN) == 0) { + && CharCode_CompareNumChars(trName, monOTName, TRAINER_NAME_LEN) == 0) { return TRUE; } diff --git a/src/charcode_util.c b/src/charcode_util.c index c0ac0ec81d..e6d2e7c121 100644 --- a/src/charcode_util.c +++ b/src/charcode_util.c @@ -35,7 +35,7 @@ static const int Unk_020E4CA8[] = { 1000000000, }; -u16 *GF_strcpy(u16 *param0, const u16 *param1) +u16 *CharCode_Copy(u16 *param0, const u16 *param1) { while (*param1 != 0xffff) { *param0 = *param1; @@ -47,7 +47,7 @@ u16 *GF_strcpy(u16 *param0, const u16 *param1) return param0; } -u16 *sub_020021D0(u16 *param0, const u16 *param1, u32 param2) +u16 *CharCode_CopyNumChars(u16 *param0, const u16 *param1, u32 param2) { u32 v0; @@ -58,7 +58,7 @@ u16 *sub_020021D0(u16 *param0, const u16 *param1, u32 param2) return ¶m0[param2]; } -u32 GF_strlen(const u16 *param0) +u32 CharCode_Length(const u16 *param0) { u32 v0 = 0; @@ -69,7 +69,7 @@ u32 GF_strlen(const u16 *param0) return v0; } -BOOL GF_strcmp(const u16 *param0, const u16 *param1) +BOOL CharCode_Compare(const u16 *param0, const u16 *param1) { while (*param0 == *param1) { if (*param0 == 0xffff) { @@ -83,7 +83,7 @@ BOOL GF_strcmp(const u16 *param0, const u16 *param1) return 1; } -BOOL GF_strncmp(const u16 *param0, const u16 *param1, u32 param2) +BOOL CharCode_CompareNumChars(const u16 *param0, const u16 *param1, u32 param2) { while (*param0 == *param1) { if (param2 == 0) { @@ -102,7 +102,7 @@ BOOL GF_strncmp(const u16 *param0, const u16 *param1, u32 param2) return 1; } -u16 *sub_02002278(u16 *param0, u16 param1, u32 param2) +u16 *CharCode_FillWith(u16 *param0, u16 param1, u32 param2) { u32 v0; @@ -113,12 +113,12 @@ u16 *sub_02002278(u16 *param0, u16 param1, u32 param2) return ¶m0[v0]; } -u16 *sub_02002294(u16 *param0, u32 param1) +u16 *CharCode_FillWithEOS(u16 *param0, u32 param1) { - return sub_02002278(param0, 0xffff, param1); + return CharCode_FillWith(param0, 0xffff, param1); } -u16 *sub_020022A4(u16 *param0, s32 param1, u32 param2, u32 param3) +u16 *CharCode_FromInt(u16 *param0, s32 param1, u32 param2, u32 param3) { u32 v0; u32 v1; diff --git a/src/overlay006/ov6_02246444.c b/src/overlay006/ov6_02246444.c index b569a4638e..8ed2b378c1 100644 --- a/src/overlay006/ov6_02246444.c +++ b/src/overlay006/ov6_02246444.c @@ -49,7 +49,7 @@ static void ov6_02246458(UnkStruct_ov6_022465F4 *param0, int param1) static void ov6_0224645C(UnkStruct_ov6_022465F4 *param0, const u16 *param1) { - sub_020021D0(param0->unk_04, param1, 7 + 1); + CharCode_CopyNumChars(param0->unk_04, param1, 7 + 1); } static void ov6_02246468(UnkStruct_ov6_022465F4 *param0, UnkStruct_0202E4D4 *param1) diff --git a/src/overlay059/ov59_021D2B44.c b/src/overlay059/ov59_021D2B44.c index b2561fc76b..5a039a1a4c 100644 --- a/src/overlay059/ov59_021D2B44.c +++ b/src/overlay059/ov59_021D2B44.c @@ -160,7 +160,7 @@ static void ov59_021D2B90(SaveData *param0, UnkStruct_0202E794 *param1, UnkStruc param1->unk_05 = GAME_VERSION; param1->unk_06 = GAME_LANGUAGE; - sub_020021D0(param1->unk_08, TrainerInfo_Name(v1), 7 + 1); + CharCode_CopyNumChars(param1->unk_08, TrainerInfo_Name(v1), 7 + 1); param1->unk_18 = param2[v0].unk_00; param1->unk_18.unk_01 = 0; diff --git a/src/overlay088/ov88_0223B140.c b/src/overlay088/ov88_0223B140.c index 5b45d6853b..1dc14a3a6d 100644 --- a/src/overlay088/ov88_0223B140.c +++ b/src/overlay088/ov88_0223B140.c @@ -1667,7 +1667,7 @@ static void ov88_0223D0D4(TrainerInfo *param0, UnkStruct_02027F8C *param1, UnkSt { int v0; - GF_strcpy(param2->unk_00, TrainerInfo_Name(param0)); + CharCode_Copy(param2->unk_00, TrainerInfo_Name(param0)); param2->unk_10 = TrainerInfo_ID(param0); param2->unk_14 = TrainerInfo_RegionCode(param0); diff --git a/src/overlay094/ov94_022414B8.c b/src/overlay094/ov94_022414B8.c index 0df655bea0..12d5d1ea6f 100644 --- a/src/overlay094/ov94_022414B8.c +++ b/src/overlay094/ov94_022414B8.c @@ -1054,7 +1054,7 @@ void ov94_022425A8(UnkStruct_ov94_0223BA88 *param0, UnkStruct_ov94_0223FD4C *par Pokemon_FromBoxPokemon(param1->unk_114, (Pokemon *)param0->unk_00.unk_00); } - sub_020021D0(param0->unk_10C, TrainerInfo_Name(param1->unk_00->unk_1C), 8); + CharCode_CopyNumChars(param0->unk_10C, TrainerInfo_Name(param1->unk_00->unk_1C), 8); param0->unk_11C = TrainerInfo_ID_LowHalf(param1->unk_00->unk_1C); param0->unk_11E = sub_0202C8C0(param1->unk_00->unk_18); diff --git a/src/overlay104/ov104_0222DCE0.c b/src/overlay104/ov104_0222DCE0.c index 51cbf4fedc..955bc6cb14 100644 --- a/src/overlay104/ov104_0222DCE0.c +++ b/src/overlay104/ov104_0222DCE0.c @@ -446,7 +446,7 @@ void ov104_0222E284(BattleParams *param0, UnkStruct_ov104_0223A348_sub1 *param1, param0->trainerIDs[param3] = param1->unk_00; param0->trainerData[param3].class = param1->unk_04; - GF_strcpy(¶m0->trainerData[param3].name[0], ¶m1->unk_08[0]); + CharCode_Copy(¶m0->trainerData[param3].name[0], ¶m1->unk_08[0]); v0 = (Sentence *)¶m1->unk_20[0]; param0->trainerData[param3].winMsg = *v0; diff --git a/src/pokemon.c b/src/pokemon.c index 0a686ecf2b..e8c515434f 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1490,7 +1490,7 @@ static void BoxPokemon_SetDataInternal(BoxPokemon *boxMon, enum PokemonDataParam charcode_t baseName[MON_NAME_LEN + 1]; MessageLoader_GetSpeciesName(monDataBlockA->species, HEAP_ID_SYSTEM, baseName); - monDataBlockB->hasNickname = GF_strcmp(baseName, u16Value); + monDataBlockB->hasNickname = CharCode_Compare(baseName, u16Value); } // fall-through case MON_DATA_NICKNAME: @@ -1506,7 +1506,7 @@ static void BoxPokemon_SetDataInternal(BoxPokemon *boxMon, enum PokemonDataParam MessageLoader_GetSpeciesName(monDataBlockA->species, HEAP_ID_SYSTEM, baseName); Strbuf_ToChars(value, nickname, NELEMS(nickname)); - monDataBlockB->hasNickname = GF_strcmp(baseName, nickname); + monDataBlockB->hasNickname = CharCode_Compare(baseName, nickname); } // fall-through case MON_DATA_NICKNAME_STRBUF: diff --git a/src/trainer_data.c b/src/trainer_data.c index 9c789603b8..5a936b0485 100644 --- a/src/trainer_data.c +++ b/src/trainer_data.c @@ -39,7 +39,7 @@ void TrainerData_Encounter(BattleParams *battleParams, const SaveData *save, int battleParams->trainerData[i] = trdata; if (trdata.class == TRAINER_CLASS_RIVAL) { - GF_strcpy(battleParams->trainerData[i].name, rivalName); + CharCode_Copy(battleParams->trainerData[i].name, rivalName); } else { Strbuf *trainerName = MessageLoader_GetNewStrbuf(msgLoader, battleParams->trainerIDs[i]); Strbuf_ToChars(trainerName, battleParams->trainerData[i].name, TRAINER_NAME_LEN + 1); diff --git a/src/trainer_info.c b/src/trainer_info.c index 6c119d9210..3a0f4510db 100644 --- a/src/trainer_info.c +++ b/src/trainer_info.c @@ -50,10 +50,10 @@ BOOL TrainerInfo_HasNoName(const TrainerInfo *info) void TrainerInfo_SetName(TrainerInfo *info, const charcode_t *name) { - int len = GF_strlen(name); + int len = CharCode_Length(name); GF_ASSERT(len < TRAINER_NAME_LEN + 1); - GF_strcpy(info->name, name); + CharCode_Copy(info->name, name); } void TrainerInfo_SetNameFromStrbuf(TrainerInfo *info, const Strbuf *name) @@ -228,6 +228,6 @@ BOOL TrainerInfo_HasNationalDex(TrainerInfo *info) BOOL TrainerInfo_Equals(const TrainerInfo *info1, const TrainerInfo *info2) { - return GF_strncmp(info1->name, info2->name, TRAINER_NAME_LEN) == 0 + return CharCode_CompareNumChars(info1->name, info2->name, TRAINER_NAME_LEN) == 0 && info1->id == info2->id; } diff --git a/src/unk_0200C440.c b/src/unk_0200C440.c index c1e8114b3a..6a2a11a4a8 100644 --- a/src/unk_0200C440.c +++ b/src/unk_0200C440.c @@ -97,7 +97,7 @@ void sub_0200C5BC(UnkStruct_0200C440 *param0, s32 param1, u32 param2, int param3 { int v0; - sub_020022A4(param0->unk_08, param1, param3, param2); + CharCode_FromInt(param0->unk_08, param1, param3, param2); for (v0 = 0; param0->unk_08[v0] != 0xffff; v0++) { if ((param0->unk_08[v0] >= 0xa2) && (param0->unk_08[v0] <= 0xab)) { @@ -125,7 +125,7 @@ void sub_0200C67C(UnkStruct_0200C440 *param0, s32 param1, u32 param2, int param3 v2 = param4; v1 = param0->unk_28 | (param0->unk_28 << 4); - sub_020022A4(param0->unk_08, param1, param3, param2); + CharCode_FromInt(param0->unk_08, param1, param3, param2); for (v0 = 0; param0->unk_08[v0] != 0xffff; v0++) { if ((param0->unk_08[v0] >= 0xa2) && (param0->unk_08[v0] <= 0xab)) { diff --git a/src/unk_02027F84.c b/src/unk_02027F84.c index 11b68f53ef..b9e3d4b62d 100644 --- a/src/unk_02027F84.c +++ b/src/unk_02027F84.c @@ -41,7 +41,7 @@ u8 sub_02027FC4(const UnkStruct_02027F8C *param0, int param1) BOOL sub_02027FCC(const UnkStruct_02027F8C *param0, const UnkStruct_02027F8C *param1) { - if (0 == GF_strcmp(param0->unk_00, param1->unk_00)) { + if (0 == CharCode_Compare(param0->unk_00, param1->unk_00)) { if (param0->unk_10 == param1->unk_10) { return 1; } diff --git a/src/unk_02028124.c b/src/unk_02028124.c index c5a5650b97..d2c2157844 100644 --- a/src/unk_02028124.c +++ b/src/unk_02028124.c @@ -49,7 +49,7 @@ void sub_02028124(UnkStruct_0202818C *param0) param0->unk_06 = Unk_020E4C40; param0->unk_07 = 0xFFFF; - sub_02002294(param0->unk_08, 8); + CharCode_FillWithEOS(param0->unk_08, 8); for (v0 = 0; v0 < 3; v0++) { param0->unk_18[v0].val2 = 0xFFFF; @@ -101,7 +101,7 @@ void sub_020281AC(UnkStruct_0202818C *param0, u8 param1, u8 param2, SaveData *pa v9 = Party_GetFromSavedata(param3); v8 = SaveData_GetTrainerInfo(param3); - GF_strcpy(param0->unk_08, TrainerInfo_Name(v8)); + CharCode_Copy(param0->unk_08, TrainerInfo_Name(v8)); param0->unk_04 = (u8)TrainerInfo_Gender(v8); param0->unk_00 = TrainerInfo_ID(v8); diff --git a/src/unk_0202B37C.c b/src/unk_0202B37C.c index cb2693a901..c5242cb1ee 100644 --- a/src/unk_0202B37C.c +++ b/src/unk_0202B37C.c @@ -139,7 +139,7 @@ BOOL sub_0202B4D8(const UnkStruct_0202B4A0 *param0, const u16 *param1) for (v0 = 0; v0 < 6; v0++) { v1 = ¶m0->unk_00[v0]; - if (!GF_strncmp(param1, v1->unk_00, 7 + 1)) { + if (!CharCode_CompareNumChars(param1, v1->unk_00, 7 + 1)) { return 1; } } @@ -164,11 +164,11 @@ BOOL sub_0202B530(const UnkStruct_0202B510 *param0, const UnkStruct_0202B510 *pa { int v0; - if (GF_strncmp(param0->unk_10, param1->unk_10, 7 + 1)) { + if (CharCode_CompareNumChars(param0->unk_10, param1->unk_10, 7 + 1)) { return 0; } - if (GF_strncmp(param0->unk_00, param1->unk_00, 7 + 1)) { + if (CharCode_CompareNumChars(param0->unk_00, param1->unk_00, 7 + 1)) { return 0; } diff --git a/src/unk_0202E840.c b/src/unk_0202E840.c index 48030a426b..790f42a264 100644 --- a/src/unk_0202E840.c +++ b/src/unk_0202E840.c @@ -52,13 +52,13 @@ void sub_0202E858(UnkStruct_0202E858 *param0) param0->unk_00 = 0; param0->unk_04 = 0; - sub_02002294(param0->unk_08, 7 + 1); + CharCode_FillWithEOS(param0->unk_08, 7 + 1); SaveData_SetChecksum(28); } BOOL sub_0202E870(UnkStruct_0202E858 *param0) { - if (GF_strlen(param0->unk_08) == 0) { + if (CharCode_Length(param0->unk_08) == 0) { return 0; } @@ -229,7 +229,7 @@ static BOOL sub_0202EA98(const UnkStruct_0202E858 *param0, const UnkStruct_0202E return 0; } - if (GF_strcmp(param0->unk_08, param1->unk_08)) { + if (CharCode_Compare(param0->unk_08, param1->unk_08)) { return 0; } diff --git a/src/unk_02030A80.c b/src/unk_02030A80.c index 0b6b69a6b5..54e8fd909a 100644 --- a/src/unk_02030A80.c +++ b/src/unk_02030A80.c @@ -53,7 +53,7 @@ void sub_02030AA0(UnkStruct_02030A80 *param0, SaveData *param1) MiscSaveBlock_FavoriteMon(v3, &v4, &v5, &v6); MI_CpuClear8(param0, sizeof(UnkStruct_02030A80)); - GF_strcpy(param0->unk_00, TrainerInfo_Name(v0)); + CharCode_Copy(param0->unk_00, TrainerInfo_Name(v0)); param0->unk_10 = TrainerInfo_ID(v0); param0->unk_14 = TrainerInfo_Gender(v0); diff --git a/src/unk_02030CE8.c b/src/unk_02030CE8.c index 4ffb47cf9d..81bf2743b8 100644 --- a/src/unk_02030CE8.c +++ b/src/unk_02030CE8.c @@ -122,7 +122,7 @@ static void sub_02030DD0(SaveData *param0, UnkStruct_ov96_0223B574 *param1) param1->unk_03 = sub_0202C8C4(v0); param1->unk_04 = TrainerInfo_ID(v1); - GF_strcpy(param1->unk_08, TrainerInfo_Name(v1)); + CharCode_Copy(param1->unk_08, TrainerInfo_Name(v1)); param1->unk_10 = 0; strcpy(param1->unk_1C, v2); diff --git a/src/unk_02051D8C.c b/src/unk_02051D8C.c index 924ecd37dd..7cf438c7c9 100644 --- a/src/unk_02051D8C.c +++ b/src/unk_02051D8C.c @@ -423,7 +423,7 @@ void sub_020524E4(BattleParams *param0, const FieldSystem *fieldSystem, const Pa int v12 = TrainerInfo_Gender(v0); param0->trainerData[0].class = sub_0205CA14(v12, v11, 1); - GF_strcpy(¶m0->trainerData[0].name[0], TrainerInfo_Name(param0->unk_D0[0])); + CharCode_Copy(¶m0->trainerData[0].name[0], TrainerInfo_Name(param0->unk_D0[0])); param0->trainerData[2] = param0->trainerData[0]; } else { sub_02052894(param0); @@ -570,6 +570,6 @@ BOOL BattleParams_PlayerDidNotCapture(u32 battleResult) void sub_02052894(BattleParams *param0) { param0->trainerData[0].class = TrainerInfo_Gender(param0->unk_D0[0]); - GF_strcpy(¶m0->trainerData[0].name[0], TrainerInfo_Name(param0->unk_D0[0])); + CharCode_Copy(¶m0->trainerData[0].name[0], TrainerInfo_Name(param0->unk_D0[0])); param0->trainerData[2] = param0->trainerData[0]; } diff --git a/src/unk_0206CCB0.c b/src/unk_0206CCB0.c index 9ff9f447f7..1724679c0d 100644 --- a/src/unk_0206CCB0.c +++ b/src/unk_0206CCB0.c @@ -622,7 +622,7 @@ void sub_0206D088(TVBroadcast *param0, u8 param1, const TrainerInfo *param2) v0->unk_00 = 1; v0->unk_01 = param1; - GF_strcpy(v0->unk_06, TrainerInfo_Name(param2)); + CharCode_Copy(v0->unk_06, TrainerInfo_Name(param2)); v0->unk_03 = TrainerInfo_RegionCode(param2); v0->unk_04 = TrainerInfo_GameCode(param2); @@ -827,7 +827,7 @@ static void sub_0206D3E4(FieldSystem *fieldSystem, int param1) GF_ASSERT(sizeof(UnkUnion_0206D1B8) == 40); MI_CpuClearFast(&v0, 40); - sub_020021D0(v1->unk_00, sub_0202B42C(v2, 1, 0), 10 + 1); + CharCode_CopyNumChars(v1->unk_00, sub_0202B42C(v2, 1, 0), 10 + 1); sub_0206CD70(fieldSystem, 2, param1, v1); } diff --git a/src/unk_02071D40.c b/src/unk_02071D40.c index 93c6c4daf2..a4c0873cbe 100644 --- a/src/unk_02071D40.c +++ b/src/unk_02071D40.c @@ -174,7 +174,7 @@ static void sub_02072038(const u16 param0, const u8 param1, const u16 *param2, c param7->unk_28 = param0; param7->unk_04_2 = param1; - sub_020021D0(param7->unk_08, param2, 7 + 1); + CharCode_CopyNumChars(param7->unk_08, param2, 7 + 1); param7->unk_1C = param3; param7->unk_20 = param4; diff --git a/src/unk_0207A6DC.c b/src/unk_0207A6DC.c index 3127a43f87..91353ca7ee 100644 --- a/src/unk_0207A6DC.c +++ b/src/unk_0207A6DC.c @@ -656,7 +656,7 @@ static void sub_0207ADD4(TrainerInfo *param0, UnkStruct_02027F8C *param1, UnkStr { int v0; - GF_strcpy(param2->unk_00, TrainerInfo_Name(param0)); + CharCode_Copy(param2->unk_00, TrainerInfo_Name(param0)); param2->unk_10 = TrainerInfo_ID(param0); param2->unk_14 = TrainerInfo_RegionCode(param0); diff --git a/src/unk_0208694C.c b/src/unk_0208694C.c index 082f4d1d06..0542eca49c 100644 --- a/src/unk_0208694C.c +++ b/src/unk_0208694C.c @@ -1127,11 +1127,11 @@ static int sub_02086F3C(OverlayManager *param0, int *param1) Heap_FreeToHeap(v4); } - if ((v0->unk_158 == 0) || (GF_strcmp(v0->unk_D8, v0->unk_118) == 0) || sub_02086F14(v0->unk_D8)) { + if ((v0->unk_158 == 0) || (CharCode_Compare(v0->unk_D8, v0->unk_118) == 0) || sub_02086F14(v0->unk_D8)) { sub_02086E6C(v0, v1); } else { - GF_strcpy(v0->unk_118, v0->unk_D8); - GF_strcpy(v1->unk_1C, v0->unk_D8); + CharCode_Copy(v0->unk_118, v0->unk_D8); + CharCode_Copy(v1->unk_1C, v0->unk_D8); Strbuf_CopyChars(v1->unk_18, v0->unk_D8); } @@ -1413,7 +1413,7 @@ static void sub_0208737C(UnkStruct_02087A10 *param0, OverlayManager *param1) param0->unk_178 = MessageUtil_ExpandedStrbuf(param0->unk_168, param0->unk_16C, Unk_020F2850[param0->unk_00], 18); param0->unk_17C = MessageUtil_ExpandedStrbuf(param0->unk_168, param0->unk_16C, 8, 18); param0->unk_184 = MessageLoader_GetNewStrbuf(param0->unk_16C, 7); - param0->unk_158 = GF_strlen(param0->unk_118); + param0->unk_158 = CharCode_Length(param0->unk_118); param0->unk_1C.unk_00 = 0; param0->unk_1C.unk_04 = 1; param0->unk_1C.unk_08 = -1; @@ -1863,7 +1863,7 @@ static void sub_02087FC0(UnkStruct_02087A10 *param0, OverlayManager *param1, NAR UnkStruct_0208737C *v1 = (UnkStruct_0208737C *)OverlayManager_Args(param1); if (param0->unk_118[0] != 0xffff) { - GF_strcpy(param0->unk_D8, param0->unk_118); + CharCode_Copy(param0->unk_D8, param0->unk_118); sub_02088554(¶m0->unk_41C[3], param0->unk_D8, 0, 0, 12, TEXT_SPEED_INSTANT, TEXT_COLOR(14, 15, 1), NULL); } } From d586d11aa3a79e2af9b307a3ddd48bcada95b5eb Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 25 Oct 2024 09:23:09 -0700 Subject: [PATCH 3/4] Document and clean up charcode_util.c --- include/charcode_util.h | 19 +++-- include/constants/charcode.h | 6 ++ src/charcode_util.c | 159 +++++++++++++++++------------------ 3 files changed, 96 insertions(+), 88 deletions(-) diff --git a/include/charcode_util.h b/include/charcode_util.h index 72ccc7e0db..2976a5c149 100644 --- a/include/charcode_util.h +++ b/include/charcode_util.h @@ -1,13 +1,16 @@ #ifndef POKEPLATINUM_CHARCODE_UTIL_H #define POKEPLATINUM_CHARCODE_UTIL_H -u16 *CharCode_Copy(u16 *param0, const u16 *param1); -u16 *CharCode_CopyNumChars(u16 *param0, const u16 *param1, u32 param2); -u32 CharCode_Length(const u16 *param0); -BOOL CharCode_Compare(const u16 *param0, const u16 *param1); -BOOL CharCode_CompareNumChars(const u16 *param0, const u16 *param1, u32 param2); -u16 *CharCode_FillWith(u16 *param0, u16 param1, u32 param2); -u16 *CharCode_FillWithEOS(u16 *param0, u32 param1); -u16 *CharCode_FromInt(u16 *param0, s32 param1, u32 param2, u32 param3); +#include "charcode.h" +#include "strbuf.h" + +charcode_t *CharCode_Copy(charcode_t *dst, const charcode_t *src); +charcode_t *CharCode_CopyNumChars(charcode_t *dst, const charcode_t *src, u32 num); +u32 CharCode_Length(const charcode_t *str); +BOOL CharCode_Compare(const charcode_t *str1, const charcode_t *str2); +BOOL CharCode_CompareNumChars(const charcode_t *str1, const charcode_t *str2, u32 num); +charcode_t *CharCode_FillWith(charcode_t *str, charcode_t fill, u32 num); +charcode_t *CharCode_FillWithEOS(charcode_t *str, u32 num); +charcode_t *CharCode_FromInt(charcode_t *str, s32 i, enum PaddingMode paddingMode, u32 digits); #endif // POKEPLATINUM_CHARCODE_UTIL_H diff --git a/include/constants/charcode.h b/include/constants/charcode.h index 4762691da9..a9e94c655d 100644 --- a/include/constants/charcode.h +++ b/include/constants/charcode.h @@ -15,6 +15,12 @@ enum { CHAR_JP_7, CHAR_JP_8, CHAR_JP_9, + CHAR_JP_A, + CHAR_JP_B, + CHAR_JP_C, + CHAR_JP_D, + CHAR_JP_E, + CHAR_JP_F, CHAR_JP_QUESTION = 0x00E2, diff --git a/src/charcode_util.c b/src/charcode_util.c index e6d2e7c121..86ccf5f9fb 100644 --- a/src/charcode_util.c +++ b/src/charcode_util.c @@ -3,26 +3,30 @@ #include #include -static const u16 Unk_020E4C88[] = { - 0xA2, - 0xA3, - 0xA4, - 0xA5, - 0xA6, - 0xA7, - 0xA8, - 0xA9, - 0xAA, - 0xAB, - 0xAC, - 0xAD, - 0xAE, - 0xaf, - 0xB0, - 0xB1 +#include "constants/charcode.h" + +#include "charcode.h" + +static const charcode_t sHexadecimalDigits[] = { + CHAR_JP_0, + CHAR_JP_1, + CHAR_JP_2, + CHAR_JP_3, + CHAR_JP_4, + CHAR_JP_5, + CHAR_JP_6, + CHAR_JP_7, + CHAR_JP_8, + CHAR_JP_9, + CHAR_JP_A, + CHAR_JP_B, + CHAR_JP_C, + CHAR_JP_D, + CHAR_JP_E, + CHAR_JP_F, }; -static const int Unk_020E4CA8[] = { +static const int sPowersOfTen[] = { 1, 10, 100, @@ -35,115 +39,110 @@ static const int Unk_020E4CA8[] = { 1000000000, }; -u16 *CharCode_Copy(u16 *param0, const u16 *param1) +charcode_t *CharCode_Copy(charcode_t *dst, const charcode_t *src) { - while (*param1 != 0xffff) { - *param0 = *param1; - param0++; - param1++; + while (*src != CHAR_EOS) { + *dst = *src; + dst++; + src++; } - *param0 = 0xffff; - return param0; + *dst = 0xffff; + return dst; } -u16 *CharCode_CopyNumChars(u16 *param0, const u16 *param1, u32 param2) +charcode_t *CharCode_CopyNumChars(charcode_t *dst, const charcode_t *src, u32 num) { - u32 v0; - - for (v0 = 0; v0 < param2; v0++) { - param0[v0] = param1[v0]; + for (int i = 0; i < num; i++) { + dst[i] = src[i]; } - return ¶m0[param2]; + return &dst[num]; } -u32 CharCode_Length(const u16 *param0) +u32 CharCode_Length(const charcode_t *str) { - u32 v0 = 0; - - while (param0[v0] != 0xffff) { - v0++; + u32 i = 0; + while (str[i] != CHAR_EOS) { + i++; } - return v0; + return i; } -BOOL CharCode_Compare(const u16 *param0, const u16 *param1) +int CharCode_Compare(const charcode_t *str1, const charcode_t *str2) { - while (*param0 == *param1) { - if (*param0 == 0xffff) { + while (*str1 == *str2) { + if (*str1 == CHAR_EOS) { return 0; } - param0++; - param1++; + str1++; + str2++; } return 1; } -BOOL CharCode_CompareNumChars(const u16 *param0, const u16 *param1, u32 param2) +int CharCode_CompareNumChars(const charcode_t *str1, const charcode_t *str2, u32 num) { - while (*param0 == *param1) { - if (param2 == 0) { + while (*str1 == *str2) { + if (num == 0) { return 0; } - if ((*param0 == 0xffff) && (*param1 == 0xffff)) { + if (*str1 == CHAR_EOS && *str2 == CHAR_EOS) { return 0; } - param2--; - param0++; - param1++; + num--; + str1++; + str2++; } return 1; } -u16 *CharCode_FillWith(u16 *param0, u16 param1, u32 param2) +charcode_t *CharCode_FillWith(charcode_t *str, charcode_t fill, u32 num) { - u32 v0; - - for (v0 = 0; v0 < param2; v0++) { - param0[v0] = param1; + int i; + for (i = 0; i < num; i++) { + str[i] = fill; } - return ¶m0[v0]; + return &str[i]; } -u16 *CharCode_FillWithEOS(u16 *param0, u32 param1) +charcode_t *CharCode_FillWithEOS(charcode_t *str, u32 num) { - return CharCode_FillWith(param0, 0xffff, param1); + return CharCode_FillWith(str, CHAR_EOS, num); } -u16 *CharCode_FromInt(u16 *param0, s32 param1, u32 param2, u32 param3) +charcode_t *CharCode_FromInt(charcode_t *str, s32 i, enum PaddingMode paddingMode, u32 digits) { - u32 v0; - u32 v1; - u32 v2; - - for (v0 = Unk_020E4CA8[param3 - 1]; v0 > 0; v0 /= 10) { - v2 = (u16)(param1 / v0); - v1 = (u32)(param1 - (v0 * v2)); - - if (param2 == 2) { - *param0 = (u16)(v2 >= 10 ? 0xe2 : Unk_020E4C88[v2]); - param0++; - } else if ((v2 != 0) || (v0 == 1)) { - param2 = 2; - *param0 = (u16)(v2 >= 10 ? 0xe2 : Unk_020E4C88[v2]); - param0++; - } else if (param2 == 1) { - *param0 = 0x1; - param0++; + u32 j; + u32 diff; + u16 digit; + + for (j = sPowersOfTen[digits - 1]; j > 0; j /= 10) { + digit = i / j; + diff = i - (j * digit); + + if (paddingMode == PADDING_MODE_ZEROES) { + *str = digit >= 10 ? CHAR_JP_QUESTION : sHexadecimalDigits[digit]; + str++; + } else if (digit != 0 || j == 1) { + paddingMode = PADDING_MODE_ZEROES; + *str = digit >= 10 ? CHAR_JP_QUESTION : sHexadecimalDigits[digit]; + str++; + } else if (paddingMode == PADDING_MODE_SPACES) { + *str = CHAR_JP_SPACE; + str++; } - param1 = v1; + i = diff; } - *param0 = 0xffff; - - return param0; + *str = CHAR_EOS; + return str; } From 7154f2d0bb529179ea68d23aeceb59dca2242311 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 25 Oct 2024 09:34:58 -0700 Subject: [PATCH 4/4] Tag gGameVersion and gGameLanguage --- include/constdata/const_020E4C40.h | 6 ------ include/constdata/const_020E4C44.h | 6 ------ include/global/pm_version.h | 4 ++-- src/battle/battle_script.c | 2 +- src/game_version.c | 4 ++-- src/map_header.c | 2 +- src/overlay066/ov66_0223177C.c | 34 +++++++++++++++--------------- src/overlay069/ov69_0225C700.c | 2 +- src/overlay073/ov73_021D0D80.c | 8 +++---- src/overlay092/ov92_021D0D80.c | 2 +- src/overlay097/ov97_0222AE60.c | 4 +--- src/overlay097/ov97_0222D30C.c | 2 +- src/overlay097/ov97_02236380.c | 2 +- src/overlay104/ov104_0222DCE0.c | 2 +- src/overlay104/ov104_0223A0C4.c | 2 +- src/pokemon.c | 6 +++--- src/unk_02028124.c | 4 ++-- src/unk_020298BC.c | 2 +- src/unk_020474B8.c | 2 +- src/unk_0204AEE8.c | 2 +- src/unk_02073700.c | 4 ++-- 21 files changed, 44 insertions(+), 58 deletions(-) delete mode 100644 include/constdata/const_020E4C40.h delete mode 100644 include/constdata/const_020E4C44.h diff --git a/include/constdata/const_020E4C40.h b/include/constdata/const_020E4C40.h deleted file mode 100644 index 0653f440cf..0000000000 --- a/include/constdata/const_020E4C40.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_CONST_020E4C40_H -#define POKEPLATINUM_CONST_020E4C40_H - -extern const u8 Unk_020E4C40; - -#endif // POKEPLATINUM_CONST_020E4C40_H diff --git a/include/constdata/const_020E4C44.h b/include/constdata/const_020E4C44.h deleted file mode 100644 index 7de18c90b8..0000000000 --- a/include/constdata/const_020E4C44.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_CONST_020E4C44_H -#define POKEPLATINUM_CONST_020E4C44_H - -extern const u8 Unk_020E4C44; - -#endif // POKEPLATINUM_CONST_020E4C44_H diff --git a/include/global/pm_version.h b/include/global/pm_version.h index 0558ffa852..87eb3641a8 100644 --- a/include/global/pm_version.h +++ b/include/global/pm_version.h @@ -21,7 +21,7 @@ #define SPANISH 7 #define KOREAN 8 -extern const u8 Unk_020E4C40; -extern const u8 Unk_020E4C44; +extern const u8 gGameVersion; +extern const u8 gGameLanguage; #endif // POKEPLATINUM_PM_VERSION_H diff --git a/src/battle/battle_script.c b/src/battle/battle_script.c index d0a6805685..4f1e613e57 100644 --- a/src/battle/battle_script.c +++ b/src/battle/battle_script.c @@ -9989,7 +9989,7 @@ static void BattleScript_GetExpTask(SysTask *task, void *inData) } if (BattleSystem_PokemonIsOT(data->battleSys, mon) == FALSE) { - if (Pokemon_GetValue(mon, MON_DATA_LANGUAGE, NULL) != Unk_020E4C44) { + if (Pokemon_GetValue(mon, MON_DATA_LANGUAGE, NULL) != gGameLanguage) { totalExp = totalExp * 170 / 100; } else { totalExp = totalExp * 150 / 100; diff --git a/src/game_version.c b/src/game_version.c index a20128c18b..feea1295c5 100644 --- a/src/game_version.c +++ b/src/game_version.c @@ -1,2 +1,2 @@ -const u8 Unk_020E4C40 = GAME_VERSION; -const u8 Unk_020E4C44 = GAME_LANGUAGE; +const u8 gGameVersion = GAME_VERSION; +const u8 gGameLanguage = GAME_LANGUAGE; diff --git a/src/map_header.c b/src/map_header.c index 2d2326004a..2cb729d447 100644 --- a/src/map_header.c +++ b/src/map_header.c @@ -35,7 +35,7 @@ const u16 MapHeader_GetMapMatrixID(u32 headerID) mapMatrixID = sMapHeaders[headerID].mapMatrixID; if (mapMatrixID == 22) { - if (Unk_020E4C40 == 11) { + if (gGameVersion == 11) { mapMatrixID = 23; } } diff --git a/src/overlay066/ov66_0223177C.c b/src/overlay066/ov66_0223177C.c index 8f5e20f332..d8dc496095 100644 --- a/src/overlay066/ov66_0223177C.c +++ b/src/overlay066/ov66_0223177C.c @@ -736,8 +736,8 @@ static BOOL ov66_02232068(UnkStruct_ov66_02231FB0 *param0, const UnkStruct_ov66_ { Strbuf *v0; - StringTemplate_SetStrbuf(param2, 0, param0->unk_10[0], 0, 1, Unk_020E4C44); - StringTemplate_SetStrbuf(param2, 1, param0->unk_10[1], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, 0, param0->unk_10[0], 0, 1, gGameLanguage); + StringTemplate_SetStrbuf(param2, 1, param0->unk_10[1], 0, 1, gGameLanguage); v0 = MessageLoader_GetNewStrbuf(param3, 7); @@ -751,8 +751,8 @@ static BOOL ov66_022320BC(UnkStruct_ov66_02231FB0 *param0, const UnkStruct_ov66_ { Strbuf *v0; - StringTemplate_SetStrbuf(param2, 0, param0->unk_10[0], 0, 1, Unk_020E4C44); - StringTemplate_SetStrbuf(param2, 1, param0->unk_10[1], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, 0, param0->unk_10[0], 0, 1, gGameLanguage); + StringTemplate_SetStrbuf(param2, 1, param0->unk_10[1], 0, 1, gGameLanguage); StringTemplate_SetPlazaItemName(param2, 2, param0->unk_04[0]); v0 = MessageLoader_GetNewStrbuf(param3, 8); @@ -774,21 +774,21 @@ static BOOL ov66_0223211C(UnkStruct_ov66_02231FB0 *param0, const UnkStruct_ov66_ switch (param0->unk_04[1]) { case 3: - StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, Unk_020E4C44); - StringTemplate_SetStrbuf(param2, 2, param0->unk_10[1], 0, 1, Unk_020E4C44); - StringTemplate_SetStrbuf(param2, 3, param0->unk_10[2], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, gGameLanguage); + StringTemplate_SetStrbuf(param2, 2, param0->unk_10[1], 0, 1, gGameLanguage); + StringTemplate_SetStrbuf(param2, 3, param0->unk_10[2], 0, 1, gGameLanguage); v1 = 18; break; case 2: - StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, Unk_020E4C44); - StringTemplate_SetStrbuf(param2, 2, param0->unk_10[1], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, gGameLanguage); + StringTemplate_SetStrbuf(param2, 2, param0->unk_10[1], 0, 1, gGameLanguage); v1 = 19; break; case 4: - StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, Unk_020E4C44); - StringTemplate_SetStrbuf(param2, 2, param0->unk_10[1], 0, 1, Unk_020E4C44); - StringTemplate_SetStrbuf(param2, 3, param0->unk_10[2], 0, 1, Unk_020E4C44); - StringTemplate_SetStrbuf(param2, 4, param0->unk_10[3], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, gGameLanguage); + StringTemplate_SetStrbuf(param2, 2, param0->unk_10[1], 0, 1, gGameLanguage); + StringTemplate_SetStrbuf(param2, 3, param0->unk_10[2], 0, 1, gGameLanguage); + StringTemplate_SetStrbuf(param2, 4, param0->unk_10[3], 0, 1, gGameLanguage); v1 = 6; break; default: @@ -797,7 +797,7 @@ static BOOL ov66_0223211C(UnkStruct_ov66_02231FB0 *param0, const UnkStruct_ov66_ v0 = MessageLoader_GetNewStrbuf(param3, v1); } else { - StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, gGameLanguage); StringTemplate_SetNumber(param2, 2, 4 - param0->unk_04[1], 1, 1, 1); v0 = MessageLoader_GetNewStrbuf(param3, 5); @@ -814,7 +814,7 @@ static BOOL ov66_02232258(UnkStruct_ov66_02231FB0 *param0, const UnkStruct_ov66_ Strbuf *v0; StringTemplate_SetPlazaMinigameName(param2, 0, param0->unk_04[0]); - StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, 1, param0->unk_10[0], 0, 1, gGameLanguage); StringTemplate_SetNumber(param2, 2, 8 - param0->unk_04[1], 1, 1, 1); v0 = MessageLoader_GetNewStrbuf(param3, 9); @@ -832,7 +832,7 @@ static BOOL ov66_022322B8(UnkStruct_ov66_02231FB0 *param0, const UnkStruct_ov66_ u32 v2; for (v1 = 0; v1 < param0->unk_04[0]; v1++) { - StringTemplate_SetStrbuf(param2, v1, param0->unk_10[v1], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, v1, param0->unk_10[v1], 0, 1, gGameLanguage); } if (param0->unk_00 == 4) { @@ -924,7 +924,7 @@ static BOOL ov66_022323C4(UnkStruct_ov66_02231FB0 *param0, const UnkStruct_ov66_ StringTemplate_SetPlazaMinigameName(param2, 0, param0->unk_04[0]); for (v2 = 0; v2 < param0->unk_04[1]; v2++) { - StringTemplate_SetStrbuf(param2, v2 + 1, param0->unk_10[v2], 0, 1, Unk_020E4C44); + StringTemplate_SetStrbuf(param2, v2 + 1, param0->unk_10[v2], 0, 1, gGameLanguage); } if ((param0->unk_04[0] == UnkEnum_ov66_022324D0_00) || (param0->unk_04[0] == UnkEnum_ov66_022324D0_01)) { diff --git a/src/overlay069/ov69_0225C700.c b/src/overlay069/ov69_0225C700.c index 254679553c..585a9aa062 100644 --- a/src/overlay069/ov69_0225C700.c +++ b/src/overlay069/ov69_0225C700.c @@ -1351,7 +1351,7 @@ static void ov69_0225D2A8(UnkStruct_ov69_0225CE64 *param0, const UnkStruct_ov66_ param0->unk_04.unk_00_1 = 0; param0->unk_04.unk_00_0 = 0; - if (Unk_020E4C44 == 1) { + if (gGameLanguage == 1) { param0->unk_04.unk_00_1 = 1; } else { param0->unk_04.unk_00_1 = 0; diff --git a/src/overlay073/ov73_021D0D80.c b/src/overlay073/ov73_021D0D80.c index 1502ad95ca..047f20876b 100644 --- a/src/overlay073/ov73_021D0D80.c +++ b/src/overlay073/ov73_021D0D80.c @@ -770,7 +770,7 @@ static BOOL ov73_021D1648(UnkStruct_ov73_021D1058 *param0, int param1, int param case 2: v2 = &Unk_ov72_021D37CC; - if ((Unk_020E4C40 == 10) || (GAME_VERSION == 12)) { + if ((gGameVersion == 10) || (GAME_VERSION == 12)) { v3 = Unk_ov72_021D3954; v5 = NELEMS(Unk_ov72_021D3954); } else { @@ -912,10 +912,10 @@ static void ov73_021D1930(UnkStruct_ov73_021D1058 *param0) { int v0, v1; - if (Unk_020E4C40 == 12) { + if (gGameVersion == 12) { v0 = 3; v1 = 27; - } else if (Unk_020E4C40 == 10) { + } else if (gGameVersion == 10) { v0 = 1; v1 = 25; } else { @@ -2107,7 +2107,7 @@ static BOOL ov73_021D2318(UnkStruct_ov73_021D1058 *param0) case 5: { u32 v9; - if ((Unk_020E4C40 == 10) || (GAME_VERSION == 12)) { + if ((gGameVersion == 10) || (GAME_VERSION == 12)) { v9 = Unk_ov72_021D3954[param0->unk_48 - 1].unk_00; } else { v9 = Unk_ov73_021D1648[param0->unk_48 - 1].unk_00; diff --git a/src/overlay092/ov92_021D0D80.c b/src/overlay092/ov92_021D0D80.c index ae32ff3cd2..2e0c2c7716 100644 --- a/src/overlay092/ov92_021D0D80.c +++ b/src/overlay092/ov92_021D0D80.c @@ -322,7 +322,7 @@ int ov92_021D0D80(OverlayManager *param0, int *param1) memset(v0, 0, sizeof(UnkStruct_ov92_021D1B24)); v0->unk_00 = v1; - if (Unk_020E4C44 == 1) { + if (gGameLanguage == 1) { v0->unk_BAF0 = 1; } else { v0->unk_BAF0 = 0; diff --git a/src/overlay097/ov97_0222AE60.c b/src/overlay097/ov97_0222AE60.c index 73635c55f1..530b72aa2d 100644 --- a/src/overlay097/ov97_0222AE60.c +++ b/src/overlay097/ov97_0222AE60.c @@ -48,8 +48,6 @@ #include "unk_020366A0.h" #include "unk_0209A74C.h" -#include "constdata/const_020E4C44.h" - FS_EXTERN_OVERLAY(overlay57); FS_EXTERN_OVERLAY(overlay77); FS_EXTERN_OVERLAY(overlay97); @@ -245,7 +243,7 @@ static void ov97_0222AF1C(UnkStruct_0222AE60 *param0) return; } - if (ov97_02235DBC() != Unk_020E4C44) { + if (ov97_02235DBC() != gGameLanguage) { return; } diff --git a/src/overlay097/ov97_0222D30C.c b/src/overlay097/ov97_0222D30C.c index e19c62601d..4b022484a8 100644 --- a/src/overlay097/ov97_0222D30C.c +++ b/src/overlay097/ov97_0222D30C.c @@ -1098,7 +1098,7 @@ static int ov97_0222E2DC(OverlayManager *param0, int *param1) if (ov97_02237624()) { v0->unk_1638 = 2; - sub_02017B70(Unk_020E4C40); + sub_02017B70(gGameVersion); ov97_02238400(1); } diff --git a/src/overlay097/ov97_02236380.c b/src/overlay097/ov97_02236380.c index 7e27f17914..b0dbadb663 100644 --- a/src/overlay097/ov97_02236380.c +++ b/src/overlay097/ov97_02236380.c @@ -1591,7 +1591,7 @@ void BoxMonGBAToBoxMon(BoxPokemonGBA *param0, BoxPokemon *param1) BoxPokemon_SetValue(param1, 118, &v6[0]); - if (GetGBABoxMonData(param0, 3, NULL) != Unk_020E4C44) { + if (GetGBABoxMonData(param0, 3, NULL) != gGameLanguage) { v1 = 1; BoxPokemon_SetValue(param1, 77, &v1); } diff --git a/src/overlay104/ov104_0222DCE0.c b/src/overlay104/ov104_0222DCE0.c index 955bc6cb14..ceeb62cbeb 100644 --- a/src/overlay104/ov104_0222DCE0.c +++ b/src/overlay104/ov104_0222DCE0.c @@ -229,7 +229,7 @@ u32 ov104_0222DD6C(UnkStruct_ov104_0223A348_sub2 *param0, u16 param1, u32 param2 } param0->unk_1E_val2 = 0; - param0->unk_1F = Unk_020E4C44; + param0->unk_1F = gGameLanguage; v0 = PokemonPersonalData_GetSpeciesValue(param0->unk_00_val1_0, 25); diff --git a/src/overlay104/ov104_0223A0C4.c b/src/overlay104/ov104_0223A0C4.c index 1ad20b47ae..b01ae4537a 100644 --- a/src/overlay104/ov104_0223A0C4.c +++ b/src/overlay104/ov104_0223A0C4.c @@ -881,7 +881,7 @@ static u32 ov104_0223A3A8(UnkStruct_0204AFC4 *param0, UnkStruct_ov104_0223A348_s } param1->unk_1E_val2 = 0; - param1->unk_1F = Unk_020E4C44; + param1->unk_1F = gGameLanguage; v0 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 25); diff --git a/src/pokemon.c b/src/pokemon.c index e8c515434f..0c8b5dfd5e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -280,7 +280,7 @@ static void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int m } BoxPokemon_SetValue(boxMon, MON_DATA_OT_ID, &monOTID); - BoxPokemon_SetValue(boxMon, MON_DATA_LANGUAGE, &Unk_020E4C44); + BoxPokemon_SetValue(boxMon, MON_DATA_LANGUAGE, &gGameLanguage); BoxPokemon_SetValue(boxMon, MON_DATA_SPECIES, &monSpecies); BoxPokemon_SetValue(boxMon, MON_DATA_SPECIES_NAME, NULL); @@ -293,7 +293,7 @@ static void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int m BoxPokemon_SetValue(boxMon, MON_DATA_FRIENDSHIP, &v1); BoxPokemon_SetValue(boxMon, MON_DATA_MET_LEVEL, &monLevel); - BoxPokemon_SetValue(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); + BoxPokemon_SetValue(boxMon, MON_DATA_MET_GAME, &gGameVersion); v1 = ITEM_POKE_BALL; BoxPokemon_SetValue(boxMon, MON_DATA_POKEBALL, &v1); @@ -4401,7 +4401,7 @@ void Pokemon_SetCatchData(Pokemon *mon, TrainerInfo *param1, int monPokeball, in static void InitializeBoxPokemonAfterCapture(BoxPokemon *boxMon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5) { UpdateBoxMonStatusAndTrainerInfo(boxMon, param1, 0, param3, param5); - BoxPokemon_SetValue(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); + BoxPokemon_SetValue(boxMon, MON_DATA_MET_GAME, &gGameVersion); BoxPokemon_SetValue(boxMon, MON_DATA_POKEBALL, &monPokeball); BoxPokemon_SetValue(boxMon, MON_DATA_MET_TERRAIN, ¶m4); } diff --git a/src/unk_02028124.c b/src/unk_02028124.c index d2c2157844..d98bf63d2b 100644 --- a/src/unk_02028124.c +++ b/src/unk_02028124.c @@ -45,8 +45,8 @@ void sub_02028124(UnkStruct_0202818C *param0) param0->unk_00 = 0; param0->unk_04 = 0; - param0->unk_05 = Unk_020E4C44; - param0->unk_06 = Unk_020E4C40; + param0->unk_05 = gGameLanguage; + param0->unk_06 = gGameVersion; param0->unk_07 = 0xFFFF; CharCode_FillWithEOS(param0->unk_08, 8); diff --git a/src/unk_020298BC.c b/src/unk_020298BC.c index aa9427567d..8c34f909ee 100644 --- a/src/unk_020298BC.c +++ b/src/unk_020298BC.c @@ -563,7 +563,7 @@ void sub_02029F5C(UnkStruct_02029C68 *param0) GF_ASSERT(inline_02029CA8(param0)); param0->unk_00 = 0x2345; - param0->unk_71 = Unk_020E4C44; + param0->unk_71 = gGameLanguage; } void sub_02029F84(UnkStruct_02029C68 *param0) diff --git a/src/unk_020474B8.c b/src/unk_020474B8.c index 5c770657c4..49c684e5e3 100644 --- a/src/unk_020474B8.c +++ b/src/unk_020474B8.c @@ -413,7 +413,7 @@ BOOL ScrCmd_272(ScriptContext *param0) v0 = Strbuf_Init(10 + 1, 11); Strbuf_CopyChars(v0, MiscSaveBlock_TabletName(SaveData_MiscSaveBlock(param0->fieldSystem->saveData))); - StringTemplate_SetStrbuf(*v2, v3, v0, 0, 0, Unk_020E4C44); + StringTemplate_SetStrbuf(*v2, v3, v0, 0, 0, gGameLanguage); Strbuf_Free(v0); return 0; diff --git a/src/unk_0204AEE8.c b/src/unk_0204AEE8.c index f49103a856..2fffd60d64 100644 --- a/src/unk_0204AEE8.c +++ b/src/unk_0204AEE8.c @@ -377,7 +377,7 @@ static u32 sub_0204B1E8(UnkStruct_0204AFC4 *param0, UnkStruct_ov104_0223A348_sub } param1->unk_1E_val2 = 0; - param1->unk_1F = Unk_020E4C44; + param1->unk_1F = gGameLanguage; v0 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 25); diff --git a/src/unk_02073700.c b/src/unk_02073700.c index fd6604f844..ac7d2d86fb 100644 --- a/src/unk_02073700.c +++ b/src/unk_02073700.c @@ -27,8 +27,8 @@ void sub_02073700(SaveData *param0, int param1, UnkStruct_ov96_0223B450_sub1 *pa MI_CpuCopy8(TrainerInfo_Name(v1), param2->unk_A8, 8 * 2); *((u32 *)param2->unk_BC) = TrainerInfo_ID(v1); - param2->unk_B8 = Unk_020E4C40; - param2->unk_B9 = Unk_020E4C44; + param2->unk_B8 = gGameVersion; + param2->unk_B9 = gGameLanguage; param2->unk_BA = (u8)sub_0202C8C0(v2); param2->unk_BB = (u8)sub_0202C8C4(v2); param2->unk_C8_val1_1 = TrainerInfo_Gender(v1);