From 5d202ae9ea47383c835bf7641ba4a7bb339a0e94 Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sat, 14 Sep 2013 15:07:53 -0700 Subject: [PATCH] proper fix for issue 6206 --- Source/Core/DiscIO/Src/BannerLoaderGC.cpp | 1 + Source/Core/DolphinWX/Src/GameListCtrl.cpp | 43 +++++------ Source/Core/DolphinWX/Src/ISOFile.cpp | 3 +- Source/Core/DolphinWX/Src/ISOProperties.cpp | 80 +++++++++++++-------- 4 files changed, 72 insertions(+), 55 deletions(-) diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp index 3585835443..58b79d12db 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp @@ -145,6 +145,7 @@ std::vector CBannerLoaderGC::GetDescriptions() desc_count = 1; break; + // English, German, French, Spanish, Italian, Dutch case CBannerLoaderGC::BANNER_BNR2: desc_count = 6; break; diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index a0186fa7e0..49a38b6ea8 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -62,24 +62,25 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is int indexOne = 0; int indexOther = 0; - switch (iso1->GetCountry()) + + // index only matters for WADS and PAL GC games, but invalid indicies for the others + // will return the (only) language in the list + if (iso1->GetPlatform() == GameListItem::WII_WAD) { - case DiscIO::IVolume::COUNTRY_JAPAN: - case DiscIO::IVolume::COUNTRY_USA: - indexOne = 0; - break; - default: - indexOne = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; + indexOne = SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG"); + } + else + { // GC + indexOne = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; } - switch (iso2->GetCountry()) + if (iso2->GetPlatform() == GameListItem::WII_WAD) { - case DiscIO::IVolume::COUNTRY_JAPAN: - case DiscIO::IVolume::COUNTRY_USA: - indexOther = 0; - break; - default: - indexOther = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; + indexOther = SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG"); + } + else + { // GC + indexOther = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; } switch(sortData) @@ -410,19 +411,9 @@ void CGameListCtrl::InsertItemInReportView(long _Index) int SelectedLanguage = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; // Is this sane? - switch (rISOFile.GetCountry()) + if (rISOFile.GetPlatform() == GameListItem::WII_WAD) { - case DiscIO::IVolume::COUNTRY_TAIWAN: - case DiscIO::IVolume::COUNTRY_JAPAN: - SelectedLanguage = -1; - break; - - case DiscIO::IVolume::COUNTRY_USA: - SelectedLanguage = 0; - break; - - default: - break; + SelectedLanguage = SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG"); } std::string const name = rISOFile.GetName(SelectedLanguage); diff --git a/Source/Core/DolphinWX/Src/ISOFile.cpp b/Source/Core/DolphinWX/Src/ISOFile.cpp index 8f2ce68a0d..c38f6f5110 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.cpp +++ b/Source/Core/DolphinWX/Src/ISOFile.cpp @@ -78,7 +78,8 @@ GameListItem::GameListItem(const std::string& _rFileName) { if (pBannerLoader->IsValid()) { - m_names = pBannerLoader->GetNames(); + if (m_Platform != WII_WAD) + m_names = pBannerLoader->GetNames(); m_company = pBannerLoader->GetCompany(); m_descriptions = pBannerLoader->GetDescriptions(); diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index a158c37278..1928e60ce6 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -75,7 +75,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW { // Load ISO data OpenISO = DiscIO::CreateVolumeFromFilename(fileName); - if (DiscIO::IsVolumeWiiDisc(OpenISO)) + bool IsWad = DiscIO::IsVolumeWadFile(OpenISO); + bool IsWiiDisc = DiscIO::IsVolumeWiiDisc(OpenISO); + if (IsWiiDisc) { for (u32 i = 0; i < 0xFFFFFFFF; i++) // yes, technically there can be OVER NINE THOUSAND partitions... { @@ -97,7 +99,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW else { // TODO : Should we add a way to browse the wad file ? - if (!DiscIO::IsVolumeWadFile(OpenISO)) + if (!IsWad) { GCFiles.clear(); pFileSystem = DiscIO::CreateFileSystem(OpenISO); @@ -132,7 +134,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW bRefreshList = false; - CreateGUIControls(DiscIO::IsVolumeWadFile(OpenISO)); + CreateGUIControls(IsWad); LoadGameConfig(); @@ -156,21 +158,33 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW break; case DiscIO::IVolume::COUNTRY_USA: m_Country->SetValue(_("USA")); - m_Lang->SetSelection(0); - m_Lang->Disable(); // For NTSC Games, there's no multi lang + if (!IsWad) // For (non wad) NTSC Games, there's no multi lang + { + m_Lang->SetSelection(0); + m_Lang->Disable(); + } + break; case DiscIO::IVolume::COUNTRY_JAPAN: m_Country->SetValue(_("JAPAN")); - m_Lang->SetSelection(-1); - m_Lang->Disable(); // For NTSC Games, there's no multi lang + if (!IsWad) // For (non wad) NTSC Games, there's no multi lang + { + m_Lang->Insert(_("Japanese"), 0); + m_Lang->SetSelection(0); + m_Lang->Disable(); + } break; case DiscIO::IVolume::COUNTRY_KOREA: m_Country->SetValue(_("KOREA")); break; case DiscIO::IVolume::COUNTRY_TAIWAN: m_Country->SetValue(_("TAIWAN")); - m_Lang->SetSelection(-1); - m_Lang->Disable(); // For NTSC Games, there's no multi lang + if (!IsWad) // For (non wad) NTSC Games, there's no multi lang + { + m_Lang->Insert(_("TAIWAN"), 0); + m_Lang->SetSelection(0); + m_Lang->Disable(); + } break; case DiscIO::IVolume::COUNTRY_SDK: m_Country->SetValue(_("No Country (SDK)")); @@ -179,6 +193,13 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW m_Country->SetValue(_("UNKNOWN")); break; } + + if (IsWiiDisc) // Only one language with wii banners + { + m_Lang->SetSelection(0); + m_Lang->Disable(); + } + wxString temp = _T("0x") + StrToWxStr(OpenISO->GetMakerID()); m_MakerID->SetValue(temp); m_Revision->SetValue(wxString::Format(wxT("%u"), OpenISO->GetRevision())); @@ -186,7 +207,15 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW m_FST->SetValue(wxString::Format(wxT("%u"), OpenISO->GetFSTSize())); // Here we set all the info to be shown (be it SJIS or Ascii) + we set the window title - ChangeBannerDetails((int)SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage); + if (!IsWad) + { + ChangeBannerDetails((int)SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage); + } + else + { + ChangeBannerDetails(SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG")); + } + m_Banner->SetBitmap(OpenGameListItem->GetImage()); m_Banner->Bind(wxEVT_RIGHT_DOWN, &CISOProperties::RightClickOnBanner, this); @@ -480,8 +509,19 @@ void CISOProperties::CreateGUIControls(bool IsWad) arrayStringFor_Lang.Add(_("Spanish")); arrayStringFor_Lang.Add(_("Italian")); arrayStringFor_Lang.Add(_("Dutch")); + int language = (int)SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; + if (IsWad) + { + arrayStringFor_Lang.Insert(_("Japanese"), 0); + arrayStringFor_Lang.Add(_("Simplified Chinese")); + arrayStringFor_Lang.Add(_("Traditional Chinese")); + arrayStringFor_Lang.Add(_("Korean")); + + language = SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG"); + } m_Lang = new wxChoice(m_Information, ID_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Lang); - m_Lang->SetSelection((int)SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage); + m_Lang->SetSelection(language); + wxStaticText * const m_ShortText = new wxStaticText(m_Information, wxID_ANY, _("Short Name:")); m_ShortName = new wxTextCtrl(m_Information, ID_SHORTNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); wxStaticText * const m_MakerText = new wxStaticText(m_Information, wxID_ANY, _("Maker:")); @@ -1342,23 +1382,7 @@ void CISOProperties::OnChangeBannerLang(wxCommandEvent& event) void CISOProperties::ChangeBannerDetails(int lang) { - // why? - switch (OpenGameListItem->GetCountry()) - { - case DiscIO::IVolume::COUNTRY_TAIWAN: - case DiscIO::IVolume::COUNTRY_JAPAN: - lang = -1; - break; - - case DiscIO::IVolume::COUNTRY_USA: - lang = 0; - break; - - default: - break; - } - - wxString const shortName = StrToWxStr(OpenGameListItem->GetBannerName(lang)); + wxString const shortName = StrToWxStr(OpenGameListItem->GetName(lang)); wxString const comment = StrToWxStr(OpenGameListItem->GetDescription(lang)); wxString const maker = StrToWxStr(OpenGameListItem->GetCompany());