From 962728ce4490dd3209a62dbb31b9625b794bbca7 Mon Sep 17 00:00:00 2001 From: hev7 <143887945+hev7@users.noreply.github.com> Date: Sat, 18 Oct 2025 00:46:07 +0100 Subject: [PATCH] d_name work for PAL (#2742) * d_name work for PAL * Fix regressions --- config/GZ2P01/symbols.txt | 10 +- configure.py | 30 ++--- src/d/actor/d_a_horse.cpp | 9 +- src/d/actor/d_a_npc_kn.cpp | 8 +- src/d/d_msg_class.cpp | 74 ++++++++++ src/d/d_msg_object.cpp | 19 +++ src/d/d_msg_unit.cpp | 8 +- src/d/d_name.cpp | 267 ++++++++++++++++++++++++++++++++++++- 8 files changed, 391 insertions(+), 34 deletions(-) diff --git a/config/GZ2P01/symbols.txt b/config/GZ2P01/symbols.txt index 3a9e9c6908b..b693df47006 100644 --- a/config/GZ2P01/symbols.txt +++ b/config/GZ2P01/symbols.txt @@ -8995,8 +8995,8 @@ isOutfontKanjiCode__Fi = .text:0x80228B6C; // type:function size:0x54 scope:glob getFontCCColorTable__FUcUc = .text:0x80228BC0; // type:function size:0xAC scope:global align:4 getFontGCColorTable__FUcUc = .text:0x80228C6C; // type:function size:0xAC scope:global align:4 getOutFontNumberType__Fi = .text:0x80228D18; // type:function size:0x78 scope:global align:4 -setPlayerName__FPcUc = .text:0x80228D90; // type:function size:0xC8 scope:global align:4 -setHorseName__FPcUc = .text:0x80228E58; // type:function size:0xC8 scope:global align:4 +setPlayerName__FPcUc = .text:0x80228D90; // type:function size:0xC8 scope:local align:4 +setHorseName__FPcUc = .text:0x80228E58; // type:function size:0xC8 scope:local align:4 getPohNum__Fv = .text:0x80228F20; // type:function size:0x38 scope:global align:4 __ct__19jmessage_tReferenceFv = .text:0x80228F58; // type:function size:0x1B0 scope:global align:4 __dt__19jmessage_tReferenceFv = .text:0x80229108; // type:function size:0x74 scope:global align:4 @@ -21839,9 +21839,9 @@ lbl_80452E08 = .sbss:0x80452E08; // type:object size:0x1 data:byte lbl_80452E09 = .sbss:0x80452E09; // type:object size:0x1 data:byte it$4206 = .sbss:0x80452E0C; // type:object size:0x4 scope:local align:4 data:4byte lbl_80452E10 = .sbss:0x80452E10; // type:object size:0x8 data:byte -lbl_80452E18 = .sbss:0x80452E18; // type:object size:0x1 data:byte +mNowStayFloorNo__10dMapInfo_c = .sbss:0x80452E18; // type:object size:0x1 data:byte mNowStayRoomNo__10dMapInfo_c = .sbss:0x80452E1C; // type:object size:0x4 scope:global align:4 data:4byte -lbl_80452E20 = .sbss:0x80452E20; // type:object size:0x1 data:byte +mNowStayFloorNoDecisionFlg__10dMapInfo_c = .sbss:0x80452E20; // type:object size:0x1 data:byte mLayerList__8dMpath_c = .sbss:0x80452E24; // type:object size:0x4 scope:global align:4 data:4byte mMinX__8dMpath_c = .sbss:0x80452E28; // type:object size:0x4 scope:global align:4 data:float mMaxX__8dMpath_c = .sbss:0x80452E2C; // type:object size:0x4 scope:global align:4 data:float @@ -26448,7 +26448,7 @@ j2dDefaultAlphaCmp = .sdata2:0x80458186; // type:object size:0x2 scope:global al @1171 = .sdata2:0x80458390; // type:object size:0x8 scope:local align:4 data:double j3dDefaultColInfo = .sdata2:0x80458398; // type:object size:0x4 scope:global align:4 data:4byte j3dDefaultAmbInfo = .sdata2:0x8045839C; // type:object size:0x4 scope:global align:4 data:4byte -data_804563C8 = .sdata2:0x804583A0; // type:object size:0x1 data:byte +j3dDefaultNumChans = .sdata2:0x804583A0; // type:object size:0x1 data:byte j3dDefaultTevOrderInfoNull = .sdata2:0x804583A4; // type:object size:0x4 scope:global align:4 data:4byte j3dDefaultIndTexOrderNull = .sdata2:0x804583A8; // type:object size:0x4 scope:global align:4 data:4byte j3dDefaultTevColor = .sdata2:0x804583AC; // type:object size:0x8 scope:global align:4 data:4byte diff --git a/configure.py b/configure.py index 9147a3d5684..dcb215aae41 100755 --- a/configure.py +++ b/configure.py @@ -688,7 +688,7 @@ config.libs = [ Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d/d_menu_calibration.cpp"), Object(NonMatching, "d/d_menu_collect.cpp"), Object(NonMatching, "d/d_menu_dmap.cpp"), - Object(Equivalent, "d/d_menu_dmap_map.cpp"), + Object(MatchingFor("GZ2E01", "GZ2P01"), "d/d_menu_dmap_map.cpp"), Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d/d_menu_map_common.cpp"), Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d/d_menu_fishing.cpp"), Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d/d_menu_fmap.cpp"), @@ -715,7 +715,7 @@ config.libs = [ Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d/d_msg_out_font.cpp"), Object(NonMatching, "d/d_msg_class.cpp"), Object(Equivalent, "d/d_msg_object.cpp"), # weak func order - Object(NonMatching, "d/d_msg_unit.cpp"), + Object(MatchingFor("GZ2P01"), "d/d_msg_unit.cpp"), Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d/d_msg_scrn_3select.cpp"), Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d/d_msg_scrn_arrow.cpp"), Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d/d_msg_scrn_base.cpp"), @@ -1684,7 +1684,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_b_ds"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_b_gg"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_b_gm"), - ActorRel(MatchingFor("GZ2E01"), "d_a_b_gnd"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_b_gnd"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_b_go"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_b_gos"), ActorRel(Equivalent, "d_a_b_mgn"), # extra mr/regalloc @@ -1704,7 +1704,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_coach_fire"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_cow"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_cstatue"), - ActorRel(Equivalent, "d_a_do"), # Z2SoundObjSimple dtor + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_do"), # Z2SoundObjSimple dtor ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_door_boss"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_door_bossL5"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_door_mbossL1"), @@ -1750,8 +1750,8 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_md"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_mf"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_mk"), - ActorRel(MatchingFor("GZ2E01"), "d_a_e_mk_bo"), - ActorRel(MatchingFor("GZ2E01"), "d_a_e_mm"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_e_mk_bo"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_e_mm"), ActorRel(NonMatching, "d_a_e_mm_mt"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_ms"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_e_nz"), @@ -1821,7 +1821,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_mirror"), ActorRel(NonMatching, "d_a_movie_player", extra_cflags=["-O3,p"]), ActorRel(Equivalent, "d_a_myna"), # weird missing function issue - ActorRel(MatchingFor("GZ2E01"), "d_a_ni"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_ni"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_aru"), ActorRel(NonMatching, "d_a_npc_ash", extra_cflags=[DANPCF_C_HACK]), ActorRel(NonMatching, "d_a_npc_ashB", extra_cflags=[DANPCF_C_HACK]), @@ -1830,7 +1830,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_bou"), ActorRel(NonMatching, "d_a_npc_bouS"), ActorRel(NonMatching, "d_a_npc_cdn3"), - ActorRel(MatchingFor("GZ2E01"), "d_a_npc_chat", extra_cflags=[DANPCF_C_HACK]), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_npc_chat", extra_cflags=[DANPCF_C_HACK]), ActorRel(NonMatching, "d_a_npc_chin"), ActorRel(NonMatching, "d_a_npc_clerka"), ActorRel(NonMatching, "d_a_npc_clerkb"), @@ -1879,7 +1879,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_moi"), ActorRel(NonMatching, "d_a_npc_moir", extra_cflags=[DANPCF_C_HACK]), ActorRel(NonMatching, "d_a_npc_myna2"), - ActorRel(MatchingFor("GZ2E01"), "d_a_npc_ne"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_npc_ne"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_p2"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_pachi_besu"), ActorRel(NonMatching, "d_a_npc_pachi_maro"), @@ -1895,8 +1895,8 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_seib"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_seic"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_seid"), - ActorRel(MatchingFor("GZ2E01"), "d_a_npc_seira"), - ActorRel(MatchingFor("GZ2E01"), "d_a_npc_seira2"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_npc_seira"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_npc_seira2"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_seirei"), ActorRel(Equivalent, "d_a_npc_shad", extra_cflags=[DANPCF_C_HACK]), # weak func order ActorRel(NonMatching, "d_a_npc_shaman"), @@ -1913,7 +1913,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_npc_tkc"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_tkj2"), ActorRel(NonMatching, "d_a_npc_tks", extra_cflags=[DANPCF_C_HACK]), - ActorRel(MatchingFor("GZ2E01"), "d_a_npc_toby"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_npc_toby"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_tr"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_uri"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_worm"), @@ -2115,11 +2115,11 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_mirror_chain"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_mirror_sand"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_mirror_screw"), - ActorRel(MatchingFor("GZ2E01"), "d_a_obj_mirror_table"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_obj_mirror_table"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_msima"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_mvstair"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_myogan"), - ActorRel(MatchingFor("GZ2E01"), "d_a_obj_nagaisu"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_obj_nagaisu"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_nan"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_ndoor"), ActorRel(NonMatching, "d_a_obj_nougu"), @@ -2138,7 +2138,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_poFire"), ActorRel(NonMatching, "d_a_obj_poTbox"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_prop"), - ActorRel(MatchingFor("GZ2E01"), "d_a_obj_pumpkin"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01"), "d_a_obj_pumpkin"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_rcircle"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_rfHole"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_rgate"), diff --git a/src/d/actor/d_a_horse.cpp b/src/d/actor/d_a_horse.cpp index b90e9ff4554..c4f12697c7d 100644 --- a/src/d/actor/d_a_horse.cpp +++ b/src/d/actor/d_a_horse.cpp @@ -3390,13 +3390,12 @@ int daHorse_c::setHorsePosAndAngleSubstance(cXyz const* param_0, s16 param_1) { mDoMtx_stack_c::transM(-sp10.x, -sp10.y, -sp10.z); mDoMtx_stack_c::multVec(&field_0x17a0, &field_0x17a0); - daHorseRein_c* m_rein = m_rein; - for (i = 0; i < 3; i++) { - cXyz* var_r28 = m_rein->field_0x0[0]; - for (j = 0; j < m_rein->field_0x8[1]; j++, var_r28++) { + daHorseRein_c* rein_p = m_rein; + for (i = 0; i < 3; i++, rein_p++) { + cXyz* var_r28 = rein_p->field_0x0[0]; + for (j = 0; j < rein_p->field_0x8[1]; j++, var_r28++) { mDoMtx_stack_c::multVec(var_r28, var_r28); } - m_rein++; } } diff --git a/src/d/actor/d_a_npc_kn.cpp b/src/d/actor/d_a_npc_kn.cpp index 2e404a05c78..ec303aa62aa 100644 --- a/src/d/actor/d_a_npc_kn.cpp +++ b/src/d/actor/d_a_npc_kn.cpp @@ -2340,7 +2340,6 @@ static void* s_subEnd6(void* i_actor, void* i_other) { /* 80A2FC80-80A30398 005360 0718+00 1/0 0/0 0/0 .text teach06_superJumpWait__10daNpc_Kn_cFPv */ int daNpc_Kn_c::teach06_superJumpWait(void* param_0) { - // NONMATCHING - value comparison not getting optimized switch (mMode) { case 0: case 1: @@ -2427,7 +2426,7 @@ int daNpc_Kn_c::teach06_superJumpWait(void* param_0) { } } else { if (field_0x15bd == 2 && - (cut_type != daPy_py_c::CUT_TYPE_LARGE_JUMP && cut_type != daPy_py_c::CUT_TYPE_LARGE_JUMP_FINISH)) + !(cut_type == daPy_py_c::CUT_TYPE_LARGE_JUMP || cut_type == daPy_py_c::CUT_TYPE_LARGE_JUMP_FINISH)) { mEvtNo = 22; fpcM_Search(s_subEnd6, this); @@ -2765,7 +2764,6 @@ static void* s_subEnd7(void* i_actor, void* i_other) { /* 80A31028-80A315D0 006708 05A8+00 1/0 0/0 0/0 .text teach07_superTurnAttackWait__10daNpc_Kn_cFPv */ -// NONMATCHING - value comparison not getting optimized int daNpc_Kn_c::teach07_superTurnAttackWait(void* param_0) { switch (mMode) { case 0: @@ -2837,7 +2835,9 @@ int daNpc_Kn_c::teach07_superTurnAttackWait(void* param_0) { mSound.startCollisionSE(Z2SE_HIT_SWORD, 0x28); } } - } else if (field_0x15bd == 2 && cut_type != daPy_py_c::CUT_TYPE_LARGE_TURN_LEFT && cut_type != daPy_py_c::CUT_TYPE_LARGE_TURN_RIGHT) { + } else if (field_0x15bd == 2 && + !(cut_type == daPy_py_c::CUT_TYPE_LARGE_TURN_LEFT || cut_type == daPy_py_c::CUT_TYPE_LARGE_TURN_RIGHT)) + { mEvtNo = 0x19; fpcM_Search(s_subEnd7, this); break; diff --git a/src/d/d_msg_class.cpp b/src/d/d_msg_class.cpp index 877edc58ef5..3a27ceddaef 100644 --- a/src/d/d_msg_class.cpp +++ b/src/d/d_msg_class.cpp @@ -290,6 +290,38 @@ static u8 getOutFontNumberType(int param_0) { } } +#if VERSION == VERSION_GCN_PAL +static void setPlayerName(char* i_player_name, u8 param_2) { + if (param_2 != 0) { + strcpy(i_player_name, dComIfGs_getPlayerName()); + u32 name_length = strlen(i_player_name); + char last = i_player_name[name_length - 1]; + if (last == 0x73 || last == 0x53 || last == 0x7a || last == 0x5a || last == 0x78 || last == 0x58 || last == 0xdf) { + strcat(i_player_name, "'"); + } else { + strcat(i_player_name, "s"); + } + } else { + strcpy(i_player_name, dComIfGs_getPlayerName()); + } +} + +static void setHorseName(char* i_horse_name, u8 param_2) { + if (param_2 != 0) { + strcpy(i_horse_name, dComIfGs_getHorseName()); + u32 name_length = strlen(i_horse_name); + char last = i_horse_name[name_length - 1]; + if (last == 0x73 || last == 0x53 || last == 0x7a || last == 0x5a || last == 0x78 || last == 0x58 || last == 0xdf) { + strcat(i_horse_name, "'"); + } else { + strcat(i_horse_name, "s"); + } + } else { + strcpy(i_horse_name, dComIfGs_getHorseName()); + } +} +#endif + /* 80228ACC-80228B04 22340C 0038+00 3/3 0/0 0/0 .text getPohNum__Fv */ static u8 getPohNum() { u8 num = 0; @@ -1472,9 +1504,23 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz char buffer[40]; switch (i_tag & 0xFF00FFFF) { case MSGTAG_PLAYER_GENITIV: + #if VERSION == VERSION_GCN_PAL + if (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_GERMAN) { + setPlayerName(buffer, 1); + } else { + setPlayerName(buffer, 0); + } + #endif push_word(buffer); return true; case MSGTAG_HORSE_GENITIV: + #if VERSION == VERSION_GCN_PAL + if (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_GERMAN) { + setHorseName(buffer, 1); + } else { + setHorseName(buffer, 0); + } + #endif push_word(buffer); return true; case MSGTAG_MALE_ICON: @@ -4232,10 +4278,24 @@ bool jmessage_string_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u3 char buffer[40]; switch (i_tag & 0xFF00FFFF) { case MSGTAG_PLAYER_GENITIV: + #if VERSION == VERSION_GCN_PAL + if (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_GERMAN) { + setPlayerName(buffer, 1); + } else { + setPlayerName(buffer, 0); + } + #endif // @bug buffer is uninitialized stack_pushCurrent(buffer); break; case MSGTAG_HORSE_GENITIV: + #if VERSION == VERSION_GCN_PAL + if (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_GERMAN) { + setHorseName(buffer, 1); + } else { + setHorseName(buffer, 0); + } + #endif stack_pushCurrent(buffer); break; case MSGTAG_MALE_ICON: @@ -4861,10 +4921,24 @@ bool jmessage_string_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data, char buffer[40]; switch (i_tag & 0xFF00FFFF) { case MSGTAG_PLAYER_GENITIV: + #if VERSION == VERSION_GCN_PAL + if (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_GERMAN) { + setPlayerName(buffer, 1); + } else { + setPlayerName(buffer, 0); + } + #endif // @bug buffer is uninitialized push_word(buffer); break; case MSGTAG_HORSE_GENITIV: + #if VERSION == VERSION_GCN_PAL + if (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_GERMAN) { + setHorseName(buffer, 1); + } else { + setHorseName(buffer, 0); + } + #endif push_word(buffer); break; case MSGTAG_MALE_ICON: diff --git a/src/d/d_msg_object.cpp b/src/d/d_msg_object.cpp index f1be27c37af..94506d8656f 100644 --- a/src/d/d_msg_object.cpp +++ b/src/d/d_msg_object.cpp @@ -1653,7 +1653,26 @@ void dMsgObject_c::readMessageGroupLocal(mDoDvdThd_mountXArchive_c** p_arcMount) static char arcName[22]; int msgGroup = dStage_stagInfo_GetMsgGroup(dComIfGp_getStage()->getStagInfo()); + #if VERSION == VERSION_GCN_PAL + switch (dComIfGs_getPalLanguage()) { + case dSv_player_config_c::LANGAUGE_GERMAN: + sprintf(arcName, "/res/Msgde/bmgres%d.arc", msgGroup); + break; + case dSv_player_config_c::LANGAUGE_FRENCH: + sprintf(arcName, "/res/Msgfr/bmgres%d.arc", msgGroup); + break; + case dSv_player_config_c::LANGAUGE_SPANISH: + sprintf(arcName, "/res/Msgsp/bmgres%d.arc", msgGroup); + break; + case dSv_player_config_c::LANGAUGE_ITALIAN: + sprintf(arcName, "/res/Msgit/bmgres%d.arc", msgGroup); + break; + default: + sprintf(arcName, "/res/Msguk/bmgres%d.arc", msgGroup); + } + #else sprintf(arcName, "/res/Msgus/bmgres%d.arc", msgGroup); + #endif *p_arcMount = mDoDvdThd_mountXArchive_c::create(arcName, 0, JKRArchive::MOUNT_MEM, NULL); diff --git a/src/d/d_msg_unit.cpp b/src/d/d_msg_unit.cpp index 8c415101678..ff03c960fde 100644 --- a/src/d/d_msg_unit.cpp +++ b/src/d/d_msg_unit.cpp @@ -122,13 +122,19 @@ void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) { const char* uVar5; if (i_value == 1 #ifdef DEBUG - || (dComIfGs_getPalLanguage() == 3 && i_value == 0) + || (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_SPANISH && i_value == 0) + #elif VERSION == VERSION_GCN_PAL + || (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_FRENCH && i_value == 0) #endif ) { #ifdef DEBUG uVar5 = entriesStr + endFrame; } else { uVar5 = entriesStr + startFrame; + #elif VERSION == VERSION_GCN_PAL + uVar5 = pStrAttributeBlock->entries->str + startFrame; + } else { + uVar5 = pStrAttributeBlock->entries->str + endFrame; #else uVar5 = pStrAttributeBlock->entries->str + endFrame; } else { diff --git a/src/d/d_name.cpp b/src/d/d_name.cpp index 1c301e3e868..474c352c54c 100644 --- a/src/d/d_name.cpp +++ b/src/d/d_name.cpp @@ -78,6 +78,22 @@ static const char* l_mojiEisu[65] = { "X", "k", "x", ",", "L", "Y", "l", "y", ".", "M", "Z", "m", "z", " ", }; +#if VERSION == VERSION_GCN_PAL +static char* l_mojiEisuPal_1[65] = { + "A", "N", "AA", "BB", "1", "B", "O", "CC", "DD", "2", "C", "P", "EE", "FF", "3", "D", "Q", + "GG", "HH", "4", "E", "R", "II", "JJ", "5", "F", "S", "KK", "LL", "6", "G", "T", "MM", "NN", + "7", "H", "U", "OO", "PP", "8", "I", "V", "QQ", "RR", "9", "J", "W", "SS", "TT", "0", "K", + "X", "UU", "VV", ",", "L", "Y", "WW", "XX", ".", "M", "Z", "YY", "ZZ", " ", +}; + +static char* l_mojiEisuPal_2[65] = { + "a", "n", "aa", "bb", "1", "b", "o", "cc", "dd", "2", "c", "p", "ee", "ff", "3", "d", "q", + "gg", "hh", "4", "e", "r", "ii", "jj", "5", "f", "s", "kk", "ll", "6", "g", "t", "mm", + "nn", "7", "h", "u", "oo", "pp", "8", "i", "v", "qq", "rr", "9", "j", "w", "ss", "tt", "0", + "k", "x", "uu", "vv", ",", "l", "y", "ww", "xx", ".", "m", "z", "yy", "zz", " ", +}; +#endif + /* 80430734-80430748 05D454 0014+00 9/9 0/0 0/0 .bss g_nmHIO */ static dNm_HIO_c g_nmHIO; @@ -165,10 +181,19 @@ void dName_c::init() { field_0x2ac = mSelProc; field_0x2ad = mSelProc; field_0x2ae = field_0x2ac; + #if VERSION == VERSION_GCN_PAL + mMojiSet = MOJI_HIRA; + #else mMojiSet = MOJI_EIGO; + #endif mPrevMojiSet = 255; + #if VERSION == VERSION_GCN_PAL + mSelMenu = MENU_HIRA; + mPrevSelMenu = MENU_HIRA; + #else mSelMenu = MENU_END; mPrevSelMenu = MENU_END; + #endif mojiListChange(); } @@ -180,6 +205,17 @@ void dName_c::initial() { NameStrSet(); mNextNameStr[0] = 0; } + + #if VERSION == VERSION_GCN_PAL + if (mSelProc == PROC_MOJI_SELECT) { + mMenuIcon[mMojiSet]->scale(g_nmHIO.mMenuScale, g_nmHIO.mMenuScale); + mMenuText[mMojiSet]->setWhite(JUtility::TColor(0xC8, 0xC8, 0xC8, 0xFF)); + if (mPrevMojiSet != 255) { + mMenuIcon[mPrevMojiSet]->scale(1.0f, 1.0f); + mMenuText[mPrevMojiSet]->setWhite(JUtility::TColor(0x96, 0x96, 0x96, 0xFF)); + } + } + #endif } /* 8024E7EC-8024E9A0 24912C 01B4+00 0/0 2/2 0/0 .text showIcon__7dName_cFv */ @@ -215,6 +251,17 @@ void dName_c::_move() { stick->checkTrigger(); (this->*SelProc[mSelProc])(); + #if VERSION == VERSION_GCN_PAL + if (mDoCPd_c::getTrigY(PAD_1)) { + mDoAud_seStart(Z2SE_SY_DUMMY, 0, 0, 0); + mPrevMojiSet = mMojiSet; + mMojiSet++; + if (mMojiSet > MOJI_KATA) { + mMojiSet = MOJI_HIRA; + } + mojiListChange(); + } else { + #endif if (mDoCPd_c::getTrigRight(PAD_1)) { // BUG: this check only fails if the cursor is at exactly 7 // setMoji allows the cursor to reach 8, which is out of bounds here @@ -242,12 +289,22 @@ void dName_c::_move() { backSpace(); } } else if (mDoCPd_c::getTrigStart(PAD_1)) { + #if VERSION == VERSION_GCN_PAL + if ((mSelProc != PROC_MENU_SELECT || mSelMenu != MENU_EIGO) && + (mSelProc == PROC_MENU_SELECT || mSelProc == PROC_MOJI_SELECT)) + { + #else if ((mSelProc != PROC_MENU_SELECT || mSelMenu != MENU_END) && (mSelProc == PROC_MENU_SELECT || mSelProc == PROC_MOJI_SELECT)) { + #endif mDoAud_seStart(Z2SE_SY_CURSOR_OPTION, 0, 0, 0); mPrevSelMenu = mSelMenu; + #if VERSION == VERSION_GCN_PAL + mSelMenu = MENU_EIGO; + #else mSelMenu = MENU_END; + #endif switch (mSelProc) { case PROC_MOJI_SELECT: @@ -263,6 +320,9 @@ void dName_c::_move() { } } } + #if VERSION == VERSION_GCN_PAL + } + #endif cursorAnm(); } @@ -529,6 +589,16 @@ void dName_c::selectMojiSet() { int dName_c::getMoji() { const char* moji; + #if VERSION == VERSION_GCN_PAL + switch (mMojiSet) { + case MOJI_HIRA: + moji = l_mojiEisuPal_1[mCharRow + mCharColumn * 5]; + break; + case MOJI_KATA: + moji = l_mojiEisuPal_2[mCharRow + mCharColumn * 5]; + break; + } + #else switch (mMojiSet) { case MOJI_HIRA: moji = l_mojiHira[mCharRow + mCharColumn * 5]; @@ -540,6 +610,7 @@ int dName_c::getMoji() { moji = l_mojiEisu[mCharRow + mCharColumn * 5]; break; } + #endif return *moji; } @@ -569,7 +640,11 @@ void dName_c::setMoji(int moji) { mChrInfo[mCurPos].mRow = mCharRow; mChrInfo[mCurPos].mMojiSet = mMojiSet; mChrInfo[mCurPos].field_0x3 = 1; + #if VERSION == VERSION_GCN_PAL + mChrInfo[mCurPos].mCharacter = moji & 0xFF; + #else mChrInfo[mCurPos].mCharacter = moji; + #endif if (mCurPos != 8) { mLastCurPos = mCurPos; @@ -582,7 +657,11 @@ void dName_c::setMoji(int moji) { mChrInfo[mCurPos].mRow = mCharRow; mChrInfo[mCurPos].mMojiSet = mMojiSet; mChrInfo[mCurPos].field_0x3 = 1; + #if VERSION == VERSION_GCN_PAL + mChrInfo[mCurPos].mCharacter = moji & 0xFF; + #else mChrInfo[mCurPos].mCharacter = moji; + #endif if (mCurPos != 8) { mLastCurPos = mCurPos; @@ -604,7 +683,14 @@ void dName_c::setNameText() { "CR\x1b" "CC[000000]\x1bGM[0]%c\x1bHM\x1b" "CC[ffffff]\x1bGM[0]%c", - (u8)mChrInfo[i].mCharacter, (u8)mChrInfo[i].mCharacter); + #if VERSION == VERSION_GCN_PAL + (u8)mChrInfo[i].mCharacter & 0xFF, + (u8)mChrInfo[i].mCharacter & 0xFF + #else + (u8)mChrInfo[i].mCharacter, + (u8)mChrInfo[i].mCharacter + #endif + ); } } } @@ -628,9 +714,21 @@ void dName_c::nameCursorMove() { /* 8024F994-8024FAF4 24A2D4 0160+00 3/3 0/0 0/0 .text selectCursorMove__7dName_cFv */ void dName_c::selectCursorMove() { - field_0x30c[3][0] = mCharColumn; - field_0x30c[3][1] = mCharRow; - field_0x30c[3][2] = 1; + int idx; + #if VERSION == VERSION_GCN_PAL + if (mCharColumn < 3) { + idx = 0; + } else if (mCharColumn < 6) { + idx = 1; + } else if (mCharColumn >= 6) { + idx = 2; + } + #else + idx = 3; + #endif + field_0x30c[idx][0] = mCharColumn; + field_0x30c[idx][1] = mCharRow; + field_0x30c[idx][2] = 1; mMojiIcon[mCharRow + mCharColumn * 5]->getPanePtr()->scale(g_nmHIO.mSelCharScale, g_nmHIO.mSelCharScale); @@ -645,12 +743,45 @@ void dName_c::selectCursorMove() { /* 8024FAF4-8024FB08 24A434 0014+00 1/1 0/0 0/0 .text menuCursorPosSet__7dName_cFv */ void dName_c::menuCursorPosSet() { mPrevSelMenu = mSelMenu; + #if VERSION == VERSION_GCN_PAL + if (mCharColumn < 3) { + mSelMenu = MENU_HIRA; + } else if (mCharColumn < 6) { + mSelMenu = MENU_KATA; + } else if (mCharColumn >= 6) { + mSelMenu = MENU_EIGO; + } + #else mSelMenu = MENU_END; + #endif } /* 8024FB08-8024FDA0 24A448 0298+00 1/0 0/0 0/0 .text MenuSelect__7dName_cFv */ void dName_c::MenuSelect() { + #if VERSION == VERSION_GCN_PAL + if (stick->checkRightTrigger()) { + mDoAud_seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0); + mPrevSelMenu = mSelMenu; + mSelMenu++; + if (mSelMenu > MENU_EIGO) { + mSelMenu = MENU_HIRA; + } + MenuSelectAnmInit(); + mSelProc = PROC_MENU_SEL_ANM; + } else if (stick->checkLeftTrigger()) { + mDoAud_seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0); + mPrevSelMenu = mSelMenu; + if (mSelMenu == MENU_HIRA) { + mSelMenu = MENU_EIGO; + } else { + mSelMenu--; + } + MenuSelectAnmInit(); + mSelProc = PROC_MENU_SEL_ANM; + } else { + #else if (!stick->checkRightTrigger() && !stick->checkLeftTrigger()) { + #endif if (stick->checkUpTrigger()) { mDoAud_seStart(Z2SE_SY_NAME_CURSOR, NULL, 0, 0); mPrevSelMenu = mSelMenu; @@ -664,7 +795,11 @@ void dName_c::MenuSelect() { MenuSelectAnmInit(); mSelProc = PROC_MENU_SEL_ANM2; } else if (mDoCPd_c::getTrigA(PAD_1)) { + #if VERSION == VERSION_GCN_PAL + if (mSelMenu == MENU_EIGO) { + #else if (mSelMenu == MENU_END) { + #endif if (nameCheck() != 0) { mDoAud_seStart(Z2SE_SY_NAME_OK, NULL, 0, 0); } else { @@ -675,7 +810,11 @@ void dName_c::MenuSelect() { } menuAbtnSelect(); } else if (mDoCPd_c::getTrigStart(PAD_1)) { + #if VERSION == VERSION_GCN_PAL + if (mSelMenu == MENU_EIGO) { + #else if (mSelMenu == MENU_END) { + #endif if (nameCheck() != 0) { mDoAud_seStart(Z2SE_SY_NAME_OK, NULL, 0, 0); } else { @@ -720,6 +859,10 @@ void dName_c::MenuSelectAnm2() { if (canMove == true) { if (prevMenu_i != mojiSet_i) { mMenuText[prevMenu_i]->setWhite(JUtility::TColor(0x96, 0x96, 0x96, 0xFF)); + #if VERSION == VERSION_GCN_PAL + mMenuIcon[mojiSet_i]->scale(g_nmHIO.mMenuScale, g_nmHIO.mMenuScale); + mMenuText[mojiSet_i]->setWhite(JUtility::TColor(0xC8, 0xC8, 0xC8, 0xFF)); + #endif } selectCursorMove(); mSelProc = PROC_MOJI_SELECT; @@ -735,14 +878,20 @@ void dName_c::menuAbtnSelect() { switch (mSelMenu) { case MENU_HIRA: case MENU_KATA: + #if VERSION != VERSION_GCN_PAL case MENU_EIGO: + #endif if (mSelMenu != mMojiSet) { mPrevMojiSet = mMojiSet; mMojiSet = mSelMenu; mojiListChange(); } break; + #if VERSION == VERSION_GCN_PAL + case MENU_EIGO: + #else case MENU_END: + #endif int nameNum = nameCheck(); if (nameNum != 0) { playNameSet(nameNum); @@ -765,7 +914,11 @@ void dName_c::backSpace() { if (mCurPos == 8 && mChrInfo[7].mCharacter != ' ') { mChrInfo[7].mColumn = 7; mChrInfo[7].mRow = 1; + #if VERSION == VERSION_GCN_PAL + mChrInfo[7].mMojiSet = MOJI_HIRA; + #else mChrInfo[7].mMojiSet = MOJI_EIGO; + #endif mChrInfo[7].field_0x3 = 1; mChrInfo[7].mCharacter = ' '; } else { @@ -774,7 +927,11 @@ void dName_c::backSpace() { } mChrInfo[7].mColumn = 7; mChrInfo[7].mRow = 1; + #if VERSION == VERSION_GCN_PAL + mChrInfo[7].mMojiSet = MOJI_HIRA; + #else mChrInfo[7].mMojiSet = MOJI_EIGO; + #endif mChrInfo[7].field_0x3 = 1; mChrInfo[7].mCharacter = ' '; } @@ -788,6 +945,18 @@ void dName_c::backSpace() { /* 802501B0-80250284 24AAF0 00D4+00 2/2 0/0 0/0 .text mojiListChange__7dName_cFv */ void dName_c::mojiListChange() { + #if VERSION == VERSION_GCN_PAL + char** mojiSet; + + switch (mMojiSet) { + case MOJI_HIRA: + mojiSet = l_mojiEisuPal_1; + break; + case MOJI_KATA: + mojiSet = l_mojiEisuPal_2; + break; + } + #else const char** mojiSet; switch (mMojiSet) { @@ -801,6 +970,7 @@ void dName_c::mojiListChange() { mojiSet = l_mojiEisu; break; } + #endif char buf[74]; for (int i = 0; i < 65; i++) { @@ -822,6 +992,17 @@ void dName_c::mojiListChange() { strcat(buf, mojiSet[i]); strcpy(mMojiText[i], buf); } + + #if VERSION == VERSION_GCN_PAL + if (mSelProc == PROC_MOJI_SELECT) { + mMenuIcon[mMojiSet]->scale(g_nmHIO.mMenuScale, g_nmHIO.mMenuScale); + mMenuText[mMojiSet]->setWhite(JUtility::TColor(0xC8, 0xC8, 0xC8, 0xFF)); + if (mPrevMojiSet != 255) { + mMenuIcon[mPrevMojiSet]->scale(1.0f, 1.0f); + mMenuText[mPrevMojiSet]->setWhite(JUtility::TColor(0x96, 0x96, 0x96, 0xFF)); + } + } + #endif } /* 80250284-80250380 24ABC4 00FC+00 1/1 0/0 0/0 .text menuCursorMove__7dName_cFv */ @@ -843,6 +1024,10 @@ void dName_c::menuCursorMove2() { if (menu_i != mojiSet_i) { mMenuIcon[menu_i]->scale(g_nmHIO.mMenuScale, g_nmHIO.mMenuScale); mMenuText[menu_i]->setWhite(JUtility::TColor(0xC8, 0xC8, 0xC8, 0xFF)); + #if VERSION == VERSION_GCN_PAL + mMenuIcon[mojiSet_i]->scale(1.0f, 1.0f); + mMenuText[mojiSet_i]->setWhite(JUtility::TColor(0x96, 0x96, 0x96, 0xFF)); + #endif } Vec pos = mMenuIcon[menu_i]->getGlobalVtxCenter(false, 0); @@ -864,11 +1049,17 @@ void dName_c::selectCursorPosSet(int row) { mCharColumn = 3; break; case MENU_EIGO: + #if VERSION == VERSION_GCN_PAL + mCharColumn = 8; + #else mCharColumn = 6; + #endif break; + #if VERSION != VERSION_GCN_PAL case MENU_END: mCharColumn = 8; break; + #endif } mCharRow = row; @@ -988,8 +1179,10 @@ void dName_c::screenSet() { } } + #if VERSION != VERSION_GCN_PAL mMenuIcon[0]->hide(); mMenuIcon[1]->hide(); + #endif mMojiPane = nameIn.NameInScr->search('moji_n'); for (u32 i = 0; i < 65; i++) { @@ -1006,9 +1199,48 @@ void dName_c::screenSet() { ((J2DTextBox*)nameTagPane[i])->setFont(nameIn.font); ((J2DTextBox*)nameTagPane[i])->setString(72, ""); ((J2DTextBox*)nameTagPane[i])->setWhite(JUtility::TColor(0xC8, 0xC8, 0xC8, 0xFF)); + #if VERSION == VERSION_GCN_PAL + ((J2DTextBox*)nameTagPane[i])->resize(24.0f, 23.0f); + #endif mNameText[i] = ((J2DTextBox*)nameTagPane[i])->getStringPtr(); } + #if VERSION == VERSION_GCN_PAL + int idx = 2; + + static u8 palMoji00[13] = { + 0xC0, 0xC1, 0xC2, 0xC4, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, + }; + static u8 palMoji01[13] = { + 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD6, 0x8C, 0xD9, 0xDA, 0xDB, 0xDC, 0x2D, + }; + static u8 palMoji10[13] = { + 0xE0, 0xE1, 0xE2, 0xE4, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, + }; + static u8 palMoji11[13] = { + 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF6, 0x9C, 0xF9, 0xFA, 0xFB, 0xFC, 0xDF, + }; + + u8* palMoji00_p = palMoji00; + u8* palMoji01_p = palMoji01; + u8* palMoji10_p = palMoji10; + u8* palMoji11_p = palMoji11; + + for (int i = 0; i < 13; i++, palMoji11_p++, palMoji10_p++, palMoji01_p++, palMoji00_p++, idx += 5) { + l_mojiEisuPal_1[idx][0] = *palMoji00_p; + l_mojiEisuPal_1[idx][1] = 0; + + l_mojiEisuPal_1[idx + 1][0] = *palMoji01_p; + l_mojiEisuPal_1[idx + 1][1] = 0; + + l_mojiEisuPal_2[idx][0] = *palMoji10_p; + l_mojiEisuPal_2[idx][1] = 0; + + l_mojiEisuPal_2[idx + 1][0] = *palMoji11_p; + l_mojiEisuPal_2[idx + 1][1] = 0; + } + #endif + mCharColumn = 0; mCharRow = 0; @@ -1045,7 +1277,11 @@ void dName_c::displayInit() { mNameCursor[i]->hide(); mChrInfo[i].mColumn = 7; mChrInfo[i].mRow = 1; + #if VERSION == VERSION_GCN_PAL + mChrInfo[i].mMojiSet = MOJI_HIRA; + #else mChrInfo[i].mMojiSet = MOJI_EIGO; + #endif mChrInfo[i].field_0x3 = 1; mChrInfo[i].mCharacter = ' '; } @@ -1059,6 +1295,22 @@ void dName_c::NameStrSet() { int i = 0; while (*moji != 0) { + #if VERSION == VERSION_GCN_PAL + mChrInfo[i].mCharacter = static_cast(*moji); + + for (int j = 0; j < 65; j++) { + if (mChrInfo[i].mCharacter == *(u8*)l_mojiEisuPal_1[j] || + mChrInfo[i].mCharacter == *(u16*)l_mojiEisuPal_2[j]) + { + mChrInfo[i].mColumn = j / 5; + mChrInfo[i].mRow = j % 5; + mChrInfo[i].mMojiSet = MOJI_HIRA; + break; + } + } + moji++; + i++; + #else if (*(u8*)moji >> 4 == 8 || *(u8*)moji >> 4 == 9) { mChrInfo[i].mCharacter = *(u16*)moji; @@ -1097,6 +1349,7 @@ void dName_c::NameStrSet() { moji++; i++; } + #endif } mLastCurPos = mCurPos; @@ -1116,11 +1369,17 @@ s32 dName_c::getMenuPosIdx(u8 selPos) { result = 1; break; case 2: + #if VERSION == VERSION_GCN_PAL + result = 3; + #else result = 2; + #endif break; + #if VERSION != VERSION_GCN_PAL case 3: result = 3; break; + #endif } return result; //!@bug UB: uninitialized default return