From 40e488ba79a7e00b8c504a5d0708006cbb098afc Mon Sep 17 00:00:00 2001 From: lijunyu-cn Date: Wed, 7 Sep 2022 11:10:21 +0800 Subject: [PATCH] Fix various issues related to title names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed various issues related to title names: 1. If console language is set to non-English, the title names in Title Manager may be empty. 2. Game list do not show custom names if list style set to icon or small icon. 3. Custom title names for some languages (like JP or CN) appear confusing if re-edited. 4. Unexpected overrides of variable values in ParsedMetaXml.h --- src/Cafe/TitleList/ParsedMetaXml.h | 6 +++--- src/gui/components/wxGameList.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Cafe/TitleList/ParsedMetaXml.h b/src/Cafe/TitleList/ParsedMetaXml.h index 59cdaf87..2cb2e7a8 100644 --- a/src/Cafe/TitleList/ParsedMetaXml.h +++ b/src/Cafe/TitleList/ParsedMetaXml.h @@ -18,12 +18,12 @@ struct ParsedMetaXml std::string GetShortName(CafeConsoleLanguage languageId) const { - return m_short_name[(size_t)languageId]; + return m_short_name[(size_t)languageId].empty() ? m_short_name[(size_t)CafeConsoleLanguage::EN] : m_short_name[(size_t)languageId]; } std::string GetLongName(CafeConsoleLanguage languageId) const { - return m_long_name[(size_t)languageId]; + return m_long_name[(size_t)languageId].empty() ? m_long_name[(size_t)CafeConsoleLanguage::EN] : m_long_name[(size_t)languageId]; } TitleId GetTitleId() const @@ -134,7 +134,7 @@ private: else if (language == "ru") return (sint32)CafeConsoleLanguage::RU; else if (language == "zht") - return (sint32)CafeConsoleLanguage::ZH; + return (sint32)CafeConsoleLanguage::TW; // if return ZH here, xxx_zht values may cover xxx_zh values in function Parse() return -1; } }; diff --git a/src/gui/components/wxGameList.cpp b/src/gui/components/wxGameList.cpp index 87eb5cdd..68dde7c6 100644 --- a/src/gui/components/wxGameList.cpp +++ b/src/gui/components/wxGameList.cpp @@ -536,7 +536,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event) std::string customName = ""; if (!GetConfig().GetGameListCustomName(title_id, customName)) customName.clear(); - wxTextEntryDialog dialog(this, wxEmptyString, L"Enter a custom game title", customName); + wxTextEntryDialog dialog(this, wxEmptyString, _("Enter a custom game title"), wxHelper::FromUtf8(customName)); if(dialog.ShowModal() == wxID_OK) { const auto custom_name = dialog.GetValue(); @@ -859,7 +859,7 @@ void wxGameList::OnGameEntryUpdatedByTitleId(wxTitleIdEvent& event) if(index == wxNOT_FOUND) { // entry doesn't exist - index = InsertItem(FindInsertPosition(baseTitleId), wxHelper::FromUtf8(gameInfo.GetTitleName())); + index = InsertItem(FindInsertPosition(baseTitleId), wxHelper::FromUtf8(GetNameByTitleId(baseTitleId))); SetItemPtrData(index, baseTitleId); isNewEntry = true; }