From f52c715364b861d76512ed6e5167751f30d974bb Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Tue, 28 Apr 2026 02:53:36 -0700 Subject: [PATCH 01/14] convert d_name literals to hex + enable version --- src/d/actor/d_flower.inc | 20 +++++++------- src/d/actor/d_grass.inc | 16 +++++------ src/d/d_name.cpp | 57 +++++++++++++++++++++++++++++++++++++++ src/dusk/iso_validate.cpp | 1 + src/dusk/version.cpp | 2 ++ 5 files changed, 78 insertions(+), 18 deletions(-) diff --git a/src/d/actor/d_flower.inc b/src/d/actor/d_flower.inc index 4024d5ad6a..4b78e2950d 100644 --- a/src/d/actor/d_flower.inc +++ b/src/d/actor/d_flower.inc @@ -13,7 +13,7 @@ const u16 l_J_Ohana00_64TEX__height = 63; #if TARGET_PC #include "dusk/dvd_asset.hpp" using GameVersion = dusk::version::GameVersion; -static u8* l_J_Ohana00_64TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9060}, {GameVersion::GcnPal, 0x9060}}, 0x800), true); return buf; } +static u8* l_J_Ohana00_64TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9060}, {GameVersion::GcnPal, 0x9060}, {GameVersion::GcnJpn, 0x9060}}, 0x800), true); return buf; } #define l_J_Ohana00_64TEX (l_J_Ohana00_64TEX_get()) #else #include "assets/l_J_Ohana00_64TEX.h" @@ -111,10 +111,10 @@ static u8 l_flowerTexCoord[] = { #if TARGET_PC using GameVersion = dusk::version::GameVersion; -static u8* l_J_hana00DL_get() { static u8 buf[0x150]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9D20}, {GameVersion::GcnPal, 0x9D20}}, 0x150), true); return buf; } -static u8* l_J_hana00_cDL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9E80}, {GameVersion::GcnPal, 0x9E80}}, 0xDE), true); return buf; } -static u8* l_matDL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9F60}, {GameVersion::GcnPal, 0x9F60}}, 0x99), true); return buf; } -static u8* l_matLight4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xA000}, {GameVersion::GcnPal, 0xA000}}, 0x99), true); return buf; } +static u8* l_J_hana00DL_get() { static u8 buf[0x150]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9D20}, {GameVersion::GcnPal, 0x9D20}, {GameVersion::GcnJpn, 0x9D20}}, 0x150), true); return buf; } +static u8* l_J_hana00_cDL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9E80}, {GameVersion::GcnPal, 0x9E80}, {GameVersion::GcnJpn, 0x9E80}}, 0xDE), true); return buf; } +static u8* l_matDL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9F60}, {GameVersion::GcnPal, 0x9F60}, {GameVersion::GcnJpn, 0x9F60}}, 0x99), true); return buf; } +static u8* l_matLight4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xA000}, {GameVersion::GcnPal, 0xA000}, {GameVersion::GcnJpn, 0xA000}}, 0x99), true); return buf; } #define l_J_hana00DL (l_J_hana00DL_get()) #define l_J_hana00_cDL (l_J_hana00_cDL_get()) #define l_matDL (l_matDL_get()) @@ -270,11 +270,11 @@ static u8 l_flowerTexCoord2[] = { #if TARGET_PC using GameVersion = dusk::version::GameVersion; -static u8* l_J_hana01DL_get() { static u8 buf[0x138]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB7C0}, {GameVersion::GcnPal, 0xB7C0}}, 0x138), true); return buf; } -static u8* l_J_hana01_c_00DL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB900}, {GameVersion::GcnPal, 0xB900}}, 0xDE), true); return buf; } -static u8* l_J_hana01_c_01DL_get() { static u8 buf[0x128]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB9E0}, {GameVersion::GcnPal, 0xB9E0}}, 0x128), true); return buf; } -static u8* l_mat2DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xBB20}, {GameVersion::GcnPal, 0xBB20}}, 0x99), true); return buf; } -static u8* l_mat2Light4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xBBC0}, {GameVersion::GcnPal, 0xBBC0}}, 0x99), true); return buf; } +static u8* l_J_hana01DL_get() { static u8 buf[0x138]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB7C0}, {GameVersion::GcnPal, 0xB7C0}, {GameVersion::GcnJpn, 0xB7C0}}, 0x138), true); return buf; } +static u8* l_J_hana01_c_00DL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB900}, {GameVersion::GcnPal, 0xB900}, {GameVersion::GcnJpn, 0xB900}}, 0xDE), true); return buf; } +static u8* l_J_hana01_c_01DL_get() { static u8 buf[0x128]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB9E0}, {GameVersion::GcnPal, 0xB9E0}, {GameVersion::GcnJpn, 0xB9E0}}, 0x128), true); return buf; } +static u8* l_mat2DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xBB20}, {GameVersion::GcnPal, 0xBB20}, {GameVersion::GcnJpn, 0xBB20}}, 0x99), true); return buf; } +static u8* l_mat2Light4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xBBC0}, {GameVersion::GcnPal, 0xBBC0}, {GameVersion::GcnJpn, 0xBBC0}}, 0x99), true); return buf; } #define l_J_hana01DL (l_J_hana01DL_get()) #define l_J_hana01_c_00DL (l_J_hana01_c_00DL_get()) #define l_J_hana01_c_01DL (l_J_hana01_c_01DL_get()) diff --git a/src/d/actor/d_grass.inc b/src/d/actor/d_grass.inc index 3d67a57007..785b05c281 100644 --- a/src/d/actor/d_grass.inc +++ b/src/d/actor/d_grass.inc @@ -21,8 +21,8 @@ const u16 l_M_kusa05_RGBATEX__height = 31; #if TARGET_PC #include "dusk/dvd_asset.hpp" using GameVersion = dusk::version::GameVersion; -static u8* l_M_kusa05_RGBATEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x7680}, {GameVersion::GcnPal, 0x7680}}, 0x800), true); return buf; } -static u8* l_M_Hijiki00TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x7E80}, {GameVersion::GcnPal, 0x7E80}}, 0x800), true); return buf; } +static u8* l_M_kusa05_RGBATEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x7680}, {GameVersion::GcnPal, 0x7680}, {GameVersion::GcnJpn, 0x7680}}, 0x800), true); return buf; } +static u8* l_M_Hijiki00TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x7E80}, {GameVersion::GcnPal, 0x7E80}, {GameVersion::GcnJpn, 0x7E80}}, 0x800), true); return buf; } #define l_M_kusa05_RGBATEX (l_M_kusa05_RGBATEX_get()) #define l_M_Hijiki00TEX (l_M_Hijiki00TEX_get()) #else @@ -116,12 +116,12 @@ static u8 l_texCoord[160] = { #if TARGET_PC using GameVersion = dusk::version::GameVersion; -static u8* l_M_Kusa_9qDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8B00}, {GameVersion::GcnPal, 0x8B00}}, 0xCB), true); return buf; } -static u8* l_M_Kusa_9q_cDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8BE0}, {GameVersion::GcnPal, 0x8BE0}}, 0xCB), true); return buf; } -static u8* l_M_TenGusaDL_get() { static u8 buf[0xD4]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8CC0}, {GameVersion::GcnPal, 0x8CC0}}, 0xD4), true); return buf; } -static u8* l_Tengusa_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8DA0}, {GameVersion::GcnPal, 0x8DA0}}, 0xA8), true); return buf; } -static u8* l_kusa9q_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8E60}, {GameVersion::GcnPal, 0x8E60}}, 0xA8), true); return buf; } -static u8* l_kusa9q_l4_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8F20}, {GameVersion::GcnPal, 0x8F20}}, 0xA8), true); return buf; } +static u8* l_M_Kusa_9qDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8B00}, {GameVersion::GcnPal, 0x8B00}, {GameVersion::GcnJpn, 0x8B00}}, 0xCB), true); return buf; } +static u8* l_M_Kusa_9q_cDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8BE0}, {GameVersion::GcnPal, 0x8BE0}, {GameVersion::GcnJpn, 0x8BE0}}, 0xCB), true); return buf; } +static u8* l_M_TenGusaDL_get() { static u8 buf[0xD4]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8CC0}, {GameVersion::GcnPal, 0x8CC0}, {GameVersion::GcnJpn, 0x8CC0}}, 0xD4), true); return buf; } +static u8* l_Tengusa_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8DA0}, {GameVersion::GcnPal, 0x8DA0}, {GameVersion::GcnJpn, 0x8DA0}}, 0xA8), true); return buf; } +static u8* l_kusa9q_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8E60}, {GameVersion::GcnPal, 0x8E60}, {GameVersion::GcnJpn, 0x8E60}}, 0xA8), true); return buf; } +static u8* l_kusa9q_l4_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8F20}, {GameVersion::GcnPal, 0x8F20}, {GameVersion::GcnJpn, 0x8F20}}, 0xA8), true); return buf; } #define l_M_Kusa_9qDL (l_M_Kusa_9qDL_get()) #define l_M_Kusa_9q_cDL (l_M_Kusa_9q_cDL_get()) #define l_M_TenGusaDL (l_M_TenGusaDL_get()) diff --git a/src/d/d_name.cpp b/src/d/d_name.cpp index 1f3ccbb1d7..56fea3309d 100644 --- a/src/d/d_name.cpp +++ b/src/d/d_name.cpp @@ -17,6 +17,62 @@ static bool isPalOrJpn() { return dusk::version::isRegionPal() || dusk::version::isRegionJpn(); } +#if TARGET_PC +static const char* l_mojiHira[65] = { + "\x82\xA0", "\x82\xA2", "\x82\xA4", "\x82\xA6", "\x82\xA8", "\x82\xA9", "\x82\xAB", "\x82\xAD", "\x82\xAF", "\x82\xB1", "\x82\xB3", "\x82\xB5", "\x82\xB7", + "\x82\xB9", "\x82\xBB", "\x82\xBD", "\x82\xBF", "\x82\xC2", "\x82\xC4", "\x82\xC6", "\x82\xC8", "\x82\xC9", "\x82\xCA", "\x82\xCB", "\x82\xCC", "\x82\xCD", + "\x82\xD0", "\x82\xD3", "\x82\xD6", "\x82\xD9", "\x82\xDC", "\x82\xDD", "\x82\xDE", "\x82\xDF", "\x82\xE0", "\x82\xE2", "\x81\x40", "\x82\xE4", "\x81\x40", + "\x82\xE6", "\x82\xE7", "\x82\xE8", "\x82\xE9", "\x82\xEA", "\x82\xEB", "\x82\xED", "\x81\x40", "\x82\xF0", "\x81\x40", "\x82\xF1", "\x82\x9F", "\x82\xA1", + "\x82\xA3", "\x82\xA5", "\x82\xA7", "\x82\xE1", "\x81\x40", "\x82\xE3", "\x81\x40", "\x82\xE5", "\x82\xC1", "\x81\x40", "\x81\x5B", "\x81\x4A", "\x81\x4B", +}; + +static const char* l_mojiHira2[65] = { + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x82\xAA", "\x82\xAC", "\x82\xAE", "\x82\xB0", "\x82\xB2", "\x82\xB4", "\x82\xB6", "\x82\xB8", + "\x82\xBA", "\x82\xBC", "\x82\xBE", "\x82\xC0", "\x82\xC3", "\x82\xC5", "\x82\xC7", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x82\xCE", + "\x82\xD1", "\x82\xD4", "\x82\xD7", "\x82\xDA", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", +}; + +static const char* l_mojiHira3[65] = { + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x82\xCF", + "\x82\xD2", "\x82\xD5", "\x82\xD8", "\x82\xDB", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", +}; + +static const char* l_mojikata[65] = { + "\x83\x41", "\x83\x43", "\x83\x45", "\x83\x47", "\x83\x49", "\x83\x4A", "\x83\x4C", "\x83\x4E", "\x83\x50", "\x83\x52", "\x83\x54", "\x83\x56", "\x83\x58", + "\x83\x5A", "\x83\x5C", "\x83\x5E", "\x83\x60", "\x83\x63", "\x83\x65", "\x83\x67", "\x83\x69", "\x83\x6A", "\x83\x6B", "\x83\x6C", "\x83\x6D", "\x83\x6E", + "\x83\x71", "\x83\x74", "\x83\x77", "\x83\x7A", "\x83\x7D", "\x83\x7E", "\x83\x80", "\x83\x81", "\x83\x82", "\x83\x84", "\x81\x40", "\x83\x86", "\x81\x40", + "\x83\x88", "\x83\x89", "\x83\x8A", "\x83\x8B", "\x83\x8C", "\x83\x8D", "\x83\x8F", "\x81\x40", "\x83\x93", "\x81\x40", "\x83\x93", "\x83\x40", "\x83\x42" + "\x83\x44", "\x83\x46", "\x83\x48", "\x83\x83", "\x81\x40", "\x83\x85", "\x81\x40", "\x83\x87", "\x83\x62", "\x81\x40", "\x81\x5B", "\x81\x4A", "\x81\x4B", +}; + +static const char* l_mojikata2[65] = { + "\x81\x8F", "\x81\x8F", "\x83\x94", "\x81\x8F", "\x81\x8F", "\x83\x4B", "\x83\x4D", "\x83\x4F", "\x83\x51", "\x83\x53", "\x83\x55", "\x83\x57", "\x83\x59", + "\x83\x5B", "\x83\x5D", "\x83\x5F", "\x83\x61", "\x83\x64", "\x83\x66", "\x83\x68", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x83\x6F", + "\x83\x72", "\x83\x75", "\x83\x78", "\x83\x7B", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", +}; + +static const char* l_mojikata3[65] = { + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x83\x70", + "\x83\x73", "\x83\x76", "\x83\x79", "\x83\x7C", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", + "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", +}; + +static const char* l_mojiEisu[65] = { + "A", "N", "a", "n", "1", "B", "O", "b", "o", "2", "C", "P", "c", "p", "3", "D", "Q", + "d", "q", "4", "E", "R", "e", "r", "5", "F", "S", "f", "s", "6", "G", "T", "g", "t", + "7", "H", "U", "h", "u", "8", "I", "V", "i", "v", "9", "J", "W", "j", "w", "0", "K", + "X", "k", "x", ",", "L", "Y", "l", "y", ".", "M", "Z", "m", "z", " ", +}; +#else static const char* l_mojiHira[65] = { "あ", "い", "う", "え", "お", "か", "き", "く", "け", "こ", "さ", "し", "す", "せ", "そ", "た", "ち", "つ", "て", "と", "な", "に", "ぬ", "ね", "の", "は", @@ -71,6 +127,7 @@ static const char* l_mojiEisu[65] = { "7", "H", "U", "h", "u", "8", "I", "V", "i", "v", "9", "J", "W", "j", "w", "0", "K", "X", "k", "x", ",", "L", "Y", "l", "y", ".", "M", "Z", "m", "z", " ", }; +#endif #if TARGET_PC // The game normally mutates this string list to fill in the real character codes. diff --git a/src/dusk/iso_validate.cpp b/src/dusk/iso_validate.cpp index e83b3fd34e..0eac34711b 100644 --- a/src/dusk/iso_validate.cpp +++ b/src/dusk/iso_validate.cpp @@ -25,6 +25,7 @@ constexpr const char* PAL_GAME_IDS[] = { constexpr const char* SUPPORTED_TP_GAME_IDS[] = { "GZ2E01", // GCN USA "GZ2P01", // GCN PAL + "GZ2J01", }; template diff --git a/src/dusk/version.cpp b/src/dusk/version.cpp index e925dabaf8..1655031cdb 100644 --- a/src/dusk/version.cpp +++ b/src/dusk/version.cpp @@ -28,6 +28,8 @@ void init() { gameVersion = GameVersion::GcnUsa; } else if (game == "GZ2P") { gameVersion = GameVersion::GcnPal; + } else if (game == "GZ2J") { + gameVersion = GameVersion::GcnJpn; } else { // TODO: Handle remaining valid versions. DuskLog.fatal("Unknown/unsupported game version in disc: {}", game); From 00704ad838667e3c47b1fdd58adcc24c20ed5974 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Tue, 28 Apr 2026 03:43:52 -0700 Subject: [PATCH 02/14] mDoExt font region handling --- src/m_Do/m_Do_ext.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index fc8952e91d..48aa1cc2cd 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -3701,7 +3701,15 @@ static ResFONT* mDoExt_resfont0; static void mDoExt_initFont0() { static char const fontdata[] = "rodan_b_24_22.bfn"; -#if REGION_JPN +#if TARGET_PC + if (getGameVersion() == GameVersion::GcnJpn) { + mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(), + fontdata, dComIfGp_getFontArchive(), 0, 200, 512); + } else { + mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(), + fontdata, dComIfGp_getFontArchive(), 1, 0, 0); + } +#elif REGION_JPN mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(), fontdata, dComIfGp_getFontArchive(), 0, 200, 512); #else @@ -3728,7 +3736,13 @@ void mDoExt_removeMesgFont() { JKR_DELETE(mDoExt_font0); mDoExt_font0 = NULL; if (mDoExt_resfont0 != NULL) { -#if REGION_JPN +#if TARGET_PC + if (getGameVersion() == GameVersion::GcnJpn) { + JKRFileLoader::removeResource(mDoExt_resfont0, NULL); + } else { + JKRFree(mDoExt_resfont0); + } +#elif REGION_JPN JKRFileLoader::removeResource(mDoExt_resfont0, NULL); #else JKRFree(mDoExt_resfont0); From 9a3428983bc7bb4df50511c08cdfc7a45dbb2dd4 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sat, 16 May 2026 19:37:46 -0700 Subject: [PATCH 03/14] build fix / verif --- src/dusk/iso_validate.cpp | 2 +- src/m_Do/m_Do_ext.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dusk/iso_validate.cpp b/src/dusk/iso_validate.cpp index 00cd365ca9..fbb05bab13 100644 --- a/src/dusk/iso_validate.cpp +++ b/src/dusk/iso_validate.cpp @@ -88,7 +88,7 @@ struct KnownDisc { constexpr auto KNOWN_DISCS = std::to_array({ {"GZ2E01", Platform::GameCube, Region::NorthAmerica, "14e886f08e548a000afde98a3195e788"}, - {"GZ2J01", Platform::GameCube, Region::Japan}, + {"GZ2J01", Platform::GameCube, Region::Japan, "5967dc7a6a553652f4d2050aeef6f368"}, {"GZ2P01", Platform::GameCube, Region::Europe, "9ef597588b0035ca9e91b333fa9a8a7e"}, {"RZDE01", Platform::Wii, Region::NorthAmerica}, {"RZDJ01", Platform::Wii, Region::Japan}, diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 48aa1cc2cd..0ea258c527 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -26,6 +26,7 @@ #include #include "dusk/logging.h" #include "dusk/frame_interpolation.h" +#include "dusk/version.hpp" u8 mDoExt::CurrentHeapAdjustVerbose; u8 mDoExt::HeapAdjustVerbose; @@ -3702,7 +3703,7 @@ static ResFONT* mDoExt_resfont0; static void mDoExt_initFont0() { static char const fontdata[] = "rodan_b_24_22.bfn"; #if TARGET_PC - if (getGameVersion() == GameVersion::GcnJpn) { + if (dusk::version::getGameVersion() == dusk::version::GameVersion::GcnJpn) { mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(), fontdata, dComIfGp_getFontArchive(), 0, 200, 512); } else { @@ -3737,7 +3738,7 @@ void mDoExt_removeMesgFont() { mDoExt_font0 = NULL; if (mDoExt_resfont0 != NULL) { #if TARGET_PC - if (getGameVersion() == GameVersion::GcnJpn) { + if (dusk::version::getGameVersion() == dusk::version::GameVersion::GcnJpn) { JKRFileLoader::removeResource(mDoExt_resfont0, NULL); } else { JKRFree(mDoExt_resfont0); From 1a7c853d9be2a38b2347850fd79af386fe0d0d8d Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sat, 16 May 2026 21:06:55 -0700 Subject: [PATCH 04/14] better disc info display --- src/d/d_s_logo.cpp | 9 ++++++++- src/dusk/iso_validate.cpp | 22 +++++++--------------- src/dusk/iso_validate.hpp | 15 ++++++++++++++- src/dusk/ui/prelaunch.cpp | 32 ++++++++++++++++++++++++++++++-- src/dusk/ui/settings.cpp | 4 ++-- 5 files changed, 61 insertions(+), 21 deletions(-) diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index db0cfa1387..7a58a4cf77 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -907,7 +907,14 @@ dScnLogo_c::~dScnLogo_c() { mDoExt_getRubyFont(); mDoExt_setAraCacheSize(free_size - aram_heap->getTotalFreeSize()); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (getGameVersion() == GameVersion::GcnJpn) { + if (dComIfGp_getFontArchive() != NULL) { + dComIfGp_getFontArchive()->unmount(); + dComIfGp_setFontArchive(NULL); + } + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGp_getFontArchive() != NULL) { dComIfGp_getFontArchive()->unmount(); dComIfGp_setFontArchive(NULL); diff --git a/src/dusk/iso_validate.cpp b/src/dusk/iso_validate.cpp index fbb05bab13..9dc2c894b8 100644 --- a/src/dusk/iso_validate.cpp +++ b/src/dusk/iso_validate.cpp @@ -60,18 +60,6 @@ const char* verification_state_name(dusk::DiscVerificationState state) noexcept namespace dusk::iso { -enum class Platform : u8 { - GameCube, - Wii, -}; - -enum class Region : u8 { - NorthAmerica, - Europe, - Japan, - Korea, -}; - struct KnownDisc { std::string_view id; Platform platform; @@ -216,7 +204,9 @@ ValidationError validate(const char* path, VerificationStatus& status, DiscInfo& return ValidationError::WrongGame; } status.knownDisc = knownDisc; - info.isPal = knownDisc->region == Region::Europe; + + info.platform = knownDisc->platform; + info.region = knownDisc->region; if (!knownDisc->supported) { return ValidationError::WrongVersion; } @@ -251,7 +241,9 @@ ValidationError inspect(const char* path, DiscInfo& info) { if (!knownDisc) { return ValidationError::WrongGame; } - info.isPal = knownDisc->region == Region::Europe; + + info.platform = knownDisc->platform; + info.region = knownDisc->region; if (!knownDisc->supported) { return ValidationError::WrongVersion; } @@ -260,7 +252,7 @@ ValidationError inspect(const char* path, DiscInfo& info) { bool isPal(const char* path) { DiscInfo info{}; - return inspect(path, info) == ValidationError::Success && info.isPal; + return inspect(path, info) == ValidationError::Success && info.region == Region::Europe; } void log_verification_state(std::string_view path, DiscVerificationState state) { diff --git a/src/dusk/iso_validate.hpp b/src/dusk/iso_validate.hpp index 176284fd02..c064aa81cd 100644 --- a/src/dusk/iso_validate.hpp +++ b/src/dusk/iso_validate.hpp @@ -17,6 +17,18 @@ enum class ValidationError : u8 { Success }; +enum class Platform : u8 { + GameCube, + Wii, +}; + +enum class Region : u8 { + NorthAmerica, + Europe, + Japan, + Korea, +}; + struct VerificationStatus { std::atomic_size_t bytesRead = 0; std::atomic_size_t bytesTotal = 0; @@ -25,7 +37,8 @@ struct VerificationStatus { }; struct DiscInfo { - bool isPal = false; + Platform platform = Platform::GameCube; + Region region = Region::NorthAmerica; }; ValidationError inspect(const char* path, DiscInfo& info); diff --git a/src/dusk/ui/prelaunch.cpp b/src/dusk/ui/prelaunch.cpp index ef6b6e5709..44f7ea47d6 100644 --- a/src/dusk/ui/prelaunch.cpp +++ b/src/dusk/ui/prelaunch.cpp @@ -877,8 +877,36 @@ void Prelaunch::update() { if (mDiscDetail != nullptr) { if (activeDiscLoaded) { mDiscDetail->SetProperty(Rml::PropertyId::Display, Rml::Style::Display::Block); - Rml::String innerRML = "GameCube • "; - innerRML += state.activeDiscInfo.isPal ? "EUR" : "USA"; + Rml::String innerRML = ""; + + switch (state.activeDiscInfo.platform) { + case iso::Platform::GameCube: + innerRML += "GameCube"; + break; + case iso::Platform::Wii: + innerRML += "Wii"; + break; + } + + innerRML += " • "; + + switch (state.activeDiscInfo.region) { + case iso::Region::Japan: + innerRML += "JPN"; + break; + case iso::Region::Europe: + innerRML += "EUR"; + break; + case iso::Region::NorthAmerica: + innerRML += "USA"; + break; + case iso::Region::Korea: + innerRML += "KOR"; + break; + default: + innerRML += "Unknown"; + break; + } mDiscDetail->SetInnerRML(innerRML); } else { mDiscDetail->SetProperty(Rml::PropertyId::Display, Rml::Style::Display::None); diff --git a/src/dusk/ui/settings.cpp b/src/dusk/ui/settings.cpp index f12cb11ade..0300b84747 100644 --- a/src/dusk/ui/settings.cpp +++ b/src/dusk/ui/settings.cpp @@ -562,7 +562,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) { .getValue = [] { const auto& state = prelaunch_state(); - if (!state.configuredDiscCanLaunch || !state.configuredDiscInfo.isPal) { + if (!state.configuredDiscCanLaunch || state.configuredDiscInfo.region != iso::Region::Europe) { return kLanguageNames[0]; } const u8 idx = static_cast(getSettings().game.language.getValue()); @@ -572,7 +572,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) { [] { const auto& state = prelaunch_state(); return !state.configuredDiscCanLaunch || - !state.configuredDiscInfo.isPal; + state.configuredDiscInfo.region != iso::Region::Europe; }, .isModified = [] { From 8051679c96dd9992584a1160b105e4d333319083 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Thu, 16 Jul 2026 17:23:51 -0700 Subject: [PATCH 05/14] fix jp font rendering Co-Authored-By: pengin <2162454+pengin@users.noreply.github.com> --- .../include/JSystem/JUtility/JUTCacheFont.h | 4 +++ libs/JSystem/src/JUtility/JUTCacheFont.cpp | 33 ++++++++++++++++++- libs/JSystem/src/JUtility/JUTResFont.cpp | 25 +++++++++++--- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/libs/JSystem/include/JSystem/JUtility/JUTCacheFont.h b/libs/JSystem/include/JSystem/JUtility/JUTCacheFont.h index 2e089b7cc4..6c4b0b14fc 100644 --- a/libs/JSystem/include/JSystem/JUtility/JUTCacheFont.h +++ b/libs/JSystem/include/JSystem/JUtility/JUTCacheFont.h @@ -55,7 +55,11 @@ public: void prepend(JUTCacheFont::TGlyphCacheInfo*); virtual ~JUTCacheFont(); +#if TARGET_PC + virtual void loadImage(int, GXTexMapID FONT_DRAW_CTX); +#else virtual void loadImage(int, GXTexMapID); +#endif virtual void setBlock(); void setPagingType(EPagingType type) { mPagingType = type; } diff --git a/libs/JSystem/src/JUtility/JUTCacheFont.cpp b/libs/JSystem/src/JUtility/JUTCacheFont.cpp index 81b9f252f1..2282361672 100644 --- a/libs/JSystem/src/JUtility/JUTCacheFont.cpp +++ b/libs/JSystem/src/JUtility/JUTCacheFont.cpp @@ -203,7 +203,7 @@ bool JUTCacheFont::allocArea(void* cacheBuffer, u32 param_1, JKRHeap* heap) { } } - field_0x94 = mMaxSheetSize + 0x40; + field_0x94 = mMaxSheetSize + sizeof(TCachePage); mCachePage = param_1 / field_0x94; u32 v1 = field_0x94 * mCachePage; if (mCachePage == 0) { @@ -346,7 +346,23 @@ void JUTCacheFont::getGlyphFromAram(JUTCacheFont::TGlyphCacheInfo* param_0, JUTCacheFont::TCachePage* pCachePage, int* param_2, int* param_3) { TGlyphCacheInfo* pGylphCacheInfo = pCachePage; int* r30 = param_2; +#if TARGET_PC + // TODO: proper fix to account for 64bit ptr sizes + ResFONT::GLY1* glyph = (ResFONT::GLY1*)param_0; + pGylphCacheInfo->field_0x8 = glyph->startCode; + pGylphCacheInfo->field_0xa = glyph->endCode; + pGylphCacheInfo->field_0xc = glyph->cellWidth; + pGylphCacheInfo->field_0xe = glyph->cellHeight; + pGylphCacheInfo->field_0x10 = glyph->textureSize; + pGylphCacheInfo->mTexFormat = glyph->textureFormat; + pGylphCacheInfo->field_0x16 = glyph->numRows; + pGylphCacheInfo->field_0x18 = glyph->numColumns; + pGylphCacheInfo->mWidth = glyph->textureWidth; + pGylphCacheInfo->mHeight = glyph->textureHeight; + pGylphCacheInfo->field_0x1e = 0; +#else memcpy(pGylphCacheInfo, param_0, sizeof(TGlyphCacheInfo)); +#endif prepend(pGylphCacheInfo); int iVar3 = pGylphCacheInfo->field_0x16 * pGylphCacheInfo->field_0x18; int iVar2 = *r30 / iVar3; @@ -364,7 +380,11 @@ void JUTCacheFont::getGlyphFromAram(JUTCacheFont::TGlyphCacheInfo* param_0, GX_ANISO_1); } +#if TARGET_PC +void JUTCacheFont::loadImage(int param_0, GXTexMapID texMapId FONT_DRAW_CTX) { +#else void JUTCacheFont::loadImage(int param_0, GXTexMapID texMapId) { +#endif TCachePage* cachePage = loadCache_char_subroutine(¶m_0, false); if (cachePage != NULL) { mWidth = cachePage->field_0xc * (param_0 % (int)cachePage->field_0x16); @@ -421,6 +441,16 @@ JUTCacheFont::TCachePage* JUTCacheFont::loadCache_char_subroutine(int* param_0, } void JUTCacheFont::invalidiateAllCache() { +#if TARGET_PC + u8* cacheBuffer = (u8*)mCacheBuffer; + for (int i = 0; i < mCachePage; i++) { + TGlyphCacheInfo* current = (TGlyphCacheInfo*)cacheBuffer; + current->mPrev = i == 0 ? NULL : (TGlyphCacheInfo*)(cacheBuffer - field_0x94); + current->mNext = i == mCachePage - 1 ? NULL : (TGlyphCacheInfo*)(cacheBuffer + field_0x94); + cacheBuffer = cacheBuffer + field_0x94; + } + field_0xa8 = (intptr_t)cacheBuffer - field_0x94; +#else int* cacheBuffer = (int*)mCacheBuffer; for (int i = 0; i < mCachePage; i++) { *cacheBuffer = i == 0 ? 0 : (intptr_t)cacheBuffer - field_0x94; @@ -428,6 +458,7 @@ void JUTCacheFont::invalidiateAllCache() { cacheBuffer = (int*)((intptr_t)cacheBuffer + field_0x94); } field_0xa8 = (intptr_t)cacheBuffer - field_0x94; +#endif field_0xa4 = (TGlyphCacheInfo*)mCacheBuffer; field_0x9c = NULL; field_0xa0 = NULL; diff --git a/libs/JSystem/src/JUtility/JUTResFont.cpp b/libs/JSystem/src/JUtility/JUTResFont.cpp index 02b59aa739..4ec23dff44 100644 --- a/libs/JSystem/src/JUtility/JUTResFont.cpp +++ b/libs/JSystem/src/JUtility/JUTResFont.cpp @@ -7,6 +7,8 @@ #include "JSystem/JUtility/JUTConsole.h" #include +#include "dusk/version.hpp" + JUTResFont::JUTResFont() { initialize_state(); JUTFont::initialize_state(); @@ -68,8 +70,16 @@ void JUTResFont::initJoinedTexture() { int pageCount = 0; u32 pageNumCells = block.numRows * block.numColumns; - for (u32 code = block.startCode; code < block.endCode; code += pageNumCells) { - pageCount += 1; + + if (dusk::version::getGameVersion() == dusk::version::GameVersion::GcnJpn) { + pageCount = 1; + if (pageNumCells > 0 && block.endCode > block.startCode) { + pageCount = (block.endCode - block.startCode + pageNumCells - 1) / pageNumCells; + } + } else { + for (u32 code = block.startCode; code < block.endCode; code += pageNumCells) { + pageCount += 1; + } } mJoinedTextureHeight = block.textureHeight * pageCount; @@ -273,12 +283,19 @@ f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, i u16 texW = mpGlyphBlocks[field_0x66]->textureWidth; #if TARGET_PC - u16 texH = mJoinedTextureHeight; + // JUTCacheFont does not set mJoinedTextureHeight (it uses per-page textures via loadImage override). + // Fall back to the individual glyph block's textureHeight in that case. + u16 texH = mJoinedTextureHeight > 0 ? (u16)mJoinedTextureHeight : (u16)mpGlyphBlocks[field_0x66]->textureHeight; #else u16 texH = mpGlyphBlocks[field_0x66]->textureHeight; #endif - u16 cellW = mpGlyphBlocks[field_0x66]->cellWidth; +#if AVOID_UB + if (texW == 0) texW = 1; + if (texH == 0) texH = 1; +#endif + + u16 cellW = mpGlyphBlocks[field_0x66]->cellWidth; u16 cellH = mpGlyphBlocks[field_0x66]->cellHeight; s32 u1 = (mWidth * 0x8000) / texW; s32 v1 = (mHeight * 0x8000) / texH; From 241927b4894fa7c51d675682e825225c64175a57 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Thu, 16 Jul 2026 19:53:47 -0700 Subject: [PATCH 06/14] fix jp name screen --- src/d/d_name.cpp | 200 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 144 insertions(+), 56 deletions(-) diff --git a/src/d/d_name.cpp b/src/d/d_name.cpp index 50d861d1b9..2f3970bb2f 100644 --- a/src/d/d_name.cpp +++ b/src/d/d_name.cpp @@ -17,6 +17,12 @@ static bool isPalOrJpn() { return dusk::version::isRegionPal() || dusk::version::isRegionJpn(); } +#if TARGET_PC +#define SJIS_MOJI(wmoji) ((static_cast(static_cast((wmoji)[0])) << 8) | static_cast((wmoji)[1])) +#else +#define SJIS_MOJI(wmoji) *(u16*)wmoji +#endif + #if TARGET_PC static const char* l_mojiHira[65] = { "\x82\xA0", "\x82\xA2", "\x82\xA4", "\x82\xA6", "\x82\xA8", "\x82\xA9", "\x82\xAB", "\x82\xAD", "\x82\xAF", "\x82\xB1", "\x82\xB3", "\x82\xB5", "\x82\xB7", @@ -46,7 +52,7 @@ static const char* l_mojikata[65] = { "\x83\x41", "\x83\x43", "\x83\x45", "\x83\x47", "\x83\x49", "\x83\x4A", "\x83\x4C", "\x83\x4E", "\x83\x50", "\x83\x52", "\x83\x54", "\x83\x56", "\x83\x58", "\x83\x5A", "\x83\x5C", "\x83\x5E", "\x83\x60", "\x83\x63", "\x83\x65", "\x83\x67", "\x83\x69", "\x83\x6A", "\x83\x6B", "\x83\x6C", "\x83\x6D", "\x83\x6E", "\x83\x71", "\x83\x74", "\x83\x77", "\x83\x7A", "\x83\x7D", "\x83\x7E", "\x83\x80", "\x83\x81", "\x83\x82", "\x83\x84", "\x81\x40", "\x83\x86", "\x81\x40", - "\x83\x88", "\x83\x89", "\x83\x8A", "\x83\x8B", "\x83\x8C", "\x83\x8D", "\x83\x8F", "\x81\x40", "\x83\x93", "\x81\x40", "\x83\x93", "\x83\x40", "\x83\x42" + "\x83\x88", "\x83\x89", "\x83\x8A", "\x83\x8B", "\x83\x8C", "\x83\x8D", "\x83\x8F", "\x81\x40", "\x83\x93", "\x81\x40", "\x83\x93", "\x83\x40", "\x83\x42", "\x83\x44", "\x83\x46", "\x83\x48", "\x83\x83", "\x81\x40", "\x83\x85", "\x81\x40", "\x83\x87", "\x83\x62", "\x81\x40", "\x81\x5B", "\x81\x4A", "\x81\x4B", }; @@ -163,7 +169,7 @@ static const char* l_mojiEisuPal_2[65] = { #if TARGET_PC // ' ' (full-width space) -#define SPACE_MAYBE_FULL (dusk::version::isRegionJpn() ? '\x81\x40' : ' ') +#define SPACE_MAYBE_FULL (dusk::version::isRegionJpn() ? 0x8140U : ' ') #elif REGION_JPN // ' ' (full-width space) #define SPACE_MAYBE_FULL '\x81\x40' @@ -430,7 +436,7 @@ int dName_c::nameCheck() { #if REGION_JPN if (mChrInfo[len].mCharacter != ' ' && mChrInfo[len].mCharacter != '\x81\x40') { #else - if (mChrInfo[len].mCharacter != ' ' IF_DUSK(&& (!dusk::version::isRegionJpn() || mChrInfo[len].mCharacter != '\x81\x40'))) { + if (mChrInfo[len].mCharacter != ' ' IF_DUSK(&& (!dusk::version::isRegionJpn() || mChrInfo[len].mCharacter != 0x8140U))) { #endif return len + 1; } @@ -449,7 +455,12 @@ void dName_c::playNameSet(int nameLength) { *str = mChrInfo[i].mCharacter; str += 1; } else { + #if TARGET_PC + str[0] = mChrInfo[i].mCharacter >> 8; + str[1] = mChrInfo[i].mCharacter & 0xFF; + #else *(u16*)str = mChrInfo[i].mCharacter; + #endif str += 2; } #else @@ -682,30 +693,41 @@ int dName_c::mojiChange(u8 idx) { } void dName_c::selectMojiSet() { - #if REGION_JPN - int moji = getMoji(); - if (moji != -1) { - if (moji == '゛' || moji == '゜') { - if (mCurPos != 0) { - if (checkDakuon(moji, mCurPos - 1) == 1) { - mDoAud_seStart(Z2SE_SY_NAME_INPUT, NULL, 0, 0); - setDakuon(moji, mCurPos - 1); - } else { - mDoAud_seStart(Z2SE_SYS_ERROR, NULL, 0, 0); +#if TARGET_PC || REGION_JPN + #if TARGET_PC + if (dusk::version::isRegionJpn()) + #endif + { + int moji = getMoji(); + if (moji != -1) { + if (moji == SJIS('゛', 0x814AU) || moji == SJIS('゜', 0x814BU)) { + if (mCurPos != 0) { + if (checkDakuon(moji, mCurPos - 1) == 1) { + mDoAud_seStart(Z2SE_SY_NAME_INPUT, NULL, 0, 0); + setDakuon(moji, mCurPos - 1); + } else { + mDoAud_seStart(Z2SE_SYS_ERROR, NULL, 0, 0); + } } + } else { + setMoji(moji); } - } else { - setMoji(moji); } } + #if TARGET_PC + else { + setMoji(getMoji()); + } + #endif + setNameText(); - #else +#else setMoji(getMoji()); setNameText(); - #endif +#endif } -#if REGION_JPN +#if TARGET_PC || REGION_JPN int dName_c::checkDakuon(int param_0, u8 param_1) { if (mChrInfo[param_1].mMojiSet == MOJI_EIGO) { return 0; @@ -715,17 +737,17 @@ int dName_c::checkDakuon(int param_0, u8 param_1) { return 0; } - if (param_0 == '゜' && mChrInfo[param_1].mColumn != 5) { + if (param_0 == SJIS('゜', 0x814BU) && mChrInfo[param_1].mColumn != 5) { return 0; } - if (param_0 == '゛' && - (mChrInfo[param_1].mCharacter == 'ウ' || mChrInfo[param_1].mCharacter == 'ヴ')) + if (param_0 == SJIS('゛', 0x814AU) && + (mChrInfo[param_1].mCharacter == SJIS('ウ', 0x8345U) || mChrInfo[param_1].mCharacter == SJIS('ヴ', 0x8394U))) { return 1; } - if (param_0 == '゛' && mChrInfo[param_1].mColumn != 1 && mChrInfo[param_1].mColumn != 2 && + if (param_0 == SJIS('゛', 0x814AU) && mChrInfo[param_1].mColumn != 1 && mChrInfo[param_1].mColumn != 2 && mChrInfo[param_1].mColumn != 3 && mChrInfo[param_1].mColumn != 5) { return 0; @@ -737,46 +759,46 @@ int dName_c::checkDakuon(int param_0, u8 param_1) { int dName_c::setDakuon(int param_1, u8 param_2) { int c; - if (param_1 == '゛') { + if (param_1 == SJIS('゛', 0x814AU)) { switch (mChrInfo[param_2].mColumn) { case 0: { c = -1; - if (mChrInfo[param_2].mCharacter == 'ウ' || mChrInfo[param_2].mCharacter == 'ヴ') { + if (mChrInfo[param_2].mCharacter == SJIS('ウ', 0x8345U) || mChrInfo[param_2].mCharacter == SJIS('ヴ', 0x8394U)) { c = 4; - mChrInfo[param_2].mCharacter = 'ヴ'; + mChrInfo[param_2].mCharacter = SJIS('ヴ', 0x8394U); } break; } case 1: { - int c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? 'カ' : 'か'; + int c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? SJIS('カ', 0x834AU) : SJIS('か', 0x82A9U); c = (mChrInfo[param_2].mCharacter - c2) % 2; break; } case 2: { - int c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? 'サ' : 'さ'; + int c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? SJIS('サ', 0x8354U) : SJIS('さ', 0x82B3U); c = (mChrInfo[param_2].mCharacter - c2) % 2; break; } case 3: { int c2; if (mChrInfo[param_2].mCharacter <= - ((mChrInfo[param_2].mMojiSet != MOJI_HIRA ? 'ヂ' : 'ぢ'))) + ((mChrInfo[param_2].mMojiSet != MOJI_HIRA ? SJIS('ヂ', 0x8361U) : SJIS('ぢ', 0x82C0U)))) { - c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? 'タ' : 'た'; + c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? SJIS('タ', 0x835EU) : SJIS('た', 0x82BDU); c = (mChrInfo[param_2].mCharacter - c2) % 2; } else { - if (mChrInfo[param_2].mCharacter <= (mChrInfo[param_2].mMojiSet != 0 ? 'ド' : 'ど')) + if (mChrInfo[param_2].mCharacter <= (mChrInfo[param_2].mMojiSet != 0 ? SJIS('ド', 0x8368U) : SJIS('ど', 0x82C7U))) { if (mChrInfo[param_2].mCharacter >= - (mChrInfo[param_2].mMojiSet != 0 ? 'テ' : 'て')) + (mChrInfo[param_2].mMojiSet != 0 ? SJIS('テ', 0x8365U) : SJIS('て', 0x82C4U))) { - c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? 'テ' : 'て'; + c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? SJIS('テ', 0x8365U) : SJIS('て', 0x82C4U); c = (mChrInfo[param_2].mCharacter - c2) % 2; break; } } - c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? 'ッ' : 'っ'; + c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? SJIS('ッ', 0x8362U) : SJIS('っ', 0x82C1U); c = (mChrInfo[param_2].mCharacter - c2) % 3; if (c == 2) { c = 1; @@ -789,7 +811,7 @@ int dName_c::setDakuon(int param_1, u8 param_2) { break; } case 5: { - int c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? 'ハ' : 'は'; + int c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? SJIS('ハ', 0x836EU) : SJIS('は', 0x82CDU); c = (mChrInfo[param_2].mCharacter - c2) % 3; break; } @@ -808,8 +830,8 @@ int dName_c::setDakuon(int param_1, u8 param_2) { return 1; } - } else if (param_1 == '゜') { - int c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? 'ハ' : 'は'; + } else if (param_1 == SJIS('゜', 0x814BU)) { + int c2 = mChrInfo[param_2].mMojiSet != MOJI_HIRA ? SJIS('ハ', 0x836EU) : SJIS('は', 0x82CDU); c = (mChrInfo[param_2].mCharacter - c2) % 3; if (c != 2) { mChrInfo[param_2].mCharacter = mChrInfo[param_2].mCharacter + (2 - c); @@ -880,7 +902,7 @@ int dName_c::getMoji() { #if TARGET_PC if (dusk::version::isRegionJpn()) { if (*(u8*)moji >> 4 == 0x8 || *(u8*)moji >> 4 == 0x9) { - result = *(u16*)moji; + result = SJIS_MOJI(moji); } else { result = *moji; } @@ -962,8 +984,8 @@ void dName_c::setNameText() { //"\x1bCD\x1bCR\x1bCC[000000]\x1bGM[0]%c\x1bHM\x1bCC[ffffff]\x1bGM[0]%c" //"\x1bCD\x1bCR\x1bCC[000000]\x1bGM[0]%c%c\x1bHM\x1bCC[ffffff]\x1bGM[0]%c%c" if (mChrInfo[i].field_0x3 != 0) { - #if REGION_JPN - if (mChrInfo[i].mMojiSet == 2) { + #if TARGET_PC || REGION_JPN + if (IF_DUSK(!dusk::version::isRegionJpn() ||) mChrInfo[i].mMojiSet == 2) { #endif SAFE_SPRINTF(mNameText[i], "\x1b" @@ -974,7 +996,7 @@ void dName_c::setNameText() { CHAR_TRUNC((u8)mChrInfo[i].mCharacter), CHAR_TRUNC((u8)mChrInfo[i].mCharacter) ); - #if REGION_JPN + #if TARGET_PC || REGION_JPN } else { SAFE_SPRINTF(mNameText[i], "\x1b" @@ -1062,7 +1084,7 @@ void dName_c::selectCursorMove() { g_nmHIO.mSelCharScale); ((J2DTextBox*)mMojiIcon[mCharRow + mCharColumn * 5]->getPanePtr()) ->setWhite(JUtility::TColor(0xC8, 0xC8, 0xC8, 0xFF)); - + #if TARGET_PC nameWide(); #endif @@ -1493,7 +1515,7 @@ void dName_c::nameWide() { for (PaneCache& entry : l_tagName) { J2DPane* pane = nameIn.NameInScr->search(entry.tag); if (!entry.cached) { - entry.origTransX = pane->getTranslateX(); + entry.origTransX = pane->getTranslateX(); entry.origTransY = pane->getTranslateY(); entry.cached = true; } @@ -1501,7 +1523,7 @@ void dName_c::nameWide() { for (PaneCache& entry : l_nameTagName) { J2DPane* pane = nameIn.NameInScr->search(entry.tag); if (!entry.cached) { - entry.origTransX = pane->getTranslateX(); + entry.origTransX = pane->getTranslateX(); entry.origTransY = pane->getTranslateY(); entry.cached = true; } @@ -1509,7 +1531,7 @@ void dName_c::nameWide() { for (PaneCache& entry : l_nameCurTagName) { J2DPane* pane = nameIn.NameInScr->search(entry.tag); if (!entry.cached) { - entry.origTransX = pane->getTranslateX(); + entry.origTransX = pane->getTranslateX(); entry.origTransY = pane->getTranslateY(); entry.cached = true; } @@ -1587,7 +1609,42 @@ void dName_c::screenSet() { static u64 l_cur1TagName[8] = { 's_0r', MULTI_CHAR('s_01r'), MULTI_CHAR('s_02r'), MULTI_CHAR('s_03r'), MULTI_CHAR('s_04r'), MULTI_CHAR('s_05r'), MULTI_CHAR('s_06r'), MULTI_CHAR('s_07r'), }; -#if REGION_JPN + +#if TARGET_PC + static u64 l_menu_icon_tag_jpn[4] = { + MULTI_CHAR('j_hira_n'), + MULTI_CHAR('j_kata_n'), + MULTI_CHAR('j_eigo_n'), + MULTI_CHAR('j_end_n'), + }; + static u64 l_menu_tag_jpn[5][3] = { + MULTI_CHAR('m_hira_0'), MULTI_CHAR('m_hira_1'), MULTI_CHAR('m_hira_s'), MULTI_CHAR('m_kata_0'), MULTI_CHAR('m_kata_1'), MULTI_CHAR('m_kata_s'), + MULTI_CHAR('m_eigo_0'), MULTI_CHAR('m_eigo_1'), MULTI_CHAR('m_eigo_s'), MULTI_CHAR('j_end_0'), MULTI_CHAR('j_end_1'), MULTI_CHAR('j_end_s'), + }; + static u32 l_menu_msg_jpn[4] = { + 0x386, + 0x387, + 0x388, + 0x38A, + }; + + static u64 l_menu_icon_tag[4] = { + MULTI_CHAR('p_ABC_n'), + MULTI_CHAR('p_abc_n'), + MULTI_CHAR('j_eigo_n'), + MULTI_CHAR('p_end_n'), + }; + static u64 l_menu_tag[5][3] = { + MULTI_CHAR('p_ABC_0'), MULTI_CHAR('p_ABC_1'), MULTI_CHAR('p_ABC_2'), MULTI_CHAR('p_abc_0'), MULTI_CHAR('p_abc_1'), MULTI_CHAR('p_abc_2'), + MULTI_CHAR('m_eigo_0'), MULTI_CHAR('m_eigo_1'), MULTI_CHAR('m_eigo_2'), MULTI_CHAR('p_end_0'), MULTI_CHAR('p_end_1'), MULTI_CHAR('p_end_2'), + }; + static u32 l_menu_msg[4] = { + 0x38B, + 0x38C, + 0x388, + 0x38E, + }; +#elif REGION_JPN static u64 l_menu_icon_tag[4] = { MULTI_CHAR('j_hira_n'), MULTI_CHAR('j_kata_n'), @@ -1669,7 +1726,26 @@ void dName_c::screenSet() { panes1[i]->setAnimation(mCursorColorKey); } - #if REGION_JPN + #if TARGET_PC + if (dusk::version::isRegionJpn()) { + nameIn.NameInScr->search(MULTI_CHAR('pal_n'))->hide(); + mMenuPane = nameIn.NameInScr->search(MULTI_CHAR('jpn_n')); + mMenuPane->show(); + + nameIn.NameInScr->search(MULTI_CHAR('p_ABC_n'))->scale(0.0f, 0.0f); + nameIn.NameInScr->search(MULTI_CHAR('p_abc_n'))->scale(0.0f, 0.0f); + nameIn.NameInScr->search(MULTI_CHAR('p_end_n'))->scale(0.0f, 0.0f); + } else { + nameIn.NameInScr->search(MULTI_CHAR('jpn_n'))->hide(); + mMenuPane = nameIn.NameInScr->search(MULTI_CHAR('pal_n')); + mMenuPane->show(); + + nameIn.NameInScr->search(MULTI_CHAR('j_hira_n'))->scale(0.0f, 0.0f); + nameIn.NameInScr->search(MULTI_CHAR('j_kata_n'))->scale(0.0f, 0.0f); + nameIn.NameInScr->search(MULTI_CHAR('j_eigo_n'))->scale(0.0f, 0.0f); + nameIn.NameInScr->search(MULTI_CHAR('j_end_n'))->scale(0.0f, 0.0f); + } + #elif REGION_JPN nameIn.NameInScr->search(MULTI_CHAR('pal_n'))->hide(); mMenuPane = nameIn.NameInScr->search(MULTI_CHAR('jpn_n')); mMenuPane->show(); @@ -1690,19 +1766,31 @@ void dName_c::screenSet() { J2DTextBox* menuPane[3]; for (int i = 0; i < 4; i++) { - #if !REGION_JPN - if (i == 2) { + #if TARGET_PC || !REGION_JPN + if (IF_DUSK(!dusk::version::isRegionJpn() &&) i == 2) { mMenuIcon[i] = NULL; mMenuText[i] = NULL; } else { #endif + #if TARGET_PC + mMenuIcon[i] = JKR_NEW CPaneMgr(nameIn.NameInScr, dusk::version::isRegionJpn() ? l_menu_icon_tag_jpn[i] : l_menu_icon_tag[i], 1, NULL); + #else mMenuIcon[i] = JKR_NEW CPaneMgr(nameIn.NameInScr, l_menu_icon_tag[i], 1, NULL); + #endif char buf[16]; + #if TARGET_PC + fopMsgM_messageGet(buf, dusk::version::isRegionJpn() ? l_menu_msg_jpn[i] : l_menu_msg[i]); + #else fopMsgM_messageGet(buf, l_menu_msg[i]); + #endif for (int j = 0; j < 3; j++) { + #if TARGET_PC + menuPane[j] = (J2DTextBox*)nameIn.NameInScr->search(dusk::version::isRegionJpn() ? l_menu_tag_jpn[i][j] : l_menu_tag[i][j]); + #else menuPane[j] = (J2DTextBox*)nameIn.NameInScr->search(l_menu_tag[i][j]); + #endif if (j == 0) { mMenuText[i] = menuPane[j]; @@ -1711,7 +1799,7 @@ void dName_c::screenSet() { menuPane[j]->setFont(nameIn.font); menuPane[j]->setString(buf); } - #if !REGION_JPN + #if TARGET_PC || !REGION_JPN } #endif } @@ -1852,20 +1940,20 @@ void dName_c::NameStrSet() { i++; } else { if (*(u8*)moji >> 4 == 8 || *(u8*)moji >> 4 == 9) { - mChrInfo[i].mCharacter = *(u16*)moji; + mChrInfo[i].mCharacter = SJIS_MOJI(moji); for (int j = 0; j < 65; j++) { - if (mChrInfo[i].mCharacter == *(u16*)l_mojiHira[j] || - mChrInfo[i].mCharacter == *(u16*)l_mojiHira2[j] || - mChrInfo[i].mCharacter == *(u16*)l_mojiHira3[j]) + if (mChrInfo[i].mCharacter == SJIS_MOJI(l_mojiHira[j]) || + mChrInfo[i].mCharacter == SJIS_MOJI(l_mojiHira2[j]) || + mChrInfo[i].mCharacter == SJIS_MOJI(l_mojiHira3[j])) { mChrInfo[i].mColumn = j / 5; mChrInfo[i].mRow = j % 5; mChrInfo[i].mMojiSet = MOJI_HIRA; break; - } else if (mChrInfo[i].mCharacter == *(u16*)l_mojikata[j] || - mChrInfo[i].mCharacter == *(u16*)l_mojikata2[j] || - mChrInfo[i].mCharacter == *(u16*)l_mojikata3[j]) + } else if (mChrInfo[i].mCharacter == SJIS_MOJI(l_mojikata[j]) || + mChrInfo[i].mCharacter == SJIS_MOJI(l_mojikata2[j]) || + mChrInfo[i].mCharacter == SJIS_MOJI(l_mojikata3[j])) { mChrInfo[i].mColumn = j / 5; mChrInfo[i].mRow = j % 5; From 1654d256ecf2824097f6b71dc21227bfb611427a Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Thu, 16 Jul 2026 20:06:37 -0700 Subject: [PATCH 07/14] mant/flower jp offsets --- src/d/actor/d_a_mant.cpp | 12 ++++++------ src/d/actor/d_flower.inc | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/d/actor/d_a_mant.cpp b/src/d/actor/d_a_mant.cpp index 956bd6cc72..449efcd672 100644 --- a/src/d/actor/d_a_mant.cpp +++ b/src/d/actor/d_a_mant.cpp @@ -18,9 +18,9 @@ using GameVersion = dusk::version::GameVersion; // keep the original version of the cape texture const so we don't need to reload the file -static u8 const * l_Egnd_mantTEX_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x1C00}, {GameVersion::GcnPal, 0x1C00}}, 0x4000), true); return buf; } -static u8* l_Egnd_mantTEX_U_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x5C00}, {GameVersion::GcnPal, 0x5C00}}, 0x4000), true); return buf; } -static u8* l_Egnd_mantPAL_get() { alignas(32) static u8 buf[0x60]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x9C00}, {GameVersion::GcnPal, 0x9C00}}, 0x60), true); return buf; } +static u8 const * l_Egnd_mantTEX_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x1C00}, {GameVersion::GcnPal, 0x1C00}, {GameVersion::GcnJpn, 0x1C00}}, 0x4000), true); return buf; } +static u8* l_Egnd_mantTEX_U_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x5C00}, {GameVersion::GcnPal, 0x5C00}, {GameVersion::GcnJpn, 0x5C00}}, 0x4000), true); return buf; } +static u8* l_Egnd_mantPAL_get() { alignas(32) static u8 buf[0x60]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x9C00}, {GameVersion::GcnPal, 0x9C00}, {GameVersion::GcnJpn, 0x9C00}}, 0x60), true); return buf; } #define l_Egnd_mantTEX (l_Egnd_mantTEX_get()) #define l_Egnd_mantTEX_U (l_Egnd_mantTEX_U_get()) #define l_Egnd_mantPAL (l_Egnd_mantPAL_get()) @@ -36,8 +36,8 @@ static TGXTexObj undersideTexObj; // l_pos is unused //static f32* l_pos_get() { alignas(32) static f32 buf[507]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0xA44C}, {GameVersion::GcnPal, 0xA44C}}, sizeof(buf)), true); return buf; } -static f32* l_normal_get() { alignas(32) static f32 buf[3]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x9C60}, {GameVersion::GcnPal, 0x9C60}}, sizeof(buf)), true); return buf; } -static f32* l_texCoord_get() { alignas(32) static f32 buf[338]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0xA458}, {GameVersion::GcnPal, 0xA458}}, sizeof(buf)), true); return buf; } +static f32* l_normal_get() { alignas(32) static f32 buf[3]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0x9C60}, {GameVersion::GcnPal, 0x9C60}, {GameVersion::GcnJpn, 0x9C60}}, sizeof(buf)), true); return buf; } +static f32* l_texCoord_get() { alignas(32) static f32 buf[338]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0xA458}, {GameVersion::GcnPal, 0xA458}, {GameVersion::GcnJpn, 0xA458}}, sizeof(buf)), true); return buf; } //#define l_pos (l_pos_get()) #define l_normal (l_normal_get()) #define l_texCoord (l_texCoord_get()) @@ -55,7 +55,7 @@ static bool l_Egnd_mantTEX_hasReplacement = false; #if TARGET_PC using GameVersion = dusk::version::GameVersion; -static u8* l_Egnd_mantDL_get() { alignas(32) static u8 buf[0x3EC]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0xA9A0}, {GameVersion::GcnPal, 0xA9A0}}, 0x3EC), true); return buf; } +static u8* l_Egnd_mantDL_get() { alignas(32) static u8 buf[0x3EC]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", {{GameVersion::GcnUsa, 0xA9A0}, {GameVersion::GcnPal, 0xA9A0}, {GameVersion::GcnJpn, 0xA9A0}}, 0x3EC), true); return buf; } #define l_Egnd_mantDL (l_Egnd_mantDL_get()) #else #include "assets/l_Egnd_mantDL.h" diff --git a/src/d/actor/d_flower.inc b/src/d/actor/d_flower.inc index accaff88fa..f8fe0bed10 100644 --- a/src/d/actor/d_flower.inc +++ b/src/d/actor/d_flower.inc @@ -142,7 +142,7 @@ const u16 l_J_Ohana01_64128_0419TEX__height = 127; #if TARGET_PC using GameVersion = dusk::version::GameVersion; -static u8* l_J_Ohana01_64128_0419TEX_get() { static u8 buf[0x1000]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xA0A0}, {GameVersion::GcnPal, 0xA0A0}}, 0x1000), true); return buf; } +static u8* l_J_Ohana01_64128_0419TEX_get() { static u8 buf[0x1000]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xA0A0}, {GameVersion::GcnPal, 0xA0A0}, {GameVersion::GcnJpn, 0xA0A0}}, 0x1000), true); return buf; } #define l_J_Ohana01_64128_0419TEX (l_J_Ohana01_64128_0419TEX_get()) #else #include "assets/l_J_Ohana01_64128_0419TEX.h" From ce386d8dbdfb5a13cdd915fb34166398499d377e Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Fri, 17 Jul 2026 18:12:28 -0700 Subject: [PATCH 08/14] convert jpn ui/text changes to runtime checks --- include/d/d_menu_option.h | 18 +- include/d/d_msg_class.h | 6 +- include/d/d_msg_unit.h | 4 + include/d/d_timer.h | 2 +- src/d/d_file_sel_info.cpp | 29 +- src/d/d_file_sel_warning.cpp | 23 +- src/d/d_file_select.cpp | 111 ++++++- src/d/d_menu_collect.cpp | 202 ++++++++++-- src/d/d_menu_dmap.cpp | 91 +++++- src/d/d_menu_fishing.cpp | 11 +- src/d/d_menu_fmap2D.cpp | 139 +++++++-- src/d/d_menu_insect.cpp | 27 +- src/d/d_menu_item_explain.cpp | 36 ++- src/d/d_menu_letter.cpp | 233 ++++++++++++-- src/d/d_menu_option.cpp | 573 ++++++++++++++++++++++++++-------- src/d/d_menu_ring.cpp | 147 ++++++--- src/d/d_menu_save.cpp | 131 ++++++-- src/d/d_menu_skill.cpp | 55 +++- src/d/d_meter2_draw.cpp | 14 +- src/d/d_meter2_info.cpp | 39 ++- src/d/d_meter_button.cpp | 83 ++++- src/d/d_msg_class.cpp | 136 ++++++-- src/d/d_msg_object.cpp | 7 + src/d/d_msg_out_font.cpp | 17 +- src/d/d_msg_scrn_3select.cpp | 112 ++++++- src/d/d_msg_scrn_boss.cpp | 7 +- src/d/d_msg_scrn_explain.cpp | 75 ++++- src/d/d_msg_scrn_howl.cpp | 37 ++- src/d/d_msg_scrn_item.cpp | 50 ++- src/d/d_msg_scrn_jimaku.cpp | 53 +++- src/d/d_msg_scrn_kanban.cpp | 45 ++- src/d/d_msg_scrn_place.cpp | 13 +- src/d/d_msg_scrn_talk.cpp | 92 +++++- src/d/d_msg_scrn_tree.cpp | 50 ++- src/d/d_msg_unit.cpp | 205 +++++++++++- src/d/d_save.cpp | 7 +- src/d/d_timer.cpp | 29 +- 37 files changed, 2467 insertions(+), 442 deletions(-) diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index 03aca42808..49e81f98ae 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -17,6 +17,20 @@ class dSelect_cursor_c; class dMenu_Option_c : public dDlst_base_c { public: + enum { + PROC_ATTEN_e, +#if TARGET_PC || VERSION == VERSION_GCN_JPN + PROC_RUBY_e, +#endif + PROC_VIB_e, + PROC_SOUND_e, + PROC_CHANGE_MOVE_e, + PROC_CONFIRM_OPEN_MOVE_e, + PROC_CONFIRM_MOVE_MOVE_e, + PROC_CONFIRM_SELECT_MOVE_e, + PROC_CONFIRM_CLOSE_MOVE_e, + }; + dMenu_Option_c(JKRArchive*, STControl*); void _create(); void _delete(); @@ -31,7 +45,7 @@ public: bool _close(); void atten_init(); void atten_move(); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN void ruby_init(); void ruby_move(); #endif @@ -189,7 +203,7 @@ private: /* 0x3E2 */ u8 field_0x3e2; /* 0x3E3 */ u8 field_0x3e3; /* 0x3E4 */ u8 field_0x3e4; -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN /* 0x3E5 */ u8 field_0x3e5_JPN; #endif /* 0x3E5 */ u8 field_0x3e5; diff --git a/include/d/d_msg_class.h b/include/d/d_msg_class.h index 5292eed5d3..a8bba32351 100644 --- a/include/d/d_msg_class.h +++ b/include/d/d_msg_class.h @@ -7,7 +7,11 @@ #include "helpers/endian.h" #include "helpers/string.hpp" -#if REGION_JPN +#if TARGET_PC +#define D_MSG_CLASS_PAGE_CNT_MAX 40 +#define D_MSG_CLASS_CHAR_CNT_MAX 0x210 +#define D_MSG_CLASS_LINE_MAX 12 +#elif REGION_JPN #define D_MSG_CLASS_PAGE_CNT_MAX 30 #define D_MSG_CLASS_CHAR_CNT_MAX 0x210 #define D_MSG_CLASS_LINE_MAX 9 diff --git a/include/d/d_msg_unit.h b/include/d/d_msg_unit.h index c48d89d0e0..59e0a81183 100644 --- a/include/d/d_msg_unit.h +++ b/include/d/d_msg_unit.h @@ -8,6 +8,10 @@ public: dMsgUnit_c(); void setTag(int, int, TEXT_SPAN, bool); +#if TARGET_PC + void setTag_jpn(int, int, TEXT_SPAN, bool); +#endif + virtual ~dMsgUnit_c(); }; diff --git a/include/d/d_timer.h b/include/d/d_timer.h index 9d3bd7ce1f..104a4cae9e 100644 --- a/include/d/d_timer.h +++ b/include/d/d_timer.h @@ -52,7 +52,7 @@ public: s32 createStart(u16); bool checkStartAnimeEnd(); void playBckAnimation(f32); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN bool isLeadByte(int); #endif void drawPikari(int); diff --git a/src/d/d_file_sel_info.cpp b/src/d/d_file_sel_info.cpp index e107d6dacc..70bd101aa0 100644 --- a/src/d/d_file_sel_info.cpp +++ b/src/d/d_file_sel_info.cpp @@ -46,8 +46,19 @@ void dFile_info_c::screenSet() { J2DTextBox* info_text[4]; - - #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) + #if TARGET_PC + if (dusk::version::isRegionJpn()) { + info_text[0] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('w_s_t_01')); + info_text[1] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('w_p_t_01')); + mFileInfo.Scr->search(MULTI_CHAR('f_s_t_02'))->hide(); + mFileInfo.Scr->search(MULTI_CHAR('f_p_t_02'))->hide(); + } else { + info_text[0] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('f_s_t_02')); + info_text[1] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('f_p_t_02')); + mFileInfo.Scr->search(MULTI_CHAR('w_s_t_01'))->hide(); + mFileInfo.Scr->search(MULTI_CHAR('w_p_t_01'))->hide(); + } + #elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) info_text[0] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('w_s_t_01')); info_text[1] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('w_p_t_01')); mFileInfo.Scr->search(MULTI_CHAR('f_s_t_02'))->hide(); @@ -66,7 +77,19 @@ void dFile_info_c::screenSet() { dMeter2Info_getString(0x3D0, info_text[0]->getStringPtr(), NULL); // Save time dMeter2Info_getString(0x3D1, info_text[1]->getStringPtr(), NULL); // Total play time - #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) + #if TARGET_PC + if (dusk::version::isRegionJpn()) { + info_text[0] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('w_name01')); + info_text[1] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('w_new_1')); + mFileInfo.Scr->search(MULTI_CHAR('f_name01'))->hide(); + mFileInfo.Scr->search(MULTI_CHAR('f_new_1'))->hide(); + } else { + info_text[0] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('f_name01')); + info_text[1] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('f_new_1')); + mFileInfo.Scr->search(MULTI_CHAR('w_name01'))->hide(); + mFileInfo.Scr->search(MULTI_CHAR('w_new_1'))->hide(); + } + #elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) info_text[0] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('w_name01')); info_text[1] = (J2DTextBox*)mFileInfo.Scr->search(MULTI_CHAR('w_new_1')); mFileInfo.Scr->search(MULTI_CHAR('f_name01'))->hide(); diff --git a/src/d/d_file_sel_warning.cpp b/src/d/d_file_sel_warning.cpp index e2d767453b..fc17e05a0d 100644 --- a/src/d/d_file_sel_warning.cpp +++ b/src/d/d_file_sel_warning.cpp @@ -4,13 +4,14 @@ #include "d/dolzel.h" // IWYU pragma: keep +#include "JSystem/J2DGraph/J2DAnmLoader.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/J2DGraph/J2DTextBox.h" +#include "d/d_com_inf_game.h" #include "d/d_file_sel_warning.h" #include "d/d_msg_string.h" #include "d/d_pane_class.h" -#include "JSystem/J2DGraph/J2DScreen.h" -#include "JSystem/J2DGraph/J2DAnmLoader.h" -#include "JSystem/J2DGraph/J2DTextBox.h" -#include "d/d_com_inf_game.h" +#include "dusk/version.hpp" typedef void (dFile_warning_c::*procFunc)(); static procFunc fileWarningProc[] = {&dFile_warning_c::modeWait, &dFile_warning_c::modeMove}; @@ -63,7 +64,19 @@ void dFile_warning_c::screenSet() { JUT_ASSERT(0, mpRootPane != NULL); field_0x34 = mpRootPane->getTranslateY(); -#if REGION_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mFileWarn.Scr->search(MULTI_CHAR('ms_for_2'))->hide(); + mFileWarn.Scr->search(MULTI_CHAR('ms_for_3'))->hide(); + + field_0x20 = static_cast(mFileWarn.Scr->search(MULTI_CHAR('w_msg_jp'))); + } else { + mFileWarn.Scr->search(MULTI_CHAR('w_msg_jp'))->hide(); + mFileWarn.Scr->search(MULTI_CHAR('ms_for_2'))->hide(); + + field_0x20 = static_cast(mFileWarn.Scr->search(MULTI_CHAR('ms_for_3'))); + } +#elif REGION_JPN mFileWarn.Scr->search(MULTI_CHAR('ms_for_2'))->hide(); mFileWarn.Scr->search(MULTI_CHAR('ms_for_3'))->hide(); diff --git a/src/d/d_file_select.cpp b/src/d/d_file_select.cpp index f57265aa77..98d60fa195 100644 --- a/src/d/d_file_select.cpp +++ b/src/d/d_file_select.cpp @@ -23,6 +23,8 @@ #include "m_Do/m_Do_graphic.h" #include +#include "dusk/version.hpp" + #if TARGET_PC #include "dusk/menu_pointer.h" #include "helpers/string.hpp" @@ -3184,8 +3186,10 @@ void dFile_select_c::screenSet() { static u64 l_nouseTag[15] = {MULTI_CHAR('w_mcheck'), MULTI_CHAR('w_tabi1'), MULTI_CHAR('w_tabi2'), MULTI_CHAR('w_tabi3'), MULTI_CHAR('w_doko_c'), MULTI_CHAR('w_uwa_c'), MULTI_CHAR('w_cp_chu'), MULTI_CHAR('w_cpsita'), MULTI_CHAR('w_cp_x'), 'w_de', MULTI_CHAR('w_de_chu'), MULTI_CHAR('w_desita'), MULTI_CHAR('w_de_x'), MULTI_CHAR('w_name'), MULTI_CHAR('w_h_name')}; - -#if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) +#if TARGET_PC + static u64 l_tagName21_jpn[2] = {MULTI_CHAR('w_tabi_s'), MULTI_CHAR('w_tabi_x')}; + static u64 l_tagName21[2] = {MULTI_CHAR('t_for'), MULTI_CHAR('t_for1')}; +#elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) static u64 l_tagName21[2] = {MULTI_CHAR('w_tabi_s'), MULTI_CHAR('w_tabi_x')}; #else static u64 l_tagName21[2] = {MULTI_CHAR('t_for'), MULTI_CHAR('t_for1')}; @@ -3194,7 +3198,10 @@ void dFile_select_c::screenSet() { static u64 l_tagName18[3] = {MULTI_CHAR('w_de_ef0'), MULTI_CHAR('w_de_ef1'), MULTI_CHAR('w_de_ef2')}; static u64 l_tagName19[3] = {MULTI_CHAR('w_cp_ef0'), MULTI_CHAR('w_cp_ef1'), MULTI_CHAR('w_cp_ef2')}; -#if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) +#if TARGET_PC + static u64 l_tagName20_jpn[2] = {MULTI_CHAR('w_er_msg'), MULTI_CHAR('w_er_msR')}; + static u64 l_tagName20[2] = {MULTI_CHAR('er_for0'), MULTI_CHAR('er_for1')}; +#elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) static u64 l_tagName20[2] = {MULTI_CHAR('w_er_msg'), MULTI_CHAR('w_er_msR')}; #else static u64 l_tagName20[2] = {MULTI_CHAR('er_for0'), MULTI_CHAR('er_for1')}; @@ -3230,7 +3237,19 @@ void dFile_select_c::screenSet() { mBbtnPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_n_bbtn'), 2, NULL); mAbtnPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_n_abtn'), 2, NULL); -#if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mModoruTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_modo'), 2, NULL); + mKetteiTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_kete'), 2, NULL); + fileSel.Scr->search(MULTI_CHAR('f_modo'))->hide(); + fileSel.Scr->search(MULTI_CHAR('f_kete'))->hide(); + } else { + mModoruTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('f_modo'), 2, NULL); + mKetteiTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('f_kete'), 2, NULL); + fileSel.Scr->search(MULTI_CHAR('w_modo'))->hide(); + fileSel.Scr->search(MULTI_CHAR('w_kete'))->hide(); + } +#elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) mModoruTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_modo'), 2, NULL); mKetteiTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_kete'), 2, NULL); fileSel.Scr->search(MULTI_CHAR('f_modo'))->hide(); @@ -3306,7 +3325,17 @@ void dFile_select_c::screenSet() { fileSel.Scr->search(l_nouseTag[i])->hide(); } -#if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + fileSel.Scr->search(MULTI_CHAR('t_for'))->hide(); + fileSel.Scr->search(MULTI_CHAR('t_for1'))->hide(); + } else { + fileSel.Scr->search(MULTI_CHAR('w_tabi_s'))->hide(); + fileSel.Scr->search(MULTI_CHAR('w_tabi_x'))->hide(); + fileSel.Scr->search(MULTI_CHAR('w_mgn1'))->hide(); + fileSel.Scr->search(MULTI_CHAR('w_mgn2'))->hide(); + } +#elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) fileSel.Scr->search(MULTI_CHAR('t_for'))->hide(); fileSel.Scr->search(MULTI_CHAR('t_for1'))->hide(); #else @@ -3317,10 +3346,20 @@ void dFile_select_c::screenSet() { #endif for (int i = 0; i < 2; i++) { - mHeaderTxtPane[i] = JKR_NEW CPaneMgrAlpha(fileSel.Scr, l_tagName21[i], 0, NULL); + mHeaderTxtPane[i] = JKR_NEW CPaneMgrAlpha(fileSel.Scr, DUSK_IF_ELSE(dusk::version::isRegionJpn() ? l_tagName21_jpn[i] : l_tagName21[i], l_tagName21[i]), 0, NULL); ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setFont(fileSel.font[0]); ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setString(512, ""); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setFontSize(21.0f, 21.0f); + ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setLineSpace(22.0f); + ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setCharSpace(2.0f); + } else { + ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setFontSize(24.0f, 24.0f); + ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setLineSpace(20.0f); + ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setCharSpace(0.0f); + } +#elif VERSION == VERSION_GCN_JPN ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setFontSize(21.0f, 21.0f); ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setLineSpace(22.0f); ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setCharSpace(2.0f); @@ -3361,8 +3400,15 @@ void dFile_select_c::screenSet() { field_0x0208 = 0; field_0x0209 = 0; mErrorMsgPane = fileSel.Scr->search(MULTI_CHAR('w_er_n')); - -#if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + fileSel.Scr->search(MULTI_CHAR('er_for0'))->hide(); + fileSel.Scr->search(MULTI_CHAR('er_for1'))->hide(); + } else { + fileSel.Scr->search(MULTI_CHAR('w_er_msg'))->hide(); + fileSel.Scr->search(MULTI_CHAR('w_er_msR'))->hide(); + } +#elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) fileSel.Scr->search(MULTI_CHAR('er_for0'))->hide(); fileSel.Scr->search(MULTI_CHAR('er_for1'))->hide(); #else @@ -3373,17 +3419,27 @@ void dFile_select_c::screenSet() { fileSel.Scr->search(MULTI_CHAR('w_er_msE'))->hide(); for (int i = 0; i < 2; i++) { - mErrorMsgTxtPane[i] = JKR_NEW CPaneMgrAlpha(fileSel.Scr, l_tagName20[i], 0, NULL); + mErrorMsgTxtPane[i] = JKR_NEW CPaneMgrAlpha(fileSel.Scr, DUSK_IF_ELSE(dusk::version::isRegionJpn() ? l_tagName20_jpn[i] : l_tagName20[i], l_tagName20[i]), 0, NULL); ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setFont(fileSel.font[0]); ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setString(512, ""); -#if (VERSION != VERSION_GCN_JPN) && (VERSION != VERSION_WII_JPN) +#if TARGET_PC || ((VERSION != VERSION_GCN_JPN) && (VERSION != VERSION_WII_JPN)) + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) mErrorMsgTxtPane[i]->getPanePtr()->resize(440.0f, 198.0f); + IF_DUSK_BLOCK_END #endif ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setFontSize(21.0f, 21.0f); -#if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setLineSpace(22.0f); + ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setCharSpace(2.0f); + } else { + ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setLineSpace(21.0f); + ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setCharSpace(1.0f); + } +#elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setLineSpace(22.0f); ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setCharSpace(2.0f); #else @@ -3579,7 +3635,15 @@ void dFile_select_c::screenSetYesNo() { for (int i = 0; i < 2; i++) { mYnSelPane[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName012[i], 0, NULL); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mYnSelTxtPane[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName013[i], 0, NULL); + mYnSel.ScrYn->search(l_tagName013U[i])->hide(); + } else { + mYnSelTxtPane[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName013U[i], 0, NULL); + mYnSel.ScrYn->search(l_tagName013[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN mYnSelTxtPane[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName013[i], 0, NULL); mYnSel.ScrYn->search(l_tagName013U[i])->hide(); #else @@ -3657,7 +3721,15 @@ void dFile_select_c::screenSet3Menu() { for (int i = 0; i < 3; i++) { m3mSelPane[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName1[i], 0, NULL); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + m3mSelTextPane[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName011[i], 0, NULL); + m3mSel.Scr3m->search(l_tagName011U[i])->hide(); + } else { + m3mSelTextPane[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName011U[i], 0, NULL); + m3mSel.Scr3m->search(l_tagName011[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN m3mSelTextPane[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName011[i], 0, NULL); m3mSel.Scr3m->search(l_tagName011U[i])->hide(); #else @@ -3777,7 +3849,12 @@ void dFile_select_c::headerTxtSet(u16 i_msgId, u8 i_type, u8 param_3) { SAFE_STRCPY(mHeaderStringPtr[dispIdx], ""); } else { static f32 fontsize[2] = {21.0f, 27.0f}; - #if VERSION == VERSION_GCN_JPN + #if TARGET_PC + static f32 linespace_jpn[2] = {22.0f, 20.0f}; + static f32 charspace_jpn[2] = {2.0f, 3.0f}; + static f32 linespace[2] = {21.0f, 20.0f}; + static f32 charspace[2] = {0.0f, 0.0f}; + #elif VERSION == VERSION_GCN_JPN static f32 linespace[2] = {22.0f, 20.0f}; static f32 charspace[2] = {2.0f, 3.0f}; #else @@ -3787,8 +3864,8 @@ void dFile_select_c::headerTxtSet(u16 i_msgId, u8 i_type, u8 param_3) { ((J2DTextBox*)mHeaderTxtPane[dispIdx]->getPanePtr())->setFont(fileSel.font[i_type]); ((J2DTextBox*)mHeaderTxtPane[dispIdx]->getPanePtr())->setFontSize(fontsize[i_type], fontsize[i_type]); - ((J2DTextBox*)mHeaderTxtPane[dispIdx]->getPanePtr())->setLineSpace(linespace[i_type]); - ((J2DTextBox*)mHeaderTxtPane[dispIdx]->getPanePtr())->setCharSpace(charspace[i_type]); + ((J2DTextBox*)mHeaderTxtPane[dispIdx]->getPanePtr())->setLineSpace(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? linespace_jpn[i_type] : linespace[i_type], linespace[i_type])); + ((J2DTextBox*)mHeaderTxtPane[dispIdx]->getPanePtr())->setCharSpace(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? charspace_jpn[i_type] : charspace[i_type], charspace[i_type])); fileSel.mMessageString->getString(i_msgId, ((J2DTextBox*)mHeaderTxtPane[dispIdx]->getPanePtr()), NULL, fileSel.font[i_type], NULL, 0); diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 4de8b2c5a4..28f964ec10 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -5,36 +5,37 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_menu_collect.h" -#include "JSystem/J3DGraphLoader/J3DModelLoader.h" -#include "JSystem/J3DGraphLoader/J3DAnmLoader.h" +#include +#include +#include "JSystem/J2DGraph/J2DAnmLoader.h" +#include "JSystem/J2DGraph/J2DGrafContext.h" #include "JSystem/J2DGraph/J2DTextBox.h" +#include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "JSystem/J3DGraphLoader/J3DAnmLoader.h" +#include "JSystem/J3DGraphLoader/J3DModelLoader.h" #include "JSystem/JKernel/JKRExpHeap.h" #include "JSystem/JKernel/JKRSolidHeap.h" #include "d/actor/d_a_alink.h" -#include "d/d_select_cursor.h" +#include "d/d_item.h" +#include "d/d_lib.h" +#include "d/d_menu_collect.h" #include "d/d_menu_fishing.h" #include "d/d_menu_insect.h" #include "d/d_menu_letter.h" #include "d/d_menu_option.h" #include "d/d_menu_save.h" #include "d/d_menu_skill.h" +#include "d/d_menu_window.h" +#include "d/d_meter2_info.h" #include "d/d_meter_HIO.h" #include "d/d_msg_class.h" #include "d/d_msg_object.h" #include "d/d_msg_string.h" #include "d/d_pane_class.h" -#include "d/d_item.h" -#include "d/d_lib.h" -#include "d/d_meter2_info.h" -#include -#include +#include "d/d_select_cursor.h" +#include "dusk/version.hpp" #include "m_Do/m_Do_graphic.h" #include "m_Do/m_Do_mtx.h" -#include "JSystem/J2DGraph/J2DAnmLoader.h" -#include "JSystem/J2DGraph/J2DGrafContext.h" -#include "d/d_menu_window.h" -#include "JSystem/J3DGraphBase/J3DMaterial.h" #if TARGET_PC #include "dusk/menu_pointer.h" @@ -438,7 +439,21 @@ void dMenu_Collect2D_c::screenSet() { static const u64 text_a_tag[5] = {MULTI_CHAR('atext1_1'), MULTI_CHAR('atext1_2'), MULTI_CHAR('atext1_3'), MULTI_CHAR('atext1_4'), MULTI_CHAR('atext1_5')}; static const u64 text_b_tag[5] = {MULTI_CHAR('btext1_1'), MULTI_CHAR('btext1_2'), MULTI_CHAR('btext1_3'), MULTI_CHAR('btext1_4'), MULTI_CHAR('btext1_5')}; -#if REGION_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpScreen->search(MULTI_CHAR('t_t00')))->setFont(mDoExt_getRubyFont()); + static_cast(mpScreen->search(MULTI_CHAR('t_t00')))->setString(0x20, ""); + dMeter2Info_getStringKanji( + 0x3E1, static_cast(mpScreen->search(MULTI_CHAR('t_t00')))->getStringPtr(), NULL); + mpScreen->search(MULTI_CHAR('f_t00'))->hide(); + } else { + static_cast(mpScreen->search(MULTI_CHAR('f_t00')))->setFont(mDoExt_getRubyFont()); + static_cast(mpScreen->search(MULTI_CHAR('f_t00')))->setString(0x20, ""); + dMeter2Info_getStringKanji( + 0x3E1, static_cast(mpScreen->search(MULTI_CHAR('f_t00')))->getStringPtr(), NULL); + mpScreen->search(MULTI_CHAR('t_t00'))->hide(); + } +#elif REGION_JPN static_cast(mpScreen->search(MULTI_CHAR('t_t00')))->setFont(mDoExt_getRubyFont()); static_cast(mpScreen->search(MULTI_CHAR('t_t00')))->setString(0x20, ""); dMeter2Info_getStringKanji( @@ -453,7 +468,31 @@ void dMenu_Collect2D_c::screenSet() { #endif for (int i = 0; i < 3; i++) { -#if REGION_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpScreen->search(text_sv[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(text_op[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(text_sv[i]))->setString(0x20, ""); + static_cast(mpScreen->search(text_op[i]))->setString(0x20, ""); + dMeter2Info_getStringKanji( + 0x60, static_cast(mpScreen->search(text_sv[i]))->getStringPtr(), NULL); + dMeter2Info_getStringKanji( + 0x5F, static_cast(mpScreen->search(text_op[i]))->getStringPtr(), NULL); + mpScreen->search(ftext_sv[i])->hide(); + mpScreen->search(ftext_op[i])->hide(); + } else { + static_cast(mpScreen->search(ftext_sv[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(ftext_op[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(ftext_sv[i]))->setString(0x20, ""); + static_cast(mpScreen->search(ftext_op[i]))->setString(0x20, ""); + dMeter2Info_getStringKanji( + 0x60, static_cast(mpScreen->search(ftext_sv[i]))->getStringPtr(), NULL); + dMeter2Info_getStringKanji( + 0x5F, static_cast(mpScreen->search(ftext_op[i]))->getStringPtr(), NULL); + mpScreen->search(text_sv[i])->hide(); + mpScreen->search(text_op[i])->hide(); + } +#elif REGION_JPN static_cast(mpScreen->search(text_sv[i]))->setFont(mDoExt_getMesgFont()); static_cast(mpScreen->search(text_op[i]))->setFont(mDoExt_getMesgFont()); static_cast(mpScreen->search(text_sv[i]))->setString(0x20, ""); @@ -487,7 +526,49 @@ void dMenu_Collect2D_c::screenSet() { static_cast(mpScreenIcon->search(text_b_tag[i]))->setString(0x20, ""); } -#if REGION_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpScreen->search(MULTI_CHAR('item_n00')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('item_n01')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('item_n02')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('item_n03')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('item_n00')))->setString(0x20, ""); + static_cast(mpScreen->search(MULTI_CHAR('item_n01')))->setString(0x20, ""); + static_cast(mpScreen->search(MULTI_CHAR('item_n02')))->setString(0x20, ""); + static_cast(mpScreen->search(MULTI_CHAR('item_n03')))->setString(0x20, ""); + static_cast(mpScreen->search(MULTI_CHAR('i_text1')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('i_text0')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('i_text1')))->setString(0x100, ""); + static_cast(mpScreen->search(MULTI_CHAR('i_text0')))->setString(0x100, ""); + + mpScreen->search(MULTI_CHAR('item_n04'))->hide(); + mpScreen->search(MULTI_CHAR('item_n05'))->hide(); + mpScreen->search(MULTI_CHAR('item_n06'))->hide(); + mpScreen->search(MULTI_CHAR('item_n07'))->hide(); + mpScreen->search(MULTI_CHAR('f_text1'))->hide(); + mpScreen->search(MULTI_CHAR('f_text0'))->hide(); + } else { + static_cast(mpScreen->search(MULTI_CHAR('item_n04')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('item_n05')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('item_n06')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('item_n07')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('item_n04')))->setString(0x20, ""); + static_cast(mpScreen->search(MULTI_CHAR('item_n05')))->setString(0x20, ""); + static_cast(mpScreen->search(MULTI_CHAR('item_n06')))->setString(0x20, ""); + static_cast(mpScreen->search(MULTI_CHAR('item_n07')))->setString(0x20, ""); + static_cast(mpScreen->search(MULTI_CHAR('f_text1')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('f_text0')))->setFont(mDoExt_getMesgFont()); + static_cast(mpScreen->search(MULTI_CHAR('f_text1')))->setString(0x100, ""); + static_cast(mpScreen->search(MULTI_CHAR('f_text0')))->setString(0x100, ""); + + mpScreen->search(MULTI_CHAR('item_n00'))->hide(); + mpScreen->search(MULTI_CHAR('item_n01'))->hide(); + mpScreen->search(MULTI_CHAR('item_n02'))->hide(); + mpScreen->search(MULTI_CHAR('item_n03'))->hide(); + mpScreen->search(MULTI_CHAR('i_text1'))->hide(); + mpScreen->search(MULTI_CHAR('i_text0'))->hide(); + } +#elif REGION_JPN static_cast(mpScreen->search(MULTI_CHAR('item_n00')))->setFont(mDoExt_getMesgFont()); static_cast(mpScreen->search(MULTI_CHAR('item_n01')))->setFont(mDoExt_getMesgFont()); static_cast(mpScreen->search(MULTI_CHAR('item_n02')))->setFont(mDoExt_getMesgFont()); @@ -2337,35 +2418,69 @@ void dMenu_Collect2D_c::_draw() { mpScreen->draw(0.0f, 0.0f, grafPort); if (mItemNameString == 0) { -#if REGION_JPN +#if TARGET_PC + TEXT_SPAN stringPtr1; + if (dusk::version::isRegionJpn()) { + stringPtr1 = static_cast(mpScreen->search(MULTI_CHAR('i_text1')))->getStringPtr(); + } else { + stringPtr1 = static_cast(mpScreen->search(MULTI_CHAR('f_text1')))->getStringPtr(); + } +#elif REGION_JPN TEXT_SPAN stringPtr1 = static_cast(mpScreen->search(MULTI_CHAR('i_text1')))->getStringPtr(); #else TEXT_SPAN stringPtr1 = static_cast(mpScreen->search(MULTI_CHAR('f_text1')))->getStringPtr(); #endif SAFE_STRCPY(stringPtr1, ""); -#if REGION_JPN +#if TARGET_PC + TEXT_SPAN stringPtr0; + if (dusk::version::isRegionJpn()) { + stringPtr0 = static_cast(mpScreen->search(MULTI_CHAR('i_text0')))->getStringPtr(); + } else { + stringPtr0 = static_cast(mpScreen->search(MULTI_CHAR('f_text0')))->getStringPtr(); + } +#elif REGION_JPN TEXT_SPAN stringPtr0 = static_cast(mpScreen->search(MULTI_CHAR('i_text0')))->getStringPtr(); #else TEXT_SPAN stringPtr0 = static_cast(mpScreen->search(MULTI_CHAR('f_text0')))->getStringPtr(); #endif SAFE_STRCPY(stringPtr0, ""); } else { -#if REGION_JPN +#if TARGET_PC + J2DTextBox* textBox1; + if (dusk::version::isRegionJpn()) { + textBox1 = static_cast(mpScreen->search(MULTI_CHAR('i_text1'))); + } else { + textBox1 = static_cast(mpScreen->search(MULTI_CHAR('f_text1'))); + } +#elif REGION_JPN J2DTextBox* textBox1 = static_cast(mpScreen->search(MULTI_CHAR('i_text1'))); #else J2DTextBox* textBox1 = static_cast(mpScreen->search(MULTI_CHAR('f_text1'))); #endif mpString->getString(mItemNameString, textBox1, NULL, NULL, NULL, 0); -#if REGION_JPN +#if TARGET_PC + J2DTextBox* textBox0; + if (dusk::version::isRegionJpn()) { + textBox0 = static_cast(mpScreen->search(MULTI_CHAR('i_text0'))); + } else { + textBox0 = static_cast(mpScreen->search(MULTI_CHAR('f_text0'))); + } +#elif REGION_JPN J2DTextBox* textBox0 = static_cast(mpScreen->search(MULTI_CHAR('i_text0'))); #else J2DTextBox* textBox0 = static_cast(mpScreen->search(MULTI_CHAR('f_text0'))); #endif mpString->getString(mItemNameString, textBox0, NULL, NULL, NULL, 0); -#if REGION_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + textBox0 = static_cast(mpScreen->search(MULTI_CHAR('i_text0'))); + } else { + textBox0 = static_cast(mpScreen->search(MULTI_CHAR('f_text0'))); + } +#elif REGION_JPN textBox0 = static_cast(mpScreen->search(MULTI_CHAR('i_text0'))); #else textBox0 = static_cast(mpScreen->search(MULTI_CHAR('f_text0'))); @@ -2448,7 +2563,29 @@ void dMenu_Collect2D_c::setItemNameString(u8 param_0, u8 param_1) { if (uVar6 == 0) { setItemNameStringNull(); } else { -#if REGION_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + TEXT_SPAN stringPtr = + static_cast(mpScreen->search(MULTI_CHAR('item_n00')))->getStringPtr(); + dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); + stringPtr = static_cast(mpScreen->search(MULTI_CHAR('item_n01')))->getStringPtr(); + dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); + stringPtr = static_cast(mpScreen->search(MULTI_CHAR('item_n02')))->getStringPtr(); + dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); + stringPtr = static_cast(mpScreen->search(MULTI_CHAR('item_n03')))->getStringPtr(); + dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); + } else { + TEXT_SPAN stringPtr = + static_cast(mpScreen->search(MULTI_CHAR('item_n04')))->getStringPtr(); + dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); + stringPtr = static_cast(mpScreen->search(MULTI_CHAR('item_n05')))->getStringPtr(); + dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); + stringPtr = static_cast(mpScreen->search(MULTI_CHAR('item_n06')))->getStringPtr(); + dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); + stringPtr = static_cast(mpScreen->search(MULTI_CHAR('item_n07')))->getStringPtr(); + dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); + } +#elif REGION_JPN TEXT_SPAN stringPtr = static_cast(mpScreen->search(MULTI_CHAR('item_n00')))->getStringPtr(); dMeter2Info_getStringKanji(uVar6, stringPtr, NULL); @@ -2475,7 +2612,26 @@ void dMenu_Collect2D_c::setItemNameString(u8 param_0, u8 param_1) { void dMenu_Collect2D_c::setItemNameStringNull() { mItemNameString = 0; -#if REGION_JPN +#if TARGET_PC + J2DTextBox* textBox; + if (dusk::version::isRegionJpn()) { + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n00')); + SAFE_STRCPY(textBox->getStringPtr(), ""); + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n01')); + SAFE_STRCPY(textBox->getStringPtr(), ""); + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n02')); + SAFE_STRCPY(textBox->getStringPtr(), ""); + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n03')); + } else { + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n04')); + SAFE_STRCPY(textBox->getStringPtr(), ""); + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n05')); + SAFE_STRCPY(textBox->getStringPtr(), ""); + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n06')); + SAFE_STRCPY(textBox->getStringPtr(), ""); + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n07')); + } +#elif REGION_JPN J2DTextBox* textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n00')); SAFE_STRCPY(textBox->getStringPtr(), ""); textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('item_n01')); diff --git a/src/d/d_menu_dmap.cpp b/src/d/d_menu_dmap.cpp index 36348b4387..b71c756283 100644 --- a/src/d/d_menu_dmap.cpp +++ b/src/d/d_menu_dmap.cpp @@ -26,6 +26,7 @@ #include "m_Do/m_Do_graphic.h" #include +#include "dusk/version.hpp" #include "helpers/string.hpp" #if TARGET_PC @@ -304,6 +305,16 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { static u64 const cont_bt[5] = {MULTI_CHAR('cont_bt'), MULTI_CHAR('cont_bt1'), MULTI_CHAR('cont_bt2'), MULTI_CHAR('cont_bt3'), MULTI_CHAR('cont_bt4')}; static u64 const font_at[5] = {MULTI_CHAR('font_at'), MULTI_CHAR('font_at1'), MULTI_CHAR('font_at2'), MULTI_CHAR('font_at3'), MULTI_CHAR('font_at4')}; static u64 const font_bt[5] = {MULTI_CHAR('font_bt'), MULTI_CHAR('font_bt1'), MULTI_CHAR('font_bt2'), MULTI_CHAR('font_bt3'), MULTI_CHAR('font_bt4')}; + + #if TARGET_PC + static u64 const c_tag_jpn[2] = { + MULTI_CHAR('c_text_s'), MULTI_CHAR('c_text') + }; + + static u64 const c_tag[2] = { + MULTI_CHAR('f_text_s'), MULTI_CHAR('f_text') + }; + #else static u64 const c_tag[2] = { #if VERSION == VERSION_GCN_JPN MULTI_CHAR('c_text_s'), MULTI_CHAR('c_text') @@ -311,6 +322,7 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { MULTI_CHAR('f_text_s'), MULTI_CHAR('f_text') #endif }; + #endif mButtonScreen = JKR_NEW J2DScreen(); JUT_ASSERT(916, mButtonScreen != NULL); @@ -350,7 +362,23 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { mpJButton = NULL; for (int i = 0; i < 5; i++) { - #if VERSION == VERSION_GCN_JPN + #if TARGET_PC + if (dusk::version::isRegionJpn()) { + ((J2DTextBox*)mButtonScreen->search(cont_at[i]))->setFont(mDoExt_getMesgFont()); + ((J2DTextBox*)mButtonScreen->search(cont_bt[i]))->setFont(mDoExt_getMesgFont()); + ((J2DTextBox*)mButtonScreen->search(cont_at[i]))->setString(32, ""); + ((J2DTextBox*)mButtonScreen->search(cont_bt[i]))->setString(32, ""); + ((J2DTextBox*)mButtonScreen->search(font_at[i]))->hide(); + ((J2DTextBox*)mButtonScreen->search(font_bt[i]))->hide(); + } else { + ((J2DTextBox*)mButtonScreen->search(font_at[i]))->setFont(mDoExt_getMesgFont()); + ((J2DTextBox*)mButtonScreen->search(font_bt[i]))->setFont(mDoExt_getMesgFont()); + ((J2DTextBox*)mButtonScreen->search(font_at[i]))->setString(32, ""); + ((J2DTextBox*)mButtonScreen->search(font_bt[i]))->setString(32, ""); + ((J2DTextBox*)mButtonScreen->search(cont_at[i]))->hide(); + ((J2DTextBox*)mButtonScreen->search(cont_bt[i]))->hide(); + } + #elif VERSION == VERSION_GCN_JPN ((J2DTextBox*)mButtonScreen->search(cont_at[i]))->setFont(mDoExt_getMesgFont()); ((J2DTextBox*)mButtonScreen->search(cont_bt[i]))->setFont(mDoExt_getMesgFont()); ((J2DTextBox*)mButtonScreen->search(cont_at[i]))->setString(32, ""); @@ -372,7 +400,7 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { J2DTextBox* textBox; for (int i = 0; i < 2; i++) { - textBox = ((J2DTextBox*)mButtonScreen->search(c_tag[i])); + textBox = ((J2DTextBox*)mButtonScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? c_tag_jpn[i] : c_tag[i], c_tag[i]))); textBox->setFont(mDoExt_getMesgFont()); textBox->setString(32, ""); } @@ -389,6 +417,14 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { } void dMenu_DmapBg_c::setAButtonString(u32 i_msgNo) { +#if TARGET_PC + static u64 const cont_at_jpn[5] = { + MULTI_CHAR('cont_at'), MULTI_CHAR('cont_at1'), MULTI_CHAR('cont_at2'), MULTI_CHAR('cont_at3'), MULTI_CHAR('cont_at4') + }; + static u64 const cont_at[5] = { + MULTI_CHAR('font_at'), MULTI_CHAR('font_at1'), MULTI_CHAR('font_at2'), MULTI_CHAR('font_at3'), MULTI_CHAR('font_at4') + }; +#else static u64 const cont_at[5] = { #if VERSION == VERSION_GCN_JPN MULTI_CHAR('cont_at'), MULTI_CHAR('cont_at1'), MULTI_CHAR('cont_at2'), MULTI_CHAR('cont_at3'), MULTI_CHAR('cont_at4') @@ -396,16 +432,26 @@ void dMenu_DmapBg_c::setAButtonString(u32 i_msgNo) { MULTI_CHAR('font_at'), MULTI_CHAR('font_at1'), MULTI_CHAR('font_at2'), MULTI_CHAR('font_at3'), MULTI_CHAR('font_at4') #endif }; +#endif + for (int i = 0; i < 5; i++) { if (i_msgNo == 0) { - SAFE_STRCPY(((J2DTextBox*)mButtonScreen->search(cont_at[i]))->getStringPtr(), ""); + SAFE_STRCPY(((J2DTextBox*)mButtonScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? cont_at_jpn[i] : cont_at[i], cont_at[i])))->getStringPtr(), ""); } else { - dMeter2Info_getStringKanji(i_msgNo, ((J2DTextBox*)mButtonScreen->search(cont_at[i]))->getStringPtr(), NULL); + dMeter2Info_getStringKanji(i_msgNo, ((J2DTextBox*)mButtonScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? cont_at_jpn[i] : cont_at[i], cont_at[i])))->getStringPtr(), NULL); } } } void dMenu_DmapBg_c::setBButtonString(u32 i_msgNo) { +#if TARGET_PC + static u64 const cont_bt_jpn[5] = { + MULTI_CHAR('cont_bt'), MULTI_CHAR('cont_bt1'), MULTI_CHAR('cont_bt2'), MULTI_CHAR('cont_bt3'), MULTI_CHAR('cont_bt4') + }; + static u64 const cont_bt[5] = { + MULTI_CHAR('font_bt'), MULTI_CHAR('font_bt1'), MULTI_CHAR('font_bt2'), MULTI_CHAR('font_bt3'), MULTI_CHAR('font_bt4') + }; +#else static u64 const cont_bt[5] = { #if VERSION == VERSION_GCN_JPN MULTI_CHAR('cont_bt'), MULTI_CHAR('cont_bt1'), MULTI_CHAR('cont_bt2'), MULTI_CHAR('cont_bt3'), MULTI_CHAR('cont_bt4') @@ -413,11 +459,13 @@ void dMenu_DmapBg_c::setBButtonString(u32 i_msgNo) { MULTI_CHAR('font_bt'), MULTI_CHAR('font_bt1'), MULTI_CHAR('font_bt2'), MULTI_CHAR('font_bt3'), MULTI_CHAR('font_bt4') #endif }; +#endif + for (int i = 0; i < 5; i++) { if (i_msgNo == 0) { - SAFE_STRCPY(((J2DTextBox*)mButtonScreen->search(cont_bt[i]))->getStringPtr(), ""); + SAFE_STRCPY(((J2DTextBox*)mButtonScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? cont_bt_jpn[i] : cont_bt[i], cont_bt[i])))->getStringPtr(), ""); } else { - dMeter2Info_getStringKanji(i_msgNo, ((J2DTextBox*)mButtonScreen->search(cont_bt[i]))->getStringPtr(), NULL); + dMeter2Info_getStringKanji(i_msgNo, ((J2DTextBox*)mButtonScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? cont_bt_jpn[i] : cont_bt[i], cont_bt[i])))->getStringPtr(), NULL); } } } @@ -429,6 +477,14 @@ static f32 player_py; DUSK_GAME_DATA dMenu_Dmap_c* dMenu_Dmap_c::myclass; void dMenu_DmapBg_c::setCButtonString(u32 i_msgNo) { +#if TARGET_PC + static u64 const c_tag_jpn[2] = { + MULTI_CHAR('c_text_s'), MULTI_CHAR('c_text') + }; + static u64 const c_tag[2] = { + MULTI_CHAR('c_text_s'), MULTI_CHAR('c_text') + }; +#else static u64 const c_tag[2] = { #if VERSION == VERSION_GCN_JPN MULTI_CHAR('c_text_s'), MULTI_CHAR('c_text') @@ -436,6 +492,7 @@ void dMenu_DmapBg_c::setCButtonString(u32 i_msgNo) { MULTI_CHAR('f_text_s'), MULTI_CHAR('f_text') #endif }; +#endif int i; u32 msgNo; @@ -447,12 +504,12 @@ void dMenu_DmapBg_c::setCButtonString(u32 i_msgNo) { if (msgNo == 0) { for (i = 0; i < 2; i++) { - SAFE_STRCPY(((J2DTextBox*)mButtonScreen->search(c_tag[i]))->getStringPtr(), ""); + SAFE_STRCPY(((J2DTextBox*)mButtonScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? c_tag_jpn[i] : c_tag[i], c_tag[i])))->getStringPtr(), ""); } mpCButton->setAlphaRate(0.5f); } else { for (i = 0; i < 2; i++) { - dMeter2Info_getStringKanji(msgNo, ((J2DTextBox*)mButtonScreen->search(c_tag[i]))->getStringPtr(), NULL); + dMeter2Info_getStringKanji(msgNo, ((J2DTextBox*)mButtonScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? c_tag_jpn[i] : c_tag[i], c_tag[i])))->getStringPtr(), NULL); } mpCButton->setAlphaRate(1.0f); } @@ -511,7 +568,16 @@ void dMenu_DmapBg_c::baseScreenInit() { mpDrawCursor->setAlphaRate(1.0f); mpDrawCursor->setParam(0.95f, 0.9f, 0.1f, 0.6f, 0.5f); - #if VERSION == VERSION_GCN_JPN + #if TARGET_PC + J2DTextBox* uVar9; + if (dusk::version::isRegionJpn()) { + uVar9 = (J2DTextBox*)mBaseScreen->search(MULTI_CHAR('t_t00')); + mBaseScreen->search(MULTI_CHAR('f_t_00'))->hide(); + } else { + uVar9 = (J2DTextBox*)mBaseScreen->search(MULTI_CHAR('f_t_00')); + mBaseScreen->search(MULTI_CHAR('t_t00'))->hide(); + } + #elif VERSION == VERSION_GCN_JPN J2DTextBox* uVar9 = (J2DTextBox*)mBaseScreen->search(MULTI_CHAR('t_t00')); mBaseScreen->search(MULTI_CHAR('f_t_00'))->hide(); #else @@ -541,7 +607,12 @@ void dMenu_DmapBg_c::setFloorMessage() { 0x036E, 0x036F, 0x03DC, 0x03DD, 0x03D9, 0x03D8, }; - #if VERSION == VERSION_GCN_JPN + #if TARGET_PC + u64 tag0 = dusk::version::isRegionJpn() ? MULTI_CHAR('ffoor0_0') : MULTI_CHAR('floor0_0'); + #define FLOOR_TAG(A, B) (tag0 | (A<<16) | (B)) + u64 tag1 = dusk::version::isRegionJpn() ? MULTI_CHAR('floor0_0') : MULTI_CHAR('ffoor0_0'); + #define FFOOR_TAG(A, B) (tag1 | (A<<16) | (B)) + #elif VERSION == VERSION_GCN_JPN #define FLOOR_TAG(A, B) (MULTI_CHAR('ffoor0_0') | (A<<16) | (B)) #define FFOOR_TAG(A, B) (MULTI_CHAR('floor0_0') | (A<<16) | (B)) #else diff --git a/src/d/d_menu_fishing.cpp b/src/d/d_menu_fishing.cpp index 2af4291525..eb24852160 100644 --- a/src/d/d_menu_fishing.cpp +++ b/src/d/d_menu_fishing.cpp @@ -305,7 +305,16 @@ void dMenu_Fishing_c::screenSetBase() { mpFishInfoParent[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('info_blu'), 0, NULL); mpFishInfoParent[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('info_red'), 0, NULL); - #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) + #if TARGET_PC + J2DTextBox* textBox; + if (dusk::version::isRegionJpn()) { + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('t_t00')); + mpScreen->search(MULTI_CHAR('f_t00'))->hide(); + } else { + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('f_t00')); + mpScreen->search(MULTI_CHAR('t_t00'))->hide(); + } + #elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) J2DTextBox* textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('t_t00')); mpScreen->search(MULTI_CHAR('f_t00'))->hide(); #else diff --git a/src/d/d_menu_fmap2D.cpp b/src/d/d_menu_fmap2D.cpp index 8b4e4b59b9..9d1d17ca0e 100644 --- a/src/d/d_menu_fmap2D.cpp +++ b/src/d/d_menu_fmap2D.cpp @@ -23,6 +23,8 @@ #endif #include +#include "dusk/version.hpp" + #if TARGET_PC void dMenu_Fmap2DBack_c::fMapBackWide() { mpBaseScreen->scale(mDoGph_gInf_c::hudAspectScaleUp, 1.0f); @@ -2417,7 +2419,17 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { static const u64 area_name[3] = {MULTI_CHAR('i_name_s'), MULTI_CHAR('i_name') ,MULTI_CHAR('i_name1')}; static const u64 farea_name[3] = {MULTI_CHAR('f_name_1'), MULTI_CHAR('f_name3'), MULTI_CHAR('f_name2')}; for (int i = 0; i < 3; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpTitleScreen->search(area_name[i]))->setFont(mDoExt_getRubyFont()); + static_cast(mpTitleScreen->search(area_name[i]))->setString(0x40, ""); + mpTitleScreen->search(farea_name[i])->hide(); + } else { + static_cast(mpTitleScreen->search(farea_name[i]))->setFont(mDoExt_getRubyFont()); + static_cast(mpTitleScreen->search(farea_name[i]))->setString(0x40, ""); + mpTitleScreen->search(area_name[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN static_cast(mpTitleScreen->search(area_name[i])) ->setFont(mDoExt_getRubyFont()); static_cast(mpTitleScreen->search(area_name[i]))->setString(0x40, ""); @@ -2445,7 +2457,17 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { }; #endif for (int i = 0; i < 7; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpTitleScreen->search(sfont_name[i]))->setFont(mDoExt_getRubyFont()); + static_cast(mpTitleScreen->search(sfont_name[i]))->setString(0x40, ""); + mpTitleScreen->search(ffont_name[i])->hide(); + } else { + static_cast(mpTitleScreen->search(ffont_name[i]))->setFont(mDoExt_getRubyFont()); + static_cast(mpTitleScreen->search(ffont_name[i]))->setString(0x40, ""); + mpTitleScreen->search(sfont_name[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN static_cast(mpTitleScreen->search(sfont_name[i])) ->setFont(mDoExt_getRubyFont()); static_cast(mpTitleScreen->search(sfont_name[i]))->setString(0x40, ""); @@ -2462,7 +2484,17 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { static const u64 cont_zt[5] = {MULTI_CHAR('cont_zt'), MULTI_CHAR('cont_zt1'), MULTI_CHAR('cont_zt2'), MULTI_CHAR('cont_zt3'), MULTI_CHAR('cont_zt4')}; static const u64 font_zt[5] = {MULTI_CHAR('font_zt1'), MULTI_CHAR('font_zt2'), MULTI_CHAR('font_zt3'), MULTI_CHAR('font_zt4'), MULTI_CHAR('font_zt5')}; for (int i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpTitleScreen->search(cont_zt[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(cont_zt[i]))->setString(0x20, ""); + mpTitleScreen->search(font_zt[i])->hide(); + } else { + static_cast(mpTitleScreen->search(font_zt[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(font_zt[i]))->setString(0x20, ""); + mpTitleScreen->search(cont_zt[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN static_cast(mpTitleScreen->search(cont_zt[i])) ->setFont(mDoExt_getMesgFont()); static_cast(mpTitleScreen->search(cont_zt[i]))->setString(0x20, ""); @@ -2483,7 +2515,17 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { static const u64 font_bt[5] = {MULTI_CHAR('font_bt1'), MULTI_CHAR('font_bt2'), MULTI_CHAR('font_bt3'), MULTI_CHAR('font_bt4'), MULTI_CHAR('font_bt5')}; #endif for (int i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpTitleScreen->search(cont_bt[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(cont_bt[i]))->setString(0x20, ""); + mpTitleScreen->search(font_bt[i])->hide(); + } else { + static_cast(mpTitleScreen->search(font_bt[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(font_bt[i]))->setString(0x20, ""); + mpTitleScreen->search(cont_bt[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN static_cast(mpTitleScreen->search(cont_bt[i])) ->setFont(mDoExt_getMesgFont()); static_cast(mpTitleScreen->search(cont_bt[i]))->setString(0x20, ""); @@ -2500,7 +2542,17 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { static const u64 cont_at[5] = {MULTI_CHAR('cont_at'), MULTI_CHAR('cont_at1'), MULTI_CHAR('cont_at2'), MULTI_CHAR('cont_at3'), MULTI_CHAR('cont_at4')}; static const u64 font_at[5] = {MULTI_CHAR('font_at1'), MULTI_CHAR('font_at2'), MULTI_CHAR('font_at3'), MULTI_CHAR('font_at4'), MULTI_CHAR('font_at5')}; for (int i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpTitleScreen->search(cont_at[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(cont_at[i]))->setString(0x20, ""); + mpTitleScreen->search(font_at[i])->hide(); + } else { + static_cast(mpTitleScreen->search(font_at[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(font_at[i]))->setString(0x20, ""); + mpTitleScreen->search(cont_at[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN static_cast(mpTitleScreen->search(cont_at[i])) ->setFont(mDoExt_getMesgFont()); static_cast(mpTitleScreen->search(cont_at[i]))->setString(0x20, ""); @@ -2518,7 +2570,17 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { static const u64 juji_c[5] = {MULTI_CHAR('juji_c00'), MULTI_CHAR('juji_c01'), MULTI_CHAR('juji_c02'), MULTI_CHAR('juji_c03'), MULTI_CHAR('juji_c04')}; static const u64 fuji_c[5] = {MULTI_CHAR('fuji_c00'), MULTI_CHAR('fuji_c01'), MULTI_CHAR('fuji_c02'), MULTI_CHAR('fuji_c03'), MULTI_CHAR('fuji_c04')}; for (int i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpTitleScreen->search(juji_c[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(juji_c[i]))->setString(0x20, ""); + mpTitleScreen->search(fuji_c[i])->hide(); + } else { + static_cast(mpTitleScreen->search(fuji_c[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(fuji_c[i]))->setString(0x20, ""); + mpTitleScreen->search(juji_c[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN static_cast(mpTitleScreen->search(juji_c[i])) ->setFont(mDoExt_getMesgFont()); static_cast(mpTitleScreen->search(juji_c[i]))->setString(0x20, ""); @@ -2535,7 +2597,17 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { static const u64 ast_c[5] = {MULTI_CHAR('ast_00'), MULTI_CHAR('ast_01'), MULTI_CHAR('ast_02'), MULTI_CHAR('ast_03'), MULTI_CHAR('ast_04')}; static const u64 fst_c[5] = {MULTI_CHAR('fst_00'), MULTI_CHAR('fst_01'), MULTI_CHAR('fst_02'), MULTI_CHAR('fst_03'), MULTI_CHAR('fst_04')}; for (int i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + static_cast(mpTitleScreen->search(ast_c[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(ast_c[i]))->setString(0x20, ""); + mpTitleScreen->search(fst_c[i])->hide(); + } else { + static_cast(mpTitleScreen->search(fst_c[i]))->setFont(mDoExt_getMesgFont()); + static_cast(mpTitleScreen->search(fst_c[i]))->setString(0x20, ""); + mpTitleScreen->search(ast_c[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN static_cast(mpTitleScreen->search(ast_c[i])) ->setFont(mDoExt_getMesgFont()); static_cast(mpTitleScreen->search(ast_c[i]))->setString(0x20, ""); @@ -2784,7 +2856,16 @@ void dMenu_Fmap2DTop_c::setMoyaAlpha(u8 i_alpha) { } void dMenu_Fmap2DTop_c::setTitleNameString(u32 param_0) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + static const u64 sfont_name[7] = { + MULTI_CHAR('sfont00'), MULTI_CHAR('sfontl0'), MULTI_CHAR('sfontl1'), MULTI_CHAR('sfontl2'), MULTI_CHAR('sfontb0'), MULTI_CHAR('sfontb1'), MULTI_CHAR('sfontb2') + }; + static const u64 ffont_name[7] = { + MULTI_CHAR('ffont00'), MULTI_CHAR('ffontl0'), MULTI_CHAR('ffontl1'), MULTI_CHAR('ffontl2'), MULTI_CHAR('ffontb0'), MULTI_CHAR('ffontb3'), MULTI_CHAR('ffontb4') + }; + + auto setTitleNameString_font_name = dusk::version::isRegionJpn() ? sfont_name : ffont_name; +#elif VERSION == VERSION_GCN_JPN static const u64 sfont_name[7] = { MULTI_CHAR('sfont00'), MULTI_CHAR('sfontl0'), MULTI_CHAR('sfontl1'), MULTI_CHAR('sfontl2'), MULTI_CHAR('sfontb0'), MULTI_CHAR('sfontb1'), MULTI_CHAR('sfontb2') }; @@ -2816,7 +2897,11 @@ void dMenu_Fmap2DTop_c::setTitleNameString(u32 param_0) { } void dMenu_Fmap2DTop_c::setAreaNameString(u32 param_0) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + static const u64 iarea_name[3] = {MULTI_CHAR('i_name_s'), MULTI_CHAR('i_name'), MULTI_CHAR('i_name1')}; + static const u64 farea_name[3] = {MULTI_CHAR('f_name_1'), MULTI_CHAR('f_name3'), MULTI_CHAR('f_name2')}; + auto setAreaNameString_area_name = dusk::version::isRegionJpn() ? iarea_name : farea_name; +#elif VERSION == VERSION_GCN_JPN static const u64 iarea_name[3] = {MULTI_CHAR('i_name_s'), MULTI_CHAR('i_name'), MULTI_CHAR('i_name1')}; #define setAreaNameString_area_name iarea_name #else @@ -2849,7 +2934,11 @@ void dMenu_Fmap2DTop_c::setZButtonString(u32 param_0, u8 i_alpha) { dusk::ui::ControlOverride::Default); #endif -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + static const u64 cont_zt[5] = {MULTI_CHAR('cont_zt'), MULTI_CHAR('cont_zt1'), MULTI_CHAR('cont_zt2'), MULTI_CHAR('cont_zt3'), MULTI_CHAR('cont_zt4')}; + static const u64 font_zt[5] = {MULTI_CHAR('font_zt1'), MULTI_CHAR('font_zt2'), MULTI_CHAR('font_zt3'), MULTI_CHAR('font_zt4'), MULTI_CHAR('font_zt5')}; + auto setZButtonString_font_zt = dusk::version::isRegionJpn() ? cont_zt : font_zt; +#elif VERSION == VERSION_GCN_JPN static const u64 cont_zt[5] = {MULTI_CHAR('cont_zt'), MULTI_CHAR('cont_zt1'), MULTI_CHAR('cont_zt2'), MULTI_CHAR('cont_zt3'), MULTI_CHAR('cont_zt4')}; #define setZButtonString_font_zt cont_zt #else @@ -2883,7 +2972,11 @@ void dMenu_Fmap2DTop_c::setZButtonString(u32 param_0, u8 i_alpha) { } void dMenu_Fmap2DTop_c::setBButtonString(u32 param_0, u8 i_alpha) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + static const u64 cont_bt[5] = {MULTI_CHAR('cont_bt1'), MULTI_CHAR('cont_bt2'), MULTI_CHAR('cont_bt3'), MULTI_CHAR('cont_bt4'), MULTI_CHAR('cont_bt')}; + static const u64 font_bt[5] = {MULTI_CHAR('font_bt1'), MULTI_CHAR('font_bt2'), MULTI_CHAR('font_bt3'), MULTI_CHAR('font_bt4'), MULTI_CHAR('font_bt5')}; + auto setBButtonString_font_bt = dusk::version::isRegionJpn() ? cont_bt : font_bt; +#elif VERSION == VERSION_GCN_JPN static const u64 cont_bt[5] = {MULTI_CHAR('cont_bt1'), MULTI_CHAR('cont_bt2'), MULTI_CHAR('cont_bt3'), MULTI_CHAR('cont_bt4'), MULTI_CHAR('cont_bt')}; #define setBButtonString_font_bt cont_bt #else @@ -2909,7 +3002,11 @@ void dMenu_Fmap2DTop_c::setBButtonString(u32 param_0, u8 i_alpha) { } void dMenu_Fmap2DTop_c::setAButtonString(u32 param_0, u8 i_alpha) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + static const u64 cont_at[5] = {MULTI_CHAR('cont_at'), MULTI_CHAR('cont_at1'), MULTI_CHAR('cont_at2'), MULTI_CHAR('cont_at3'), MULTI_CHAR('cont_at4')}; + static const u64 font_at[5] = {MULTI_CHAR('font_at1'), MULTI_CHAR('font_at2'), MULTI_CHAR('font_at3'), MULTI_CHAR('font_at4'), MULTI_CHAR('font_at5')}; + auto setAButtonString_font_at = dusk::version::isRegionJpn() ? cont_at : font_at; +#elif VERSION == VERSION_GCN_JPN static const u64 cont_at[5] = {MULTI_CHAR('cont_at'), MULTI_CHAR('cont_at1'), MULTI_CHAR('cont_at2'), MULTI_CHAR('cont_at3'), MULTI_CHAR('cont_at4')}; #define setAButtonString_font_at cont_at #else @@ -2936,21 +3033,24 @@ void dMenu_Fmap2DTop_c::setAButtonString(u32 param_0, u8 i_alpha) { void dMenu_Fmap2DTop_c::setCrossLRString(u32 param_0) { #if PLATFORM_GCN || (VERSION == VERSION_SHIELD) -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + static const u64 juji_c_jpn[5] = {MULTI_CHAR('juji_c00'), MULTI_CHAR('juji_c01'), MULTI_CHAR('juji_c02'), MULTI_CHAR('juji_c03'), MULTI_CHAR('juji_c04')}; + static const u64 juji_c[5] = {MULTI_CHAR('fuji_c00'), MULTI_CHAR('fuji_c01'), MULTI_CHAR('fuji_c02'), MULTI_CHAR('fuji_c03'), MULTI_CHAR('fuji_c04')}; +#elif VERSION == VERSION_GCN_JPN static const u64 juji_c[5] = {MULTI_CHAR('juji_c00'), MULTI_CHAR('juji_c01'), MULTI_CHAR('juji_c02'), MULTI_CHAR('juji_c03'), MULTI_CHAR('juji_c04')}; #else static const u64 juji_c[5] = {MULTI_CHAR('fuji_c00'), MULTI_CHAR('fuji_c01'), MULTI_CHAR('fuji_c02'), MULTI_CHAR('fuji_c03'), MULTI_CHAR('fuji_c04')}; #endif if (param_0 == 0) { for (int i = 0; i < 5; i++) { - J2DTextBox* text_box = static_cast(mpTitleScreen->search(juji_c[i])); + J2DTextBox* text_box = static_cast(mpTitleScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? juji_c_jpn[i] : juji_c[i], juji_c[i]))); SAFE_STRCPY(text_box->getStringPtr(), ""); } mpTitleScreen->search(MULTI_CHAR('juy_sha0'))->show(); mAlphaDpad = 1; } else { for (int i = 0; i < 5; i++) { - J2DTextBox* text_box = static_cast(mpTitleScreen->search(juji_c[i])); + J2DTextBox* text_box = static_cast(mpTitleScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? juji_c_jpn[i] : juji_c[i], juji_c[i]))); dMeter2Info_getStringKanji(param_0, text_box->getStringPtr(), NULL); } mpTitleScreen->search(MULTI_CHAR('juy_sha0'))->show(); @@ -2961,21 +3061,24 @@ void dMenu_Fmap2DTop_c::setCrossLRString(u32 param_0) { void dMenu_Fmap2DTop_c::set3DStickString(u32 param_0) { #if PLATFORM_GCN || (VERSION == VERSION_SHIELD) -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + static const u64 ast_c_jpn[5] = {MULTI_CHAR('ast_00'), MULTI_CHAR('ast_01'), MULTI_CHAR('ast_02'), MULTI_CHAR('ast_03'), MULTI_CHAR('ast_04')}; + static const u64 ast_c[5] = {MULTI_CHAR('fst_00'), MULTI_CHAR('fst_01'), MULTI_CHAR('fst_02'), MULTI_CHAR('fst_03'), MULTI_CHAR('fst_04')}; +#elif VERSION == VERSION_GCN_JPN static const u64 ast_c[5] = {MULTI_CHAR('ast_00'), MULTI_CHAR('ast_01'), MULTI_CHAR('ast_02'), MULTI_CHAR('ast_03'), MULTI_CHAR('ast_04')}; #else static const u64 ast_c[5] = {MULTI_CHAR('fst_00'), MULTI_CHAR('fst_01'), MULTI_CHAR('fst_02'), MULTI_CHAR('fst_03'), MULTI_CHAR('fst_04')}; #endif if (param_0 == 0) { for (int i = 0; i < 5; i++) { - J2DTextBox* text_box = static_cast(mpTitleScreen->search(ast_c[i])); + J2DTextBox* text_box = static_cast(mpTitleScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? ast_c_jpn[i] : ast_c[i], ast_c[i]))); SAFE_STRCPY(text_box->getStringPtr(), ""); } mpTitleScreen->search(MULTI_CHAR('as_sha0'))->show(); mAlphaAnalogStick = 1; } else { for (int i = 0; i < 5; i++) { - J2DTextBox* text_box = static_cast(mpTitleScreen->search(ast_c[i])); + J2DTextBox* text_box = static_cast(mpTitleScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? ast_c_jpn[i] : ast_c[i], ast_c[i]))); dMeter2Info_getStringKanji(param_0, text_box->getStringPtr(), NULL); } mpTitleScreen->search(MULTI_CHAR('as_sha0'))->show(); diff --git a/src/d/d_menu_insect.cpp b/src/d/d_menu_insect.cpp index aa18407b09..e7917532a2 100644 --- a/src/d/d_menu_insect.cpp +++ b/src/d/d_menu_insect.cpp @@ -22,6 +22,8 @@ #include #include +#include "dusk/version.hpp" + #if TARGET_PC #include "dusk/menu_pointer.h" #endif @@ -535,7 +537,16 @@ void dMenu_Insect_c::screenSetBase() { } } } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + J2DTextBox* textBox; + if (dusk::version::isRegionJpn()) { + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('t_t00')); + mpScreen->search(MULTI_CHAR('f_t00'))->hide(); + } else { + textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('f_t00')); + mpScreen->search(MULTI_CHAR('t_t00'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN J2DTextBox* textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('t_t00')); mpScreen->search(MULTI_CHAR('f_t00'))->hide(); #else @@ -558,7 +569,19 @@ void dMenu_Insect_c::screenSetExplain() { if (field_0xf6 == 0) { mpExpSubWin[1]->hide(); } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpInfoText = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpExpScreen->search(MULTI_CHAR('n_e4line'))->hide(); + field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('w_msg_jp')); + mpExpScreen->search(MULTI_CHAR('ms_for_2'))->hide(); + } else { + mpInfoText = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpExpScreen->search(MULTI_CHAR('n_3line'))->hide(); + field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('ms_for_2')); + mpExpScreen->search(MULTI_CHAR('w_msg_jp'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpInfoText = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('mg_3line'), 0, NULL); mpExpScreen->search(MULTI_CHAR('n_e4line'))->hide(); field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('w_msg_jp')); diff --git a/src/d/d_menu_item_explain.cpp b/src/d/d_menu_item_explain.cpp index bebcb2cdb0..9ef85ed32e 100644 --- a/src/d/d_menu_item_explain.cpp +++ b/src/d/d_menu_item_explain.cpp @@ -5,25 +5,26 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_menu_item_explain.h" +#include +#include #include "JSystem/J2DGraph/J2DTextBox.h" #include "JSystem/JKernel/JKRExpHeap.h" #include "JSystem/JUtility/JUTTexture.h" -#include -#include #include "d/actor/d_a_player.h" #include "d/d_com_inf_game.h" #include "d/d_item.h" #include "d/d_kantera_icon_meter.h" #include "d/d_lib.h" -#include "d/d_select_cursor.h" +#include "d/d_menu_item_explain.h" #include "d/d_meter2_info.h" #include "d/d_meter_HIO.h" -#include "d/d_msg_string.h" -#include "m_Do/m_Do_controller_pad.h" -#include "m_Do/m_Do_graphic.h" #include "d/d_msg_scrn_3select.h" #include "d/d_msg_scrn_arrow.h" +#include "d/d_msg_string.h" +#include "d/d_select_cursor.h" +#include "dusk/version.hpp" +#include "m_Do/m_Do_controller_pad.h" +#include "m_Do/m_Do_graphic.h" typedef void (dMenu_ItemExplain_c::*initFunc)(); static initFunc init_process[] = { @@ -103,7 +104,16 @@ dMenu_ItemExplain_c::dMenu_ItemExplain_c(JKRExpHeap* i_heap, JKRArchive* i_archi mDescAlpha = 0.0f; field_0x78 = 0; mAlphaRatio = 201.0f; -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpInfoText = JKR_NEW CPaneMgr(mpInfoScreen, MULTI_CHAR('i_text4'), 0, NULL); + mpInfoScreen->search(MULTI_CHAR('i_text1'))->hide(); + } else { + mpInfoText = JKR_NEW CPaneMgr(mpInfoScreen, MULTI_CHAR('i_text1'), 0, NULL); + mpInfoScreen->search(MULTI_CHAR('i_text4'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpInfoText = JKR_NEW CPaneMgr(mpInfoScreen, MULTI_CHAR('i_text4'), 0, NULL); mpInfoScreen->search(MULTI_CHAR('i_text1'))->hide(); #else @@ -114,7 +124,15 @@ dMenu_ItemExplain_c::dMenu_ItemExplain_c(JKRExpHeap* i_heap, JKRArchive* i_archi ((J2DTextBox*)(mpInfoText->getPanePtr()))->setString(0x200, ""); mpInfoText->show(); for (int i = 0; i < 4; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpNameText[i] = JKR_NEW CPaneMgr(mpInfoScreen, name_tag[i], 0, NULL); + mpInfoScreen->search(fame_tag[i])->hide(); + } else { + mpNameText[i] = JKR_NEW CPaneMgr(mpInfoScreen, fame_tag[i], 0, NULL); + mpInfoScreen->search(name_tag[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpNameText[i] = JKR_NEW CPaneMgr(mpInfoScreen, name_tag[i], 0, NULL); mpInfoScreen->search(fame_tag[i])->hide(); #else diff --git a/src/d/d_menu_letter.cpp b/src/d/d_menu_letter.cpp index 3f997bbda5..a1349e9fe5 100644 --- a/src/d/d_menu_letter.cpp +++ b/src/d/d_menu_letter.cpp @@ -21,6 +21,7 @@ #include "dusk/achievements.h" #include "dusk/menu_pointer.h" #include "dusk/ui/touch_controls.hpp" +#include "dusk/version.hpp" static void enable_turn_page_controls(bool enabled) { const auto controlOverride = @@ -30,7 +31,9 @@ static void enable_turn_page_controls(bool enabled) { } #endif -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC +#define D_MENU_LETTER_LINE_MAX (dusk::version::isRegionJpn() ? 9 : 12) +#elif VERSION == VERSION_GCN_JPN #define D_MENU_LETTER_LINE_MAX 9 #else #define D_MENU_LETTER_LINE_MAX 12 @@ -459,7 +462,16 @@ void dMenu_Letter_c::wait_move() { } if (mProcess == 1 || mProcess == 2) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + J2DTextBox* textBox; + if (dusk::version::isRegionJpn()) { + textBox = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('t_t00')); + mpBaseScreen->search(MULTI_CHAR('f_t_00'))->hide(); + } else { + textBox = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('f_t_00')); + mpBaseScreen->search(MULTI_CHAR('t_t00'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN J2DTextBox* textBox = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('t_t00')); mpBaseScreen->search(MULTI_CHAR('f_t_00'))->hide(); #else @@ -811,6 +823,15 @@ void dMenu_Letter_c::screenSetMenu() { static const u64 tag_frame[6] = { MULTI_CHAR('flame_00'), MULTI_CHAR('flame_01'), MULTI_CHAR('flame_02'), MULTI_CHAR('flame_03'), MULTI_CHAR('flame_04'), MULTI_CHAR('flame_05'), }; + +#if TARGET_PC + static const u64 tag_menu0_jpn[6] = { + MULTI_CHAR('menu_t0'), MULTI_CHAR('menu_t1'), MULTI_CHAR('menu_t2'), MULTI_CHAR('menu_t3'), MULTI_CHAR('menu_t4'), MULTI_CHAR('menu_t5'), + }; + static const u64 tag_menu0[6] = { + MULTI_CHAR('fenu_t0'), MULTI_CHAR('fenu_t1'), MULTI_CHAR('fenu_t2'), MULTI_CHAR('fenu_t3'), MULTI_CHAR('fenu_t4'), MULTI_CHAR('fenu_t5'), + }; +#else static const u64 tag_menu0[6] = { #if VERSION == VERSION_GCN_JPN MULTI_CHAR('menu_t0'), MULTI_CHAR('menu_t1'), MULTI_CHAR('menu_t2'), MULTI_CHAR('menu_t3'), MULTI_CHAR('menu_t4'), MULTI_CHAR('menu_t5'), @@ -818,6 +839,16 @@ void dMenu_Letter_c::screenSetMenu() { MULTI_CHAR('fenu_t0'), MULTI_CHAR('fenu_t1'), MULTI_CHAR('fenu_t2'), MULTI_CHAR('fenu_t3'), MULTI_CHAR('fenu_t4'), MULTI_CHAR('fenu_t5'), #endif }; +#endif + +#if TARGET_PC + static const u64 tag_menu1_jpn[6] = { + MULTI_CHAR('menu_f6'), MULTI_CHAR('menu_f7'), MULTI_CHAR('menu_t8'), MULTI_CHAR('menu_t9'), MULTI_CHAR('menu_t10'), MULTI_CHAR('menu_t11'), + }; + static const u64 tag_menu1[6] = { + MULTI_CHAR('fenu_t6'), MULTI_CHAR('fenu_t7'), MULTI_CHAR('fenu_t8'), MULTI_CHAR('fenu_t9'), MULTI_CHAR('fenu_t10'), MULTI_CHAR('fenu_t11'), + }; +#else static const u64 tag_menu1[6] = { #if VERSION == VERSION_GCN_JPN MULTI_CHAR('menu_f6'), MULTI_CHAR('menu_f7'), MULTI_CHAR('menu_t8'), MULTI_CHAR('menu_t9'), MULTI_CHAR('menu_t10'), MULTI_CHAR('menu_t11'), @@ -825,6 +856,8 @@ void dMenu_Letter_c::screenSetMenu() { MULTI_CHAR('fenu_t6'), MULTI_CHAR('fenu_t7'), MULTI_CHAR('fenu_t8'), MULTI_CHAR('fenu_t9'), MULTI_CHAR('fenu_t10'), MULTI_CHAR('fenu_t11'), #endif }; +#endif + static const u64 tag_midoku[6] = { MULTI_CHAR('midoku_0'), MULTI_CHAR('midoku_1'), MULTI_CHAR('midoku_2'), MULTI_CHAR('midoku_3'), MULTI_CHAR('midoku_4'), MULTI_CHAR('midoku_5'), }; @@ -838,7 +871,27 @@ void dMenu_Letter_c::screenSetMenu() { JUT_ASSERT(1161, mpParent[0] != NULL); mpParent[0]->setAlphaRate(0.0f); for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x124[i][0] = (J2DTextBox*)mpMenuScreen->search(tag_sub0[i]); + field_0x124[i][1] = (J2DTextBox*)mpMenuScreen->search(tag_sub1[i]); + field_0x124[i][2] = (J2DTextBox*)mpMenuScreen->search(tag_name0[i]); + field_0x124[i][3] = (J2DTextBox*)mpMenuScreen->search(tag_name1[i]); + mpMenuScreen->search(ftag_sub0[i])->hide(); + mpMenuScreen->search(ftag_sub1[i])->hide(); + mpMenuScreen->search(ftag_name0[i])->hide(); + mpMenuScreen->search(ftag_name1[i])->hide(); + } else { + field_0x124[i][0] = (J2DTextBox*)mpMenuScreen->search(ftag_sub0[i]); + field_0x124[i][1] = (J2DTextBox*)mpMenuScreen->search(ftag_sub1[i]); + field_0x124[i][2] = (J2DTextBox*)mpMenuScreen->search(ftag_name0[i]); + field_0x124[i][3] = (J2DTextBox*)mpMenuScreen->search(ftag_name1[i]); + mpMenuScreen->search(tag_sub0[i])->hide(); + mpMenuScreen->search(tag_sub1[i])->hide(); + mpMenuScreen->search(tag_name0[i])->hide(); + mpMenuScreen->search(tag_name1[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x124[i][0] = (J2DTextBox*)mpMenuScreen->search(tag_sub0[i]); field_0x124[i][1] = (J2DTextBox*)mpMenuScreen->search(tag_sub1[i]); field_0x124[i][2] = (J2DTextBox*)mpMenuScreen->search(tag_name0[i]); @@ -868,8 +921,8 @@ void dMenu_Letter_c::screenSetMenu() { } for (int i = 0; i < 6; i++) { field_0x34[i][0] = mpMenuScreen->search(tag_frame[i]); - field_0x34[i][1] = mpMenuScreen->search(tag_menu0[i]); - field_0x34[i][2] = mpMenuScreen->search(tag_menu1[i]); + field_0x34[i][1] = mpMenuScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? tag_menu0_jpn[i] : tag_menu0[i], tag_menu0[i])); + field_0x34[i][2] = mpMenuScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? tag_menu1_jpn[i] : tag_menu1[i], tag_menu1[i])); field_0x34[i][3] = mpMenuScreen->search(tag_letter[i]); field_0x34[i][4] = mpMenuScreen->search(tag_midoku[i]); if (i < field_0x373) { @@ -909,7 +962,27 @@ void dMenu_Letter_c::screenSetMenu() { mpDMYParent = JKR_NEW CPaneMgr(mpMenuDMYScreen, MULTI_CHAR('n_all'), 2, NULL); JUT_ASSERT(1285, mpDMYParent != NULL); for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x184[i][0] = (J2DTextBox*)mpMenuDMYScreen->search(tag_sub0[i]); + field_0x184[i][1] = (J2DTextBox*)mpMenuDMYScreen->search(tag_sub1[i]); + field_0x184[i][2] = (J2DTextBox*)mpMenuDMYScreen->search(tag_name0[i]); + field_0x184[i][3] = (J2DTextBox*)mpMenuDMYScreen->search(tag_name1[i]); + mpMenuDMYScreen->search(ftag_sub0[i])->hide(); + mpMenuDMYScreen->search(ftag_sub1[i])->hide(); + mpMenuDMYScreen->search(ftag_name0[i])->hide(); + mpMenuDMYScreen->search(ftag_name1[i])->hide(); + } else { + field_0x184[i][0] = (J2DTextBox*)mpMenuDMYScreen->search(ftag_sub0[i]); + field_0x184[i][1] = (J2DTextBox*)mpMenuDMYScreen->search(ftag_sub1[i]); + field_0x184[i][2] = (J2DTextBox*)mpMenuDMYScreen->search(ftag_name0[i]); + field_0x184[i][3] = (J2DTextBox*)mpMenuDMYScreen->search(ftag_name1[i]); + mpMenuDMYScreen->search(tag_sub0[i])->hide(); + mpMenuDMYScreen->search(tag_sub1[i])->hide(); + mpMenuDMYScreen->search(tag_name0[i])->hide(); + mpMenuDMYScreen->search(tag_name1[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x184[i][0] = (J2DTextBox*)mpMenuDMYScreen->search(tag_sub0[i]); field_0x184[i][1] = (J2DTextBox*)mpMenuDMYScreen->search(tag_sub1[i]); field_0x184[i][2] = (J2DTextBox*)mpMenuDMYScreen->search(tag_name0[i]); @@ -964,7 +1037,16 @@ void dMenu_Letter_c::screenSetBase() { mpParent[1] = JKR_NEW CPaneMgr(mpBaseScreen, MULTI_CHAR('n_all'), 2, NULL); JUT_ASSERT(1372, mpParent[1] != NULL); mpParent[1]->setAlphaRate(0.0f); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + J2DTextBox* piVar9; + if (dusk::version::isRegionJpn()) { + piVar9 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('t_t00')); + mpBaseScreen->search(MULTI_CHAR('f_t_00'))->hide(); + } else { + piVar9 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('f_t_00')); + mpBaseScreen->search(MULTI_CHAR('t_t00'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN J2DTextBox* piVar9 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('t_t00')); mpBaseScreen->search(MULTI_CHAR('f_t_00'))->hide(); #else @@ -975,7 +1057,31 @@ void dMenu_Letter_c::screenSetBase() { piVar9->setFont(mDoExt_getSubFont()); dComIfGp_setMessageCountNumber(field_0x374 + (field_0x36f + 1) * 100); mpString->getString(0x4d6, piVar9, NULL, NULL, NULL, 0); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + J2DTextBox* text1; + J2DTextBox* text2; + J2DTextBox* text3; + J2DTextBox* text4; + if (dusk::version::isRegionJpn()) { + text1 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('wps_text')); + text2 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('w_p_text')); + text3 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('g_ps_txt')); + text4 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('g_p_text')); + mpBaseScreen->search(MULTI_CHAR('fwpstex1'))->hide(); + mpBaseScreen->search(MULTI_CHAR('fwp_tex1'))->hide(); + mpBaseScreen->search(MULTI_CHAR('fgps_tx1'))->hide(); + mpBaseScreen->search(MULTI_CHAR('fgp_tex1'))->hide(); + } else { + text1 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('fwpstex1')); + text2 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('fwp_tex1')); + text3 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('fgps_tx1')); + text4 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('fgp_tex1')); + mpBaseScreen->search(MULTI_CHAR('wps_text'))->hide(); + mpBaseScreen->search(MULTI_CHAR('w_p_text'))->hide(); + mpBaseScreen->search(MULTI_CHAR('g_ps_txt'))->hide(); + mpBaseScreen->search(MULTI_CHAR('g_p_text'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN J2DTextBox* text1 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('wps_text')); J2DTextBox* text2 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('w_p_text')); J2DTextBox* text3 = (J2DTextBox*)mpBaseScreen->search(MULTI_CHAR('g_ps_txt')); @@ -1059,7 +1165,96 @@ void dMenu_Letter_c::screenSetLetter() { JUT_ASSERT(1511, fg != false); dPaneClass_showNullPane(mpLetterScreen[0]); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() == 0) { + field_0x2ec[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('t3f_s'), 0, NULL); + field_0x2ec[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3flin'), 0, NULL); + field_0x2f4[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3f_s'), 0, NULL); + field_0x2f4[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3f'), 0, NULL); + mpLetterScreen[0]->search('t4_s')->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_e4lin'))->hide(); + mpLetterScreen[0]->search('t3_s')->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_3line'))->hide(); + mpLineParent = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('jp_fri_n'), 0, NULL); + JUT_ASSERT(1530, mpLineParent != NULL); + for (int i = 0; i < 12; i++) { + static u64 const line_tag[12] = { + MULTI_CHAR('line00'), MULTI_CHAR('line01'), MULTI_CHAR('line02'), MULTI_CHAR('line03'), MULTI_CHAR('line04'), MULTI_CHAR('line05'), + MULTI_CHAR('line06'), MULTI_CHAR('line07'), MULTI_CHAR('line08'), + }; + + if (line_tag[i] != 0) { + field_0x25c[i] = (J2DTextBox*)mpLetterScreen[0]->search(line_tag[i]); + } else { + field_0x25c[i] = NULL; + } + } + mpLetterScreen[0]->search('jp_n')->hide(); + mpLetterScreen[0]->search('us_n')->hide(); + + ((J2DTextBox*)field_0x2f4[0]->getPanePtr())->setLineSpace(((J2DTextBox*)field_0x2ec[0]->getPanePtr())->getLineSpace()); + ((J2DTextBox*)field_0x2f4[1]->getPanePtr())->setLineSpace(((J2DTextBox*)field_0x2ec[1]->getPanePtr())->getLineSpace()); + } else { + field_0x2ec[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], 't3_s', 0, NULL); + field_0x2ec[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3line'), 0, NULL); + for (int i = 0; i < 2; i++) { + field_0x2f4[i] = NULL; + } + mpLetterScreen[0]->search('t4_s')->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_e4lin'))->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('t3f_s'))->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_3flin'))->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_3f_s'))->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_3f'))->hide(); + mpLineParent = JKR_NEW CPaneMgr(mpLetterScreen[0], 'jp_n', 0, NULL); + JUT_ASSERT(1530, mpLineParent != NULL); + for (int i = 0; i < 12; i++) { + static u64 const line_tag[12] = { + MULTI_CHAR('line21'), MULTI_CHAR('line22'), MULTI_CHAR('line23'), MULTI_CHAR('line24'), MULTI_CHAR('line25'), MULTI_CHAR('line26'), + MULTI_CHAR('line27'), MULTI_CHAR('line28'), MULTI_CHAR('line29'), + }; + + if (line_tag[i] != 0) { + field_0x25c[i] = (J2DTextBox*)mpLetterScreen[0]->search(line_tag[i]); + } else { + field_0x25c[i] = NULL; + } + } + + mpLetterScreen[0]->search(MULTI_CHAR('jp_fri_n'))->hide(); + mpLetterScreen[0]->search('us_n')->hide(); + } + } else { + static u64 const line_tag[12] = { + MULTI_CHAR('line09'), MULTI_CHAR('line10'), MULTI_CHAR('line11'), MULTI_CHAR('line12'), MULTI_CHAR('line13'), MULTI_CHAR('line14'), + MULTI_CHAR('line15'), MULTI_CHAR('line16'), MULTI_CHAR('line17'), MULTI_CHAR('line18'), MULTI_CHAR('line19'), MULTI_CHAR('line20'), + }; + + field_0x2ec[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], 't4_s', 0, NULL); + field_0x2ec[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_e4lin'), 0, NULL); + for (int i = 0; i < 2; i++) { + field_0x2f4[i] = NULL; + } + mpLetterScreen[0]->search(MULTI_CHAR('t3f_s'))->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_3flin'))->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_3f_s'))->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_3f'))->hide(); + mpLetterScreen[0]->search('t3_s')->hide(); + mpLetterScreen[0]->search(MULTI_CHAR('mg_3line'))->hide(); + mpLineParent = JKR_NEW CPaneMgr(mpLetterScreen[0], 'us_n', 0, NULL); + JUT_ASSERT(1530, mpLineParent != NULL); + for (int i = 0; i < 12; i++) { + if (line_tag[i] != 0) { + field_0x25c[i] = (J2DTextBox*)mpLetterScreen[0]->search(line_tag[i]); + } else { + field_0x25c[i] = NULL; + } + } + mpLetterScreen[0]->search(MULTI_CHAR('jp_fri_n'))->hide(); + mpLetterScreen[0]->search('jp_n')->hide(); + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { field_0x2ec[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('t3f_s'), 0, NULL); field_0x2ec[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3flin'), 0, NULL); @@ -1148,20 +1343,20 @@ void dMenu_Letter_c::screenSetLetter() { mpLetterScreen[0]->search('jp_n')->hide(); #endif +#if TARGET_PC +#define STR_BUF_LEN 528 +#elif VERSION == VERSION_GCN_JPN +#define STR_BUF_LEN 528 +#else +#define STR_BUF_LEN 512 +#endif + for (int i = 0; i < 2; i++) { ((J2DTextBox*)field_0x2ec[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - ((J2DTextBox*)field_0x2ec[i]->getPanePtr())->setString(0x210, ""); -#else - ((J2DTextBox*)field_0x2ec[i]->getPanePtr())->setString(0x200, ""); -#endif + ((J2DTextBox*)field_0x2ec[i]->getPanePtr())->setString(STR_BUF_LEN, ""); if (field_0x2f4[i] != NULL) { ((J2DTextBox*)field_0x2f4[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - ((J2DTextBox*)field_0x2f4[i]->getPanePtr())->setString(0x210, ""); -#else - ((J2DTextBox*)field_0x2f4[i]->getPanePtr())->setString(0x200, ""); -#endif + ((J2DTextBox*)field_0x2f4[i]->getPanePtr())->setString(STR_BUF_LEN, ""); } } field_0x1e4[0] = (J2DTextBox*)mpLetterScreen[0]->search(MULTI_CHAR('p_texts')); diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 94babc8342..cb9af850c0 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -25,6 +25,7 @@ #include #include "JSystem/JAudio2/JASDriverIF.h" +#include "dusk/version.hpp" #if TARGET_PC #include "dusk/menu_pointer.h" @@ -34,7 +35,7 @@ typedef void (dMenu_Option_c::*initFunc)(); static initFunc init[] = { &dMenu_Option_c::atten_init, -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN &dMenu_Option_c::ruby_init, #endif &dMenu_Option_c::vib_init, @@ -46,7 +47,7 @@ static initFunc init[] = { typedef void (dMenu_Option_c::*processFunc)(); static processFunc process[] = { &dMenu_Option_c::atten_move, -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN &dMenu_Option_c::ruby_move, #endif &dMenu_Option_c::vib_move, @@ -68,21 +69,6 @@ static calibrationFunc calibration_process[] = { &dMenu_Option_c::calibration_close2_move, }; -enum SelectType { -#if VERSION == VERSION_GCN_JPN - SelectType0_JPN, -#endif - SelectType0, - SelectType1, - SelectType2, - SelectType3, - SelectType4, - SelectType5, - SelectType6, - SelectType7, - SelectType8, -}; - #if TARGET_PC static dusk::menu_pointer::TargetId option_yes_no_target(u8 index) noexcept { return static_cast(0x100 + index); @@ -271,11 +257,11 @@ void dMenu_Option_c::_create() { field_0x3e1 = 10; field_0x3e2 = 0xff; field_0x3e3 = 0xc0; - field_0x3ef = 0; + field_0x3ef = PROC_ATTEN_e; field_0x3f0 = 0xff; field_0x3f1 = 0xff; field_0x3f2 = 0; - field_0x3f5 = 0; + field_0x3f5 = PROC_ATTEN_e; field_0x3f3 = 5; field_0x3f4 = 5; field_0x334 = 0.0f; @@ -499,9 +485,9 @@ void dMenu_Option_c::_move() { } if (mDoGph_gInf_c::getFader()->getStatus() == 1) { - if (mDoCPd_c::getTrigA(PAD_1) != 0 && field_0x3ef != SelectType3 && field_0x3f3 == 5) { - if (field_0x3f4 == 5 && field_0x3ef != SelectType4 && field_0x3ef != SelectType5 && field_0x3ef != SelectType6 && - field_0x3ef != SelectType7) + if (mDoCPd_c::getTrigA(PAD_1) != 0 && field_0x3ef != PROC_CHANGE_MOVE_e && field_0x3f3 == 5) { + if (field_0x3f4 == 5 && field_0x3ef != PROC_CONFIRM_OPEN_MOVE_e && field_0x3ef != PROC_CONFIRM_MOVE_MOVE_e && field_0x3ef != PROC_CONFIRM_SELECT_MOVE_e && + field_0x3ef != PROC_CONFIRM_CLOSE_MOVE_e) { if (mDoCPd_c::getTrigStart(PAD_1) == 0 && mDoCPd_c::getTrigB(PAD_1) == 0) { if (mDoCPd_c::getTrigUp(PAD_1) == 0 && mDoCPd_c::getTrigDown(PAD_1) == 0 && @@ -509,7 +495,7 @@ void dMenu_Option_c::_move() { { field_0x3f7 = 1; field_0x3f5 = field_0x3ef; - field_0x3ef = SelectType4; + field_0x3ef = PROC_CONFIRM_OPEN_MOVE_e; dMeter2Info_set2DVibration(); (this->*init[field_0x3ef])(); goto skip; @@ -518,8 +504,8 @@ void dMenu_Option_c::_move() { } } - if (mDoCPd_c::getTrigB(PAD_1) != 0 && field_0x3ef != SelectType3 && field_0x3f3 == 5 && - field_0x3ef != SelectType4 && field_0x3ef != SelectType5 && field_0x3ef != SelectType6 && field_0x3ef != SelectType7) + if (mDoCPd_c::getTrigB(PAD_1) != 0 && field_0x3ef != PROC_CHANGE_MOVE_e && field_0x3f3 == 5 && + field_0x3ef != PROC_CONFIRM_OPEN_MOVE_e && field_0x3ef != PROC_CONFIRM_MOVE_MOVE_e && field_0x3ef != PROC_CONFIRM_SELECT_MOVE_e && field_0x3ef != PROC_CONFIRM_CLOSE_MOVE_e) { if (field_0x3f4 == 5 && mDoCPd_c::getTrigStart(PAD_1) == 0 && mDoCPd_c::getTrigA(PAD_1) == 0 && mDoCPd_c::getTrigUp(PAD_1) == 0 && @@ -528,16 +514,16 @@ void dMenu_Option_c::_move() { { field_0x3f7 = 0; field_0x3f5 = field_0x3ef; - field_0x3ef = SelectType4; + field_0x3ef = PROC_CONFIRM_OPEN_MOVE_e; dMeter2Info_set2DVibration(); (this->*init[field_0x3ef])(); } } #if TARGET_PC - if (field_0x3f4 == 5 && field_0x3ef != SelectType3 && field_0x3f3 == 5 && - field_0x3ef != SelectType4 && field_0x3ef != SelectType5 && field_0x3ef != SelectType6 && - field_0x3ef != SelectType7 && pointerConfirmSelect()) + if (field_0x3f4 == 5 && field_0x3ef != PROC_CHANGE_MOVE_e && field_0x3f3 == 5 && + field_0x3ef != PROC_CONFIRM_OPEN_MOVE_e && field_0x3ef != PROC_CONFIRM_MOVE_MOVE_e && field_0x3ef != PROC_CONFIRM_SELECT_MOVE_e && + field_0x3ef != PROC_CONFIRM_CLOSE_MOVE_e && pointerConfirmSelect()) { goto skip; } @@ -545,7 +531,7 @@ void dMenu_Option_c::_move() { } skip: u8 oldValue = field_0x3ef; - if (field_0x3f3 == 5 && oldValue != SelectType4 && oldValue != SelectType5 && oldValue != SelectType6 && oldValue != SelectType7) { + if (field_0x3f3 == 5 && oldValue != PROC_CONFIRM_OPEN_MOVE_e && oldValue != PROC_CONFIRM_MOVE_MOVE_e && oldValue != PROC_CONFIRM_SELECT_MOVE_e && oldValue != PROC_CONFIRM_CLOSE_MOVE_e) { dpdMenuMove(); } @@ -624,8 +610,8 @@ void dMenu_Option_c::drawHaihai() { field_0x3f6 = 0; field_0x3f6 |= 1; field_0x3f6 |= 4; - if (selectType < SelectType4 && field_0x3f6 != 0 && field_0x3f3 == 5 && field_0x3ef != SelectType4 && - field_0x3ef != SelectType5 && field_0x3ef != SelectType6 && field_0x3ef != SelectType7) + if (selectType < PROC_CONFIRM_OPEN_MOVE_e && field_0x3f6 != 0 && field_0x3f3 == 5 && field_0x3ef != PROC_CONFIRM_OPEN_MOVE_e && + field_0x3ef != PROC_CONFIRM_MOVE_MOVE_e && field_0x3ef != PROC_CONFIRM_SELECT_MOVE_e && field_0x3ef != PROC_CONFIRM_CLOSE_MOVE_e) { mpMeterHaihai->_execute(0); Vec haihaiPosL = @@ -766,7 +752,13 @@ void dMenu_Option_c::atten_move() { if (field_0x3f3 != 5) { (this->*tv_process[field_0x3f3])(); } else if (downTrigger) { - field_0x3ef = 1; +#if TARGET_PC + field_0x3ef = dusk::version::isRegionJpn() ? PROC_RUBY_e : PROC_VIB_e; +#elif VERSION == VERSION_GCN_JPN + field_0x3ef = PROC_RUBY_e; +#else + field_0x3ef = PROC_VIB_e; +#endif Z2GetAudioMgr()->seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (leftTrigger) { if (field_0x3e4 == 0) { @@ -776,8 +768,8 @@ void dMenu_Option_c::atten_move() { field_0x3e4 = 0; field_0x3da = -5; } - field_0x3ef = SelectType3; - field_0x3f5 = 0; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_ATTEN_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (rightTrigger) { if (field_0x3e4 == 0) { @@ -787,16 +779,23 @@ void dMenu_Option_c::atten_move() { field_0x3e4 = 0; field_0x3da = 5; } - field_0x3ef = SelectType3; - field_0x3f5 = 0; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_ATTEN_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else { changeTVCheck(); } } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN void dMenu_Option_c::ruby_init() { +#if TARGET_PC + if (!dusk::version::isRegionJpn()) { + vib_init(); + return; + } +#endif + mpDrawCursor->setAlphaRate(1.0f); setCursorPos(1); setAButtonString(0x40c); @@ -804,6 +803,12 @@ void dMenu_Option_c::ruby_init() { } void dMenu_Option_c::ruby_move() { +#if TARGET_PC + if (!dusk::version::isRegionJpn()) { + vib_move(); + return; + } +#endif bool upTrigger = mpStick->checkUpTrigger(); bool downTrigger= mpStick->checkDownTrigger(); @@ -813,10 +818,10 @@ void dMenu_Option_c::ruby_move() { if (field_0x3f3 != 5) { (this->*tv_process[field_0x3f3])(); } else if (upTrigger) { - field_0x3ef = SelectType0_JPN; + field_0x3ef = PROC_ATTEN_e; Z2GetAudioMgr()->seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (downTrigger) { - field_0x3ef = SelectType1; + field_0x3ef = PROC_VIB_e; Z2GetAudioMgr()->seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (leftTrigger) { if (field_0x3e5_JPN == 0) { @@ -826,8 +831,8 @@ void dMenu_Option_c::ruby_move() { field_0x3e5_JPN = 0; field_0x3da = -5; } - field_0x3ef = SelectType3; - field_0x3f5 = SelectType0; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_RUBY_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (rightTrigger) { if (field_0x3e5_JPN == 0) { @@ -837,8 +842,8 @@ void dMenu_Option_c::ruby_move() { field_0x3e5_JPN = 0; field_0x3da = 5; } - field_0x3ef = SelectType3; - field_0x3f5 = SelectType0; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_RUBY_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else { changeTVCheck(); @@ -848,7 +853,7 @@ void dMenu_Option_c::ruby_move() { void dMenu_Option_c::vib_init() { mpDrawCursor->setAlphaRate(1.0f); - setCursorPos(SelectType1); + setCursorPos(PROC_VIB_e); setAButtonString(0x40C); setBButtonString(0x3F9); } @@ -862,10 +867,16 @@ void dMenu_Option_c::vib_move() { if (field_0x3f3 != 5) { (this->*tv_process[field_0x3f3])(); } else if (upTrigger) { - field_0x3ef = SelectType0; +#if TARGET_PC + field_0x3ef = dusk::version::isRegionJpn() ? PROC_RUBY_e : PROC_ATTEN_e; +#elif VERSION == VERSION_GCN_JPN + field_0x3ef = PROC_RUBY_e; +#else + field_0x3ef = PROC_ATTEN_e; +#endif Z2GetAudioMgr()->seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (downTrigger) { - field_0x3ef = SelectType2; + field_0x3ef = PROC_SOUND_e; Z2GetAudioMgr()->seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (leftTrigger) { if (isRumbleSupported()) { @@ -877,8 +888,8 @@ void dMenu_Option_c::vib_move() { field_0x3ea = 0; field_0x3da = -5; } - field_0x3ef = SelectType3; - field_0x3f5 = SelectType1; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_VIB_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } @@ -892,8 +903,8 @@ void dMenu_Option_c::vib_move() { field_0x3ea = 0; field_0x3da = 5; } - field_0x3ef = SelectType3; - field_0x3f5 = SelectType1; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_VIB_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } @@ -904,7 +915,7 @@ void dMenu_Option_c::vib_move() { void dMenu_Option_c::sound_init() { mpDrawCursor->setAlphaRate(1.0f); - setCursorPos(SelectType2); + setCursorPos(PROC_SOUND_e); setAButtonString(0x40C); setBButtonString(0x3F9); } @@ -918,7 +929,7 @@ void dMenu_Option_c::sound_move() { if (field_0x3f3 != 5) { (this->*tv_process[field_0x3f3])(); } else if (upTrigger) { - field_0x3ef = SelectType1; + field_0x3ef = PROC_VIB_e; Z2GetAudioMgr()->seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (leftTrigger) { if (field_0x3e9 == 2) { @@ -943,8 +954,8 @@ void dMenu_Option_c::sound_move() { } mDoAud_setOutputMode(dMo_soundMode[field_0x3e9]); setSoundMode(dMo_soundMode[field_0x3e9]); - field_0x3ef = SelectType3; - field_0x3f5 = SelectType2; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_SOUND_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else if (rightTrigger) { if (field_0x3e9 == 0) { @@ -969,8 +980,8 @@ void dMenu_Option_c::sound_move() { } mDoAud_setOutputMode(dMo_soundMode[field_0x3e9]); setSoundMode(dMo_soundMode[field_0x3e9]); - field_0x3ef = SelectType3; - field_0x3f5 = SelectType2; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_SOUND_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } else { changeTVCheck(); @@ -992,32 +1003,28 @@ void dMenu_Option_c::change_move() { } u8 index; switch (field_0x3f5) { -#if VERSION == VERSION_GCN_JPN - case SelectType0_JPN: - index = SelectType0_JPN; + case PROC_ATTEN_e: + index = PROC_ATTEN_e; if (field_0x3da == 0) { setAttenString(); } break; -#endif - case SelectType0: - index = SelectType0; + case PROC_RUBY_e: + index = PROC_RUBY_e; if (field_0x3da == 0) { -#if VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) setRubyString(); -#else - setAttenString(); -#endif + IF_DUSK_BLOCK_END } break; - case SelectType1: - index = SelectType1; + case PROC_VIB_e: + index = DUSK_IF_ELSE(dusk::version::isRegionJpn() ? 2 : 1, PROC_VIB_e); if (field_0x3da == 0) { setVibString(); } break; - case SelectType2: - index = SelectType2; + case PROC_SOUND_e: + index = DUSK_IF_ELSE(dusk::version::isRegionJpn() ? 3 : 2, PROC_SOUND_e); if (field_0x3da == 0) { setSoundString(); } @@ -1083,7 +1090,7 @@ void dMenu_Option_c::confirm_open_move() { } if (status == 1 && yesNoMenuMove == 1 && field_0x374 == 1.0f) { yesnoCursorShow(); - field_0x3ef = SelectType5; + field_0x3ef = PROC_CONFIRM_MOVE_MOVE_e; } mpWarning->_move(); setAnimation(); @@ -1113,21 +1120,21 @@ void dMenu_Option_c::confirm_move_move() { field_0x3f9 = i; if (clicked) { yesNoSelectStart(); - field_0x3ef = SelectType7; + field_0x3ef = PROC_CONFIRM_CLOSE_MOVE_e; dMeter2Info_set2DVibrationM(); mpWarning->_move(); setAnimation(); return; } yesnoSelectAnmSet(); - field_0x3ef = SelectType6; + field_0x3ef = PROC_CONFIRM_SELECT_MOVE_e; mpWarning->_move(); setAnimation(); return; } if (clicked) { yesNoSelectStart(); - field_0x3ef = SelectType7; + field_0x3ef = PROC_CONFIRM_CLOSE_MOVE_e; dMeter2Info_set2DVibrationM(); mpWarning->_move(); setAnimation(); @@ -1138,12 +1145,12 @@ void dMenu_Option_c::confirm_move_move() { if (mDoCPd_c::getTrigA(PAD_1) != 0) { yesNoSelectStart(); - field_0x3ef = SelectType7; + field_0x3ef = PROC_CONFIRM_CLOSE_MOVE_e; dMeter2Info_set2DVibrationM(); } else if (mDoCPd_c::getTrigB(PAD_1) != 0) { field_0x3f9 = 0; yesnoCancelAnmSet(); - field_0x3ef = SelectType7; + field_0x3ef = PROC_CONFIRM_CLOSE_MOVE_e; dMeter2Info_set2DVibrationM(); } else if (rightTrigger != 0) { if (field_0x3f9 != 0) { @@ -1152,7 +1159,7 @@ void dMenu_Option_c::confirm_move_move() { field_0x3fa = field_0x3f9; field_0x3f9 = 0; yesnoSelectAnmSet(); - field_0x3ef = SelectType6; + field_0x3ef = PROC_CONFIRM_SELECT_MOVE_e; } } else if (leftTrigger != 0) { if (field_0x3f9 != 1) { @@ -1161,7 +1168,7 @@ void dMenu_Option_c::confirm_move_move() { field_0x3fa = field_0x3f9; field_0x3f9 = 1; yesnoSelectAnmSet(); - field_0x3ef = SelectType6; + field_0x3ef = PROC_CONFIRM_SELECT_MOVE_e; } } mpWarning->_move(); @@ -1195,14 +1202,14 @@ void dMenu_Option_c::confirm_select_move() { dusk::menu_pointer::Context::Options, option_yes_no_target(field_0x3f9))) { yesNoSelectStart(); - field_0x3ef = SelectType7; + field_0x3ef = PROC_CONFIRM_CLOSE_MOVE_e; dMeter2Info_set2DVibrationM(); mpWarning->_move(); setAnimation(); return; } #endif - field_0x3ef = SelectType5; + field_0x3ef = PROC_CONFIRM_MOVE_MOVE_e; } mpWarning->_move(); setAnimation(); @@ -1231,8 +1238,8 @@ void dMenu_Option_c::confirm_close_move() { if (field_0x3f9 == 1) { mQuitStatus = 3; dComIfGs_setOptAttentionType(field_0x3e4); -#if VERSION == VERSION_GCN_JPN - if (field_0x3e5_JPN == 0) { +#if TARGET_PC || VERSION == VERSION_GCN_JPN + if (IF_DUSK(dusk::version::isRegionJpn() &&) field_0x3e5_JPN == 0) { dComIfGs_setOptRuby(1); } else { dComIfGs_setOptRuby(0); @@ -1346,7 +1353,14 @@ void dMenu_Option_c::calibration_close2_move() { void dMenu_Option_c::menuVisible() { for (int i = 0; i < 6; i++) { - if (i < SelectType3) { +#if TARGET_PC + if ((dusk::version::isRegionJpn() && i < 4) || i < 3) +#elif VERSION == VERSION_GCN_JPN + if (i < 4) +#else + if (i < 3) +#endif + { menuShow(i); } else { menuHide(i); @@ -1396,7 +1410,16 @@ void dMenu_Option_c::screenSet() { static const u64 tag_frame[6] = { MULTI_CHAR('flame_00'), MULTI_CHAR('flame_01'), MULTI_CHAR('flame_02'), MULTI_CHAR('flame_03'), MULTI_CHAR('flame_04'), MULTI_CHAR('flame_05'), }; -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + static const u64 tag_menu0_jpn[6] = { + MULTI_CHAR('menu_t0'), MULTI_CHAR('menu_t1'), MULTI_CHAR('menu_t2'), MULTI_CHAR('menu_t3'), MULTI_CHAR('menu_t4'), MULTI_CHAR('menu_t5'), + }; + + static const u64 tag_menu0[6] = { + MULTI_CHAR('fenu_t0'), MULTI_CHAR('fenu_t1'), MULTI_CHAR('fenu_t2'), MULTI_CHAR('fenu_t3'), MULTI_CHAR('fenu_t4'), MULTI_CHAR('fenu_t5'), + }; +#elif VERSION == VERSION_GCN_JPN static const u64 tag_menu0[6] = { MULTI_CHAR('menu_t0'), MULTI_CHAR('menu_t1'), MULTI_CHAR('menu_t2'), MULTI_CHAR('menu_t3'), MULTI_CHAR('menu_t4'), MULTI_CHAR('menu_t5'), }; @@ -1405,6 +1428,7 @@ void dMenu_Option_c::screenSet() { MULTI_CHAR('fenu_t0'), MULTI_CHAR('fenu_t1'), MULTI_CHAR('fenu_t2'), MULTI_CHAR('fenu_t3'), MULTI_CHAR('fenu_t4'), MULTI_CHAR('fenu_t5'), }; #endif + static const u64 let_n[6] = { MULTI_CHAR('let_00_n'), MULTI_CHAR('let_01_n'), MULTI_CHAR('let_02_n'), MULTI_CHAR('let_03_n'), MULTI_CHAR('let_04_n'), MULTI_CHAR('let_05_n'), }; @@ -1444,7 +1468,34 @@ void dMenu_Option_c::screenSet() { static const u64 ftv_btnA[5] = { MULTI_CHAR('font_a1'), MULTI_CHAR('font_at2'), MULTI_CHAR('font_at3'), MULTI_CHAR('font_at4'), MULTI_CHAR('font_at'), }; -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + static const u64 fenu_t0_jpn[2] = {MULTI_CHAR('fenu_t0s'), MULTI_CHAR('fenu_t0')}; + static const u64 menu_t0_jpn[2] = {MULTI_CHAR('menu_t0s'), MULTI_CHAR('menu_t0')}; + static const u64 fenu_t1_jpn[2] = {MULTI_CHAR('fenu_t1s'), MULTI_CHAR('fenu_t1')}; + static const u64 menu_t1_jpn[2] = {MULTI_CHAR('menu_t1s'), MULTI_CHAR('menu_t1')}; + static const u64 fenu_t2_jpn[2] = {MULTI_CHAR('fenu_t2s'), MULTI_CHAR('fenu_t2')}; + static const u64 menu_t2_jpn[2] = {MULTI_CHAR('menu_t2s'), MULTI_CHAR('menu_t2')}; + static const u64 fenu_t3_jpn[2] = {MULTI_CHAR('fenu_t3s'), MULTI_CHAR('fenu_t3')}; + static const u64 menu_t3_jpn[2] = {MULTI_CHAR('menu_t3s'), MULTI_CHAR('menu_t3')}; + static const u64 fenu_t4_jpn[2] = {MULTI_CHAR('fenu_t4s'), MULTI_CHAR('fenu_t4')}; + static const u64 menu_t4_jpn[2] = {MULTI_CHAR('menu_t4s'), MULTI_CHAR('menu_t4')}; + static const u64 fenu_t5_jpn[2] = {MULTI_CHAR('fenu_t5s'), MULTI_CHAR('fenu_t5')}; + static const u64 menu_t5_jpn[2] = {MULTI_CHAR('menu_t5s'), MULTI_CHAR('menu_t5')}; + + static const u64 fenu_t0[2] = {MULTI_CHAR('fenu_t0s'), MULTI_CHAR('fenu_t0')}; + static const u64 menu_t0[2] = {MULTI_CHAR('menu_t0s'), MULTI_CHAR('menu_t0')}; + static const u64 fenu_t2[2] = {MULTI_CHAR('fenu_t1s'), MULTI_CHAR('fenu_t1')}; + static const u64 menu_t2[2] = {MULTI_CHAR('menu_t1s'), MULTI_CHAR('menu_t1')}; + static const u64 fenu_t3[2] = {MULTI_CHAR('fenu_t2s'), MULTI_CHAR('fenu_t2')}; + static const u64 menu_t3[2] = {MULTI_CHAR('menu_t2s'), MULTI_CHAR('menu_t2')}; + static const u64 fenu_t4[2] = {MULTI_CHAR('fenu_t3s'), MULTI_CHAR('fenu_t3')}; + static const u64 menu_t4[2] = {MULTI_CHAR('menu_t3s'), MULTI_CHAR('menu_t3')}; + static const u64 fenu_t1[2] = {MULTI_CHAR('fenu_t4s'), MULTI_CHAR('fenu_t4')}; + static const u64 menu_t1[2] = {MULTI_CHAR('menu_t4s'), MULTI_CHAR('menu_t4')}; + static const u64 fenu_t5[2] = {MULTI_CHAR('fenu_t5s'), MULTI_CHAR('fenu_t5')}; + static const u64 menu_t5[2] = {MULTI_CHAR('menu_t5s'), MULTI_CHAR('menu_t5')}; +#elif VERSION == VERSION_GCN_JPN static const u64 fenu_t0[2] = {MULTI_CHAR('fenu_t0s'), MULTI_CHAR('fenu_t0')}; static const u64 menu_t0[2] = {MULTI_CHAR('menu_t0s'), MULTI_CHAR('menu_t0')}; static const u64 fenu_t1[2] = {MULTI_CHAR('fenu_t1s'), MULTI_CHAR('fenu_t1')}; @@ -1501,7 +1552,15 @@ void dMenu_Option_c::screenSet() { static const u64 fenut_4[6] = { MULTI_CHAR('menut321'), MULTI_CHAR('menut320'), MULTI_CHAR('menut319'), MULTI_CHAR('menut318'), MULTI_CHAR('menut317'), MULTI_CHAR('menut316'), }; -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + static const u64 tx_jpn[6] = { + MULTI_CHAR('wps_text'), MULTI_CHAR('w_p_text'), MULTI_CHAR('g_ps_tx3'), MULTI_CHAR('g_p_tex3'), MULTI_CHAR('wps_tex1'), MULTI_CHAR('w_p_tex1'), + }; + static const u64 tx[6] = { + MULTI_CHAR('w_p_tex5'), MULTI_CHAR('w_p_tex6'), MULTI_CHAR('w_p_tex3'), MULTI_CHAR('w_p_tex4'), MULTI_CHAR('fps_tex1'), MULTI_CHAR('f_p_tex1'), + }; +#elif VERSION == VERSION_GCN_JPN static const u64 tx[6] = { MULTI_CHAR('wps_text'), MULTI_CHAR('w_p_text'), MULTI_CHAR('g_ps_tx3'), MULTI_CHAR('g_p_tex3'), MULTI_CHAR('wps_tex1'), MULTI_CHAR('w_p_tex1'), }; @@ -1510,13 +1569,24 @@ void dMenu_Option_c::screenSet() { MULTI_CHAR('w_p_tex5'), MULTI_CHAR('w_p_tex6'), MULTI_CHAR('w_p_tex3'), MULTI_CHAR('w_p_tex4'), MULTI_CHAR('fps_tex1'), MULTI_CHAR('f_p_tex1'), }; #endif + static const u64 op_tx[4] = { MULTI_CHAR('w_text_n'), MULTI_CHAR('w_btn_n'), MULTI_CHAR('w_k_t_n'), MULTI_CHAR('w_abtn_n'), }; static const u64 z_tx[3] = { MULTI_CHAR('z_gc_n'), 0, 0, }; -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + static const u64 txTV_jpn[10] = { + MULTI_CHAR('menu_t6s'), MULTI_CHAR('menu_t6'), MULTI_CHAR('menu_t9s'), MULTI_CHAR('menu_t9'), MULTI_CHAR('menut10s'), + MULTI_CHAR('menu_t10'), MULTI_CHAR('menu_t7s'), MULTI_CHAR('menu_t7'), MULTI_CHAR('menu_t8s'), MULTI_CHAR('menu_t8'), + }; + static const u64 txTV[10] = { + MULTI_CHAR('menu_t61'), MULTI_CHAR('menu_t2'), MULTI_CHAR('menu_t91'), MULTI_CHAR('menu_t1'), MULTI_CHAR('menut101'), + MULTI_CHAR('menu_t01'), MULTI_CHAR('menu_t71'), MULTI_CHAR('menu_t3'), MULTI_CHAR('menu_t81'), MULTI_CHAR('menu_t4'), + }; +#elif VERSION == VERSION_GCN_JPN static const u64 txTV[10] = { MULTI_CHAR('menu_t6s'), MULTI_CHAR('menu_t6'), MULTI_CHAR('menu_t9s'), MULTI_CHAR('menu_t9'), MULTI_CHAR('menut10s'), MULTI_CHAR('menu_t10'), MULTI_CHAR('menu_t7s'), MULTI_CHAR('menu_t7'), MULTI_CHAR('menu_t8s'), MULTI_CHAR('menu_t8'), @@ -1533,7 +1603,7 @@ void dMenu_Option_c::screenSet() { mpWarning->mPosY = pos.y + g_drawHIO.mOptionScreen.mBackgroundPosY; for (int i = 0; i < 6; i++) { field_0x280[i] = (J2DPicture*)mpScreen->search(tag_frame[i]); - field_0x298[i] = (J2DTextBox*)mpScreen->search(tag_menu0[i]); + field_0x298[i] = (J2DTextBox*)mpScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? tag_menu0_jpn[i] : tag_menu0[i], tag_menu0[i])); } field_0x2b0[0] = field_0x280[1]->getBlack(); field_0x2c0[0] = field_0x280[1]->getWhite(); @@ -1600,7 +1670,23 @@ void dMenu_Option_c::screenSet() { mpMenuPane32[i] = NULL; } } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x270[0] = (J2DTextBox*)mpBackScreen->search(MULTI_CHAR('t_t00')); + field_0x270[1] = (J2DTextBox*)mpBackScreen->search(MULTI_CHAR('t_t01')); + mpBackScreen->search(MULTI_CHAR('f_t00'))->hide(); + mpBackScreen->search(MULTI_CHAR('t_t01'))->hide(); + field_0x270[2] = (J2DTextBox*)mpTVScreen->search(MULTI_CHAR('t_t00')); + mpTVScreen->search(MULTI_CHAR('f_t00'))->hide(); + } else { + field_0x270[0] = (J2DTextBox*)mpBackScreen->search(MULTI_CHAR('f_t00')); + field_0x270[1] = (J2DTextBox*)mpBackScreen->search(MULTI_CHAR('t_t01')); + mpBackScreen->search(MULTI_CHAR('t_t00'))->hide(); + mpBackScreen->search(MULTI_CHAR('t_t01'))->hide(); + field_0x270[2] = (J2DTextBox*)mpTVScreen->search(MULTI_CHAR('f_t00')); + mpTVScreen->search(MULTI_CHAR('t_t00'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x270[0] = (J2DTextBox*)mpBackScreen->search(MULTI_CHAR('t_t00')); field_0x270[1] = (J2DTextBox*)mpBackScreen->search(MULTI_CHAR('t_t01')); mpBackScreen->search(MULTI_CHAR('f_t00'))->hide(); @@ -1623,7 +1709,15 @@ void dMenu_Option_c::screenSet() { mpString->getString(0x547, field_0x270[1], NULL, NULL, NULL, 0); mpString->getString(0x55C, field_0x270[2], NULL, NULL, NULL, 0); for (int i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x25c[i] = (J2DTextBox*)mpTVScreen->search(tv_btnA[i]); + mpTVScreen->search(ftv_btnA[i])->hide(); + } else { + field_0x25c[i] = (J2DTextBox*)mpTVScreen->search(ftv_btnA[i]); + mpTVScreen->search(tv_btnA[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x25c[i] = (J2DTextBox*)mpTVScreen->search(tv_btnA[i]); mpTVScreen->search(ftv_btnA[i])->hide(); #else @@ -1634,8 +1728,17 @@ void dMenu_Option_c::screenSet() { field_0x25c[i]->setString(0x40, ""); mpString->getString(0x564, field_0x25c[i], NULL, NULL, NULL, 0); } + for (int i = 0; i < 2; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x21c[0][i] = (J2DTextBox*)mpScreen->search(menu_t0_jpn[i]); + mpScreen->search(fenu_t0_jpn[i])->hide(); + } else { + field_0x21c[0][i] = (J2DTextBox*)mpScreen->search(fenu_t0[i]); + mpScreen->search(menu_t0[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x21c[0][i] = (J2DTextBox*)mpScreen->search(menu_t0[i]); mpScreen->search(fenu_t0[i])->hide(); #else @@ -1647,7 +1750,15 @@ void dMenu_Option_c::screenSet() { mpString->getString(0x548, field_0x21c[0][i], NULL, NULL, NULL, 0); } for (int i = 0; i < 2; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x21c[1][i] = (J2DTextBox*)mpScreen->search(menu_t1_jpn[i]); + mpScreen->search(fenu_t1_jpn[i])->hide(); + } else { + field_0x21c[1][i] = (J2DTextBox*)mpScreen->search(fenu_t2[i]); + mpScreen->search(menu_t2[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x21c[1][i] = (J2DTextBox*)mpScreen->search(menu_t1[i]); mpScreen->search(fenu_t1[i])->hide(); #else @@ -1656,14 +1767,29 @@ void dMenu_Option_c::screenSet() { #endif field_0x21c[1][i]->setFont(mpFont); field_0x21c[1][i]->setString(0x40, ""); -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpString->getString(0x54B, field_0x21c[1][i], NULL, NULL, NULL, 0); + } else { + mpString->getString(0x54E, field_0x21c[1][i], NULL, NULL, NULL, 0); + } +#elif VERSION == VERSION_GCN_JPN mpString->getString(0x54B, field_0x21c[1][i], NULL, NULL, NULL, 0); #else mpString->getString(0x54E, field_0x21c[1][i], NULL, NULL, NULL, 0); #endif } for (int i = 0; i < 2; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x21c[2][i] = (J2DTextBox*)mpScreen->search(menu_t2_jpn[i]); + mpScreen->search(fenu_t2_jpn[i])->hide(); + } else { + field_0x21c[2][i] = (J2DTextBox*)mpScreen->search(fenu_t3[i]); + mpScreen->search(menu_t3[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x21c[2][i] = (J2DTextBox*)mpScreen->search(menu_t2[i]); mpScreen->search(fenu_t2[i])->hide(); #else @@ -1672,14 +1798,29 @@ void dMenu_Option_c::screenSet() { #endif field_0x21c[2][i]->setFont(mpFont); field_0x21c[2][i]->setString(0x40, ""); -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpString->getString(0x54E, field_0x21c[2][i], NULL, NULL, NULL, 0); + } else { + mpString->getString(0x54F, field_0x21c[2][i], NULL, NULL, NULL, 0); + } +#elif VERSION == VERSION_GCN_JPN mpString->getString(0x54E, field_0x21c[2][i], NULL, NULL, NULL, 0); #else mpString->getString(0x54F, field_0x21c[2][i], NULL, NULL, NULL, 0); #endif } for (int i = 0; i < 2; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x21c[3][i] = (J2DTextBox*)mpScreen->search(menu_t3_jpn[i]); + mpScreen->search(fenu_t3_jpn[i])->hide(); + } else { + field_0x21c[3][i] = (J2DTextBox*)mpScreen->search(fenu_t4[i]); + mpScreen->search(menu_t4[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x21c[3][i] = (J2DTextBox*)mpScreen->search(menu_t3[i]); mpScreen->search(fenu_t3[i])->hide(); #else @@ -1688,12 +1829,25 @@ void dMenu_Option_c::screenSet() { #endif field_0x21c[3][i]->setFont(mpFont); field_0x21c[3][i]->setString(0x40, ""); -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpString->getString(0x54F, field_0x21c[3][i], NULL, NULL, NULL, 0); + } +#elif VERSION == VERSION_GCN_JPN mpString->getString(0x54F, field_0x21c[3][i], NULL, NULL, NULL, 0); #endif } for (int i = 0; i < 2; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x21c[4][i] = (J2DTextBox*)mpScreen->search(menu_t4_jpn[i]); + mpScreen->search(fenu_t4_jpn[i])->hide(); + } else { + field_0x21c[4][i] = (J2DTextBox*)mpScreen->search(fenu_t1[i]); + mpScreen->search(menu_t1[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x21c[4][i] = (J2DTextBox*)mpScreen->search(menu_t4[i]); mpScreen->search(fenu_t4[i])->hide(); #else @@ -1704,7 +1858,15 @@ void dMenu_Option_c::screenSet() { field_0x21c[4][i]->setString(0x40, ""); } for (int i = 0; i < 2; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x21c[5][i] = (J2DTextBox*)mpScreen->search(menu_t5_jpn[i]); + mpScreen->search(fenu_t5_jpn[i])->hide(); + } else { + field_0x21c[5][i] = (J2DTextBox*)mpScreen->search(fenu_t5[i]); + mpScreen->search(menu_t5[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN field_0x21c[5][i] = (J2DTextBox*)mpScreen->search(menu_t5[i]); mpScreen->search(fenu_t5[i])->hide(); #else @@ -1716,7 +1878,17 @@ void dMenu_Option_c::screenSet() { mpString->getString(0x554, field_0x21c[5][i], NULL, NULL, NULL, 0); } for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + paneResize(menut_0[i]); + mpMenuText[0][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_0[i], 0, NULL); + mpClipScreen->search(fenut_0[i])->hide(); + } else { + paneResize(fenut_0[i]); + mpMenuText[0][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_0[i], 0, NULL); + mpClipScreen->search(menut_0[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN paneResize(menut_0[i]); mpMenuText[0][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_0[i], 0, NULL); mpClipScreen->search(fenut_0[i])->hide(); @@ -1730,7 +1902,17 @@ void dMenu_Option_c::screenSet() { mpMenuText[0][i]->getPanePtr()->setBasePosition(J2DBasePosition_4); } for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + paneResize(menut_1[i]); + mpMenuText[1][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_1[i], 0, NULL); + mpClipScreen->search(fenut_1[i])->hide(); + } else { + paneResize(fenut_1[i]); + mpMenuText[1][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_1[i], 0, NULL); + mpClipScreen->search(menut_1[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN paneResize(menut_1[i]); mpMenuText[1][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_1[i], 0, NULL); mpClipScreen->search(fenut_1[i])->hide(); @@ -1745,7 +1927,17 @@ void dMenu_Option_c::screenSet() { mpMenuText[1][i]->getPanePtr()->setBasePosition(J2DBasePosition_4); } for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + paneResize(menut_2[i]); + mpMenuText[2][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_2[i], 0, NULL); + mpClipScreen->search(fenut_2[i])->hide(); + } else { + paneResize(fenut_2[i]); + mpMenuText[2][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_2[i], 0, NULL); + mpClipScreen->search(menut_2[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN paneResize(menut_2[i]); mpMenuText[2][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_2[i], 0, NULL); mpClipScreen->search(fenut_2[i])->hide(); @@ -1760,7 +1952,17 @@ void dMenu_Option_c::screenSet() { mpMenuText[2][i]->getPanePtr()->setBasePosition(J2DBasePosition_4); } for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + paneResize(menut_3[i]); + mpMenuText[3][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_3[i], 0, NULL); + mpClipScreen->search(fenut_3[i])->hide(); + } else { + paneResize(fenut_3[i]); + mpMenuText[3][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_3[i], 0, NULL); + mpClipScreen->search(menut_3[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN paneResize(menut_3[i]); mpMenuText[3][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_3[i], 0, NULL); mpClipScreen->search(fenut_3[i])->hide(); @@ -1775,7 +1977,17 @@ void dMenu_Option_c::screenSet() { mpMenuText[3][i]->getPanePtr()->setBasePosition(J2DBasePosition_4); } for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + paneResize(menut_4[i]); + mpMenuText[4][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_4[i], 0, NULL); + mpClipScreen->search(fenut_4[i])->hide(); + } else { + paneResize(fenut_4[i]); + mpMenuText[4][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_4[i], 0, NULL); + mpClipScreen->search(menut_4[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN paneResize(menut_4[i]); mpMenuText[4][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_4[i], 0, NULL); mpClipScreen->search(fenut_4[i])->hide(); @@ -1801,7 +2013,16 @@ void dMenu_Option_c::screenSet() { } field_0x3b4 = 0.0f; menuVisible(); -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpBackScreen->search(MULTI_CHAR('jpn_n'))->show(); + mpBackScreen->search(MULTI_CHAR('foregn_n'))->hide(); + } else { + mpBackScreen->search(MULTI_CHAR('jpn_n'))->hide(); + mpBackScreen->search(MULTI_CHAR('foregn_n'))->show(); + } +#elif VERSION == VERSION_GCN_JPN mpBackScreen->search(MULTI_CHAR('jpn_n'))->show(); mpBackScreen->search(MULTI_CHAR('foregn_n'))->hide(); #else @@ -1809,7 +2030,7 @@ void dMenu_Option_c::screenSet() { mpBackScreen->search(MULTI_CHAR('foregn_n'))->show(); #endif for (int i = 0; i < 6; i++) { - J2DTextBox* backScreen = (J2DTextBox*)mpBackScreen->search(tx[i]); + J2DTextBox* backScreen = (J2DTextBox*)mpBackScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? tx_jpn[i] : tx[i], tx[i])); backScreen->setFont(mpFont); backScreen->setString(0x80, ""); if (i < 2) { @@ -1832,10 +2053,12 @@ void dMenu_Option_c::screenSet() { } } for (int i = 0; i < 10; i++) { - J2DTextBox* tvScreen = (J2DTextBox*)mpTVScreen->search(txTV[i]); + J2DTextBox* tvScreen = (J2DTextBox*)mpTVScreen->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? txTV_jpn[i] : txTV[i], txTV[i])); tvScreen->setFont(mpFont); -#if VERSION != VERSION_GCN_JPN +#if TARGET_PC || VERSION != VERSION_GCN_JPN + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) tvScreen->setCharSpace(0.0f); + IF_DUSK_BLOCK_END #endif if (i < 2) { @@ -1894,7 +2117,7 @@ void dMenu_Option_c::setAttenString() { } } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN void dMenu_Option_c::setRubyString() { u16 stringId1; u16 stringId2; @@ -1930,7 +2153,9 @@ void dMenu_Option_c::setVibString() { stringId2 = 0x54C; } for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + const int IDX = dusk::version::isRegionJpn() ? 2 : 1; +#elif VERSION == VERSION_GCN_JPN const int IDX = 2; #else const int IDX = 1; @@ -1964,7 +2189,9 @@ void dMenu_Option_c::setSoundString() { stringId3 = 0x550; } for (int i = 0; i < 6; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + const int IDX = dusk::version::isRegionJpn() ? 3 : 2; +#elif VERSION == VERSION_GCN_JPN const int IDX = 3; #else const int IDX = 2; @@ -1983,10 +2210,25 @@ void dMenu_Option_c::setSoundString() { } void dMenu_Option_c::setCursorPos(u8 i_index) { -#if VERSION != VERSION_GCN_JPN +#if TARGET_PC + if (!dusk::version::isRegionJpn()) { + switch (i_index) { + case PROC_VIB_e: + i_index = 1; + break; + case PROC_SOUND_e: + i_index = 2; + break; + } + } +#endif + +#if TARGET_PC || VERSION != VERSION_GCN_JPN + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) if (i_index == 4) { i_index = 5; } + IF_DUSK_BLOCK_END #endif Vec pos = mpMenuPane[i_index]->getGlobalVtxCenter(mpMenuPane[i_index]->mPane, false, 0); @@ -2037,13 +2279,33 @@ void dMenu_Option_c::setSelectColor(u8 param_0, bool param_1) { } u8 dMenu_Option_c::getSelectType() { - if (field_0x3ef < SelectType3) { +#if TARGET_PC + u8 proc = 0; + if (field_0x3ef < PROC_CHANGE_MOVE_e) { + proc = field_0x3ef; + } else if (field_0x3f5 < PROC_CHANGE_MOVE_e) { + proc = field_0x3f5; + } + + if (!dusk::version::isRegionJpn()) { + switch (proc) { + case PROC_VIB_e: + return 1; + case PROC_SOUND_e: + return 2; + } + } + + return proc; +#else + if (field_0x3ef < PROC_CHANGE_MOVE_e) { return field_0x3ef; } - if (field_0x3f5 < SelectType3) { + if (field_0x3f5 < PROC_CHANGE_MOVE_e) { return field_0x3f5; } return 0; +#endif } void dMenu_Option_c::changeBarColor(bool i_changeColor) { @@ -2237,7 +2499,7 @@ bool dMenu_Option_c::isRumbleSupported() { #if TARGET_PC bool dMenu_Option_c::pointerConfirmSelect() { dusk::menu_pointer::begin_context(dusk::menu_pointer::Context::Options); - for (u8 i = 0; i < SelectType3; ++i) { + for (u8 i = 0; i < (dusk::version::isRegionJpn() ? 4 : 3); ++i) { if (dusk::menu_pointer::hit_pane(mpMenuPane[i], 8.0f)) { dusk::menu_pointer::set_hover_target(i); return false; @@ -2251,7 +2513,7 @@ bool dMenu_Option_c::pointerConfirmSelect() { field_0x3f7 = 1; field_0x3f5 = field_0x3ef; - field_0x3ef = SelectType4; + field_0x3ef = PROC_CONFIRM_OPEN_MOVE_e; dMeter2Info_set2DVibration(); (this->*init[field_0x3ef])(); return true; @@ -2261,14 +2523,45 @@ bool dMenu_Option_c::pointerConfirmSelect() { bool dMenu_Option_c::dpdMenuMove() { #if TARGET_PC dusk::menu_pointer::begin_context(dusk::menu_pointer::Context::Options); - for (u8 i = 0; i < SelectType3; ++i) { + for (u8 i = 0; i < (dusk::version::isRegionJpn() ? 4 : 3); ++i) { if (!dusk::menu_pointer::hit_pane(mpMenuPane[i], 8.0f)) { continue; } dusk::menu_pointer::set_hover_target(i); + + u8 selectProc = 0; + if (dusk::version::isRegionJpn()) { + switch (i) { + case 0: + selectProc = PROC_ATTEN_e; + break; + case 1: + selectProc = PROC_RUBY_e; + break; + case 2: + selectProc = PROC_VIB_e; + break; + case 3: + selectProc = PROC_SOUND_e; + break; + } + } else { + switch (i) { + case 0: + selectProc = PROC_ATTEN_e; + break; + case 1: + selectProc = PROC_VIB_e; + break; + case 2: + selectProc = PROC_SOUND_e; + break; + } + } + if (getSelectType() != i) { - field_0x3ef = i; - setCursorPos(i); + field_0x3ef = selectProc; + setCursorPos(field_0x3ef); Z2GetAudioMgr()->seStart(Z2SE_SY_CURSOR_OPTION, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } @@ -2276,29 +2569,41 @@ bool dMenu_Option_c::dpdMenuMove() { return true; } - switch (i) { - case SelectType0: + switch (selectProc) { + case PROC_ATTEN_e: field_0x3e4 ^= 1; field_0x3da = 5; - field_0x3ef = SelectType3; - field_0x3f5 = SelectType0; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_ATTEN_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); return true; - case SelectType1: + case PROC_RUBY_e: + if (field_0x3e5_JPN == 0) { + field_0x3e5_JPN = 1; + field_0x3da = 5; + } else if (field_0x3e5_JPN == 1) { + field_0x3e5_JPN = 0; + field_0x3da = 5; + } + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_RUBY_e; + Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + return true; + case PROC_VIB_e: if (isRumbleSupported()) { field_0x3ea ^= 1; if (field_0x3ea != 0) { mDoCPd_c::startMotorWave(0, &field_0x3e0, JUTGamePad::CRumble::VAL_0, 0x3c); } field_0x3da = 5; - field_0x3ef = SelectType3; - field_0x3f5 = SelectType1; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_VIB_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } return true; - case SelectType2: + case PROC_SOUND_e: if (field_0x3e9 == 0) { field_0x3e9 = 2; } else { @@ -2307,8 +2612,8 @@ bool dMenu_Option_c::dpdMenuMove() { field_0x3da = 5; mDoAud_setOutputMode(dMo_soundMode[field_0x3e9]); setSoundMode(dMo_soundMode[field_0x3e9]); - field_0x3ef = SelectType3; - field_0x3f5 = SelectType2; + field_0x3ef = PROC_CHANGE_MOVE_e; + field_0x3f5 = PROC_SOUND_e; Z2GetAudioMgr()->seStart(Z2SE_SY_OPTION_SWITCH, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); return true; @@ -2333,8 +2638,8 @@ void dMenu_Option_c::paneResize(u64 i_tag) { void dMenu_Option_c::initialize() { field_0x3e4 = dComIfGs_getOptAttentionType(); -#if VERSION == VERSION_GCN_JPN - if (dComIfGs_getOptRuby() == 0) { +#if TARGET_PC || VERSION == VERSION_GCN_JPN + if (IF_DUSK(dusk::version::isRegionJpn() &&) dComIfGs_getOptRuby() == 0) { field_0x3e5_JPN = 1; } else { field_0x3e5_JPN = 0; @@ -2352,8 +2657,10 @@ void dMenu_Option_c::initialize() { field_0x3ea = 0; } setAttenString(); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) setRubyString(); + IF_DUSK_BLOCK_END #endif setVibString(); setSoundString(); diff --git a/src/d/d_menu_ring.cpp b/src/d/d_menu_ring.cpp index a50d6def3a..3fe55c2b6c 100644 --- a/src/d/d_menu_ring.cpp +++ b/src/d/d_menu_ring.cpp @@ -29,6 +29,8 @@ #include +#include "dusk/version.hpp" + #if TARGET_PC #include "dusk/frame_interpolation.h" #include "dusk/game_clock.h" @@ -341,7 +343,16 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i } mpString = JKR_NEW dMsgString_c(); for (i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + J2DTextBox* fxy_TextBox; + if (dusk::version::isRegionJpn()) { + fxy_TextBox = (J2DTextBox*)mpScreen->search(xy_text[i]); + mpScreen->search(fxy_text[i])->hide(); + } else { + fxy_TextBox = (J2DTextBox*)mpScreen->search(fxy_text[i]); + mpScreen->search(xy_text[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN J2DTextBox* fxy_TextBox = (J2DTextBox*)mpScreen->search(xy_text[i]); mpScreen->search(fxy_text[i])->hide(); #else @@ -353,75 +364,77 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i field_0x580[0] = mpString->getString(0x380, fxy_TextBox, NULL, NULL, NULL, 0); } for (i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN - #if TARGET_PC +#if TARGET_PC J2DTextBox* fc_TextBox; - if (dusk::getSettings().game.swapDirectSelect) { - fc_TextBox = (J2DTextBox*)mpScreen->search(c_text1[i]); - mpScreen->search(fc_text1[i])->hide(); + if (dusk::version::isRegionJpn()) { + if (dusk::getSettings().game.swapDirectSelect) { + fc_TextBox = (J2DTextBox*)mpScreen->search(c_text1[i]); + mpScreen->search(fc_text1[i])->hide(); + } else { + fc_TextBox = (J2DTextBox*)mpScreen->search(c_text[i]); + mpScreen->search(fc_text[i])->hide(); + } } else { - fc_TextBox = (J2DTextBox*)mpScreen->search(c_text[i]); - mpScreen->search(fc_text[i])->hide(); + if (dusk::getSettings().game.swapDirectSelect) { + fc_TextBox = (J2DTextBox*)mpScreen->search(fc_text1[i]); + mpScreen->search(c_text1[i])->hide(); + } else { + fc_TextBox = (J2DTextBox*)mpScreen->search(fc_text[i]); + mpScreen->search(c_text[i])->hide(); + } } - #else +#elif VERSION == VERSION_GCN_JPN J2DTextBox* fc_TextBox = (J2DTextBox*)mpScreen->search(c_text[i]); mpScreen->search(fc_text[i])->hide(); - #endif #else - #if TARGET_PC - J2DTextBox* fc_TextBox; - if (dusk::getSettings().game.swapDirectSelect) { - fc_TextBox = (J2DTextBox*)mpScreen->search(fc_text1[i]); - mpScreen->search(c_text1[i])->hide(); - } else { - fc_TextBox = (J2DTextBox*)mpScreen->search(fc_text[i]); - mpScreen->search(c_text[i])->hide(); - } - #else J2DTextBox* fc_TextBox = (J2DTextBox*)mpScreen->search(fc_text[i]); mpScreen->search(c_text[i])->hide(); - #endif #endif fc_TextBox->setFont(mDoExt_getMesgFont()); fc_TextBox->setString(0x40, ""); field_0x580[1] = mpString->getString(0x37F, fc_TextBox, NULL, NULL, NULL, 0); } for (i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN - #if TARGET_PC +#if TARGET_PC J2DTextBox* fc1_TextBox; - if (dusk::getSettings().game.swapDirectSelect) { - fc1_TextBox = (J2DTextBox*)mpScreen->search(c_text[i]); - mpScreen->search(fc_text[i])->hide(); + if (dusk::version::isRegionJpn()) { + if (dusk::getSettings().game.swapDirectSelect) { + fc1_TextBox = (J2DTextBox*)mpScreen->search(c_text[i]); + mpScreen->search(fc_text[i])->hide(); + } else { + fc1_TextBox = (J2DTextBox*)mpScreen->search(c_text1[i]); + mpScreen->search(fc_text1[i])->hide(); + } } else { - fc1_TextBox = (J2DTextBox*)mpScreen->search(c_text1[i]); - mpScreen->search(fc_text1[i])->hide(); + if (dusk::getSettings().game.swapDirectSelect) { + fc1_TextBox = (J2DTextBox*)mpScreen->search(fc_text[i]); + mpScreen->search(c_text[i])->hide(); + } else { + fc1_TextBox = (J2DTextBox*)mpScreen->search(fc_text1[i]); + mpScreen->search(c_text1[i])->hide(); + } } - #else +#elif VERSION == VERSION_GCN_JPN J2DTextBox* fc1_TextBox = (J2DTextBox*)mpScreen->search(c_text1[i]); mpScreen->search(fc_text1[i])->hide(); - #endif #else - #if TARGET_PC - J2DTextBox* fc1_TextBox; - if (dusk::getSettings().game.swapDirectSelect) { - fc1_TextBox = (J2DTextBox*)mpScreen->search(fc_text[i]); - mpScreen->search(c_text[i])->hide(); - } else { - fc1_TextBox = (J2DTextBox*)mpScreen->search(fc_text1[i]); - mpScreen->search(c_text1[i])->hide(); - } - #else J2DTextBox* fc1_TextBox = (J2DTextBox*)mpScreen->search(fc_text1[i]); mpScreen->search(c_text1[i])->hide(); - #endif #endif fc1_TextBox->setFont(mDoExt_getMesgFont()); fc1_TextBox->setString(0x40, ""); field_0x580[2] = mpString->getString(0x4CD, fc1_TextBox, NULL, NULL, NULL, 0); } for (int i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpComboOffString[i] = (J2DTextBox*)mpScreen->search(t_on[i]); + mpScreen->search(ft_on[i])->hide(); + } else { + mpComboOffString[i] = (J2DTextBox*)mpScreen->search(ft_on[i]); + mpScreen->search(t_on[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpComboOffString[i] = (J2DTextBox*)mpScreen->search(t_on[i]); mpScreen->search(ft_on[i])->hide(); #else @@ -433,7 +446,15 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i mpString->getString(0x4D2, mpComboOffString[i], NULL, NULL, NULL, 0); } for (int i = 0; i < 5; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpBowArrowComboString[i] = (J2DTextBox*)mpScreen->search(t_off[i]); + mpScreen->search(ft_off[i])->hide(); + } else { + mpBowArrowComboString[i] = (J2DTextBox*)mpScreen->search(ft_off[i]); + mpScreen->search(t_off[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpBowArrowComboString[i] = (J2DTextBox*)mpScreen->search(t_off[i]); mpScreen->search(ft_off[i])->hide(); #else @@ -464,7 +485,31 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i mpNameParent = JKR_NEW CPaneMgr(mpCenterScreen, MULTI_CHAR('label_n'), 1, NULL); mpCircle = JKR_NEW CPaneMgr(mpCenterScreen, MULTI_CHAR('circle_n'), 2, NULL); J2DTextBox* textBox[4]; -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n04')); + textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n05')); + textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n06')); + textBox[3] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n07')); + J2DPane* pane = mpCenterScreen->search(MULTI_CHAR('fitem_n1')); + pane->mVisible = false; + pane = mpCenterScreen->search(MULTI_CHAR('fitem_n2')); + pane->mVisible = false; + pane = mpCenterScreen->search(MULTI_CHAR('fitem_n3')); + pane->mVisible = false; + pane = mpCenterScreen->search(MULTI_CHAR('fitem_n4')); + pane->mVisible = false; + } else { + textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n1')); + textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n2')); + textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n3')); + textBox[3] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n4')); + mpCenterScreen->search(MULTI_CHAR('item_n04')); + mpCenterScreen->search(MULTI_CHAR('item_n05')); + mpCenterScreen->search(MULTI_CHAR('item_n06')); + mpCenterScreen->search(MULTI_CHAR('item_n07')); + } +#elif VERSION == VERSION_GCN_JPN textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n04')); textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n05')); textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n06')); @@ -1246,7 +1291,19 @@ void dMenu_Ring_c::setScale() { void dMenu_Ring_c::setNameString(u32 i_stringID) { J2DTextBox* textBox[4]; -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n04')); + textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n05')); + textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n06')); + textBox[3] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n07')); + } else { + textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n1')); + textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n2')); + textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n3')); + textBox[3] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('fitem_n4')); + } +#elif VERSION == VERSION_GCN_JPN textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n04')); textBox[1] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n05')); textBox[2] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n06')); diff --git a/src/d/d_menu_save.cpp b/src/d/d_menu_save.cpp index 78ebd3e064..e9be233f6b 100644 --- a/src/d/d_menu_save.cpp +++ b/src/d/d_menu_save.cpp @@ -1,25 +1,26 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_menu_save.h" -#include "JSystem/JKernel/JKRExpHeap.h" -#include "JSystem/JKernel/JKRMemArchive.h" #include #include +#include "JSystem/J2DGraph/J2DAnmLoader.h" +#include "JSystem/JKernel/JKRExpHeap.h" +#include "JSystem/JKernel/JKRMemArchive.h" #include "d/d_com_inf_game.h" -#include "d/d_lib.h" -#include "d/d_select_cursor.h" #include "d/d_file_sel_info.h" #include "d/d_file_sel_warning.h" +#include "d/d_lib.h" +#include "d/d_menu_save.h" #include "d/d_meter2_info.h" +#include "d/d_msg_scrn_explain.h" #include "d/d_msg_string.h" +#include "d/d_select_cursor.h" +#include "dusk/version.hpp" +#include "f_op/f_op_msg_mng.h" #include "m_Do/m_Do_MemCard.h" #include "m_Do/m_Do_MemCardRWmng.h" #include "m_Do/m_Do_Reset.h" #include "m_Do/m_Do_controller_pad.h" #include "m_Do/m_Do_graphic.h" -#include "d/d_msg_scrn_explain.h" -#include "JSystem/J2DGraph/J2DAnmLoader.h" -#include "f_op/f_op_msg_mng.h" #if TARGET_PC #include "dusk/frame_interpolation.h" @@ -179,7 +180,15 @@ void dMenu_save_c::screenSet() { static u64 l_tagName10[2] = {MULTI_CHAR('w_no_g'), MULTI_CHAR('w_yes_g')}; static u64 l_tagName11[2] = {MULTI_CHAR('w_no_gr'), MULTI_CHAR('w_yes_gr')}; static u64 l_tagName12[3] = {MULTI_CHAR('w_bk_l00'), MULTI_CHAR('w_bk_l01'), MULTI_CHAR('w_bk_l02')}; -#if VERSION == VERSION_GCN_JPN + +#if TARGET_PC + static u64 l_tagName21_jpn[2] = {MULTI_CHAR('w_tabi_s'), MULTI_CHAR('w_tabi_x')}; + static u64 l_tagName20_jpn[2] = {MULTI_CHAR('w_er_msg'), MULTI_CHAR('w_er_msR')}; + static u64 l_tagName21[2] = {MULTI_CHAR('t_for'), MULTI_CHAR('t_for1')}; + static u64 l_tagName211[10] = {MULTI_CHAR('tmoyou00'), MULTI_CHAR('tmoyou01'), MULTI_CHAR('tmoyou02'), MULTI_CHAR('tmoyou03'), MULTI_CHAR('tmoyou04'), + MULTI_CHAR('tmoyou05'), MULTI_CHAR('tmoyou06'), MULTI_CHAR('tmoyou07'), MULTI_CHAR('tmoyou08'), MULTI_CHAR('tmoyou09')}; + static u64 l_tagName20[2] = {MULTI_CHAR('er_for0'), MULTI_CHAR('er_for1')}; +#elif VERSION == VERSION_GCN_JPN static u64 l_tagName21[2] = {MULTI_CHAR('w_tabi_s'), MULTI_CHAR('w_tabi_x')}; static u64 l_tagName20[2] = {MULTI_CHAR('w_er_msg'), MULTI_CHAR('w_er_msR')}; #else @@ -188,6 +197,7 @@ void dMenu_save_c::screenSet() { MULTI_CHAR('tmoyou05'), MULTI_CHAR('tmoyou06'), MULTI_CHAR('tmoyou07'), MULTI_CHAR('tmoyou08'), MULTI_CHAR('tmoyou09')}; static u64 l_tagName20[2] = {MULTI_CHAR('er_for0'), MULTI_CHAR('er_for1')}; #endif + static u64 l_tagName13[3] = {MULTI_CHAR('w_dat_i0'), MULTI_CHAR('w_dat_i1'), MULTI_CHAR('w_dat_i2')}; static u8 l_msgNum0[2] = {0x08, 0x07}; static u8 l_msgNum[2] = {0x54, 0x55}; @@ -221,7 +231,15 @@ void dMenu_save_c::screenSet() { mpNoYes[1] = JKR_NEW CPaneMgr(mSaveSel.Scr, MULTI_CHAR('w_yes_n'), 0, NULL); for (int i = 0; i < 2; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpNoYesTxt[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName000[i], 0, NULL); + mSaveSel.Scr->search(l_tagName000U[i])->hide(); + } else { + mpNoYesTxt[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName000U[i], 0, NULL); + mSaveSel.Scr->search(l_tagName000[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpNoYesTxt[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName000[i], 0, NULL); mSaveSel.Scr->search(l_tagName000U[i])->hide(); #else @@ -240,7 +258,15 @@ void dMenu_save_c::screenSet() { mpBBtnIcon = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_nbbtn'), 2, NULL); mpABtnIcon = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_nabtn'), 2, NULL); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpBackTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_modo'), 2, NULL); + mpConfirmTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_kete'), 2, NULL); + } else { + mpBackTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('f_modo'), 2, NULL); + mpConfirmTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('f_kete'), 2, NULL); + } +#elif VERSION == VERSION_GCN_JPN mpBackTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_modo'), 2, NULL); mpConfirmTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_kete'), 2, NULL); #else @@ -255,7 +281,15 @@ void dMenu_save_c::screenSet() { for (int i = 0; i < 2; i++) { J2DTextBox* tbox[2]; -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + tbox[i] = (J2DTextBox*)mSaveSel.Scr->search(l_tagName00[i]); + mSaveSel.Scr->search(l_tagName00U[i])->hide(); + } else { + tbox[i] = (J2DTextBox*)mSaveSel.Scr->search(l_tagName00U[i]); + mSaveSel.Scr->search(l_tagName00[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN tbox[i] = (J2DTextBox*)mSaveSel.Scr->search(l_tagName00[i]); mSaveSel.Scr->search(l_tagName00U[i])->hide(); #else @@ -330,7 +364,19 @@ void dMenu_save_c::screenSet() { mpBookWaku[i]->setAlpha(0); } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mSaveSel.Scr->search(MULTI_CHAR('t_for'))->hide(); + mSaveSel.Scr->search(MULTI_CHAR('t_for1'))->hide(); + } else { + mSaveSel.Scr->search(MULTI_CHAR('w_tabi_s'))->hide(); + mSaveSel.Scr->search(MULTI_CHAR('w_tabi_x'))->hide(); + + for (int i = 0; i < 10; i++) { + mSaveSel.Scr->search(l_tagName211[i])->hide(); + } + } +#elif VERSION == VERSION_GCN_JPN mSaveSel.Scr->search(MULTI_CHAR('t_for'))->hide(); mSaveSel.Scr->search(MULTI_CHAR('t_for1'))->hide(); #else @@ -343,11 +389,21 @@ void dMenu_save_c::screenSet() { #endif for (int i = 0; i < 2; i++) { - mpHeaderTxtPane[i] = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, l_tagName21[i], 0, NULL); + mpHeaderTxtPane[i] = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, DUSK_IF_ELSE(dusk::version::isRegionJpn() ? l_tagName21_jpn[i] : l_tagName21[i], l_tagName21[i]), 0, NULL); ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setFont(mSaveSel.font[0]); ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setString(0x100, ""); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setFontSize(21.0f, 21.0f); + ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setLineSpace(22.0f); + ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setCharSpace(2.0f); + } else { + ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setFontSize(19.0f, 19.0f); + ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setLineSpace(20.0f); + ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setCharSpace(0.0f); + } +#elif VERSION == VERSION_GCN_JPN ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setFontSize(21.0f, 21.0f); ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setLineSpace(22.0f); ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setCharSpace(2.0f); @@ -364,7 +420,15 @@ void dMenu_save_c::screenSet() { mHeaderTxtType = 0; field_0xb4 = mSaveSel.Scr->search(MULTI_CHAR('w_er_n')); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mSaveSel.Scr->search(MULTI_CHAR('er_for0'))->hide(); + mSaveSel.Scr->search(MULTI_CHAR('er_for1'))->hide(); + } else { + mSaveSel.Scr->search(MULTI_CHAR('w_er_msg'))->hide(); + mSaveSel.Scr->search(MULTI_CHAR('w_er_msR'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN mSaveSel.Scr->search(MULTI_CHAR('er_for0'))->hide(); mSaveSel.Scr->search(MULTI_CHAR('er_for1'))->hide(); #else @@ -373,7 +437,9 @@ void dMenu_save_c::screenSet() { #endif for (int i = 0; i < 2; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + mpErrTxtPane[i] = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, DUSK_IF_ELSE(dusk::version::isRegionJpn() ? l_tagName20_jpn[i] : l_tagName20[i], l_tagName20[i]), 0, NULL); +#elif VERSION == VERSION_GCN_JPN mpErrTxtPane[i] = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, l_tagName20[i], 0, NULL); #else mpErrTxtPane[i] = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, l_tagName20[i], 0, NULL); @@ -381,7 +447,18 @@ void dMenu_save_c::screenSet() { ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setFont(mSaveSel.font[0]); ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setString(0x200, ""); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setFontSize(21.0f, 21.0f); + ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setLineSpace(22.0f); + ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setCharSpace(2.0f); + } else { + ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->resize(440.0f, 198.0f); + ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setFontSize(21.0f, 21.0f); + ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setLineSpace(21.0f); + ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setCharSpace(1.0f); + } +#elif VERSION == VERSION_GCN_JPN ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setFontSize(21.0f, 21.0f); ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setLineSpace(22.0f); ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setCharSpace(2.0f); @@ -2468,7 +2545,23 @@ bool dMenu_save_c::selectDataBaseMoveAnm() { mpSelectMoveBase->getPanePtr()->animationTransform(); return false; } else { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (mDataBaseMoveAnmFrame == 33) { + field_0x64 = 1; + } else { + field_0x64 = 0; + } + field_0x65 = 0; + } else { + if (mDataBaseMoveAnmFrame == 33) { + field_0x64 = 1; + field_0x65 = 0; + } else { + field_0x64 = 0; + } + } +#elif VERSION == VERSION_GCN_JPN if (mDataBaseMoveAnmFrame == 33) { field_0x64 = 1; } else { diff --git a/src/d/d_menu_skill.cpp b/src/d/d_menu_skill.cpp index 0c970e76c3..90d4a3f92b 100644 --- a/src/d/d_menu_skill.cpp +++ b/src/d/d_menu_skill.cpp @@ -18,6 +18,8 @@ #include "m_Do/m_Do_graphic.h" #include +#include "dusk/version.hpp" + #if TARGET_PC #include "dusk/menu_pointer.h" #endif @@ -467,7 +469,27 @@ void dMenu_Skill_c::screenSetMenu() { mpParent = JKR_NEW CPaneMgr(mpMenuScreen, MULTI_CHAR('n_all'), 2, NULL); mpParent->setAlphaRate(0.0f); for (int i = 0; i < 7; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpFTagPicture[i][0] = (J2DTextBox*)mpMenuScreen->search(tag_sub0[i]); + mpFTagPicture[i][1] = (J2DTextBox*)mpMenuScreen->search(tag_sub1[i]); + mpFTagPicture[i][2] = (J2DTextBox*)mpMenuScreen->search(tag_name0[i]); + mpFTagPicture[i][3] = (J2DTextBox*)mpMenuScreen->search(tag_name1[i]); + mpMenuScreen->search(ftag_sub0[i])->hide(); + mpMenuScreen->search(ftag_sub1[i])->hide(); + mpMenuScreen->search(ftag_name0[i])->hide(); + mpMenuScreen->search(ftag_name1[i])->hide(); + } else { + mpFTagPicture[i][0] = (J2DTextBox*)mpMenuScreen->search(ftag_sub0[i]); + mpFTagPicture[i][1] = (J2DTextBox*)mpMenuScreen->search(ftag_sub1[i]); + mpFTagPicture[i][2] = (J2DTextBox*)mpMenuScreen->search(ftag_name0[i]); + mpFTagPicture[i][3] = (J2DTextBox*)mpMenuScreen->search(ftag_name1[i]); + mpMenuScreen->search(tag_sub0[i])->hide(); + mpMenuScreen->search(tag_sub1[i])->hide(); + mpMenuScreen->search(tag_name0[i])->hide(); + mpMenuScreen->search(tag_name1[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpFTagPicture[i][0] = (J2DTextBox*)mpMenuScreen->search(tag_sub0[i]); mpFTagPicture[i][1] = (J2DTextBox*)mpMenuScreen->search(tag_sub1[i]); mpFTagPicture[i][2] = (J2DTextBox*)mpMenuScreen->search(tag_name0[i]); @@ -522,7 +544,16 @@ void dMenu_Skill_c::screenSetMenu() { mSelectWhite[i] = mpFTagPicture[1][i]->getWhite(); } } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + J2DTextBox* textBox; + if (dusk::version::isRegionJpn()) { + textBox = (J2DTextBox*)mpMenuScreen->search(MULTI_CHAR('t_t00')); + mpMenuScreen->search(MULTI_CHAR('f_t00'))->hide(); + } else { + textBox = (J2DTextBox*)mpMenuScreen->search(MULTI_CHAR('f_t00')); + mpMenuScreen->search(MULTI_CHAR('t_t00'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN J2DTextBox* textBox = (J2DTextBox*)mpMenuScreen->search(MULTI_CHAR('t_t00')); mpMenuScreen->search(MULTI_CHAR('f_t00'))->hide(); #else @@ -551,7 +582,15 @@ void dMenu_Skill_c::screenSetLetter() { mpLetterScreen = JKR_NEW J2DScreen(); mpLetterScreen->setPriority("zelda_ougi_info.blo", 0x20000, mpArchive); dPaneClass_showNullPane(mpLetterScreen); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpTextPane = JKR_NEW CPaneMgr(mpLetterScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpLetterScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } else { + mpTextPane = JKR_NEW CPaneMgr(mpLetterScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpLetterScreen->search(MULTI_CHAR('n_3line'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpTextPane = JKR_NEW CPaneMgr(mpLetterScreen, MULTI_CHAR('mg_3line'), 0, NULL); mpLetterScreen->search(MULTI_CHAR('n_e4line'))->hide(); #else @@ -564,7 +603,15 @@ void dMenu_Skill_c::screenSetLetter() { J2DTextBox* paneString = (J2DTextBox*)mpTextPane->getPanePtr(); paneString->setString(0x200, ""); for (int i = 0; i < 4; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpNameString[i] = (J2DTextBox*)mpLetterScreen->search(name_tag[i]); + mpLetterScreen->search(fame_tag[i])->hide(); + } else { + mpNameString[i] = (J2DTextBox*)mpLetterScreen->search(fame_tag[i]); + mpLetterScreen->search(name_tag[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpNameString[i] = (J2DTextBox*)mpLetterScreen->search(name_tag[i]); mpLetterScreen->search(fame_tag[i])->hide(); #else diff --git a/src/d/d_meter2_draw.cpp b/src/d/d_meter2_draw.cpp index 7ce7bb29d4..f4e96c6fbe 100644 --- a/src/d/d_meter2_draw.cpp +++ b/src/d/d_meter2_draw.cpp @@ -23,6 +23,8 @@ #include "dusk/frame_interpolation.h" #include +#include "dusk/version.hpp" + #if TARGET_PC #include "dusk/settings.h" #include "dusk/ui/icon_provider.hpp" @@ -59,6 +61,14 @@ void dAnchorHudScale(CPaneMgr* i_pane, HudCorner i_corner, f32* io_x, f32* io_y, #endif dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) { +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + g_drawHIO.mButtonATextSpacing = -2.0f; + } else { + g_drawHIO.mButtonATextSpacing = 1.0f; + } +#endif + OS_REPORT("enter dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap *mp_heap)\n"); heap = mp_heap; @@ -161,7 +171,8 @@ dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) { } J2DTextBox::TFontSize font_size; -#if VERSION != VERSION_GCN_JPN +#if TARGET_PC || VERSION != VERSION_GCN_JPN + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) font_size.mSizeX = 17.0f; font_size.mSizeY = 20.0f; for (int i = 0; i < 5; i++) { @@ -171,6 +182,7 @@ dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) { static_cast(mpXYText[i][1]->getPanePtr())->setFontSize(font_size); static_cast(mpXYText[i][2]->getPanePtr())->setFontSize(font_size); } + IF_DUSK_BLOCK_END #endif init(); diff --git a/src/d/d_meter2_info.cpp b/src/d/d_meter2_info.cpp index 6309e83a86..4e55a330f9 100644 --- a/src/d/d_meter2_info.cpp +++ b/src/d/d_meter2_info.cpp @@ -15,6 +15,7 @@ #include +#include "dusk/version.hpp" #include "helpers/string.hpp" enum ITEMICON_RES_FILE_ID { @@ -534,13 +535,18 @@ f32 dMeter2Info_c::getStringLength(J2DTextBox* i_textbox, char* i_string) { str_width = 0.0f; } else { int c = (u8)*string; -#if VERSION == VERSION_GCN_JPN - bool unkFlag1 = false; - if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) { - unkFlag1 = true; - } - if (unkFlag1) { - c = (c << 8) | (u8)*++string; +#if TARGET_PC || VERSION == VERSION_GCN_JPN + #if TARGET_PC + if (dusk::version::isRegionJpn()) + #endif + { + bool unkFlag1 = false; + if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) { + unkFlag1 = true; + } + if (unkFlag1) { + c = (c << 8) | (u8)*++string; + } } #endif str_width += charSpace + (fontSize.mSizeX * ((f32)font->getWidth(c) / (f32)font->getCellWidth())); @@ -566,13 +572,18 @@ f32 dMeter2Info_c::getStringLength(JUTFont* i_font, f32 param_2, f32 param_3, ch str_width = 0.0f; } else { int c = (u8)*string; -#if VERSION == VERSION_GCN_JPN - bool unkFlag1 = false; - if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) { - unkFlag1 = true; - } - if (unkFlag1) { - c = (c << 8) | (u8)*++string; +#if TARGET_PC || VERSION == VERSION_GCN_JPN + #if TARGET_PC + if (dusk::version::isRegionJpn()) + #endif + { + bool unkFlag1 = false; + if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) { + unkFlag1 = true; + } + if (unkFlag1) { + c = (c << 8) | (u8)*++string; + } } #endif str_width += param_3 + param_2 * ((f32)i_font->getWidth(c) / (f32)i_font->getCellWidth()); diff --git a/src/d/d_meter_button.cpp b/src/d/d_meter_button.cpp index 0e3354e76e..573147f888 100644 --- a/src/d/d_meter_button.cpp +++ b/src/d/d_meter_button.cpp @@ -19,11 +19,15 @@ #include "dusk/frame_interpolation.h" #include +#include "dusk/version.hpp" + #if TARGET_PC #include "helpers/string.hpp" #endif -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC +#define STR_BUF_LEN 528 +#elif VERSION == VERSION_GCN_JPN #define STR_BUF_LEN 528 #else #define STR_BUF_LEN 512 @@ -261,7 +265,15 @@ void dMeterButton_c::draw() { SAFE_STRCPY(tmp_buf, static_cast(mpTm_c[0]->getPanePtr())->getStringPtr()); mpTextScreen->draw(0.0f, 0.0f, graf_ctx); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpString_c->getString(mMsgID, static_cast(mpTm_c[0]->getPanePtr()), NULL, NULL, + NULL, 12); + } else { + mpString_c->getString(mMsgID, static_cast(mpTm_c[0]->getPanePtr()), NULL, NULL, + NULL, 8); + } +#elif VERSION == VERSION_GCN_JPN mpString_c->getString(mMsgID, static_cast(mpTm_c[0]->getPanePtr()), NULL, NULL, NULL, 12); #else @@ -1195,7 +1207,15 @@ void dMeterButton_c::screenInitButton() { field_0x4d9 = 0xFF; for (int i = 0; i < 10; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpTextBox[i] = (J2DTextBox*)mpButtonScreen->search(text_tag[i]); + mpButtonScreen->search(ftext_tag[i])->hide(); + } else { + mpTextBox[i] = (J2DTextBox*)mpButtonScreen->search(ftext_tag[i]); + mpButtonScreen->search(text_tag[i])->hide(); + } +#elif VERSION == VERSION_GCN_JPN mpTextBox[i] = (J2DTextBox*)mpButtonScreen->search(text_tag[i]); mpButtonScreen->search(ftext_tag[i])->hide(); #else @@ -1468,7 +1488,50 @@ void dMeterButton_c::screenInitText() { mpTmRoot_c = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(2499, mpTmRoot_c != NULL); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() == 0) { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + + mpTm_c[1] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('t3f_s'), 0, NULL); + + field_0x0ec[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3f'), 0, NULL); + + field_0x0ec[1] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + + mpTextScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpTextScreen->search(MULTI_CHAR('n_3fline'))->show(); + mpTextScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3line'), 0, NULL); + + mpTm_c[1] = JKR_NEW CPaneMgr(mpTextScreen, 't3_s', 0, NULL); + + field_0x0ec[0] = NULL; + field_0x0ec[1] = NULL; + OS_REPORT("[%s] %d\n", __FILE__, __LINE__); + + mpTextScreen->search(MULTI_CHAR('n_3line'))->show(); + mpTextScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpTextScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + JUT_ASSERT(2504, mpTm_c[0] != NULL); + + mpTm_c[1] = JKR_NEW CPaneMgr(mpTextScreen, 't4_s', 0, NULL); + JUT_ASSERT(2507, mpTm_c[1] != NULL); + + field_0x0ec[0] = NULL; + field_0x0ec[1] = NULL; + + OS_REPORT("[%s] %d\n", __FILE__, 2512); + + mpTextScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpTextScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpTextScreen->search(MULTI_CHAR('n_e4line'))->show(); + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { mpTm_c[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3flin'), 0, NULL); @@ -1516,19 +1579,11 @@ void dMeterButton_c::screenInitText() { f32 line_space = static_cast(mpTm_c[0]->getPanePtr())->getLineSpace(); for (int i = 0; i < 2; i++) { static_cast(mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - static_cast(mpTm_c[i]->getPanePtr())->setString(0x210, ""); -#else - static_cast(mpTm_c[i]->getPanePtr())->setString(0x200, ""); -#endif + static_cast(mpTm_c[i]->getPanePtr())->setString(STR_BUF_LEN, ""); if (field_0x0ec[i] != NULL) { static_cast(field_0x0ec[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - static_cast(field_0x0ec[i]->getPanePtr())->setString(0x210, ""); -#else - static_cast(field_0x0ec[i]->getPanePtr())->setString(0x200, ""); -#endif + static_cast(field_0x0ec[i]->getPanePtr())->setString(STR_BUF_LEN, ""); static_cast(field_0x0ec[i]->getPanePtr())->setLineSpace(line_space); } } diff --git a/src/d/d_msg_class.cpp b/src/d/d_msg_class.cpp index 8dc2a82c01..5dbc00a1d2 100644 --- a/src/d/d_msg_class.cpp +++ b/src/d/d_msg_class.cpp @@ -1,23 +1,33 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_class.h" #include #include -#include "d/d_meter2_info.h" -#include "d/d_msg_object.h" -#include "d/d_msg_unit.h" #include "JSystem/J2DGraph/J2DTextBox.h" -#include "d/d_msg_out_font.h" -#include "m_Do/m_Do_graphic.h" -#include "d/d_lib.h" #include "JSystem/JUtility/JUTFont.h" +#include "d/d_lib.h" +#include "d/d_meter2_info.h" +#include "d/d_msg_class.h" +#include "d/d_msg_object.h" +#include "d/d_msg_out_font.h" +#include "d/d_msg_unit.h" +#include "dusk/version.hpp" +#include "m_Do/m_Do_graphic.h" #if TARGET_PC #include "dusk/menu_pointer.h" #include "dusk/scope_guard.hpp" #endif -#if REGION_JPN +#if TARGET_PC +#define CHAR_CODE_MALE_ICON (dusk::version::isRegionJpn() ? 0x8189 : 0xB2) +#define CHAR_CODE_FEMALE_ICON (dusk::version::isRegionJpn() ? 0x818A : 0xB3) +#define CHAR_CODE_STAR_ICON (dusk::version::isRegionJpn() ? 0x819A : 0xB1) +#define CHAR_CODE_REFMARK (dusk::version::isRegionJpn() ? 0x81A6 : 0x89) +#define CHAR_CODE_THIN_LEFT_ARROW (dusk::version::isRegionJpn() ? 0x81A9 : 0xB9) +#define CHAR_CODE_THIN_RIGHT_ARROW (dusk::version::isRegionJpn() ? 0x81A8 : 0xBC) +#define CHAR_CODE_THIN_UP_ARROW (dusk::version::isRegionJpn() ? 0x81AA : 0xBD) +#define CHAR_CODE_THIN_DOWN_ARROW (dusk::version::isRegionJpn() ? 0x81AB : 0xBE) +#elif REGION_JPN #define CHAR_CODE_MALE_ICON 0x8189 #define CHAR_CODE_FEMALE_ICON 0x818A #define CHAR_CODE_STAR_ICON 0x819A @@ -431,8 +441,33 @@ void jmessage_tReference::calcDistance() { u8 jmessage_tReference::getLineMax() { int line_max; - -#if REGION_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (isKanban()) { + line_max = 6; + } else if (isBook()) { + line_max = 7; + } else if (isStaffRoll()) { + line_max = 10; + } else if (isSaveSeq()) { + line_max = 5; + } else { + line_max = 3; + } + } else { + if (isKanban()) { + line_max = 7; + } else if (isBook()) { + line_max = 9; + } else if (isStaffRoll()) { + line_max = 10; + } else if (isSaveSeq()) { + line_max = 6; + } else { + line_max = 4; + } + } +#elif REGION_JPN if (isKanban()) { line_max = 6; } else if (isBook()) { @@ -895,7 +930,7 @@ void jmessage_tMeasureProcessor::do_begin(void const* pEntry, char const* pszTex mSeSpeaker = ((JMSMesgEntry_c*)pEntry)->se_speaker; mSeMood = ((JMSMesgEntry_c*)pEntry)->se_mood; - for (int i = 0; i < D_MSG_CLASS_PAGE_CNT_MAX; i++) { + for (int i = 0; i < DUSK_IF_ELSE((dusk::version::isRegionJpn() ? 30 : D_MSG_CLASS_PAGE_CNT_MAX), D_MSG_CLASS_PAGE_CNT_MAX); i++) { pReference->setLineLength(i, 0.0f, 0.0f); pReference->setPageLine(i, 0); pReference->setPageLineMax(i, 0); @@ -912,7 +947,11 @@ void jmessage_tMeasureProcessor::do_begin(void const* pEntry, char const* pszTex pReference->setLineArrange(i, 1); } -#if !REGION_JPN +#if TARGET_PC + if (!dusk::version::isRegionJpn() && ((JMSMesgEntry_c*)pEntry)->unk_0xd == 0) { + pReference->setLineArrange(i, 1); + } +#elif !REGION_JPN if (((JMSMesgEntry_c*)pEntry)->unk_0xd == 0) { pReference->setLineArrange(i, 1); } @@ -1591,8 +1630,8 @@ void jmessage_tMeasureProcessor::do_scale(f32 i_scale) { mPageLineMax--; JUT_ASSERT(0x930, mPageLineMax > 0); -#if REGION_JPN - if (field_0x3e == 0) { +#if TARGET_PC || REGION_JPN + if (IF_DUSK(dusk::version::isRegionJpn() &&) field_0x3e == 0) { pReference->setPageType(field_0x40, 2); } #else @@ -1762,7 +1801,10 @@ void jmessage_tMeasureProcessor::do_pageType(int param_0) { void jmessage_tMeasureProcessor::do_name1() { const char* name = dComIfGs_getPlayerName(); -#if REGION_JPN +#if TARGET_PC || REGION_JPN + if (!dusk::version::isRegionJpn()) + return; + int c = (((char)name[0] & 0xFF) << 8) | ((char)name[1] & 0xFF); // if first character is hiragana or katakana if ((c >= 0x829F && c <= 0x82F1) || (c >= 0x8340 && c <= 0x8396)) { @@ -2041,7 +2083,7 @@ bool jmessage_tSequenceProcessor::do_isReady() { field_0xae = 1; field_0xa4 = 0; pReference->onBatchFlag(); - pReference->setCharCnt(D_MSG_CLASS_CHAR_CNT_MAX); + pReference->setCharCnt(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? D_MSG_CLASS_CHAR_CNT_MAX : 0x200, D_MSG_CLASS_CHAR_CNT_MAX)); field_0xa4 = field_0xa8; return true; } @@ -2061,7 +2103,7 @@ bool jmessage_tSequenceProcessor::do_isReady() { field_0xae = 1; field_0xa4 = 0; pReference->onBatchFlag(); - pReference->setCharCnt(D_MSG_CLASS_CHAR_CNT_MAX); + pReference->setCharCnt(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? D_MSG_CLASS_CHAR_CNT_MAX : 0x200, D_MSG_CLASS_CHAR_CNT_MAX)); return true; } @@ -2084,7 +2126,7 @@ bool jmessage_tSequenceProcessor::do_isReady() { if (mDoCPd_c::getTrigA(PAD_1) || field_0xb2 != 0 IF_DUSK(|| (dusk::getSettings().game.instantText && mDoCPd_c::getHoldB(0)))) { field_0xa4 = 0; pReference->onBatchFlag(); - pReference->setCharCnt(D_MSG_CLASS_CHAR_CNT_MAX); + pReference->setCharCnt(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? D_MSG_CLASS_CHAR_CNT_MAX : 0x200, D_MSG_CLASS_CHAR_CNT_MAX)); } break; case 1: @@ -2093,7 +2135,7 @@ bool jmessage_tSequenceProcessor::do_isReady() { case 9: field_0xa4 = 0; pReference->onBatchFlag(); - pReference->setCharCnt(D_MSG_CLASS_CHAR_CNT_MAX); + pReference->setCharCnt(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? D_MSG_CLASS_CHAR_CNT_MAX : 0x200, D_MSG_CLASS_CHAR_CNT_MAX)); break; case 2: if (field_0xb2 != 0) { @@ -2108,8 +2150,8 @@ bool jmessage_tSequenceProcessor::do_isReady() { } field_0xa6++; -#if REGION_JPN - if (field_0xa6 >= 1) { +#if TARGET_PC || REGION_JPN + if (IF_DUSK(dusk::version::isRegionJpn() &&) field_0xa6 >= 1) { #else if (field_0xa6 >= 2) { #endif @@ -2533,7 +2575,10 @@ bool jmessage_tSequenceProcessor::do_jump_isReady() { void jmessage_tSequenceProcessor::do_name1() { const char* name = dComIfGs_getPlayerName(); -#if REGION_JPN +#if TARGET_PC || REGION_JPN + if (!dusk::version::isRegionJpn()) + return; + int c = (((char)name[0] & 0xFF) << 8) | ((char)name[1] & 0xFF); // if first character is hiragana or katakana if ((c >= 0x829F && c <= 0x82F1) || (c >= 0x8340 && c <= 0x8396)) { @@ -3357,9 +3402,9 @@ void jmessage_tRenderingProcessor::do_heightcenter() { } break; } -#if REGION_JPN +#if TARGET_PC || REGION_JPN case 2: - if ((s8)pReference->getLineMax() == 3) { + if (IF_DUSK(dusk::version::isRegionJpn() &&) (s8)pReference->getLineMax() == 3) { int nowPageLine = pReference->getNowPageLine(); field_0x138 = pReference->getLineSpace() * (0.5f * (pReference->getLineMax() - (s16)nowPageLine)); var_f31 += field_0x138; @@ -3368,13 +3413,24 @@ void jmessage_tRenderingProcessor::do_heightcenter() { if (field_0x142 == 0) { field_0x138 = pReference->getLineSpace(); var_f31 += field_0x138; - } else if (field_0x142 == 1) { + } +#if TARGET_PC + else if (!dusk::version::isRegionJpn() || (dusk::version::isRegionJpn() && field_0x142 == 1)) +#else + else if (field_0x142 == 1) +#endif + { field_0x138 = 0.5f * pReference->getLineSpace(); var_f31 += field_0x138; } break; case 3: { - if (field_0x142 == 1) { +#if TARGET_PC + if (!dusk::version::isRegionJpn() || (dusk::version::isRegionJpn() && field_0x142 == 1)) +#else + if (field_0x142 == 1) +#endif + { int nowPageLine = pReference->getNowPageLine(); field_0x138 = pReference->getLineSpace() * (0.5f * (pReference->getLineMax() - (s16)nowPageLine)); var_f31 += field_0x138; @@ -3383,8 +3439,25 @@ void jmessage_tRenderingProcessor::do_heightcenter() { break; } case 4: { + #if TARGET_PC + if (!dusk::version::isRegionJpn() && field_0x142 == 0) { + int nowPageLine = pReference->getNowPageLine(); + field_0x138 = pReference->getLineSpace() * (0.5f * (pReference->getLineMax() - (s16)nowPageLine)); + var_f31 += field_0x138; + } + #endif + if (field_0x142 == 1) { + #if TARGET_PC + if (!dusk::version::isRegionJpn()) { + field_0x138 = 0.5f * pReference->getLineSpace(); + var_f31 += field_0x138; + } else { + var_f31 += 0.5f * pReference->getLineSpace(); + } + #else var_f31 += 0.5f * pReference->getLineSpace(); + #endif } f32 sp8 = pReference->getLineScale(field_0x142) / 100.0f; @@ -3662,7 +3735,7 @@ void jmessage_tRenderingProcessor::do_strcat(char* i_str, bool param_2, bool par } else { JUT_WARN(5316, "%s", "TextBox Alloc Byte Over!!"); } - } else if (field_0x11c < D_MSG_CLASS_CHAR_CNT_MAX) { + } else if (field_0x11c < DUSK_IF_ELSE((dusk::version::isRegionJpn() ? D_MSG_CLASS_CHAR_CNT_MAX : 0x200), D_MSG_CLASS_CHAR_CNT_MAX)) { if (param_2) { field_0x146++; if (pReference->getBatchColorFlag() != 0) { @@ -3697,7 +3770,7 @@ void jmessage_tRenderingProcessor::do_strcat(char* i_str, bool param_2, bool par int length = 0; length = strlen(buffer); - if (field_0x11c + length < D_MSG_CLASS_CHAR_CNT_MAX) { + if (field_0x11c + length < DUSK_IF_ELSE((dusk::version::isRegionJpn() ? D_MSG_CLASS_CHAR_CNT_MAX : 0x200), D_MSG_CLASS_CHAR_CNT_MAX)) { field_0x148 = strlen(pReference->getTextPtr()); field_0x14a = strlen(pReference->getTextSPtr()); @@ -3792,7 +3865,10 @@ void jmessage_tRenderingProcessor::do_rubystrcat(char* i_src, TEXT_SPAN i_dst, f void jmessage_tRenderingProcessor::do_name1() { const char* name = dComIfGs_getPlayerName(); -#if REGION_JPN +#if TARGET_PC || REGION_JPN + if (!dusk::version::isRegionJpn()) + return; + int c = (((char)name[0] & 0xFF) << 8) | ((char)name[1] & 0xFF); // if first character is hiragana or katakana if ((c >= 0x829F && c <= 0x82F1) || (c >= 0x8340 && c <= 0x8396)) { @@ -3889,7 +3965,7 @@ void jmessage_string_tReference::init(J2DTextBox* panePtr, J2DTextBox* runyPaneP mRubyPanePtr = runyPanePtr; mOutFontPtr = outFontPtr; mLineCount = 0; - mLineMax = D_MSG_CLASS_LINE_MAX; + mLineMax = DUSK_IF_ELSE(dusk::version::isRegionJpn() ? 9 : D_MSG_CLASS_LINE_MAX, D_MSG_CLASS_LINE_MAX); mNowPage = 0; mFlags = flags; if (font != NULL) { diff --git a/src/d/d_msg_object.cpp b/src/d/d_msg_object.cpp index 712ee61584..fc6b03d6df 100644 --- a/src/d/d_msg_object.cpp +++ b/src/d/d_msg_object.cpp @@ -314,6 +314,13 @@ dMsgObject_HIO_c::dMsgObject_HIO_c() { } int dMsgObject_c::_create(msg_class* param_1) { +#if TARGET_PC + if (dusk::version::isRegionJpn()) + g_MsgObject_HIO_c.mBoxTalkScaleX = 1.1f; + else + g_MsgObject_HIO_c.mBoxTalkScaleX = 1.2f; +#endif + field_0x124 = NULL; field_0x100 = param_1; field_0x16c = -1; diff --git a/src/d/d_msg_out_font.cpp b/src/d/d_msg_out_font.cpp index efc655d529..79bbad5ebb 100644 --- a/src/d/d_msg_out_font.cpp +++ b/src/d/d_msg_out_font.cpp @@ -1,11 +1,12 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_out_font.h" #include "JSystem/J2DGraph/J2DTextBox.h" #include "JSystem/JUtility/JUTTexture.h" #include "d/d_meter2_info.h" #include "d/d_msg_object.h" +#include "d/d_msg_out_font.h" #include "dusk/frame_interpolation.h" +#include "dusk/version.hpp" #include "f_op/f_op_msg_mng.h" COutFontSet_c::COutFontSet_c() { @@ -289,8 +290,10 @@ void COutFont_c::initialize() { void COutFont_c::drawFont(J2DTextBox* i_textbox, u8 i_type, f32 i_posX, f32 i_posY, f32 i_sizeX, f32 i_sizeY, u32 i_color, u8 i_alpha) { -#if VERSION != VERSION_GCN_JPN +#if TARGET_PC || VERSION != VERSION_GCN_JPN + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) i_posY += 1.0f; + IF_DUSK_BLOCK_END; #endif for (int i = 0; i < 35; i++) { if (mpOfs[i]->getType() == 0x47) { @@ -380,7 +383,15 @@ void COutFont_c::draw(J2DTextBox* i_textbox, f32 param_1, f32 param_2, f32 param break; case 5: case 6: { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + posY -= 2.0f; + sizeY -= 2.0f; + } else { + posY += 1.0f; + sizeY -= 3.0f; + } +#elif VERSION == VERSION_GCN_JPN posY -= 2.0f; sizeY -= 2.0f; #else diff --git a/src/d/d_msg_scrn_3select.cpp b/src/d/d_msg_scrn_3select.cpp index 2f19f23c83..b3a41a2988 100644 --- a/src/d/d_msg_scrn_3select.cpp +++ b/src/d/d_msg_scrn_3select.cpp @@ -5,16 +5,17 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_scrn_3select.h" +#include #include "JSystem/J2DGraph/J2DAnmLoader.h" #include "JSystem/J2DGraph/J2DGrafContext.h" #include "JSystem/J2DGraph/J2DScreen.h" #include "JSystem/J2DGraph/J2DTextBox.h" -#include #include "d/d_com_inf_game.h" -#include "d/d_select_cursor.h" #include "d/d_msg_object.h" +#include "d/d_msg_scrn_3select.h" #include "d/d_pane_class.h" +#include "d/d_select_cursor.h" +#include "dusk/version.hpp" #if TARGET_PC #include "dusk/menu_pointer.h" @@ -118,7 +119,97 @@ dMsgScrn3Select_c::dMsgScrn3Select_c() { mCursorPos[i] = mpCursor_c[i]->getGlobalVtxCenter(true, 0); } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() == 0) { + mpTmSel_c[0] = JKR_NEW CPaneMgr(mpScreen, 'a_tf', 0, NULL); + + mpTmSel_c[1] = JKR_NEW CPaneMgr(mpScreen, 'b_tf', 0, NULL); + + mpTmSel_c[2] = JKR_NEW CPaneMgr(mpScreen, 'c_tf', 0, NULL); + + mpTmrSel_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('a_tf_f'), 0, NULL); + + mpTmrSel_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_tf_f'), 0, NULL); + + mpTmrSel_c[2] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('c_tf_f'), 0, NULL); + + for (int i = 0; i < 3; i++) { + ((J2DTextBox*)(mpTmSel_c[i]->getPanePtr()))->setString(64, ""); + ((J2DTextBox*)(mpTmSel_c[i]->getPanePtr()))->setFont(mDoExt_getMesgFont()); + + ((J2DTextBox*)(mpTmrSel_c[i]->getPanePtr()))->setString(64, ""); + ((J2DTextBox*)(mpTmrSel_c[i]->getPanePtr()))->setFont(mDoExt_getMesgFont()); + } + + mpScreen->search(MULTI_CHAR('a_t_e'))->hide(); + mpScreen->search(MULTI_CHAR('b_t_e'))->hide(); + mpScreen->search(MULTI_CHAR('c_t_e'))->hide(); + mpScreen->search('a_tf')->show(); + mpScreen->search('b_tf')->show(); + mpScreen->search('c_tf')->show(); + mpScreen->search(MULTI_CHAR('a_tf_f'))->show(); + mpScreen->search(MULTI_CHAR('b_tf_f'))->show(); + mpScreen->search(MULTI_CHAR('c_tf_f'))->show(); + mpScreen->search('a_t')->hide(); + mpScreen->search('b_t')->hide(); + mpScreen->search('c_t')->hide(); + } else { + mpTmSel_c[0] = JKR_NEW CPaneMgr(mpScreen, 'a_t', 0, NULL); + + mpTmSel_c[1] = JKR_NEW CPaneMgr(mpScreen, 'b_t', 0, NULL); + + mpTmSel_c[2] = JKR_NEW CPaneMgr(mpScreen, 'c_t', 0, NULL); + + for (int i = 0; i < 3; i++) { + ((J2DTextBox*)(mpTmSel_c[i]->getPanePtr()))->setString(64, ""); + ((J2DTextBox*)(mpTmSel_c[i]->getPanePtr()))->setFont(mDoExt_getMesgFont()); + mpTmrSel_c[i] = NULL; + } + + mpScreen->search(MULTI_CHAR('a_t_e'))->hide(); + mpScreen->search(MULTI_CHAR('b_t_e'))->hide(); + mpScreen->search(MULTI_CHAR('c_t_e'))->hide(); + mpScreen->search('a_tf')->hide(); + mpScreen->search('b_tf')->hide(); + mpScreen->search('c_tf')->hide(); + mpScreen->search(MULTI_CHAR('a_tf_f'))->hide(); + mpScreen->search(MULTI_CHAR('b_tf_f'))->hide(); + mpScreen->search(MULTI_CHAR('c_tf_f'))->hide(); + mpScreen->search('a_t')->show(); + mpScreen->search('b_t')->show(); + mpScreen->search('c_t')->show(); + } + } else { + mpTmSel_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('a_t_e'), 0, NULL); + JUT_ASSERT(0, mpTmSel_c[0] != NULL); + + mpTmSel_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_t_e'), 0, NULL); + JUT_ASSERT(0, mpTmSel_c[1] != NULL); + + mpTmSel_c[2] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('c_t_e'), 0, NULL); + JUT_ASSERT(0, mpTmSel_c[2] != NULL); + + for (int i = 0; i < 3; i++) { + ((J2DTextBox*)(mpTmSel_c[i]->getPanePtr()))->setString(64, ""); + ((J2DTextBox*)(mpTmSel_c[i]->getPanePtr()))->setFont(mDoExt_getMesgFont()); + mpTmrSel_c[i] = NULL; + } + + mpScreen->search(MULTI_CHAR('a_t_e'))->show(); + mpScreen->search(MULTI_CHAR('b_t_e'))->show(); + mpScreen->search(MULTI_CHAR('c_t_e'))->show(); + mpScreen->search('a_tf')->hide(); + mpScreen->search('b_tf')->hide(); + mpScreen->search('c_tf')->hide(); + mpScreen->search(MULTI_CHAR('a_tf_f'))->hide(); + mpScreen->search(MULTI_CHAR('b_tf_f'))->hide(); + mpScreen->search(MULTI_CHAR('c_tf_f'))->hide(); + mpScreen->search('a_t')->hide(); + mpScreen->search('b_t')->hide(); + mpScreen->search('c_t')->hide(); + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { mpTmSel_c[0] = JKR_NEW CPaneMgr(mpScreen, 'a_tf', 0, NULL); @@ -966,7 +1057,18 @@ void dMsgScrn3Select_c::selectTrans() { f32 sp68[3]; for (int i = 0; i < 3; i++) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() == 0 && (field_0x112 & (u8)(1 << i)) != 0) { + sp68[i] = 0.0f; + } else { + f32 temp = mpTmSel_c[i]->getInitPosY(); + sp68[i] = mpScreen->search(tag_n[i])->getBounds().i.y - temp; + } + } else { + sp68[i] = 0.0f; + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0 && (field_0x112 & (u8)(1 << i)) != 0) { sp68[i] = 0.0f; } else { diff --git a/src/d/d_msg_scrn_boss.cpp b/src/d/d_msg_scrn_boss.cpp index 54938ceb72..b747887316 100644 --- a/src/d/d_msg_scrn_boss.cpp +++ b/src/d/d_msg_scrn_boss.cpp @@ -1,10 +1,11 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_scrn_boss.h" #include "JSystem/J2DGraph/J2DGrafContext.h" #include "JSystem/J2DGraph/J2DScreen.h" #include "d/d_msg_object.h" +#include "d/d_msg_scrn_boss.h" #include "d/d_pane_class.h" +#include "dusk/version.hpp" #if TARGET_PC #include "dusk/settings.h" @@ -37,8 +38,10 @@ dMsgScrnBoss_c::dMsgScrnBoss_c() { for (int i = 0; i < 7; i++) { mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getRubyFont()); -#if VERSION != VERSION_GCN_JPN +#if TARGET_PC || VERSION != VERSION_GCN_JPN + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setCharSpace(1.0f); + IF_DUSK_BLOCK_END #endif ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x100, ""); } diff --git a/src/d/d_msg_scrn_explain.cpp b/src/d/d_msg_scrn_explain.cpp index 29a88590ee..9460ce8921 100644 --- a/src/d/d_msg_scrn_explain.cpp +++ b/src/d/d_msg_scrn_explain.cpp @@ -14,7 +14,9 @@ #include #include -#if VERSION == VERSION_GCN_JPN +#include "dusk/version.hpp" + +#if TARGET_PC || VERSION == VERSION_GCN_JPN #define STR_BUF_LEN 528 #else #define STR_BUF_LEN 512 @@ -95,7 +97,13 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x50 = 0.0f; + } else { + field_0x50 = -10.0f; + } +#elif VERSION == VERSION_GCN_JPN field_0x50 = 0.0f; #else field_0x50 = -10.0f; @@ -109,7 +117,48 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs mpScreen->search(MULTI_CHAR('n_all'))->scale(g_MsgObject_HIO_c.mBoxTalkScaleX, g_MsgObject_HIO_c.mBoxTalkScaleY); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + field_0x50 = 0.0f; + + if (dComIfGs_getOptRuby() == 0) { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); + + mpTmr_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); + mpTmr_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + + mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->show(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't3_s', 0, NULL); + + mpTmr_c[0] = NULL; + mpTmr_c[1] = NULL; + + mpTxScreen->search(MULTI_CHAR('n_3line'))->show(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } + } else { + field_0x50 = -10.0f; + + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + JUT_ASSERT(162, mpTm_c[0] != NULL); + + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't4_s', 0, NULL); + JUT_ASSERT(165, mpTm_c[1] != NULL); + + mpTmr_c[0] = NULL; + mpTmr_c[1] = NULL; + + mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->show(); + } +#elif VERSION == VERSION_GCN_JPN field_0x50 = 0.0f; if (dComIfGs_getOptRuby() == 0) { @@ -160,20 +209,12 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs f32 lineSpace = ((J2DTextBox*)mpTm_c[0]->getPanePtr())->getLineSpace(); for (int i = 0; i < 2; i++) { ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x210, ""); -#else - ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x200, ""); -#endif + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(STR_BUF_LEN, ""); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setLineSpace(lineSpace); if (mpTmr_c[i] != NULL) { ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(0x210, ""); -#else - ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(0x200, ""); -#endif + ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(STR_BUF_LEN, ""); ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setLineSpace(lineSpace); } } @@ -320,7 +361,13 @@ void dMsgScrnExplain_c::draw(J2DOrthoGraph* i_graf) { SAFE_STRCPY(string_buf, ((J2DTextBox*)mpTm_c[0]->getPanePtr())->getStringPtr()); mpTxScreen->draw(0.0f, 0.0f, (J2DGrafContext*)i_graf); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpString_c->getString(mOpenMsgId, (J2DTextBox*)mpTm_c[0]->getPanePtr(), NULL, NULL, NULL, 12); + } else { + mpString_c->getString(mOpenMsgId, (J2DTextBox*)mpTm_c[0]->getPanePtr(), NULL, NULL, NULL, 8); + } +#elif VERSION == VERSION_GCN_JPN mpString_c->getString(mOpenMsgId, (J2DTextBox*)mpTm_c[0]->getPanePtr(), NULL, NULL, NULL, 12); #else mpString_c->getString(mOpenMsgId, (J2DTextBox*)mpTm_c[0]->getPanePtr(), NULL, NULL, NULL, 8); diff --git a/src/d/d_msg_scrn_howl.cpp b/src/d/d_msg_scrn_howl.cpp index c701ea0b2b..4e5c59546c 100644 --- a/src/d/d_msg_scrn_howl.cpp +++ b/src/d/d_msg_scrn_howl.cpp @@ -4,20 +4,21 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_scrn_howl.h" -#include "m_Do/m_Do_controller_pad.h" -#include "m_Do/m_Do_graphic.h" -#include "d/d_msg_object.h" -#include "d/d_pane_class.h" +#include "JSystem/J2DGraph/J2DGrafContext.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "JSystem/JUtility/JUTTexture.h" +#include "Z2AudioLib/Z2WolfHowlMgr.h" #include "d/actor/d_a_alink.h" #include "d/d_meter2.h" #include "d/d_meter2_draw.h" #include "d/d_meter2_info.h" -#include "JSystem/JUtility/JUTTexture.h" -#include "JSystem/JUtility/JUTAssert.h" -#include "JSystem/J2DGraph/J2DGrafContext.h" -#include "JSystem/J2DGraph/J2DScreen.h" -#include "Z2AudioLib/Z2WolfHowlMgr.h" +#include "d/d_msg_object.h" +#include "d/d_msg_scrn_howl.h" +#include "d/d_pane_class.h" +#include "dusk/version.hpp" +#include "m_Do/m_Do_controller_pad.h" +#include "m_Do/m_Do_graphic.h" #if TARGET_PC #include "dusk/frame_interpolation.h" @@ -89,7 +90,21 @@ dMsgScrnHowl_c::dMsgScrnHowl_c() { JUT_ASSERT(96, mpButtonIcon[1] != NULL); mpButtonText[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('gr_txt_n'), 2, NULL); JUT_ASSERT(98, mpButtonText[1] != NULL); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + J2DTextBox* piStack_19c; + J2DTextBox* piStack_1a0; + if (dusk::version::isRegionJpn()) { + piStack_19c = (J2DTextBox*)mpScreen->search(MULTI_CHAR('g_l_info')); + piStack_1a0 = (J2DTextBox*)mpScreen->search(MULTI_CHAR('g_r_info')); + mpScreen->search(MULTI_CHAR('fgr_info'))->hide(); + mpScreen->search(MULTI_CHAR('fgl_info'))->hide(); + } else { + piStack_19c = (J2DTextBox*)mpScreen->search(MULTI_CHAR('fgl_info')); + piStack_1a0 = (J2DTextBox*)mpScreen->search(MULTI_CHAR('fgr_info')); + mpScreen->search(MULTI_CHAR('g_l_info'))->hide(); + mpScreen->search(MULTI_CHAR('g_r_info'))->hide(); + } +#elif VERSION == VERSION_GCN_JPN J2DTextBox* piStack_19c = (J2DTextBox*)mpScreen->search(MULTI_CHAR('g_l_info')); J2DTextBox* piStack_1a0 = (J2DTextBox*)mpScreen->search(MULTI_CHAR('g_r_info')); mpScreen->search(MULTI_CHAR('fgr_info'))->hide(); diff --git a/src/d/d_msg_scrn_item.cpp b/src/d/d_msg_scrn_item.cpp index 26a741e320..ab91739acc 100644 --- a/src/d/d_msg_scrn_item.cpp +++ b/src/d/d_msg_scrn_item.cpp @@ -24,6 +24,8 @@ #include "JSystem/JUtility/JUTTexture.h" #include +#include "dusk/version.hpp" + dMsgScrnItem_c::dMsgScrnItem_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { if (param_3 != NULL) { field_0x138 = param_3; @@ -198,7 +200,53 @@ dMsgScrnItem_c::dMsgScrnItem_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { mpPmP_c->scale(g_MsgObject_HIO_c.mBoxItemScaleX, g_MsgObject_HIO_c.mBoxItemScaleY); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() == 0) { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + JUT_ASSERT(407, mpTm_c[0] != NULL); + + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); + JUT_ASSERT(410, mpTm_c[1] != NULL); + + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_w'), 0, NULL); + JUT_ASSERT(413, mpTm_c[2] != NULL); + + mpTmr_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); + JUT_ASSERT(416, mpTmr_c[0] != NULL); + + mpTmr_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + JUT_ASSERT(419, mpTmr_c[1] != NULL); + + mpTmr_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_w'), 0, NULL); + JUT_ASSERT(422, mpTmr_c[2] != NULL); + + mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->show(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); + JUT_ASSERT(407, mpTm_c[0] != NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't3_s', 0, NULL); + JUT_ASSERT(410, mpTm_c[1] != NULL); + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, 't3_w', 0, NULL); + JUT_ASSERT(413, mpTm_c[2] != NULL); + mpTxScreen->search(MULTI_CHAR('n_3line'))->show(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + JUT_ASSERT(407, mpTm_c[0] != NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't4_s', 0, NULL); + JUT_ASSERT(410, mpTm_c[1] != NULL); + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, 't4_w', 0, NULL); + JUT_ASSERT(413, mpTm_c[2] != NULL); + mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->show(); + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); JUT_ASSERT(407, mpTm_c[0] != NULL); diff --git a/src/d/d_msg_scrn_jimaku.cpp b/src/d/d_msg_scrn_jimaku.cpp index ce059bd194..832befb543 100644 --- a/src/d/d_msg_scrn_jimaku.cpp +++ b/src/d/d_msg_scrn_jimaku.cpp @@ -15,6 +15,14 @@ #include "d/d_pane_class.h" #include +#include "dusk/version.hpp" + +#if TARGET_PC || VERSION == VERSION_GCN_JPN +#define STR_BUF_LEN 528 +#else +#define STR_BUF_LEN 512 +#endif + dMsgScrnJimaku_c::dMsgScrnJimaku_c(u8 param_0, JKRExpHeap* i_heap) { if (i_heap != NULL) { heap = i_heap; @@ -46,7 +54,38 @@ dMsgScrnJimaku_c::dMsgScrnJimaku_c(u8 param_0, JKRExpHeap* i_heap) { field_0xcc = g_MsgObject_HIO_c.mBoxPos[0][5]; mpPmP_c->paneTrans(0.0f, field_0xcc); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() == 0) { + mpTm_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('t3f_s'), 0, NULL); + + mpTmr_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3f'), 0, NULL); + mpTmr_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + + mpScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpScreen->search(MULTI_CHAR('n_3fline'))->show(); + mpScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpScreen, 't3_s', 0, NULL); + + mpScreen->search(MULTI_CHAR('n_3line'))->show(); + mpScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + JUT_ASSERT(0, mpTm_c[0] != NULL); + + mpTm_c[1] = JKR_NEW CPaneMgr(mpScreen, 't4_s', 0, NULL); + JUT_ASSERT(0, mpTm_c[1] != NULL); + + mpScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpScreen->search(MULTI_CHAR('n_e4line'))->show(); + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { mpTm_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3flin'), 0, NULL); mpTm_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('t3f_s'), 0, NULL); @@ -79,21 +118,13 @@ dMsgScrnJimaku_c::dMsgScrnJimaku_c(u8 param_0, JKRExpHeap* i_heap) { for (int i = 0; i < 2; i++) { ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x210, ""); -#else - ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x200, ""); -#endif + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(STR_BUF_LEN, ""); mpTm_c[i]->setBlackWhite(g_MsgObject_HIO_c.mBoxStartBlack[i][4], g_MsgObject_HIO_c.mBoxStartWhite[i][4]); if (mpTmr_c[i] != NULL) { ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(0x210, ""); -#else - ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(0x200, ""); -#endif + ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(STR_BUF_LEN, ""); mpTmr_c[i]->setBlackWhite(g_MsgObject_HIO_c.mBoxStartBlack[i][4], g_MsgObject_HIO_c.mBoxStartWhite[i][4]); } diff --git a/src/d/d_msg_scrn_kanban.cpp b/src/d/d_msg_scrn_kanban.cpp index d6e91b12f6..8e2346feab 100644 --- a/src/d/d_msg_scrn_kanban.cpp +++ b/src/d/d_msg_scrn_kanban.cpp @@ -4,14 +4,15 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_scrn_kanban.h" #include "JSystem/J2DGraph/J2DAnmLoader.h" #include "JSystem/J2DGraph/J2DGrafContext.h" #include "JSystem/J2DGraph/J2DScreen.h" #include "JSystem/JKernel/JKRExpHeap.h" #include "d/d_msg_object.h" #include "d/d_msg_out_font.h" +#include "d/d_msg_scrn_kanban.h" #include "d/d_pane_class.h" +#include "dusk/version.hpp" #if TARGET_PC #include "dusk/settings.h" @@ -60,8 +61,48 @@ dMsgScrnKanban_c::dMsgScrnKanban_c(JKRExpHeap* param_0) { mpSpot_c->getPanePtr()->setAnimation(field_0xd0); +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() != 0) { + static u64 const t_tag[3] = {MULTI_CHAR('mg_3line'), 't3_w', 't3_s'}; + for (int i = 0; i < 3; i++) { + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); + } -#if VERSION == VERSION_GCN_JPN + mpScreen->search(MULTI_CHAR('n_3line'))->show(); + mpScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } else { + static u64 const t_tag_2[3] = {MULTI_CHAR('t3fline'), MULTI_CHAR('t3f_w'), MULTI_CHAR('t3f_s')}; + static u64 const tr_tag[3] = {MULTI_CHAR('mg_3f'), MULTI_CHAR('mg_3f_w'), MULTI_CHAR('mg_3f_s')}; + + for (int i = 0; i < 3; i++) { + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag_2[i], 0, NULL); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); + + mpTmr_c[i] = JKR_NEW CPaneMgr(mpScreen, tr_tag[i], 0, NULL); + ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); + } + + mpScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpScreen->search(MULTI_CHAR('n_3fline'))->show(); + mpScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } + } else { + static u64 const t_tag[3] = {MULTI_CHAR('mg_e4lin'), 'f4_w', 't4_s'}; + + for (int i = 0; i < 3; i++) { + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); + JUT_ASSERT(81, mpTm_c[i] != NULL); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); + } + + mpScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpScreen->search(MULTI_CHAR('n_e4line'))->show(); + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() != 0) { static u64 const t_tag[3] = {MULTI_CHAR('mg_3line'), 't3_w', 't3_s'}; for (int i = 0; i < 3; i++) { diff --git a/src/d/d_msg_scrn_place.cpp b/src/d/d_msg_scrn_place.cpp index 93c2ec7c20..31718f6d49 100644 --- a/src/d/d_msg_scrn_place.cpp +++ b/src/d/d_msg_scrn_place.cpp @@ -5,12 +5,13 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_scrn_place.h" #include "JSystem/J2DGraph/J2DGrafContext.h" #include "JSystem/J2DGraph/J2DScreen.h" #include "d/d_camera.h" #include "d/d_msg_object.h" +#include "d/d_msg_scrn_place.h" #include "d/d_pane_class.h" +#include "dusk/version.hpp" #if TARGET_PC #include "dusk/settings.h" @@ -32,7 +33,13 @@ dMsgScrnPlace_c::dMsgScrnPlace_c() { } mpScreen = JKR_NEW J2DScreen(); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + mpScreen->setPriority("zelda_stage_title.blo", 0x20000, dComIfGp_getMsgArchive(4)); + } else { + mpScreen->setPriority("zelda_stage_title_foreign.blo", 0x20000, dComIfGp_getMsgArchive(4)); + } +#elif VERSION == VERSION_GCN_JPN mpScreen->setPriority("zelda_stage_title.blo", 0x20000, dComIfGp_getMsgArchive(4)); #else mpScreen->setPriority("zelda_stage_title_foreign.blo", 0x20000, dComIfGp_getMsgArchive(4)); @@ -59,7 +66,9 @@ dMsgScrnPlace_c::dMsgScrnPlace_c() { ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getRubyFont()); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x80, ""); #if VERSION != VERSION_GCN_JPN + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setCharSpace(1.0f); + IF_DUSK_BLOCK_END #endif } diff --git a/src/d/d_msg_scrn_talk.cpp b/src/d/d_msg_scrn_talk.cpp index 5cf1b184da..6a30d08c47 100644 --- a/src/d/d_msg_scrn_talk.cpp +++ b/src/d/d_msg_scrn_talk.cpp @@ -20,10 +20,20 @@ #include "JSystem/J2DGraph/J2DScreen.h" #include +#include "dusk/version.hpp" + #if TARGET_PC #include "dusk/settings.h" #endif +#if TARGET_PC +#define STR_BUF_LEN 528 +#elif VERSION == VERSION_GCN_JPN +#define STR_BUF_LEN 528 +#else +#define STR_BUF_LEN 512 +#endif + dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { if (param_3 != NULL) { field_0xe4 = param_3; @@ -100,7 +110,12 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { JUT_ASSERT(153, mpMg_c[1] != NULL); OSInitFastCast(); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) + field_0xf4 = 0.0f; + else + field_0xf4 = -10.0f; +#elif VERSION == VERSION_GCN_JPN field_0xf4 = 0.0f; #else field_0xf4 = -10.0f; @@ -110,7 +125,68 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { JUT_ASSERT(176, mpPmP_c != NULL); mpPmP_c->scale(g_MsgObject_HIO_c.mBoxTalkScaleX, g_MsgObject_HIO_c.mBoxTalkScaleY); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() == 0) { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); + + mpTmr_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); + if (dMsgObject_getMsgObjectClass()->getFukiKind() == 8) { + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s1'), 0, NULL); + mpTm_c[3] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s2'), 0, NULL); + mpTm_c[4] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s3'), 0, NULL); + mpTm_c[5] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s4'), 0, NULL); + mpTmr_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s1'), 0, NULL); + mpTmr_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s2'), 0, NULL); + } else { + mpTmr_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + } + + mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->show(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't3_s', 0, NULL); + + if (dMsgObject_getMsgObjectClass()->getFukiKind() == 8) { + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s1'), 0, NULL); + JUT_ASSERT(189, mpTm_c[2] != NULL); + mpTm_c[3] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s2'), 0, NULL); + JUT_ASSERT(191, mpTm_c[3] != NULL); + mpTm_c[4] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s3'), 0, NULL); + JUT_ASSERT(193, mpTm_c[4] != NULL); + mpTm_c[5] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s4'), 0, NULL); + JUT_ASSERT(193, mpTm_c[5] != NULL); + } + + mpTxScreen->search(MULTI_CHAR('n_3line'))->show(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } + } else { + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + JUT_ASSERT(182, mpTm_c[0] != NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't4_s', 0, NULL); + JUT_ASSERT(185, mpTm_c[1] != NULL); + + if (dMsgObject_getMsgObjectClass()->getFukiKind() == 8) { + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s1'), 0, NULL); + JUT_ASSERT(189, mpTm_c[2] != NULL); + mpTm_c[3] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s2'), 0, NULL); + JUT_ASSERT(191, mpTm_c[3] != NULL); + mpTm_c[4] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s3'), 0, NULL); + JUT_ASSERT(193, mpTm_c[4] != NULL); + mpTm_c[5] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s4'), 0, NULL); + JUT_ASSERT(193, mpTm_c[5] != NULL); + } + + mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpTxScreen->search(MULTI_CHAR('n_e4line'))->show(); + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); @@ -173,19 +249,11 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { for (int i = 0; i < 6; i++) { if (mpTm_c[i] != NULL) { ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x210, ""); -#else - ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x200, ""); -#endif + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(STR_BUF_LEN, ""); } if (mpTmr_c[i] != NULL) { ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); -#if VERSION == VERSION_GCN_JPN - ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(0x210, ""); -#else - ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(0x200, ""); -#endif + ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(STR_BUF_LEN, ""); } } if (dMsgObject_getMsgObjectClass()->getFukiKind() != 8) { diff --git a/src/d/d_msg_scrn_tree.cpp b/src/d/d_msg_scrn_tree.cpp index 899a8f449a..440b2702d3 100644 --- a/src/d/d_msg_scrn_tree.cpp +++ b/src/d/d_msg_scrn_tree.cpp @@ -1,13 +1,14 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_scrn_tree.h" #include "JSystem/J2DGraph/J2DAnmLoader.h" #include "JSystem/J2DGraph/J2DGrafContext.h" #include "JSystem/J2DGraph/J2DScreen.h" #include "JSystem/JKernel/JKRExpHeap.h" #include "d/d_msg_object.h" #include "d/d_msg_out_font.h" +#include "d/d_msg_scrn_tree.h" #include "d/d_pane_class.h" +#include "dusk/version.hpp" #if TARGET_PC #include "dusk/settings.h" @@ -61,7 +62,52 @@ dMsgScrnTree_c::dMsgScrnTree_c(JUTFont* param_0, JKRExpHeap* param_1) { mpScreen->search(MULTI_CHAR('white_m'))->setAnimation(field_0xd4); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (dComIfGs_getOptRuby() != 0) { + for (int i = 0; i < 3; i++) { + static u64 const t_tag[3] = {MULTI_CHAR('mg_3line'), 't3_w', 't3_s'}; + + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(field_0x54); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x210, ""); + } + + mpScreen->search(MULTI_CHAR('n_3line'))->show(); + mpScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } else { + for (int i = 0; i < 3; i++) { + static u64 const t_tag[3] = {MULTI_CHAR('t3fline'), MULTI_CHAR('t3f_w'), MULTI_CHAR('t3f_s')}; + static u64 const tr_tag[3] = {MULTI_CHAR('mg_3f'), MULTI_CHAR('mg_3f_w'), MULTI_CHAR('mg_3f_s')}; + + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(field_0x54); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x210, ""); + + mpTmr_c[i] = JKR_NEW CPaneMgr(mpScreen, tr_tag[i], 0, NULL); + ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setFont(field_0x54); + ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(0x210, ""); + } + + mpScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpScreen->search(MULTI_CHAR('n_3fline'))->show(); + mpScreen->search(MULTI_CHAR('n_e4line'))->hide(); + } + } else { + for (int i = 0; i < 3; i++) { + static u64 const t_tag[3] = {MULTI_CHAR('mg_e4lin'), 'f4_w', 't4_s'}; + + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(field_0x54); + ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x200, ""); + } + + mpScreen->search(MULTI_CHAR('n_3line'))->hide(); + mpScreen->search(MULTI_CHAR('n_3fline'))->hide(); + mpScreen->search(MULTI_CHAR('n_e4line'))->show(); + } +#elif VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() != 0) { for (int i = 0; i < 3; i++) { static u64 const t_tag[3] = {MULTI_CHAR('mg_3line'), 't3_w', 't3_s'}; diff --git a/src/d/d_msg_unit.cpp b/src/d/d_msg_unit.cpp index 130b5da906..057e6cc3fc 100644 --- a/src/d/d_msg_unit.cpp +++ b/src/d/d_msg_unit.cpp @@ -1,11 +1,12 @@ #include "d/dolzel.h" // IWYU pragma: keep -#include "d/d_msg_unit.h" -#include "d/d_com_inf_game.h" #include #include +#include "d/d_com_inf_game.h" #include "d/d_kankyo.h" #include "d/d_meter2_info.h" +#include "d/d_msg_unit.h" +#include "dusk/version.hpp" // temporary until a better solution is found typedef struct dMsgUnit_inf1_entry { @@ -41,6 +42,199 @@ dMsgUnit_c::dMsgUnit_c() {} dMsgUnit_c::~dMsgUnit_c() {} +#if TARGET_PC +typedef struct dMsgUnit_inf1_entry_JPN { + BE(u32) dat1EntryOffset; + BE(u16) field_0x04; + BE(u16) field_0x06; + BE(u16) field_0x08; + BE(u16) field_0x0a; + BE(u16) field_0x0c; + BE(u16) field_0x0e; + BE(u16) field_0x10; + BE(u16) field_0x12; + BE(u16) field_0x14; + BE(u16) field_0x16; + BE(u16) field_0x18; + BE(u16) startFrame; + BE(u16) endFrame; +} dMsgUnit_inf1_entry_JPN; + +typedef struct dMsgUnit_inf1_section_JPN { + /* 0x00 */ BE(u32) msgType; // sectionType + /* 0x04 */ BE(u32) size; // total size of the section + /* 0x08 */ BE(u16) entryCount; + /* 0x0A */ BE(u16) entryLength; + /* 0x0C */ BE(u16) msgArchiveId; + /* 0x10 */ dMsgUnit_inf1_entry_JPN entries[0]; +} dMsgUnit_inf1_section_JPN; + +void dMsgUnit_c::setTag_jpn(int i_type, int i_value, TEXT_SPAN o_buffer, bool param_4) { + *o_buffer = 0; + bool stack9 = false; + bool stack8 = false; + int value = i_value; + + if (i_type == 0x10000) { + SAFE_SPRINTF(o_buffer, "%d", i_value); + return; + } + + if (i_type == 0x10001) { + int tens_digit = i_value / 10; + int ones_digit = i_value % 10; + SAFE_SPRINTF(o_buffer, "%d-%d", tens_digit, ones_digit); + return; + } + + if ((i_type == 4 && param_4 == true) || (i_type == 5 && param_4 == false)) { + int seconds = i_value / 1000; + int minutes = seconds / 60; + seconds -= minutes * 60; + if (minutes > 99) { + minutes = 99; + seconds = 59; + } + + if (minutes == 0 && seconds == 0) { + if (strcmp(dComIfGp_getStartStageName(), "F_SP00") == 0) { + return; + } + } + + if (i_type == 4) { + i_value = minutes; + if (minutes == 0) { + stack9 = true; + } + } + + if (i_type == 5) { + if (seconds == 0 && minutes != 0) { + return; + } + i_value = seconds; + } + } + + if ((i_type == 3 && param_4 == true) || i_type == 4 && param_4 == false) { + f32 dayTime = g_env_light.getDaytime(); + f32 hour = dayTime / 15.0f; + + f32 iVar8b = ((s32)(1000000.0f * dayTime) % 15000000) / 1000000.0f; + f32 minute = 60.0f * (iVar8b / 15.0f); + // not sure why this affects codegen, in theory it should be optimized out + f32 minute2 = 60.0f * (iVar8b / 15.0f); + if (i_type == 3) { + i_value = (s32)hour; + } + + if (i_type == 4) { + i_value = (s32)minute; + } + } + + if (i_type == 9 && param_4 == true) { + SAFE_SPRINTF(o_buffer, "%d", i_value); + stack8 = true; + } + + if (!stack9) { + bmg_header_t* pHeader = (bmg_header_t*)dMeter2Info_getMsgUnitResource(); + dMsgUnit_inf1_section_JPN* pInfoBlock = NULL; + const void* pMsgDataBlock = NULL; + str1_section_t* pStrAttributeBlock = NULL; + int filepos = sizeof(bmg_header_t); + u32 filesize = pHeader->size; + bmg_section_t* pSection = (bmg_section_t*)(((u8*)pHeader) + filepos); + + for (; filepos < filesize; filepos += pSection->size) { + switch(pSection->magic) { + case 'FLW1': + break; + case 'FLI1': + break; + case 'INF1': + pInfoBlock = (dMsgUnit_inf1_section_JPN*)pSection; + break; + case 'DAT1': + pMsgDataBlock = pSection; + break; + case 'STR1': + pStrAttributeBlock = (str1_section_t*)pSection; + break; + } + pSection = (bmg_section_t*)((u8*)pSection + pSection->size); + } + + u16 vals[12]; + vals[0] = pInfoBlock->entries[i_type].field_0x04; + vals[1] = pInfoBlock->entries[i_type].field_0x06; + vals[2] = pInfoBlock->entries[i_type].field_0x08; + vals[3] = pInfoBlock->entries[i_type].field_0x0a; + vals[4] = pInfoBlock->entries[i_type].field_0x0c; + vals[5] = pInfoBlock->entries[i_type].field_0x0e; + vals[6] = pInfoBlock->entries[i_type].field_0x10; + vals[7] = pInfoBlock->entries[i_type].field_0x12; + vals[8] = pInfoBlock->entries[i_type].field_0x14; + vals[9] = pInfoBlock->entries[i_type].field_0x16; + vals[10] = pInfoBlock->entries[i_type].field_0x18; + int entryOff = pInfoBlock->entries[i_type].dat1EntryOffset; + + char* value2 = (char*)((uintptr_t)pMsgDataBlock + entryOff + 8); + + const char* uVar5; + if (i_value == 0) { + uVar5 = pStrAttributeBlock->entries->str + vals[0]; + } else { + if ((i_value % 10) == 0) { + uVar5 = pStrAttributeBlock->entries->str + (vals[10]); + } else { + uVar5 = pStrAttributeBlock->entries->str + vals[i_value % 10]; + } + } + + int uVar5Len = strlen(uVar5); + if (uVar5Len == 0) { + if (stack8) { + SAFE_STRCAT(o_buffer, value2); + } else { + SAFE_SPRINTF(o_buffer, "%d%s", i_value, value2); + } + } else { + char unkCharArr[7]; + unkCharArr[0] = 26; + unkCharArr[1] = uVar5Len + 6; + unkCharArr[2] = -1; + unkCharArr[3] = -1; + unkCharArr[4] = 2; + unkCharArr[5] = strlen(value2) / 2; + unkCharArr[6] = 0; + + if (stack8) { + SAFE_STRCAT(o_buffer, unkCharArr); + SAFE_STRCAT(o_buffer, uVar5); + SAFE_STRCAT(o_buffer, value2); + } else { + SAFE_SPRINTF(o_buffer, "%d%s%s%s", i_value, unkCharArr, uVar5, value2); + } + } + } + + if (i_type == 3 && param_4 == true) { + char buffer[20]; + setTag(4, 0, buffer, false); + SAFE_STRCAT(o_buffer, buffer); + } + + if (i_type == 4 && param_4 == true) { + char buffer[20]; + setTag(5, value, buffer, false); + SAFE_STRCAT(o_buffer, buffer); + } +} +#endif + #if REGION_JPN void dMsgUnit_c::setTag(int i_type, int i_value, TEXT_SPAN o_buffer, bool param_4) { *o_buffer = 0; @@ -208,6 +402,13 @@ void dMsgUnit_c::setTag(int i_type, int i_value, TEXT_SPAN o_buffer, bool param_ } #else void dMsgUnit_c::setTag(int i_type, int i_value, TEXT_SPAN o_buffer, bool param_4) { +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + setTag_jpn(i_type, i_value, o_buffer, param_4); + return; + } +#endif + *o_buffer = 0; bool stack9 = false; bool stack8 = false; diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index 22729ad43e..cdd5c467ef 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -1016,7 +1016,12 @@ void dSv_player_info_c::init() { } void dSv_player_config_c::init() { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) + mRuby = 0; + else + mRuby = 1; +#elif VERSION == VERSION_GCN_JPN mRuby = 0; #else mRuby = 1; diff --git a/src/d/d_timer.cpp b/src/d/d_timer.cpp index 1b4febc9f4..e07cc3af80 100644 --- a/src/d/d_timer.cpp +++ b/src/d/d_timer.cpp @@ -24,6 +24,7 @@ #include #include "dusk/frame_interpolation.h" +#include "dusk/version.hpp" static int dTimer_createStart2D(s32 param_0, u16 param_1); @@ -1430,7 +1431,7 @@ void dDlst_TimerScrnDraw_c::playBckAnimation(f32 i_frame) { mpGetInParent->getPanePtr()->setAnimation((J2DAnmTransform*)NULL); } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN bool dDlst_TimerScrnDraw_c::isLeadByte(int i_char) { return (i_char >= 0x81 && i_char <= 0x9f) || (i_char >= 0xe0 && i_char <= 0xfc); } @@ -1466,7 +1467,18 @@ void dDlst_TimerScrnDraw_c::drawPikari(int i_no) { var_f25 * static_cast(mpGetInText->getPanePtr())->getCharSpace(); } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (isLeadByte(c)) { + c = ((string[str_idx] & 0xFF) << 8) | (string[str_idx + 1] & 0xFF); + str_idx++; + } else { + c = string[str_idx] & 0xFF; + } + } else { + c = string[str_idx] & 0xFF; + } +#elif VERSION == VERSION_GCN_JPN if (isLeadByte(c)) { c = ((string[str_idx] & 0xFF) << 8) | (string[str_idx + 1] & 0xFF); str_idx++; @@ -1492,7 +1504,18 @@ void dDlst_TimerScrnDraw_c::drawPikari(int i_no) { var_f25 * static_cast(mpGetInText->getPanePtr())->getCharSpace(); } -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (isLeadByte(c)) { + c = ((string[str_idx] & 0xFF) << 8) | (string[str_idx + 1] & 0xFF); + str_idx++; + } else { + c = string[str_idx] & 0xFF; + } + } else { + c = string[str_idx] & 0xFF; + } +#elif VERSION == VERSION_GCN_JPN if (isLeadByte(c)) { c = ((string[str_idx] & 0xFF) << 8) | (string[str_idx + 1] & 0xFF); str_idx++; From e3075520e7406d4459284adf27b4107fa1e2f639 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Fri, 17 Jul 2026 20:35:15 -0700 Subject: [PATCH 09/14] convert jpn logic changes to runtime checks --- src/Z2AudioLib/Z2SoundObjMgr.cpp | 6 +++ src/d/actor/d_a_alink_demo.inc | 13 +++-- src/d/actor/d_a_e_mk.cpp | 6 ++- src/d/actor/d_a_e_mk_bo.cpp | 11 ++-- src/d/actor/d_a_e_mm_mt.cpp | 7 ++- src/d/actor/d_a_mg_fshop.cpp | 8 ++- src/d/d_kankyo_rain.cpp | 18 +++++-- src/d/d_menu_fmap.cpp | 8 +-- src/d/d_msg_unit.cpp | 86 ++++++++++++++++---------------- src/m_Do/m_Do_MemCardRWmng.cpp | 7 +-- 10 files changed, 105 insertions(+), 65 deletions(-) diff --git a/src/Z2AudioLib/Z2SoundObjMgr.cpp b/src/Z2AudioLib/Z2SoundObjMgr.cpp index 19099c7675..2c67cfb22b 100644 --- a/src/Z2AudioLib/Z2SoundObjMgr.cpp +++ b/src/Z2AudioLib/Z2SoundObjMgr.cpp @@ -6,6 +6,8 @@ #include "Z2AudioLib/Z2LinkMgr.h" #include +#include "dusk/version.hpp" + Z2SoundObjMgr::Z2SoundObjMgr() : JASGlobalInstance(true) { ghostEnemyState_ = 0; twilightBattle_ = 0; @@ -207,6 +209,10 @@ void Z2SoundObjMgr::searchEnemy() { case Z2_ENEMY_RD: case Z2_ENEMY_SH: case Z2_ENEMY_HP: +#elif TARGET_PC + case Z2_ENEMY_SH: + if (enemyId == Z2_ENEMY_SH && !dusk::version::isRegionJpn()) + continue; #endif if (!Z2GetLink()->isRiding()) break; diff --git a/src/d/actor/d_a_alink_demo.inc b/src/d/actor/d_a_alink_demo.inc index b1eb71a85d..cf1a222c9c 100644 --- a/src/d/actor/d_a_alink_demo.inc +++ b/src/d/actor/d_a_alink_demo.inc @@ -26,6 +26,7 @@ #include "dusk/imgui/ImGuiConsole.hpp" #include "dusk/settings.h" #include "dusk/speedrun.h" +#include "dusk/version.hpp" BOOL daAlink_c::checkEventRun() const { return dComIfGp_event_runCheck() || checkPlayerDemoMode(); @@ -4399,8 +4400,10 @@ void daAlink_c::checkWarpStart() { if (dMeter2Info_getWarpStatus() == WARP_STATUS_DECIDED_e || dComIfGp_event_compulsory(this, 0, 0xFFFF)) { - #if VERSION != VERSION_GCN_JPN && VERSION != VERSION_SHIELD_DEBUG + #if TARGET_PC || (VERSION != VERSION_GCN_JPN && VERSION != VERSION_SHIELD_DEBUG) + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) onNoResetFlg0(FLG0_UNK_4000); + IF_DUSK_BLOCK_END #endif if (dMeter2Info_getWarpStatus() == WARP_STATUS_DECIDED_e) { @@ -4428,8 +4431,10 @@ void daAlink_c::checkWarpStart() { fopAcM_orderOtherEvent(this, portal, 0xFFFF, 1, 1); } else { mDemo.setSpecialDemoType(); - #if VERSION == VERSION_GCN_JPN || VERSION == VERSION_SHIELD_DEBUG + #if TARGET_PC || (VERSION == VERSION_GCN_JPN || VERSION == VERSION_SHIELD_DEBUG) + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) onNoResetFlg0(FLG0_UNK_4000); + IF_DUSK_BLOCK_END #endif if (dMeter2Info_getWarpStatus() == 1) { @@ -4513,10 +4518,12 @@ int daAlink_c::procCoWarpInit(int param_0, int param_1) { soundId = Z2SE_WOLF_WARP_IN_TATE; } - #if VERSION == VERSION_GCN_JPN || VERSION == VERSION_SHIELD_DEBUG + #if TARGET_PC || (VERSION == VERSION_GCN_JPN || VERSION == VERSION_SHIELD_DEBUG) + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) if (param_1) { onNoResetFlg0(FLG0_UNK_4000); } + IF_DUSK_BLOCK_END #endif if (param_1) { diff --git a/src/d/actor/d_a_e_mk.cpp b/src/d/actor/d_a_e_mk.cpp index f507177f1d..7484a4b22b 100644 --- a/src/d/actor/d_a_e_mk.cpp +++ b/src/d/actor/d_a_e_mk.cpp @@ -21,6 +21,8 @@ #include "Z2AudioLib/Z2Instances.h" #include +#include "dusk/version.hpp" + class daE_MK_HIO_c : public JORReflexible { public: virtual ~daE_MK_HIO_c() {} @@ -612,8 +614,10 @@ static void e_mk_shoot(e_mk_class* i_this) { i_this->sound.startCreatureVoice(Z2SE_EN_MK_V_CATCH_BOOM, -1); i_this->sound.startCreatureSound(Z2SE_EN_MK_CATCH_BOOM, 0, -1); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) return; + IF_DUSK_BLOCK_END #endif } } diff --git a/src/d/actor/d_a_e_mk_bo.cpp b/src/d/actor/d_a_e_mk_bo.cpp index 950d6cdc56..c3b303cf6f 100644 --- a/src/d/actor/d_a_e_mk_bo.cpp +++ b/src/d/actor/d_a_e_mk_bo.cpp @@ -5,12 +5,13 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep -#include "d/actor/d_a_e_mk_bo.h" +#include "Z2AudioLib/Z2Instances.h" +#include "c/c_damagereaction.h" #include "d/actor/d_a_e_mk.h" +#include "d/actor/d_a_e_mk_bo.h" #include "d/actor/d_a_player.h" #include "d/d_s_play.h" -#include "c/c_damagereaction.h" -#include "Z2AudioLib/Z2Instances.h" +#include "dusk/version.hpp" static int daE_MK_BO_Draw(e_mk_bo_class* i_this) { if (i_this->field_0x9b4 != 0) { @@ -569,8 +570,10 @@ static int daE_MK_BO_Execute(e_mk_bo_class* i_this) { if (i_this->field_0x600 != 0) { fopAcM_delete(actor); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) return 1; + IF_DUSK_BLOCK_END #endif } diff --git a/src/d/actor/d_a_e_mm_mt.cpp b/src/d/actor/d_a_e_mm_mt.cpp index a3f57ddcf1..782978d801 100644 --- a/src/d/actor/d_a_e_mm_mt.cpp +++ b/src/d/actor/d_a_e_mm_mt.cpp @@ -3,9 +3,10 @@ * */ -#include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_e_mm_mt.h" #include "d/d_cc_d.h" +#include "d/dolzel_rel.h" // IWYU pragma: keep +#include "dusk/version.hpp" #include "f_op/f_op_actor_enemy.h" static int daE_MM_MT_Draw(e_mm_mt_class* i_this) { @@ -802,7 +803,9 @@ static int daE_MM_MT_Create(fopAc_ac_c* i_this) { if (i_this->argument == 1) { fopAcM_OffStatus(i_this, 0x80000); helmasaurShell->m_sphere.SetAtType( - #if VERSION == VERSION_GCN_JPN + #if TARGET_PC + dusk::version::isRegionJpn() ? AT_TYPE_CSTATUE_SWING : 0xD8FBBDFF + #elif VERSION == VERSION_GCN_JPN AT_TYPE_CSTATUE_SWING #else 0xD8FBBDFF diff --git a/src/d/actor/d_a_mg_fshop.cpp b/src/d/actor/d_a_mg_fshop.cpp index 9e8eb3f357..061fb5b7be 100644 --- a/src/d/actor/d_a_mg_fshop.cpp +++ b/src/d/actor/d_a_mg_fshop.cpp @@ -1783,7 +1783,13 @@ static int daFshop_Create(fopAc_ac_c* actor) { }; if (sp10 == 1) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + sp24 = dComIfGs_getEventReg(check_kind[i]); + } else { + sp24 = 2.54f * dComIfGs_getEventReg(check_kind[i]); + } +#elif VERSION == VERSION_GCN_JPN sp24 = dComIfGs_getEventReg(check_kind[i]); #else sp24 = 2.54f * dComIfGs_getEventReg(check_kind[i]); diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index bcc8b228e6..02dcd94d68 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -12,6 +12,8 @@ #include "m_Do/m_Do_graphic.h" #include "m_Do/m_Do_lib.h" #include + +#include "dusk/version.hpp" #if TARGET_PC #include "dusk/frame_interpolation.h" #endif @@ -2386,10 +2388,12 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* ppos, GXColor& unused, u8** tex) { u8 draw_sun = false; u16 date = dComIfGs_getDate(); -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) if (g_env_light.hide_vrbox) { return; } + IF_DUSK_BLOCK_END #endif if (strcmp(dComIfGp_getStartStageName(), "F_SP200") == 0) { @@ -2754,10 +2758,12 @@ void dKyr_drawLenzflare(Mtx drawMtx, cXyz* ppos, GXColor& param_2, u8** tex) { static s16 S_rot_work1 = 0; static s16 S_rot_work2 = 0; -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) if (g_env_light.hide_vrbox) { return; } + IF_DUSK_BLOCK_END #endif Mtx camMtx; @@ -4223,10 +4229,12 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) { csXyz(0, 30000, 19000), }; -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) if (g_env_light.hide_vrbox) { return; } + IF_DUSK_BLOCK_END #endif if (star_packet->mEffectNum != 0) { @@ -4770,10 +4778,12 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) { int pass = 1; f32 spC4 = 0.0f; -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) if (g_env_light.hide_vrbox) { return; } + IF_DUSK_BLOCK_END #endif cXyz sp15C; diff --git a/src/d/d_menu_fmap.cpp b/src/d/d_menu_fmap.cpp index 7db489e51b..c2d642a6d4 100644 --- a/src/d/d_menu_fmap.cpp +++ b/src/d/d_menu_fmap.cpp @@ -21,8 +21,9 @@ #include "d/d_msg_object.h" #include "d/d_msg_scrn_explain.h" #include "d/d_stage.h" -#include "helpers/string.hpp" +#include "dusk/version.hpp" #include "f_op/f_op_msg_mng.h" +#include "helpers/string.hpp" #if TARGET_PC #include "dusk/frame_interpolation.h" @@ -1217,7 +1218,8 @@ void dMenu_Fmap_c::spot_map_proc() { { mpDraw2DBack->stageMapMove(mpStick, 1, true); } else if (dMw_Z_TRIGGER() && mpDraw2DTop->isWarpAccept()) { -#if VERSION >= VERSION_GCN_JPN +#if TARGET_PC || VERSION >= VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) //! JPN version added a check to make sure if Arbiter's Grounds is cleared that //! the Mirror Chamber Statue has been spun before allowing portal warping from the map screen. if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[265]) && !dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[361])) { @@ -1227,7 +1229,7 @@ void dMenu_Fmap_c::spot_map_proc() { mPrevProcessAlt = mProcess; setProcess(PROC_PORTAL_WARP_FORBID); Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); - } else + } IF_DUSK_BLOCK_END else #endif if (mpDraw2DTop->checkPlayerWarpAccept()) { mIsWarpMap = true; diff --git a/src/d/d_msg_unit.cpp b/src/d/d_msg_unit.cpp index 057e6cc3fc..e81e5cd2b5 100644 --- a/src/d/d_msg_unit.cpp +++ b/src/d/d_msg_unit.cpp @@ -56,8 +56,7 @@ typedef struct dMsgUnit_inf1_entry_JPN { BE(u16) field_0x14; BE(u16) field_0x16; BE(u16) field_0x18; - BE(u16) startFrame; - BE(u16) endFrame; + BE(u16) field_0x1A; } dMsgUnit_inf1_entry_JPN; typedef struct dMsgUnit_inf1_section_JPN { @@ -117,7 +116,7 @@ void dMsgUnit_c::setTag_jpn(int i_type, int i_value, TEXT_SPAN o_buffer, bool pa } } - if ((i_type == 3 && param_4 == true) || i_type == 4 && param_4 == false) { + if ((i_type == 3 && param_4 == true) || (i_type == 4 && param_4 == false)) { f32 dayTime = g_env_light.getDaytime(); f32 hour = dayTime / 15.0f; @@ -141,65 +140,64 @@ void dMsgUnit_c::setTag_jpn(int i_type, int i_value, TEXT_SPAN o_buffer, bool pa if (!stack9) { bmg_header_t* pHeader = (bmg_header_t*)dMeter2Info_getMsgUnitResource(); - dMsgUnit_inf1_section_JPN* pInfoBlock = NULL; + bmg_section_t* pInfoBlock = NULL; const void* pMsgDataBlock = NULL; str1_section_t* pStrAttributeBlock = NULL; int filepos = sizeof(bmg_header_t); u32 filesize = pHeader->size; - bmg_section_t* pSection = (bmg_section_t*)(((u8*)pHeader) + filepos); + u8* pSection = ((u8*)pHeader) + filepos; - for (; filepos < filesize; filepos += pSection->size) { - switch(pSection->magic) { - case 'FLW1': - break; - case 'FLI1': - break; - case 'INF1': - pInfoBlock = (dMsgUnit_inf1_section_JPN*)pSection; - break; - case 'DAT1': - pMsgDataBlock = pSection; - break; - case 'STR1': - pStrAttributeBlock = (str1_section_t*)pSection; - break; + while (filepos < filesize) { + switch(((bmg_section_t*)pSection)->magic) { + case 'FLW1': + break; + case 'FLI1': + break; + case 'INF1': + pInfoBlock = (bmg_section_t*)pSection; + break; + case 'DAT1': + pMsgDataBlock = pSection; + break; + case 'STR1': + pStrAttributeBlock = (str1_section_t*)pSection; + break; } - pSection = (bmg_section_t*)((u8*)pSection + pSection->size); + filepos += ((bmg_section_t*)pSection)->size; + pSection += ((bmg_section_t*)pSection)->size; } u16 vals[12]; - vals[0] = pInfoBlock->entries[i_type].field_0x04; - vals[1] = pInfoBlock->entries[i_type].field_0x06; - vals[2] = pInfoBlock->entries[i_type].field_0x08; - vals[3] = pInfoBlock->entries[i_type].field_0x0a; - vals[4] = pInfoBlock->entries[i_type].field_0x0c; - vals[5] = pInfoBlock->entries[i_type].field_0x0e; - vals[6] = pInfoBlock->entries[i_type].field_0x10; - vals[7] = pInfoBlock->entries[i_type].field_0x12; - vals[8] = pInfoBlock->entries[i_type].field_0x14; - vals[9] = pInfoBlock->entries[i_type].field_0x16; - vals[10] = pInfoBlock->entries[i_type].field_0x18; - int entryOff = pInfoBlock->entries[i_type].dat1EntryOffset; + vals[0] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x04; + vals[1] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x06; + vals[2] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x08; + vals[3] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x0a; + vals[4] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x0c; + vals[5] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x0e; + vals[6] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x10; + vals[7] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x12; + vals[8] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x14; + vals[9] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x16; + vals[10] = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].field_0x18; + u32 dat1EntryOffset = ((dMsgUnit_inf1_section_JPN*)pInfoBlock)->entries[i_type].dat1EntryOffset; - char* value2 = (char*)((uintptr_t)pMsgDataBlock + entryOff + 8); + char* dat1Entry = (char*)((u8*)pMsgDataBlock + dat1EntryOffset + 8); const char* uVar5; if (i_value == 0) { uVar5 = pStrAttributeBlock->entries->str + vals[0]; + } else if ((i_value % 10) == 0) { + uVar5 = pStrAttributeBlock->entries->str + (vals[10]); } else { - if ((i_value % 10) == 0) { - uVar5 = pStrAttributeBlock->entries->str + (vals[10]); - } else { - uVar5 = pStrAttributeBlock->entries->str + vals[i_value % 10]; - } + uVar5 = pStrAttributeBlock->entries->str + vals[i_value % 10]; } int uVar5Len = strlen(uVar5); if (uVar5Len == 0) { if (stack8) { - SAFE_STRCAT(o_buffer, value2); + SAFE_STRCAT(o_buffer, dat1Entry); } else { - SAFE_SPRINTF(o_buffer, "%d%s", i_value, value2); + SAFE_SPRINTF(o_buffer, "%d%s", i_value, dat1Entry); } } else { char unkCharArr[7]; @@ -208,15 +206,15 @@ void dMsgUnit_c::setTag_jpn(int i_type, int i_value, TEXT_SPAN o_buffer, bool pa unkCharArr[2] = -1; unkCharArr[3] = -1; unkCharArr[4] = 2; - unkCharArr[5] = strlen(value2) / 2; + unkCharArr[5] = strlen(dat1Entry) / 2; unkCharArr[6] = 0; if (stack8) { SAFE_STRCAT(o_buffer, unkCharArr); SAFE_STRCAT(o_buffer, uVar5); - SAFE_STRCAT(o_buffer, value2); + SAFE_STRCAT(o_buffer, dat1Entry); } else { - SAFE_SPRINTF(o_buffer, "%d%s%s%s", i_value, unkCharArr, uVar5, value2); + SAFE_SPRINTF(o_buffer, "%d%s%s%s", i_value, unkCharArr, uVar5, dat1Entry); } } } diff --git a/src/m_Do/m_Do_MemCardRWmng.cpp b/src/m_Do/m_Do_MemCardRWmng.cpp index d7739d6158..59688043a5 100644 --- a/src/m_Do/m_Do_MemCardRWmng.cpp +++ b/src/m_Do/m_Do_MemCardRWmng.cpp @@ -348,9 +348,10 @@ static void mDoMemCdRWm_BuildHeader(mDoMemCdRWm_HeaderData* header) { snprintf(header->mComment, sizeof(header->mComment), HEADER_COMMENT, time.mon + 1, time.mday); } else { - // TODO JPN SHIFT-JIS - // snprintf(header->mTitle, sizeof(header->mTitle), "ゼルダの伝説 トワイライトプリンセス"); - // snprintf(header->mComment, sizeof(header->mComment), "%d月%d日のセーブデータです", time.mon + 1, time.mday); + // shift-jis "ゼルダの伝説 トワイライトプリンセス" + snprintf(header->mTitle, sizeof(header->mTitle), "\x83\x5b\x83\x8b\x83\x5f\x82\xcc\x93\x60\x90\xe0\x20\xc4\xdc\xb2\xd7\xb2\xc4\xcc\xdf\xd8\xdd\xbe\xbd"); + // shift-jis "%d月%d日のセーブデータです" + snprintf(header->mComment, sizeof(header->mComment), "\x25\x64\x8c\x8e\x25\x64\x93\xfa\x82\xcc\x83\x5a\x81\x5b\x83\x75\x83\x66\x81\x5b\x83\x5e\x82\xc5\x82\xb7", time.mon + 1, time.mday); } #elif VERSION == VERSION_GCN_PAL switch (dComIfGs_getPalLanguage()) { From 8caab1a6ba4aad5513bc9fe402a76dce53964e9c Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 17 Jul 2026 22:35:37 -0600 Subject: [PATCH 10/14] Implement iOS hook prepatching & improve MSVC PTMF support (#2222) --- CMakeLists.txt | 62 +++++-- CMakePresets.json | 16 ++ cmake/ModSDK.cmake | 33 ++++ cmake/SymbolManifest.cmake | 14 +- files.cmake | 2 + sdk/include/mods/api.h | 25 ++- sdk/include/mods/meta.hpp | 46 +++++- src/dusk/mod_loader.hpp | 10 ++ src/dusk/mods/loader/loader.cpp | 28 ++++ src/dusk/mods/loader/prepatch.cpp | 260 ++++++++++++++++++++++++++++++ src/dusk/mods/loader/prepatch.hpp | 20 +++ src/dusk/mods/svc/hook.cpp | 256 ++++++++++++++++++++++++----- 12 files changed, 707 insertions(+), 65 deletions(-) create mode 100644 src/dusk/mods/loader/prepatch.cpp create mode 100644 src/dusk/mods/loader/prepatch.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 75a8d01151..b1c8986597 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,35 @@ option(DUSK_PACKAGE_INSTALL "Install Dusklight with a Linux-native file structur option(DUSK_GFX_DEBUG_GROUPS "Report debug groups to the native graphics API" ${DUSK_GFX_DEBUG_GROUPS_DEFAULT}) option(DUSK_ENABLE_CODE_MODS "Enable code mods" OFF) +set(DUSK_HAS_FUNCHOOK OFF) +if (DUSK_ENABLE_CODE_MODS AND (NOT APPLE OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")) + set(DUSK_HAS_FUNCHOOK ON) +endif () +set(DUSK_HAS_FUNCHOOK ${DUSK_HAS_FUNCHOOK} CACHE INTERNAL "Enable funchook" FORCE) + +set(_target_architectures ${CMAKE_OSX_ARCHITECTURES}) +if (NOT _target_architectures) + set(_target_architectures ${CMAKE_SYSTEM_PROCESSOR}) +endif () +list(LENGTH _target_architectures _target_arch_count) +set(DUSK_HAS_PREPATCH OFF) +if (DUSK_ENABLE_CODE_MODS AND APPLE AND _target_arch_count EQUAL 1) + list(GET _target_architectures 0 _target_arch) + if (_target_arch STREQUAL "arm64") + set(DUSK_HAS_PREPATCH ON) + endif () +endif () +set(DUSK_HAS_PREPATCH ${DUSK_HAS_PREPATCH} CACHE INTERNAL "Enable symgen prepatch support" FORCE) + +if (DUSK_ENABLE_CODE_MODS AND CMAKE_SYSTEM_NAME MATCHES "^(iOS|tvOS)$") + list(LENGTH CMAKE_OSX_ARCHITECTURES _mobile_arch_count) + if (NOT _mobile_arch_count EQUAL 1 OR NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") + message(FATAL_ERROR + "iOS/tvOS code mods require a single arm64 architecture; got " + "CMAKE_OSX_ARCHITECTURES='${CMAKE_OSX_ARCHITECTURES}'") + endif () +endif () + # Edit & Continue if (MSVC) if ("${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}" STREQUAL "" AND CMAKE_BUILD_TYPE STREQUAL "Debug" @@ -175,8 +204,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL Linux) set(CMAKE_BUILD_RPATH "$ORIGIN") elseif (APPLE) add_compile_options(-Wno-declaration-after-statement -Wno-non-pod-varargs) - set(CMAKE_INSTALL_RPATH "$ORIGIN") - set(CMAKE_BUILD_RPATH "$ORIGIN") + set(CMAKE_INSTALL_RPATH "@loader_path") + set(CMAKE_BUILD_RPATH "@loader_path") elseif (MSVC) add_compile_options( $<$:/bigobj> @@ -219,7 +248,7 @@ FetchContent_Declare(miniz ) set(_fetch_content_deps cxxopts json miniz) -if (DUSK_ENABLE_CODE_MODS) +if (DUSK_HAS_FUNCHOOK) message(STATUS "dusklight: Fetching funchook") # cmake/PatchFunchook.cmake patches funchook's cmake/capstone.cmake.in to inject a # PATCH_COMMAND into capstone's inner ExternalProject. That PATCH_COMMAND runs @@ -272,10 +301,10 @@ if (DUSK_ENABLE_SENTRY_NATIVE) ) if (NOT sentry_native_POPULATED) FetchContent_Populate(sentry_native) - set(_dusk_skip_install_rules ${CMAKE_SKIP_INSTALL_RULES}) + set(_skip_install_rules ${CMAKE_SKIP_INSTALL_RULES}) set(CMAKE_SKIP_INSTALL_RULES ON) add_subdirectory(${sentry_native_SOURCE_DIR} ${sentry_native_BINARY_DIR} EXCLUDE_FROM_ALL) - set(CMAKE_SKIP_INSTALL_RULES ${_dusk_skip_install_rules}) + set(CMAKE_SKIP_INSTALL_RULES ${_skip_install_rules}) endif () endif () @@ -308,7 +337,7 @@ set(GAME_COMPILE_DEFS DUSK_BUILDING_GAME=1) set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt Threads::Threads zstd::libzstd dusklight_game_headers) -if (DUSK_ENABLE_CODE_MODS) +if (DUSK_HAS_FUNCHOOK) list(APPEND GAME_LIBS funchook-static) endif () @@ -381,6 +410,9 @@ endif () if (DUSK_ENABLE_CODE_MODS) list(APPEND GAME_COMPILE_DEFS DUSK_CODE_MODS=1) endif () +list(APPEND GAME_COMPILE_DEFS + DUSK_HAS_FUNCHOOK=$ + DUSK_HAS_PREPATCH=$) if (DUSK_PACKAGE_INSTALL) include(GNUInstallDirs) @@ -473,18 +505,28 @@ if (MSVC) else () target_link_options(dusklight PRIVATE /FUNCTIONPADMIN /OPT:NOICF) endif () -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +elseif (CMAKE_CXX_COMPILER_ID MATCHES "^(AppleClang|Clang)$") if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_OSX_ARCHITECTURES MATCHES "arm64") set(DUSK_PATCHABLE_ENTRY_FLAG $<$:-fpatchable-function-entry=2,1>) else () set(DUSK_PATCHABLE_ENTRY_FLAG $<$:-fpatchable-function-entry=10,5>) endif () endif () + if (DEFINED DUSK_PATCHABLE_ENTRY_FLAG) target_compile_options(dusklight PRIVATE ${DUSK_PATCHABLE_ENTRY_FLAG}) foreach(jsystem_lib IN LISTS JSYSTEM_LIBRARIES) target_compile_options(${jsystem_lib} PRIVATE ${DUSK_PATCHABLE_ENTRY_FLAG}) endforeach() + foreach(_sdk_lib aurora_card aurora_core aurora_dvd aurora_gd aurora_gx aurora_mtx + aurora_os aurora_pad aurora_si aurora_vi) + if (TARGET ${_sdk_lib}) + get_target_property(_sdk_lib_imported ${_sdk_lib} IMPORTED) + if (NOT _sdk_lib_imported) + target_compile_options(${_sdk_lib} PRIVATE ${DUSK_PATCHABLE_ENTRY_FLAG}) + endif () + endif () + endforeach () endif () if (WIN32) @@ -612,13 +654,13 @@ if (APPLE) list(APPEND _apple_bundle_properties XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${DUSK_ENTITLEMENTS}) endif () - if (NOT IOS AND NOT TVOS) + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") list(APPEND _apple_bundle_properties XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES") endif () set_target_properties(dusklight PROPERTIES ${_apple_bundle_properties}) - if (NOT IOS AND NOT TVOS AND NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode") + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode") set(_sign_nested_commands) if (TARGET crashpad_handler) list(APPEND _sign_nested_commands @@ -635,7 +677,7 @@ if (APPLE) endif () endif () -if (APPLE AND NOT IOS AND NOT TVOS) +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") find_library(APPKIT_FRAMEWORK AppKit REQUIRED) target_sources(dusklight PRIVATE src/dusk/file_select_macos.mm) set_source_files_properties(src/dusk/file_select_macos.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) diff --git a/CMakePresets.json b/CMakePresets.json index e6485ddac1..4faccc4448 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -314,11 +314,19 @@ "type": "BOOL", "value": false }, + "ENABLE_VISIBILITY": { + "type": "BOOL", + "value": true + }, "Rust_CARGO_TARGET": "aarch64-apple-ios", "BUILD_SHARED_LIBS": { "type": "BOOL", "value": false }, + "DUSK_ENABLE_CODE_MODS": { + "type": "BOOL", + "value": true + }, "CMAKE_DISABLE_FIND_PACKAGE_PkgConfig": { "type": "BOOL", "value": true @@ -354,12 +362,20 @@ "type": "BOOL", "value": false }, + "ENABLE_VISIBILITY": { + "type": "BOOL", + "value": true + }, "Rust_CARGO_TARGET": "aarch64-apple-tvos", "Rust_TOOLCHAIN": "nightly", "BUILD_SHARED_LIBS": { "type": "BOOL", "value": false }, + "DUSK_ENABLE_CODE_MODS": { + "type": "BOOL", + "value": true + }, "CMAKE_DISABLE_FIND_PACKAGE_PkgConfig": { "type": "BOOL", "value": true diff --git a/cmake/ModSDK.cmake b/cmake/ModSDK.cmake index 10a87e8525..0dfe5c48b4 100644 --- a/cmake/ModSDK.cmake +++ b/cmake/ModSDK.cmake @@ -417,6 +417,21 @@ function(install_bundled_mods) DESTINATION "${_bundle_dir}/Frameworks" PATTERN "${_lib_name}" EXCLUDE) endforeach () + if (DUSK_HAS_PREPATCH) + set(_prepatch_executable "${_bundle_dir}/Dusklight") + set(_prepatch_mod_args "") + foreach (_id IN LISTS _ids) + string(APPEND _prepatch_mod_args + " \"${_bundle_dir}/Frameworks/${_id}.so\"") + endforeach () + install(CODE " + execute_process( + COMMAND \"${SYMGEN_EXE}\" prepatch + --binary \"${_prepatch_executable}\" + --report \"${CMAKE_BINARY_DIR}/prepatch-report-$.json\" + ${_prepatch_mod_args} + COMMAND_ERROR_IS_FATAL ANY)") + endif () else () foreach (_i RANGE ${_last}) list(GET _ids ${_i} _id) @@ -432,6 +447,24 @@ function(install_bundled_mods) endif () endforeach ()") endforeach () + if (DUSK_HAS_PREPATCH) + set(_prepatch_executable "${_bundle_dir}/Contents/MacOS/Dusklight") + set(_prepatch_mod_args "") + foreach (_i RANGE ${_last}) + list(GET _ids ${_i} _id) + list(GET _lib_platforms ${_i} _lib_platform) + list(GET _lib_names ${_i} _lib_name) + string(APPEND _prepatch_mod_args + " \"${_bundle_dir}/Contents/Resources/mods/${_id}/lib/${_lib_platform}/${_lib_name}\"") + endforeach () + install(CODE " + execute_process( + COMMAND \"${SYMGEN_EXE}\" prepatch + --binary \"${_prepatch_executable}\" + --report \"${CMAKE_BINARY_DIR}/prepatch-report-$.json\" + ${_prepatch_mod_args} + COMMAND_ERROR_IS_FATAL ANY)") + endif () if (TARGET crashpad_handler) install(CODE "execute_process(COMMAND /usr/bin/codesign --force --sign - \"${_bundle_dir}/Contents/MacOS/$\" COMMAND_ERROR_IS_FATAL ANY)") endif () diff --git a/cmake/SymbolManifest.cmake b/cmake/SymbolManifest.cmake index 657afa2a78..40584ede19 100644 --- a/cmake/SymbolManifest.cmake +++ b/cmake/SymbolManifest.cmake @@ -2,7 +2,7 @@ include_guard(GLOBAL) get_filename_component(_SYMBOL_MANIFEST_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) -set(_SYMGEN_VERSION "1.2.3") +set(_SYMGEN_VERSION "1.3.1") set(_SYMGEN_RELEASE_BASE_URL "https://github.com/encounter/symgen/releases/download/v${_SYMGEN_VERSION}") set(SYMGEN_PATH "" CACHE FILEPATH "Path to a symgen executable; empty downloads the pinned release") mark_as_advanced(SYMGEN_PATH) @@ -113,14 +113,18 @@ function(setup_symbol_manifest target) endif () if (APPLE) - # Room for the load command `symgen manifest --embed` inserts post-link. - target_link_options(${target} PRIVATE "LINKER:-headerpad,0x200") + # Room for the symbol manifest and several prepatch arenas. + target_link_options(${target} PRIVATE "LINKER:-headerpad,0x1000") + # ld64 may update an existing output, which breaks our symdb insertion. Remove it first. + add_custom_command(TARGET ${target} PRE_LINK + COMMAND "${CMAKE_COMMAND}" -E rm -f "$" + VERBATIM) endif () # The manifest is embedded into the image as a new section, located at runtime through # the descriptor manifest.cpp reserves. On Apple platforms this command must stay - # attached before the ad-hoc codesign POST_BUILD command: the patch invalidates any - # existing signature. + # attached before the ad-hoc codesign POST_BUILD command: the patch removes any existing + # signature. add_custom_command(TARGET ${target} POST_BUILD COMMAND "${SYMGEN_EXE}" manifest ${_input} --embed "$" COMMENT "Embedding symbol manifest" diff --git a/files.cmake b/files.cmake index c8c92c9b75..fa96e313c6 100644 --- a/files.cmake +++ b/files.cmake @@ -1479,6 +1479,8 @@ set(DUSK_FILES src/dusk/mods/loader/loader.hpp src/dusk/mods/loader/native_module.cpp src/dusk/mods/loader/native_module.hpp + src/dusk/mods/loader/prepatch.cpp + src/dusk/mods/loader/prepatch.hpp src/dusk/mods/log_buffer.cpp src/dusk/mods/log_buffer.hpp src/dusk/mods/manifest.cpp diff --git a/sdk/include/mods/api.h b/sdk/include/mods/api.h index c63d08cfe2..3a72135388 100644 --- a/sdk/include/mods/api.h +++ b/sdk/include/mods/api.h @@ -148,6 +148,7 @@ typedef enum ModMetaKind { MOD_META_HOOK_FN = 4, MOD_META_HOOK_MEM = 5, MOD_META_HOOK_NAME = 6, + MOD_META_HOOK_MEM_EXT = 7, } ModMetaKind; typedef struct ModMetaRecord { @@ -203,15 +204,37 @@ static_assert(sizeof(ModMetaHookFn) == 24); * NUL-terminated strings follow `resolved`: the class vtable symbol (empty if the class name is not * representable), then the stringified target for tooling display. */ +#define MOD_META_HOOK_MEM_CAPACITY 16u typedef struct MOD_META_ALIGN ModMetaHookMem { ModMetaRecord rec; uint32_t reserved; - unsigned char pmf[16]; + unsigned char pmf[MOD_META_HOOK_MEM_CAPACITY]; void* resolved; /* runtime only */ } ModMetaHookMem; static_assert(sizeof(ModMetaHookMem) == 32); +/* + * Extended member-function hook record. The Microsoft x64 ABI uses a 24-byte member pointer for + * classes whose inheritance model was fixed while the class was incomplete. Keep this a distinct + * record kind so loaders can continue to consume MOD_META_HOOK_MEM's original 16-byte layout. + * + * MSVC cannot constant-initialize that member pointer, so materialize points to a compiler- + * generated helper that writes its native representation to a caller-provided buffer. The record + * itself, including its trailing names and the helper relocation, remains constant-initialized and + * available to static tooling. pmf_size is the number of bytes the helper writes. + */ +#define MOD_META_HOOK_MEM_EXT_CAPACITY 24u +typedef void (*ModMetaHookMemMaterializeFn)(unsigned char* out_pmf); +typedef struct MOD_META_ALIGN ModMetaHookMemExt { + ModMetaRecord rec; + uint32_t pmf_size; + ModMetaHookMemMaterializeFn materialize; + void* resolved; /* runtime only */ +} ModMetaHookMemExt; + +static_assert(sizeof(ModMetaHookMemExt) == 24); + /* * Hook on a function by symbol name, for targets that cannot be named in C++ (file-local statics, * private members). One NUL-terminated string follows `resolved`; it may be either the platform diff --git a/sdk/include/mods/meta.hpp b/sdk/include/mods/meta.hpp index 023783cea1..3c6223e6fb 100644 --- a/sdk/include/mods/meta.hpp +++ b/sdk/include/mods/meta.hpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -185,12 +186,21 @@ struct HookMemRecord { uint32_t reserved; union { F fn; - unsigned char raw[16]; + unsigned char raw[MOD_META_HOOK_MEM_CAPACITY]; } pmf; void* resolved; char names[N]; }; +template +struct HookMemExtRecord { + ModMetaRecord rec; + uint32_t pmfSize; + ModMetaHookMemMaterializeFn materialize; + void* resolved; + char names[N]; +}; + template struct HookNameRecord { ModMetaRecord rec; @@ -232,19 +242,43 @@ consteval auto make_hook_mem_names() { } /* - * MSVC constant-evaluates a pointer-to-member only when every other operand in the - * initializer is a literal: no consteval calls, constexpr-object copies, or default - * member initializers. + * MSVC constant-evaluates a compact pointer-to-member only when every other operand in the + * initializer is a literal: no consteval calls, constexpr-object copies, or default member + * initializers. It cannot constant-initialize the 24-byte general representation at all, so the + * extended record points at a compiler-generated materializer while keeping the metadata itself + * constant-initialized for static tooling. */ +template +struct HookMemHolderImpl; + template -struct HookMemHolder { +struct HookMemHolderImpl { using F = decltype(Target); - static_assert(sizeof(F) <= 16, "unsupported pointer-to-member representation"); MOD_META_RECORD static constinit inline HookMemRecord record = { {sizeof(HookMemRecord), MOD_META_HOOK_MEM, 0}, 0, {Target}, nullptr, {Cs...}}; }; +template +struct HookMemHolderImpl { + using F = decltype(Target); + static void materialize(unsigned char* outPmf) { + const F target = Target; + std::memcpy(outPmf, &target, sizeof(target)); + } + MOD_META_RECORD static constinit inline HookMemExtRecord record = { + {sizeof(HookMemExtRecord), MOD_META_HOOK_MEM_EXT, 0}, sizeof(F), materialize, + nullptr, {Cs...}}; +}; + +template +struct HookMemHolder + : HookMemHolderImpl MOD_META_HOOK_MEM_CAPACITY), Cs...> { + using F = decltype(Target); + static_assert(sizeof(F) <= MOD_META_HOOK_MEM_EXT_CAPACITY, + "unsupported pointer-to-member representation"); +}; + template struct HookFnHolder { using F = decltype(Target); diff --git a/src/dusk/mod_loader.hpp b/src/dusk/mod_loader.hpp index 34e17274bc..fad9ba1501 100644 --- a/src/dusk/mod_loader.hpp +++ b/src/dusk/mod_loader.hpp @@ -73,6 +73,7 @@ struct ModMetaParsed { std::vector exports; std::vector hookFns; std::vector hookMems; + std::vector hookMemExts; std::vector hookNames; }; @@ -85,6 +86,15 @@ inline const char* hook_mem_display_name(const ModMetaHookMem& rec) { return vtable + std::char_traits::length(vtable) + 1; } +inline const char* hook_mem_vtable_symbol(const ModMetaHookMemExt& rec) { + return reinterpret_cast(&rec) + sizeof(ModMetaHookMemExt); +} + +inline const char* hook_mem_display_name(const ModMetaHookMemExt& rec) { + const char* vtable = hook_mem_vtable_symbol(rec); + return vtable + std::char_traits::length(vtable) + 1; +} + inline const char* hook_name_symbol(const ModMetaHookName& rec) { return reinterpret_cast(&rec) + sizeof(ModMetaHookName); } diff --git a/src/dusk/mods/loader/loader.cpp b/src/dusk/mods/loader/loader.cpp index 353a2ab596..cdcc16c5e2 100644 --- a/src/dusk/mods/loader/loader.cpp +++ b/src/dusk/mods/loader/loader.cpp @@ -26,6 +26,9 @@ #include "miniz.h" #include "native_module.hpp" #include "nlohmann/json.hpp" +#if DUSK_HAS_PREPATCH +#include "prepatch.hpp" +#endif using namespace std::string_literals; using namespace std::string_view_literals; @@ -411,6 +414,28 @@ static bool parse_meta(NativeMod& native, LoadedMod& mod) { parsed.hookMems.push_back(record); break; } + case MOD_META_HOOK_MEM_EXT: { + if (size <= sizeof(ModMetaHookMemExt)) { + return invalid("truncated extended hook record"); + } + auto* record = reinterpret_cast(const_cast(cursor)); + if (record->pmf_size <= MOD_META_HOOK_MEM_CAPACITY || + record->pmf_size > MOD_META_HOOK_MEM_EXT_CAPACITY || record->materialize == nullptr) + { + return invalid("bad extended hook member-pointer size"); + } + const char* strings = reinterpret_cast(cursor) + sizeof(ModMetaHookMemExt); + const size_t capacity = size - sizeof(ModMetaHookMemExt); + if (!terminated_within(strings, capacity)) { + return invalid("unterminated extended hook vtable symbol"); + } + const size_t vtableLen = std::char_traits::length(strings); + if (!terminated_within(strings + vtableLen + 1, capacity - vtableLen - 1)) { + return invalid("unterminated extended hook display name"); + } + parsed.hookMemExts.push_back(record); + break; + } case MOD_META_HOOK_NAME: { if (size <= sizeof(ModMetaHookName)) { return invalid("truncated hook record"); @@ -906,6 +931,9 @@ void ModLoader::init() { m_initialized = true; manifest::initialize(); +#if DUSK_HAS_PREPATCH + prepatch::initialize(); +#endif if (m_searchDirs.empty()) { Log.warn("no mod search directories configured; mod loading skipped"); diff --git a/src/dusk/mods/loader/prepatch.cpp b/src/dusk/mods/loader/prepatch.cpp new file mode 100644 index 0000000000..a9da0f9301 --- /dev/null +++ b/src/dusk/mods/loader/prepatch.cpp @@ -0,0 +1,260 @@ +#include "prepatch.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "aurora/lib/logging.hpp" + +#if DUSK_HAS_PREPATCH +#include +#include +#endif + +namespace dusk::mods::prepatch { +namespace { + +aurora::Module Log("dusk::mods::prepatch"); + +constexpr std::string_view kSiteMagic = "PS01"; +constexpr size_t kSiteHeaderSize = 12; +constexpr size_t kGatewaySize = 28; +constexpr size_t kOriginalStubOffset = 20; + +constexpr uint32_t kBranchMask = 0xfc000000u; +constexpr uint32_t kBranch = 0x14000000u; +constexpr uint32_t kLdarX16X16 = 0xc8dffe10u; +constexpr uint32_t kCbzX16Stub = 0xb4000050u; +constexpr uint32_t kBrX16 = 0xd61f0200u; +constexpr uint32_t kBtiC = 0xd503245fu; + +struct SiteHeader { + char magic[4]; + int32_t targetDelta; + int32_t slotDelta; +}; +static_assert(sizeof(SiteHeader) == kSiteHeaderSize); + +struct Range { + uintptr_t begin = 0; + uintptr_t end = 0; + + bool contains(uintptr_t address, size_t size) const { + return address >= begin && address <= end && size <= end - address; + } +}; + +struct State { + std::vector executableRanges; + std::vector writableRanges; + std::string failureReason = "not initialized"; + bool loaded = false; + bool initialized = false; +}; +State s_state; + +void fail(std::string reason) { + s_state.failureReason = std::move(reason); + Log.error("prepatch backend unavailable: {}", s_state.failureReason); +} + +void unavailable(std::string reason) { + s_state.failureReason = std::move(reason); + Log.info("prepatch backend unavailable: {}", s_state.failureReason); +} + +bool add_delta(uintptr_t address, int64_t delta, uintptr_t& out) { + if (delta >= 0) { + const auto offset = static_cast(delta); + if (address > std::numeric_limits::max() - offset) { + return false; + } + out = address + offset; + } else { + const auto offset = static_cast(-(delta + 1)) + 1; + if (address < offset) { + return false; + } + out = address - offset; + } + return true; +} + +bool branch_target(uintptr_t address, uint32_t instruction, uintptr_t& out) { + if ((instruction & kBranchMask) != kBranch) { + return false; + } + int64_t words = instruction & 0x03ffffffu; + if ((words & 0x02000000) != 0) { + words -= int64_t{1} << 26; + } + return add_delta(address, words * 4, out); +} + +const Range* containing(const std::vector& ranges, uintptr_t address, size_t size) { + for (const auto& range : ranges) { + if (range.contains(address, size)) { + return ⦥ + } + } + return nullptr; +} + +#if DUSK_HAS_PREPATCH +bool slide_address(intptr_t slide, uint64_t vmaddr, uintptr_t& out) { + if (vmaddr > std::numeric_limits::max()) { + return false; + } + return add_delta(static_cast(vmaddr), slide, out); +} +#endif + +} // namespace + +void initialize() { + if (s_state.initialized) { + return; + } + s_state.initialized = true; + +#if DUSK_HAS_PREPATCH + const auto* imageHeader = reinterpret_cast(_dyld_get_image_header(0)); + if (imageHeader == nullptr || imageHeader->magic != MH_MAGIC_64 || + imageHeader->cputype != CPU_TYPE_ARM64 || + (imageHeader->cpusubtype & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_ARM64E || + (imageHeader->cpusubtype & CPU_SUBTYPE_ARM64_PTR_AUTH_MASK) != 0) + { + fail("main image is not a supported 64-bit arm64 Mach-O image"); + return; + } + + const intptr_t slide = _dyld_get_image_vmaddr_slide(0); + const auto* commands = reinterpret_cast(imageHeader + 1); + size_t commandOffset = 0; + for (uint32_t i = 0; i < imageHeader->ncmds; ++i) { + if (commandOffset > imageHeader->sizeofcmds || + imageHeader->sizeofcmds - commandOffset < sizeof(load_command)) + { + fail("main image has malformed load commands"); + return; + } + const auto* command = reinterpret_cast(commands + commandOffset); + if (command->cmdsize < sizeof(load_command) || + command->cmdsize > imageHeader->sizeofcmds - commandOffset) + { + fail("main image has malformed load commands"); + return; + } + if (command->cmd == LC_SEGMENT_64) { + if (command->cmdsize < sizeof(segment_command_64)) { + fail("main image has a truncated segment command"); + return; + } + const auto* segment = reinterpret_cast(command); + const uint64_t vmEnd = segment->vmaddr + segment->vmsize; + if (vmEnd < segment->vmaddr) { + fail("main image segment range overflows"); + return; + } + uintptr_t begin = 0; + uintptr_t end = 0; + if (!slide_address(slide, segment->vmaddr, begin) || + !slide_address(slide, vmEnd, end) || end < begin) + { + fail("main image runtime segment range overflows"); + return; + } + constexpr vm_prot_t kRx = VM_PROT_READ | VM_PROT_EXECUTE; + constexpr vm_prot_t kRw = VM_PROT_READ | VM_PROT_WRITE; + if (segment->initprot == kRx && segment->maxprot == kRx) { + s_state.executableRanges.push_back({begin, end}); + } else if (segment->initprot == kRw && segment->maxprot == kRw) { + s_state.writableRanges.push_back({begin, end}); + } + } + commandOffset += command->cmdsize; + } + if (commandOffset != imageHeader->sizeofcmds || s_state.executableRanges.empty() || + s_state.writableRanges.empty()) + { + fail("main image has no usable executable or writable segments"); + return; + } + + s_state.failureReason.clear(); + s_state.loaded = true; +#else + unavailable("prepatch support is not available in this build"); +#endif +} + +bool available() { + return s_state.loaded; +} + +const char* unavailable_reason() { + return s_state.failureReason.c_str(); +} + +std::optional lookup(void* runtimeTarget) { + if (!s_state.loaded || runtimeTarget == nullptr) { + return std::nullopt; + } + const auto target = reinterpret_cast(runtimeTarget); + if (containing(s_state.executableRanges, target, sizeof(uint32_t)) == nullptr) { + return std::nullopt; + } + + uint32_t entry = 0; + std::memcpy(&entry, reinterpret_cast(target), sizeof(entry)); + uintptr_t gateway = 0; + if (!branch_target(target, entry, gateway) || gateway < kSiteHeaderSize) { + return std::nullopt; + } + const uintptr_t headerAddress = gateway - kSiteHeaderSize; + if (containing(s_state.executableRanges, headerAddress, kSiteHeaderSize + kGatewaySize) == + nullptr) + { + return std::nullopt; + } + + SiteHeader header{}; + std::memcpy(&header, reinterpret_cast(headerAddress), sizeof(header)); + if (std::memcmp(header.magic, kSiteMagic.data(), kSiteMagic.size()) != 0) { + return std::nullopt; + } + uintptr_t recordedTarget = 0; + uintptr_t slot = 0; + if (!add_delta(gateway, header.targetDelta, recordedTarget) || recordedTarget != target || + !add_delta(gateway, header.slotDelta, slot) || (slot & (alignof(void*) - 1)) != 0 || + containing(s_state.writableRanges, slot, sizeof(void*)) == nullptr) + { + return std::nullopt; + } + + uint32_t instructions[7]{}; + std::memcpy(instructions, reinterpret_cast(gateway), sizeof(instructions)); + uintptr_t original = 0; + if (instructions[2] != kLdarX16X16 || instructions[3] != kCbzX16Stub || + instructions[4] != kBrX16 || instructions[5] != kBtiC || + target > std::numeric_limits::max() - 4 || + !branch_target(gateway + 24, instructions[6], original) || original != target + 4) + { + return std::nullopt; + } + + return Site{ + reinterpret_cast(slot), reinterpret_cast(gateway + kOriginalStubOffset)}; +} + +void publish(const Site& site, void* trampoline) { + std::atomic_ref slot{*site.slot}; + slot.store(trampoline, std::memory_order_release); +} + +} // namespace dusk::mods::prepatch diff --git a/src/dusk/mods/loader/prepatch.hpp b/src/dusk/mods/loader/prepatch.hpp new file mode 100644 index 0000000000..3b742d003b --- /dev/null +++ b/src/dusk/mods/loader/prepatch.hpp @@ -0,0 +1,20 @@ +#pragma once + +#include + +namespace dusk::mods::prepatch { + +struct Site { + void** slot = nullptr; + void* original = nullptr; +}; + +void initialize(); +bool available(); +const char* unavailable_reason(); +// Returns the target function's prepatched hook site, or nullopt if it is not prepatched. +std::optional lookup(void* runtimeTarget); +// Publishes a trampoline (or nullptr to deactivate). +void publish(const Site& site, void* trampoline); + +} // namespace dusk::mods::prepatch diff --git a/src/dusk/mods/svc/hook.cpp b/src/dusk/mods/svc/hook.cpp index 34d7d54aa7..ec967ae7e6 100644 --- a/src/dusk/mods/svc/hook.cpp +++ b/src/dusk/mods/svc/hook.cpp @@ -1,6 +1,9 @@ #include "registry.hpp" #include "dusk/mods/loader/loader.hpp" +#if DUSK_HAS_PREPATCH +#include "dusk/mods/loader/prepatch.hpp" +#endif #include "dusk/mods/manifest.hpp" #include "mods/svc/hook.h" @@ -9,11 +12,14 @@ #include "dusk/mods/log_buffer.hpp" #include +#include #include #include #include #include +#if DUSK_HAS_FUNCHOOK #include +#endif #include #include #include @@ -48,8 +54,7 @@ struct HookSlot { // One per mod that requested a hook on a target: its template-generated trampoline and the // address of its Hook::g_orig, both living in the mod's dylib. Any candidate's trampoline // is interchangeable (dispatch walks the shared HookSlot), so when the active installer's mod -// unloads, the funchook detour is handed off to a surviving candidate and every candidate's -// *orig_store is rewritten to the new original pointer. +// unloads, the backend is handed off to a surviving candidate. struct HookCandidate { ModContext* context = nullptr; void* trampoline = nullptr; @@ -57,8 +62,28 @@ struct HookCandidate { uint64_t order = 0; }; -struct InstalledHook { +enum class BackendKind { + None, +#if DUSK_HAS_FUNCHOOK + Funchook, +#endif +#if DUSK_HAS_PREPATCH + Prepatch, +#endif +}; + +struct InstalledBackend { + BackendKind kind = BackendKind::None; +#if DUSK_HAS_FUNCHOOK funchook_t* handle = nullptr; +#endif +#if DUSK_HAS_PREPATCH + prepatch::Site prepatchSite{}; +#endif +}; + +struct InstalledHook { + InstalledBackend backend{}; void* original = nullptr; ModContext* active = nullptr; std::vector candidates; @@ -205,7 +230,8 @@ void* resolve_target(void* addr) { return addr; } -funchook_t* install_trampoline(void* fnAddr, void* trampoline, void** outOriginal) { +#if DUSK_HAS_FUNCHOOK +funchook_t* install_funchook(void* fnAddr, void* trampoline, void** outOriginal) { funchook_t* fh = funchook_create(); if (fh == nullptr) { DuskLog.warn("HookSystem: funchook_create failed for {:p}", fnAddr); @@ -214,18 +240,101 @@ funchook_t* install_trampoline(void* fnAddr, void* trampoline, void** outOrigina void* fn = fnAddr; const int prep = funchook_prepare(fh, &fn, trampoline); + if (prep == 0) { + *outOriginal = fn; + } const int inst = prep == 0 ? funchook_install(fh, 0) : -1; if (prep != 0 || inst != 0) { const char* message = funchook_error_message(fh); DuskLog.warn("HookSystem: funchook failed for {:p} (prepare={} install={}): {}", fnAddr, prep, inst, message != nullptr && message[0] != '\0' ? message : "no details"); funchook_destroy(fh); + *outOriginal = nullptr; return nullptr; } - - *outOriginal = fn; return fh; } +#endif + +bool install_backend( + void* fnAddr, void* trampoline, InstalledBackend& outBackend, void** originalStore) { +#if DUSK_HAS_PREPATCH + if (const auto site = prepatch::lookup(fnAddr)) { + *originalStore = site->original; + prepatch::publish(*site, trampoline); + outBackend.kind = BackendKind::Prepatch; + outBackend.prepatchSite = *site; + return true; + } +#endif + +#if DUSK_HAS_FUNCHOOK + funchook_t* handle = install_funchook(fnAddr, trampoline, originalStore); + if (handle == nullptr) { + return false; + } + outBackend.kind = BackendKind::Funchook; + outBackend.handle = handle; + return true; +#else +#if DUSK_HAS_PREPATCH + DuskLog.warn("HookSystem: prepatch backend cannot install target {:p}: {}", fnAddr, + prepatch::available() ? "target has no valid gateway" : prepatch::unavailable_reason()); +#else + DuskLog.warn("HookSystem: no hook backend can install target {:p}", fnAddr); +#endif + return false; +#endif +} + +void deactivate_backend(void* target, InstalledBackend& backend) { +#if DUSK_HAS_PREPATCH + if (backend.kind == BackendKind::Prepatch) { + prepatch::publish(backend.prepatchSite, nullptr); + backend = {}; + return; + } +#endif +#if DUSK_HAS_FUNCHOOK + if (backend.kind == BackendKind::Funchook) { + const int uninst = funchook_uninstall(backend.handle, 0); + const int destr = funchook_destroy(backend.handle); + if (uninst != 0 || destr != 0) { + DuskLog.warn("HookSystem: funchook uninstall/destroy for {:p} returned {}/{}", target, + uninst, destr); + } + } +#else + (void)target; +#endif + backend = {}; +} + +bool handoff_backend( + void* target, InstalledHook& entry, const HookCandidate& candidate, void** outOriginal) { +#if DUSK_HAS_PREPATCH + if (entry.backend.kind == BackendKind::Prepatch) { + *candidate.origStore = entry.original; + prepatch::publish(entry.backend.prepatchSite, candidate.trampoline); + *outOriginal = entry.original; + return true; + } +#endif +#if DUSK_HAS_FUNCHOOK + InstalledBackend backend; + if (!install_backend(target, candidate.trampoline, backend, candidate.origStore)) { + return false; + } + entry.backend = backend; + *outOriginal = *candidate.origStore; + return true; +#else + (void)target; + (void)candidate; + (void)outOriginal; + return false; +#endif +} ModResult hook_install(ModContext* context, void* fnAddr, void* trampolineFn, void** outOriginal) { if (fnAddr == nullptr || trampolineFn == nullptr || outOriginal == nullptr) { @@ -272,18 +381,16 @@ ModResult hook_install(ModContext* context, void* fnAddr, void* trampolineFn, vo name != nullptr ? name : "?", fnAddr, mod_id_from_context(context)); } - void* original = nullptr; - funchook_t* fh = install_trampoline(fnAddr, trampolineFn, &original); - if (fh == nullptr) { + InstalledBackend backend; + if (!install_backend(fnAddr, trampolineFn, backend, outOriginal)) { return MOD_ERROR; } auto& entry = s_installed[key]; - entry.handle = fh; - entry.original = original; + entry.backend = backend; + entry.original = *outOriginal; entry.active = context; entry.candidates.push_back({context, trampolineFn, outOriginal, s_nextOrder++}); - *outOriginal = original; return MOD_OK; } @@ -543,20 +650,67 @@ bool resolve_symbol_checked(const char* symbol, bool requireCode, void** out, st return false; } -/* Decode a HOOK_MEM record's pointer-to-member representation into the target code address, - * mirroring what calling through the mfp would invoke. Virtual members hook the class's own - * overrider, read from its vtable (resolved from the symbol manifest). */ -void* resolve_member_record( - const ModMetaHookMem& record, const char* vtableSymbol, std::string& why) { - uintptr_t words[2]; - std::memcpy(words, record.pmf, sizeof(words)); +/* + * Decodes a member hook record's pointer-to-member representation into the target code address. + * Virtual members prefer their named overrider, then fall back to reading the primary vtable slot. + */ +void* resolve_member_record(const unsigned char* pmf, size_t pmfSize, const char* vtableSymbol, + const char* displayName, std::string& why) { + if (pmfSize < sizeof(uintptr_t)) { + why = "truncated pointer-to-member representation"; + return nullptr; + } + uintptr_t words[2]{}; + std::memcpy(words, pmf, std::min(sizeof(words), pmfSize)); #if defined(_WIN32) const void* fn = reinterpret_cast(words[0]); + if (fn == nullptr) { + why = "null pointer-to-member target"; + return nullptr; + } const size_t slot = vcall_slot_offset(fn); if (slot == static_cast(-1)) { // not a vcall thunk: direct address return const_cast(fn); } + + // A display name resolves the actual overrider rather than an ABI vcall thunk. Besides being + // more direct, this covers secondary vtables: the MSVC representation has `this` adjustment + // but does not have the base-path suffix used by the decorated vtable symbol. + std::string displayWhy; + void* displayTarget = nullptr; + if (displayName[0] != '\0' && + resolve_symbol_checked(displayName, true, &displayTarget, displayWhy)) + { + return displayTarget; + } + + int32_t thisAdjustment = 0; + if (pmfSize >= sizeof(uintptr_t) + sizeof(thisAdjustment)) { + std::memcpy(&thisAdjustment, pmf + sizeof(uintptr_t), sizeof(thisAdjustment)); + } + if (thisAdjustment != 0) { + why = fmt::format( + "virtual member requires a {}-byte this adjustment and its overrider did not " + "resolve by name ({})", + thisAdjustment, displayWhy); + return nullptr; + } + int32_t firstVirtualField = 0; + if (pmfSize > MOD_META_HOOK_MEM_CAPACITY && pmfSize >= sizeof(uintptr_t) + 2 * sizeof(int32_t)) + { + std::memcpy(&firstVirtualField, pmf + sizeof(uintptr_t) + sizeof(int32_t), sizeof(int32_t)); + } + int32_t secondVirtualField = 0; + if (pmfSize > MOD_META_HOOK_MEM_CAPACITY && pmfSize >= sizeof(uintptr_t) + 3 * sizeof(int32_t)) + { + std::memcpy( + &secondVirtualField, pmf + sizeof(uintptr_t) + 2 * sizeof(int32_t), sizeof(int32_t)); + } + if (firstVirtualField != 0 || secondVirtualField != 0) { + why = fmt::format("virtual-base member did not resolve by name ({})", displayWhy); + return nullptr; + } if (vtableSymbol[0] == '\0') { why = "class name is not representable as a vtable symbol"; return nullptr; @@ -583,10 +737,18 @@ void* resolve_member_record( if (!isVirtual) { // non-virtual: the address itself return reinterpret_cast(words[0]); } + + std::string displayWhy; + void* displayTarget = nullptr; + if (displayName[0] != '\0' && + resolve_symbol_checked(displayName, true, &displayTarget, displayWhy)) + { + return displayTarget; + } if (thisAdjust != 0) { - // this-adjusting mfp (member of a secondary base): the slot offset is relative to a - // vtable we can't locate. Hook the overrider by name instead. - why = "virtual member of a secondary base; hook the overrider by name"; + // The slot is relative to a secondary vtable whose base path is not encoded in the mfp. + why = fmt::format( + "virtual member of a secondary base did not resolve by name ({})", displayWhy); return nullptr; } if (vtableSymbol[0] == '\0') { @@ -638,35 +800,32 @@ void hook_remove_mod(LoadedMod& mod) { } auto* target = reinterpret_cast(it->first); - const int uninst = funchook_uninstall(entry.handle, 0); - const int destr = funchook_destroy(entry.handle); - if (uninst != 0 || destr != 0) { - DuskLog.warn("HookSystem: funchook uninstall/destroy for {:p} returned {}/{}", target, - uninst, destr); - } - entry.handle = nullptr; - entry.active = nullptr; - if (entry.candidates.empty()) { + deactivate_backend(target, entry.backend); it = s_installed.erase(it); continue; } - // Hand the detour off to a surviving candidate (lowest registration order first; the - // vector is append-ordered). A candidate whose install fails stays in the list: its - // g_orig must still track the current original pointer. + // A prepatch may be atomically updated directly. + // Funchook must first restore the original instructions before reinstalling. +#if DUSK_HAS_PREPATCH + const bool prepatched = entry.backend.kind == BackendKind::Prepatch; +#else + constexpr bool prepatched = false; +#endif + if (!prepatched) { + deactivate_backend(target, entry.backend); + } + entry.active = nullptr; for (auto& cand : entry.candidates) { void* original = nullptr; - funchook_t* fh = install_trampoline(target, cand.trampoline, &original); - if (fh == nullptr) { + if (!handoff_backend(target, entry, cand, &original)) { continue; } - entry.handle = fh; entry.original = original; entry.active = cand.context; - DuskLog.info("HookSystem: reinstalled trampoline for {:p}: {} -> {} (tramp={:p})", - target, mod_id_from_context(context), mod_id_from_context(cand.context), - cand.trampoline); + DuskLog.info("HookSystem: replaced trampoline for {:p}: {} -> {} (tramp={:p})", target, + mod_id_from_context(context), mod_id_from_context(cand.context), cand.trampoline); break; } @@ -677,6 +836,7 @@ void hook_remove_mod(LoadedMod& mod) { for (auto& cand : entry.candidates) { *cand.origStore = target; } + deactivate_backend(target, entry.backend); it = s_installed.erase(it); continue; } @@ -772,14 +932,24 @@ void hook_resolve_mod_records(LoadedMod& mod) { unresolved("", "null link-time target", &record->resolved); } } - for (auto* record : mod.native->parsed.hookMems) { + const auto resolveMember = [&](auto* record, const unsigned char* pmf, size_t pmfSize) { + const char* displayName = hook_mem_display_name(*record); std::string why; - void* target = resolve_member_record(*record, hook_mem_vtable_symbol(*record), why); + void* target = + resolve_member_record(pmf, pmfSize, hook_mem_vtable_symbol(*record), displayName, why); if (target != nullptr) { resolved(target, &record->resolved); } else { - unresolved(hook_mem_display_name(*record), why, &record->resolved); + unresolved(displayName, why, &record->resolved); } + }; + for (auto* record : mod.native->parsed.hookMems) { + resolveMember(record, record->pmf, sizeof(record->pmf)); + } + for (auto* record : mod.native->parsed.hookMemExts) { + alignas(std::max_align_t) unsigned char pmf[MOD_META_HOOK_MEM_EXT_CAPACITY]{}; + record->materialize(pmf); + resolveMember(record, pmf, record->pmf_size); } for (auto* record : mod.native->parsed.hookNames) { const char* name = hook_name_symbol(*record); From 27c9719abc5f0c6a669a828d6bcc218e8998eeaa Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sat, 18 Jul 2026 18:07:49 -0700 Subject: [PATCH 11/14] pr comments --- README.md | 2 +- libs/JSystem/src/JUtility/JUTCacheFont.cpp | 4 +++ src/Z2AudioLib/Z2SoundObjMgr.cpp | 9 ++++- src/d/d_msg_class.cpp | 38 +++++++++++++++++++--- 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7584c09c46..b5a9ecae72 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ It aims to be as accurate as possible to the original while also providing new o You must dump your own copy of the game. Please see [this article](https://wiki.dolphin-emu.org/index.php?title=Ripping_Games) for instructions. After dumping, you can use a program like [Dolphin](https://dolphin-emu.org/) or [nodtool](https://github.com/encounter/nod/releases) to convert the `.iso` to `.rvz` to save space. -Currently, only the GameCube USA and EUR releases are supported. Support for other versions of the game is planned in the future. +Currently, only the GameCube releases are supported. Support for other versions of the game is planned in the future. ### 2. Install Dusklight diff --git a/libs/JSystem/src/JUtility/JUTCacheFont.cpp b/libs/JSystem/src/JUtility/JUTCacheFont.cpp index 2282361672..3fd02a1232 100644 --- a/libs/JSystem/src/JUtility/JUTCacheFont.cpp +++ b/libs/JSystem/src/JUtility/JUTCacheFont.cpp @@ -56,6 +56,10 @@ void JUTCacheFont::initialize_state() { mCacheBuffer = NULL; field_0x9c = NULL; field_0xa0 = NULL; + +#if TARGET_PC + mJoinedTextureHeight = 0; +#endif } int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_widSize, diff --git a/src/Z2AudioLib/Z2SoundObjMgr.cpp b/src/Z2AudioLib/Z2SoundObjMgr.cpp index 2c67cfb22b..013dbd1c54 100644 --- a/src/Z2AudioLib/Z2SoundObjMgr.cpp +++ b/src/Z2AudioLib/Z2SoundObjMgr.cpp @@ -182,6 +182,13 @@ void Z2SoundObjMgr::searchEnemy() { case Z2_ENEMY_PO: case Z2_ENEMY_HP: isGhostEnemy = true; +#if TARGET_PC + if (enemyId == Z2_ENEMY_HP && dusk::version::isRegionJpn() && + Z2GetLink()->isRiding() && Z2GetLink()->getMoveSpeed() > 38) + { + continue; + } +#endif break; case Z2_ENEMY_RDB: if (subBgmType == 0) @@ -212,7 +219,7 @@ void Z2SoundObjMgr::searchEnemy() { #elif TARGET_PC case Z2_ENEMY_SH: if (enemyId == Z2_ENEMY_SH && !dusk::version::isRegionJpn()) - continue; + break; #endif if (!Z2GetLink()->isRiding()) break; diff --git a/src/d/d_msg_class.cpp b/src/d/d_msg_class.cpp index 5dbc00a1d2..aeeb2243b8 100644 --- a/src/d/d_msg_class.cpp +++ b/src/d/d_msg_class.cpp @@ -1630,8 +1630,35 @@ void jmessage_tMeasureProcessor::do_scale(f32 i_scale) { mPageLineMax--; JUT_ASSERT(0x930, mPageLineMax > 0); -#if TARGET_PC || REGION_JPN - if (IF_DUSK(dusk::version::isRegionJpn() &&) field_0x3e == 0) { +#if TARGET_PC + if (dusk::version::isRegionJpn()) { + if (field_0x3e == 0) { + pReference->setPageType(field_0x40, 2); + } else { + pReference->setPageType(field_0x40, 3); + if (field_0x3e == 1 && pReference->getPageType(field_0x40) == 2) { + pReference->setPageType(field_0x40, 4); + } + } + } else { + if (field_0x3e == 0) { + pReference->setPageType(field_0x40, 2); + } else if (field_0x3e == 2 && mPageLineMax == 3) { + if (pReference->getPageType(field_0x40) == 4) { + pReference->setPageType(field_0x40, 5); + } else { + pReference->setPageType(field_0x40, 8); + } + } else { + pReference->setPageType(field_0x40, 3); + if (field_0x3e == 1 && pReference->getPageType(field_0x40) == 2) { + pReference->setPageType(field_0x40, 4); + } + } + } +#else +#if REGION_JPN + if (field_0x3e == 0) { pReference->setPageType(field_0x40, 2); } #else @@ -1651,6 +1678,7 @@ void jmessage_tMeasureProcessor::do_scale(f32 i_scale) { pReference->setPageType(field_0x40, 4); } } +#endif } } @@ -2150,8 +2178,10 @@ bool jmessage_tSequenceProcessor::do_isReady() { } field_0xa6++; -#if TARGET_PC || REGION_JPN - if (IF_DUSK(dusk::version::isRegionJpn() &&) field_0xa6 >= 1) { +#if TARGET_PC + if ((dusk::version::isRegionJpn() && field_0xa6 >= 1) || (!dusk::version::isRegionJpn() && field_0xa6 >= 2)) { +#elif REGION_JPN + if (field_0xa6 >= 1) { #else if (field_0xa6 >= 2) { #endif From d3e05a4f37ee488e386e075a4a327fca7be2226a Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sat, 18 Jul 2026 19:39:24 -0700 Subject: [PATCH 12/14] pr comments again --- src/d/actor/d_a_e_pm.cpp | 139 +++++++++++++++++++++++---------------- src/d/d_bright_check.cpp | 53 +++++++++++++-- src/d/d_menu_dmap.cpp | 2 +- src/d/d_msg_class.cpp | 10 +-- src/d/d_name.cpp | 10 ++- 5 files changed, 141 insertions(+), 73 deletions(-) diff --git a/src/d/actor/d_a_e_pm.cpp b/src/d/actor/d_a_e_pm.cpp index 8c68907f15..0d019da747 100644 --- a/src/d/actor/d_a_e_pm.cpp +++ b/src/d/actor/d_a_e_pm.cpp @@ -19,6 +19,7 @@ #include "d/actor/d_a_obj_smw_stone.h" #include "f_op/f_op_actor_enemy.h" #include "f_op/f_op_camera_mng.h" +#include "dusk/version.hpp" class daE_PM_HIO_c { public: @@ -115,7 +116,7 @@ enum Joint { }; enum Mode { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN /* 0x00 */ Mode0_JPN, #endif /* 0x00 */ Mode0, @@ -470,26 +471,31 @@ void daE_PM_c::Ap_StartAction() { bool bVar3 = false; switch (mMode) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN case Mode0_JPN: - if (mAppear) { - bVar3 = true; - mMode++; - } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { - bVar3 = true; - mMode++; - } + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) + if (mAppear) { + bVar3 = true; + mMode++; + } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { + bVar3 = true; + mMode++; + } + IF_DUSK_BLOCK_END break; - case Mode0: - bVar3 = true; -#else - case Mode0: - if (mAppear) { - bVar3 = true; - } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { - bVar3 = true; - } #endif + case Mode0: + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) + bVar3 = true; + IF_DUSK_BLOCK_END + + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) + if (mAppear) { + bVar3 = true; + } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { + bVar3 = true; + } + IF_DUSK_BLOCK_END if (bVar3 && CameraSet()) { if (dComIfG_play_c::getLayerNo(0) == 2) { player_pos.set(-10477.0f, mAcch.GetGroundH(), 17710.0f); @@ -816,10 +822,12 @@ void daE_PM_c::DemoBeforeEscape() { for (int i = 0; i < 4; i++) { e_fs_class* puppet; if (fopAcM_SearchByID(mPuppetID[i], (fopAc_ac_c**)&puppet)) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) if (puppet == NULL) { continue; } + IF_DUSK_BLOCK_END #endif puppet->mAction = e_fs_class::ACT_END; puppet->mMode = 0; @@ -1271,11 +1279,14 @@ void daE_PM_c::DemoBossStart2() { player = (daPy_py_c*)dComIfGp_getPlayer(0); -#if VERSION == VERSION_GCN_JPN - if (mDemoMode > Mode0) { +#if TARGET_PC + if (dusk::version::isRegionJpn() ? (mDemoMode > Mode0) : (mDemoMode != Mode0)) +#elif VERSION == VERSION_GCN_JPN + if (mDemoMode > Mode0) #else - if (mDemoMode != Mode0) { + if (mDemoMode != Mode0) #endif + { SetMoveCam(0.1f, 50.0f); } else { SetMoveCam(0.03f, 50.0f); @@ -1284,31 +1295,33 @@ void daE_PM_c::DemoBossStart2() { mTargetAngleY = s_TargetAngle; switch (mDemoMode) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN case Mode0_JPN: - if (!CameraSet()) { - break; - } + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) + if (!CameraSet()) { + break; + } - mPuppetNum = 4; - gravity = -9.0f; - mTimer[0] = 130; - if (mSecondEncounter) { - mTimer[0] = 180; - vec1.set(current.pos.x, 1900.0f, current.pos.z); - SetStopCam(vec1, 500.0f, 0.0f, s_TargetAngle); - mCamEye.set(mCamEyeTarget); - actor_status &= ~fopAcStts_CULL_e; - } - if (mSecondEncounter) { - player->mDemo.setDemoType(daPy_demo_c::DEMO_TYPE_ORIGINAL_e); - player->mDemo.setParam0(0); - player->mDemo.setDemoMode(4); - player->mDemo.setParam0(0); - player->mDemo.setParam1(0); - player->mDemo.setParam2(0); - } - mDemoMode++; + mPuppetNum = 4; + gravity = -9.0f; + mTimer[0] = 130; + if (mSecondEncounter) { + mTimer[0] = 180; + vec1.set(current.pos.x, 1900.0f, current.pos.z); + SetStopCam(vec1, 500.0f, 0.0f, s_TargetAngle); + mCamEye.set(mCamEyeTarget); + actor_status &= ~fopAcStts_CULL_e; + } + if (mSecondEncounter) { + player->mDemo.setDemoType(daPy_demo_c::DEMO_TYPE_ORIGINAL_e); + player->mDemo.setParam0(0); + player->mDemo.setDemoMode(4); + player->mDemo.setParam0(0); + player->mDemo.setParam1(0); + player->mDemo.setParam2(0); + } + mDemoMode++; + IF_DUSK_BLOCK_END break; #endif case Mode0: @@ -1443,20 +1456,21 @@ void daE_PM_c::DemoBossStart() { } switch (mDemoMode) { -#if VERSION == VERSION_GCN_JPN +#if TARGET_PC || VERSION == VERSION_GCN_JPN case Mode0_JPN: - if (!CameraSet()) { - break; - } - - mPuppetNum = 4; - gravity = -9.0f; - mTimer[0] = 130; - vec1.set(current.pos.x, current.pos.y + 80.0f, current.pos.z); - mTargetAngleY = shape_angle.y; - SetStopCam(vec1, 500.0f, -150.0f, shape_angle.y); - mDemoMode++; + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) + if (!CameraSet()) { + break; + } + mPuppetNum = 4; + gravity = -9.0f; + mTimer[0] = 130; + vec1.set(current.pos.x, current.pos.y + 80.0f, current.pos.z); + mTargetAngleY = shape_angle.y; + SetStopCam(vec1, 500.0f, -150.0f, shape_angle.y); + mDemoMode++; + IF_DUSK_BLOCK_END break; #endif case Mode0: @@ -2209,7 +2223,8 @@ void daE_PM_c::StartAction() { if (fopAcM_gc_c::gndCheck(&pos) && current.pos.absXZ(*s_LinkPos) < 1000.0f && mAnm == ANM_WAIT01 && s_LinkPos->y <= fopAcM_gc_c::getGroundY() + 100.0f) { -#if VERSION != VERSION_GCN_JPN +#if TARGET_PC || VERSION != VERSION_GCN_JPN + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) if (!CameraSet()) { break; } @@ -2236,6 +2251,14 @@ void daE_PM_c::StartAction() { player->changeOriginalDemo(); player->changeDemoMode(4, 0, 0, 0); } + IF_DUSK_BLOCK_END + + IF_DUSK_BLOCK(dusk::version::isRegionJpn()) + mPuppetNum = 4; + mAction = 6; + mMode = Mode0; + mDemoMode = 0; + IF_DUSK_BLOCK_END #else mPuppetNum = 4; mAction = 6; diff --git a/src/d/d_bright_check.cpp b/src/d/d_bright_check.cpp index ccb04c69e5..cbea55100a 100644 --- a/src/d/d_bright_check.cpp +++ b/src/d/d_bright_check.cpp @@ -15,6 +15,8 @@ #include "m_Do/m_Do_controller_pad.h" #include +#include "dusk/version.hpp" + dBrightCheck_c::dBrightCheck_c(JKRArchive* i_archive) { mArchive = i_archive; mBrightCheck.mMsgString = JKR_NEW dMsgString_c(); @@ -39,7 +41,16 @@ void dBrightCheck_c::screenSet() { MULTI_CHAR('font_a1'), MULTI_CHAR('font_at2'), MULTI_CHAR('font_at3'), MULTI_CHAR('font_at4'), MULTI_CHAR('font_at'), }; - #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) + #if TARGET_PC + static u64 const txTV_jpn[] = { + MULTI_CHAR('menu_t6s'), MULTI_CHAR('menu_t6'), MULTI_CHAR('menu_t9s'), MULTI_CHAR('menu_t9'), MULTI_CHAR('menut10s'), + MULTI_CHAR('menu_t10'), MULTI_CHAR('menu_t7s'), MULTI_CHAR('menu_t7'), MULTI_CHAR('menu_t8s'), MULTI_CHAR('menu_t8'), + }; + static u64 const txTV[] = { + MULTI_CHAR('menu_t61'), MULTI_CHAR('menu_t2'), MULTI_CHAR('menu_t91'), MULTI_CHAR('menu_t1'), MULTI_CHAR('menut101'), + MULTI_CHAR('menu_t01'), MULTI_CHAR('menu_t71'), MULTI_CHAR('menu_t3'), MULTI_CHAR('menu_t81'), MULTI_CHAR('menu_t4'), + }; + #elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) static u64 const txTV[] = { MULTI_CHAR('menu_t6s'), MULTI_CHAR('menu_t6'), MULTI_CHAR('menu_t9s'), MULTI_CHAR('menu_t9'), MULTI_CHAR('menut10s'), MULTI_CHAR('menu_t10'), MULTI_CHAR('menu_t7s'), MULTI_CHAR('menu_t7'), MULTI_CHAR('menu_t8s'), MULTI_CHAR('menu_t8'), @@ -51,7 +62,14 @@ void dBrightCheck_c::screenSet() { }; #endif - #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) + #if TARGET_PC + static u64 const txTVhide_jpn[] = { + MULTI_CHAR('fmenu_6n'), MULTI_CHAR('fmenu_9n'), MULTI_CHAR('fmenu_10'), MULTI_CHAR('fmenu_7n'), MULTI_CHAR('fmenu_8n'), + }; + static u64 const txTVhide[] = { + MULTI_CHAR('menu_6n'), MULTI_CHAR('menu_9n'), MULTI_CHAR('menu_10n'), MULTI_CHAR('menu_7n'), MULTI_CHAR('menu_8n'), + }; + #elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) static u64 const txTVhide[] = { MULTI_CHAR('fmenu_6n'), MULTI_CHAR('fmenu_9n'), MULTI_CHAR('fmenu_10'), MULTI_CHAR('fmenu_7n'), MULTI_CHAR('fmenu_8n'), }; @@ -67,7 +85,18 @@ void dBrightCheck_c::screenSet() { mBrightCheck.Scr->search(MULTI_CHAR('g_abtn_n'))->hide(); - #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) + #if TARGET_PC + J2DTextBox* settings_text; + if (dusk::version::isRegionJpn()) { + settings_text = (J2DTextBox*)mBrightCheck.Scr->search(MULTI_CHAR('t_t00')); + mBrightCheck.Scr->search(MULTI_CHAR('t_t00'))->show(); + mBrightCheck.Scr->search(MULTI_CHAR('f_t00'))->hide(); + } else { + settings_text = (J2DTextBox*)mBrightCheck.Scr->search(MULTI_CHAR('f_t00')); + mBrightCheck.Scr->search(MULTI_CHAR('f_t00'))->show(); + mBrightCheck.Scr->search(MULTI_CHAR('t_t00'))->hide(); + } + #elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) J2DTextBox* settings_text = (J2DTextBox*)mBrightCheck.Scr->search(MULTI_CHAR('t_t00')); mBrightCheck.Scr->search(MULTI_CHAR('t_t00'))->show(); mBrightCheck.Scr->search(MULTI_CHAR('f_t00'))->hide(); @@ -83,7 +112,15 @@ void dBrightCheck_c::screenSet() { J2DTextBox* btna_text[5]; for (int i = 0; i < 5; i++) { - #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) + #if TARGET_PC + if (dusk::version::isRegionJpn()) { + btna_text[i] = (J2DTextBox*)mBrightCheck.Scr->search(tv_btnA[i]); + mBrightCheck.Scr->search(ftv_btnA[i])->hide(); + } else { + btna_text[i] = (J2DTextBox*)mBrightCheck.Scr->search(ftv_btnA[i]); + mBrightCheck.Scr->search(tv_btnA[i])->hide(); + } + #elif (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) btna_text[i] = (J2DTextBox*)mBrightCheck.Scr->search(tv_btnA[i]); mBrightCheck.Scr->search(ftv_btnA[i])->hide(); #else @@ -97,15 +134,17 @@ void dBrightCheck_c::screenSet() { } for (int i = 0; i < 5; i++) { - mBrightCheck.Scr->search(txTVhide[i])->hide(); + mBrightCheck.Scr->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? txTVhide_jpn[i] : txTVhide[i], txTVhide[i]))->hide(); } for (int i = 0; i < 10; i++) { - J2DTextBox* check_text = (J2DTextBox*)mBrightCheck.Scr->search(txTV[i]); + J2DTextBox* check_text = (J2DTextBox*)mBrightCheck.Scr->search(DUSK_IF_ELSE(dusk::version::isRegionJpn() ? txTV_jpn[i] : txTV[i], txTV[i])); check_text->setFont(mDoExt_getMesgFont()); - #if (VERSION != VERSION_GCN_JPN) && (VERSION != VERSION_WII_JPN) + #if TARGET_PC || ((VERSION != VERSION_GCN_JPN) && (VERSION != VERSION_WII_JPN)) + IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) check_text->setCharSpace(0.0f); + IF_DUSK_BLOCK_END #endif if (i < 2) { diff --git a/src/d/d_menu_dmap.cpp b/src/d/d_menu_dmap.cpp index b71c756283..6feb191562 100644 --- a/src/d/d_menu_dmap.cpp +++ b/src/d/d_menu_dmap.cpp @@ -482,7 +482,7 @@ void dMenu_DmapBg_c::setCButtonString(u32 i_msgNo) { MULTI_CHAR('c_text_s'), MULTI_CHAR('c_text') }; static u64 const c_tag[2] = { - MULTI_CHAR('c_text_s'), MULTI_CHAR('c_text') + MULTI_CHAR('f_text_s'), MULTI_CHAR('f_text') }; #else static u64 const c_tag[2] = { diff --git a/src/d/d_msg_class.cpp b/src/d/d_msg_class.cpp index aeeb2243b8..f299049f28 100644 --- a/src/d/d_msg_class.cpp +++ b/src/d/d_msg_class.cpp @@ -3456,11 +3456,13 @@ void jmessage_tRenderingProcessor::do_heightcenter() { break; case 3: { #if TARGET_PC - if (!dusk::version::isRegionJpn() || (dusk::version::isRegionJpn() && field_0x142 == 1)) -#else - if (field_0x142 == 1) + if (!dusk::version::isRegionJpn()) { + field_0x138 = 0.5f * pReference->getLineSpace(); + var_f31 += field_0x138; + break; + } #endif - { + if (field_0x142 == 1) { int nowPageLine = pReference->getNowPageLine(); field_0x138 = pReference->getLineSpace() * (0.5f * (pReference->getLineMax() - (s16)nowPageLine)); var_f31 += field_0x138; diff --git a/src/d/d_name.cpp b/src/d/d_name.cpp index 2f3970bb2f..bf906f9285 100644 --- a/src/d/d_name.cpp +++ b/src/d/d_name.cpp @@ -337,11 +337,15 @@ void dName_c::_move() { mDoAud_seStart(Z2SE_SY_DUMMY, 0, 0, 0); mPrevMojiSet = mMojiSet; mMojiSet++; - #if REGION_JPN - if (mMojiSet > MOJI_EIGO) { + + #if TARGET_PC + if ((dusk::version::isRegionJpn() && mMojiSet > MOJI_EIGO) || (!dusk::version::isRegionJpn() && mMojiSet > MOJI_KATA)) + #elif REGION_JPN + if (mMojiSet > MOJI_EIGO) #else - if (mMojiSet > MOJI_KATA) { + if (mMojiSet > MOJI_KATA) #endif + { mMojiSet = MOJI_HIRA; } mojiListChange(); From 9696c1256379c8d24ce8db7dea453dd947f4dda6 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sat, 18 Jul 2026 21:17:29 -0700 Subject: [PATCH 13/14] couple more fixes, revert e_pm for now --- .../include/JSystem/JUtility/JUTCacheFont.h | 2 +- src/d/actor/d_a_e_pm.cpp | 121 ++++++++---------- src/d/d_meter2_draw.cpp | 13 ++ 3 files changed, 69 insertions(+), 67 deletions(-) diff --git a/libs/JSystem/include/JSystem/JUtility/JUTCacheFont.h b/libs/JSystem/include/JSystem/JUtility/JUTCacheFont.h index 6c4b0b14fc..dabb561aa1 100644 --- a/libs/JSystem/include/JSystem/JUtility/JUTCacheFont.h +++ b/libs/JSystem/include/JSystem/JUtility/JUTCacheFont.h @@ -64,7 +64,7 @@ public: void setPagingType(EPagingType type) { mPagingType = type; } - static u32 calcCacheSize(u32 param_0, int param_1) { return (ALIGN_NEXT(param_0, 0x20) + 0x40) * param_1; } + static u32 calcCacheSize(u32 param_0, int param_1) { return (ALIGN_NEXT(param_0, 0x20) + sizeof(TCachePage)) * param_1; } TGXTexObj* getTexObj(void* buffer) const { return &((TCachePage*)buffer)->mTexObj; } void delete_and_initialize() { deleteMemBlocks_CacheFont(); initialize_state(); } diff --git a/src/d/actor/d_a_e_pm.cpp b/src/d/actor/d_a_e_pm.cpp index 0d019da747..5162a04598 100644 --- a/src/d/actor/d_a_e_pm.cpp +++ b/src/d/actor/d_a_e_pm.cpp @@ -116,7 +116,7 @@ enum Joint { }; enum Mode { -#if TARGET_PC || VERSION == VERSION_GCN_JPN +#if VERSION == VERSION_GCN_JPN /* 0x00 */ Mode0_JPN, #endif /* 0x00 */ Mode0, @@ -471,31 +471,26 @@ void daE_PM_c::Ap_StartAction() { bool bVar3 = false; switch (mMode) { -#if TARGET_PC || VERSION == VERSION_GCN_JPN +#if VERSION == VERSION_GCN_JPN case Mode0_JPN: - IF_DUSK_BLOCK(dusk::version::isRegionJpn()) - if (mAppear) { - bVar3 = true; - mMode++; - } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { - bVar3 = true; - mMode++; - } - IF_DUSK_BLOCK_END + if (mAppear) { + bVar3 = true; + mMode++; + } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { + bVar3 = true; + mMode++; + } break; -#endif case Mode0: - IF_DUSK_BLOCK(dusk::version::isRegionJpn()) bVar3 = true; - IF_DUSK_BLOCK_END - - IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) - if (mAppear) { - bVar3 = true; - } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { - bVar3 = true; - } - IF_DUSK_BLOCK_END +#else + case Mode0: + if (mAppear) { + bVar3 = true; + } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { + bVar3 = true; + } +#endif if (bVar3 && CameraSet()) { if (dComIfG_play_c::getLayerNo(0) == 2) { player_pos.set(-10477.0f, mAcch.GetGroundH(), 17710.0f); @@ -1279,14 +1274,11 @@ void daE_PM_c::DemoBossStart2() { player = (daPy_py_c*)dComIfGp_getPlayer(0); -#if TARGET_PC - if (dusk::version::isRegionJpn() ? (mDemoMode > Mode0) : (mDemoMode != Mode0)) -#elif VERSION == VERSION_GCN_JPN - if (mDemoMode > Mode0) +#if VERSION == VERSION_GCN_JPN + if (mDemoMode > Mode0) { #else - if (mDemoMode != Mode0) + if (mDemoMode != Mode0) { #endif - { SetMoveCam(0.1f, 50.0f); } else { SetMoveCam(0.03f, 50.0f); @@ -1295,33 +1287,31 @@ void daE_PM_c::DemoBossStart2() { mTargetAngleY = s_TargetAngle; switch (mDemoMode) { -#if TARGET_PC || VERSION == VERSION_GCN_JPN +#if VERSION == VERSION_GCN_JPN case Mode0_JPN: - IF_DUSK_BLOCK(dusk::version::isRegionJpn()) - if (!CameraSet()) { - break; - } + if (!CameraSet()) { + break; + } - mPuppetNum = 4; - gravity = -9.0f; - mTimer[0] = 130; - if (mSecondEncounter) { - mTimer[0] = 180; - vec1.set(current.pos.x, 1900.0f, current.pos.z); - SetStopCam(vec1, 500.0f, 0.0f, s_TargetAngle); - mCamEye.set(mCamEyeTarget); - actor_status &= ~fopAcStts_CULL_e; - } - if (mSecondEncounter) { - player->mDemo.setDemoType(daPy_demo_c::DEMO_TYPE_ORIGINAL_e); - player->mDemo.setParam0(0); - player->mDemo.setDemoMode(4); - player->mDemo.setParam0(0); - player->mDemo.setParam1(0); - player->mDemo.setParam2(0); - } - mDemoMode++; - IF_DUSK_BLOCK_END + mPuppetNum = 4; + gravity = -9.0f; + mTimer[0] = 130; + if (mSecondEncounter) { + mTimer[0] = 180; + vec1.set(current.pos.x, 1900.0f, current.pos.z); + SetStopCam(vec1, 500.0f, 0.0f, s_TargetAngle); + mCamEye.set(mCamEyeTarget); + actor_status &= ~fopAcStts_CULL_e; + } + if (mSecondEncounter) { + player->mDemo.setDemoType(daPy_demo_c::DEMO_TYPE_ORIGINAL_e); + player->mDemo.setParam0(0); + player->mDemo.setDemoMode(4); + player->mDemo.setParam0(0); + player->mDemo.setParam1(0); + player->mDemo.setParam2(0); + } + mDemoMode++; break; #endif case Mode0: @@ -1456,21 +1446,20 @@ void daE_PM_c::DemoBossStart() { } switch (mDemoMode) { -#if TARGET_PC || VERSION == VERSION_GCN_JPN +#if VERSION == VERSION_GCN_JPN case Mode0_JPN: - IF_DUSK_BLOCK(dusk::version::isRegionJpn()) - if (!CameraSet()) { - break; - } + if (!CameraSet()) { + break; + } + + mPuppetNum = 4; + gravity = -9.0f; + mTimer[0] = 130; + vec1.set(current.pos.x, current.pos.y + 80.0f, current.pos.z); + mTargetAngleY = shape_angle.y; + SetStopCam(vec1, 500.0f, -150.0f, shape_angle.y); + mDemoMode++; - mPuppetNum = 4; - gravity = -9.0f; - mTimer[0] = 130; - vec1.set(current.pos.x, current.pos.y + 80.0f, current.pos.z); - mTargetAngleY = shape_angle.y; - SetStopCam(vec1, 500.0f, -150.0f, shape_angle.y); - mDemoMode++; - IF_DUSK_BLOCK_END break; #endif case Mode0: diff --git a/src/d/d_meter2_draw.cpp b/src/d/d_meter2_draw.cpp index f4e96c6fbe..09963e8cc7 100644 --- a/src/d/d_meter2_draw.cpp +++ b/src/d/d_meter2_draw.cpp @@ -62,10 +62,23 @@ void dAnchorHudScale(CPaneMgr* i_pane, HudCorner i_corner, f32* io_x, f32* io_y, dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) { #if TARGET_PC + // correct hio data here because we can't do runtime disc checks in sinit data constructors if (dusk::version::isRegionJpn()) { g_drawHIO.mButtonATextSpacing = -2.0f; + for (int i = 0; i < 6; i++) { + static f32 const finfoPosX_jpn[6] = {-27.0f, 0.0f, -12.0f, 0.0f, -12.0f, -32.8f}; + static f32 const fishnPosX_jpn[6] = {-27.0f, 0.0f, -12.0f, 0.0f, -12.0f, -32.8f}; + g_drawHIO.mFishListScreen.mFishCountSizePosX[i] = finfoPosX_jpn[i]; + g_drawHIO.mFishListScreen.mFishInfoPosX[i] = fishnPosX_jpn[i]; + } } else { g_drawHIO.mButtonATextSpacing = 1.0f; + for (int i = 0; i < 6; i++) { + static f32 const finfoPosX[6] = {-17.0f, 0.0f, -14.0f, 0.0f, -12.0f, -32.8f}; + static f32 const fishnPosX[6] = {-17.0f, 0.0f, -14.0f, 0.0f, -12.0f, -32.8f}; + g_drawHIO.mFishListScreen.mFishCountSizePosX[i] = finfoPosX[i]; + g_drawHIO.mFishListScreen.mFishInfoPosX[i] = fishnPosX[i]; + } } #endif From 3e343acc8677fe3f6f71e21fb4acbd7ce82c894d Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sat, 18 Jul 2026 22:09:32 -0700 Subject: [PATCH 14/14] revert, e_pm jpn logic change TODO later --- src/d/actor/d_a_e_pm.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/d/actor/d_a_e_pm.cpp b/src/d/actor/d_a_e_pm.cpp index 5162a04598..2cf0341172 100644 --- a/src/d/actor/d_a_e_pm.cpp +++ b/src/d/actor/d_a_e_pm.cpp @@ -2212,8 +2212,7 @@ void daE_PM_c::StartAction() { if (fopAcM_gc_c::gndCheck(&pos) && current.pos.absXZ(*s_LinkPos) < 1000.0f && mAnm == ANM_WAIT01 && s_LinkPos->y <= fopAcM_gc_c::getGroundY() + 100.0f) { -#if TARGET_PC || VERSION != VERSION_GCN_JPN - IF_DUSK_BLOCK(!dusk::version::isRegionJpn()) +#if VERSION != VERSION_GCN_JPN if (!CameraSet()) { break; } @@ -2240,14 +2239,6 @@ void daE_PM_c::StartAction() { player->changeOriginalDemo(); player->changeDemoMode(4, 0, 0, 0); } - IF_DUSK_BLOCK_END - - IF_DUSK_BLOCK(dusk::version::isRegionJpn()) - mPuppetNum = 4; - mAction = 6; - mMode = Mode0; - mDemoMode = 0; - IF_DUSK_BLOCK_END #else mPuppetNum = 4; mAction = 6;