Set default player name to "リンク" ("Link" in Katakana) when playing in Japanese (#5487)

This commit is contained in:
nclok1405 2025-05-24 06:05:59 +09:00 committed by GitHub
commit 150029fa49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 4 deletions

View file

@ -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<char, 8> 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<char, 8> 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<char, 8> 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<char, 8> sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF };
for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) {

View file

@ -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;
}