From 9eb38adf9be26bf2b1b758563b2738872ea58338 Mon Sep 17 00:00:00 2001 From: nclok1405 <155463060+nclok1405@users.noreply.github.com> Date: Thu, 15 May 2025 15:26:43 +0900 Subject: [PATCH] =?UTF-8?q?Set=20default=20player=20name=20to=20"=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF"=20("Link"=20in=20Katakana)=20when=20playing?= =?UTF-8?q?=20in=20Japanese?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soh/soh/SaveManager.cpp | 12 ++++++++++ .../ovl_file_choose/z_file_choose.c | 22 +++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 97ab6a52a..0b0421fbe 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -922,6 +922,12 @@ void SaveManager::InitFileDebug() { gSaveContext.playerName[i] = sPlayerName[i]; } gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_PAL; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + const static std::array sPlayerName = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; + for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { + gSaveContext.playerName[i] = sPlayerName[i]; + } + gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_NTSC_JPN; } else { // GAME_REGION_NTSC const static std::array sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { @@ -1037,6 +1043,12 @@ void SaveManager::InitFileMaxed() { gSaveContext.playerName[i] = sPlayerName[i]; } gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_PAL; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + const static std::array sPlayerName = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; + for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { + gSaveContext.playerName[i] = sPlayerName[i]; + } + gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_NTSC_JPN; } else { // GAME_REGION_NTSC const static std::array sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 6dae312ac..78b167442 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1086,10 +1086,6 @@ static s16 sLastFileChooseButtonIndex; * Update function for `CM_MAIN_MENU` */ void FileChoose_UpdateMainMenu(GameState* thisx) { - static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }; - static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; - static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; - static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); @@ -1300,6 +1296,7 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) { static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; + static u8 linkNameJP[] = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; FileChoose_UpdateStickDirectionPromptAnim(thisx); FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; @@ -1369,6 +1366,14 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) { this->nameEntryBoxAlpha = 0; if (ResourceMgr_GetGameRegion(0) == GAME_REGION_PAL && gSaveContext.language != LANGUAGE_JPN) { defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + if (CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) != 0) { + // Set player name to "リンク" ("Link" in Katakana, 3 characters long) when playing in Japanese. + defaultName = &linkNameJP; + this->newFileNameCharCount = 3; + } else { + defaultName = &emptyNameNES; + } } else { // GAME_REGION_NTSC defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkNameNES : &emptyNameNES; } @@ -1544,6 +1549,7 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; + static u8 linkNameJP[] = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; u8* defaultName; this->prevConfigMode = this->configMode; @@ -1561,6 +1567,14 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { this->nameEntryBoxAlpha = 0; if (ResourceMgr_GetGameRegion(0) == GAME_REGION_PAL && gSaveContext.language != LANGUAGE_JPN) { defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + if (CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) != 0) { + // Set player name to "リンク" ("Link" in Katakana, 3 characters long) when playing in Japanese. + defaultName = &linkNameJP; + this->newFileNameCharCount = 3; + } else { + defaultName = &emptyNameNES; + } } else { // GAME_REGION_NTSC defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkNameNES : &emptyNameNES; }