Return GetNames languages, to avoid hardcoded language lists in callers

This makes the code cleaner and also leads to some user-visible changes:

The wx game properties will no longer let the user
select WAD languages that don't have any names.

The Qt game list will now display names using the languages
set in the configuration instead of always using
English for PAL GC games and Japanese for WADs.

If a WAD doesn't have a name in the user's preferred language,
English is now selected as a fallback before Japanese.
This commit is contained in:
JosJuice
2015-04-09 17:44:53 +02:00
parent 87a63713f4
commit 235ecfbed7
30 changed files with 399 additions and 340 deletions

View File

@ -11,6 +11,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "DiscIO/Volume.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Config/WiiConfigPane.h"
@ -125,7 +126,7 @@ void WiiConfigPane::OnConnectKeyboardCheckBoxChanged(wxCommandEvent& event)
void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event)
{
int wii_system_lang = m_system_language_choice->GetSelection();
IVolume::ELanguage wii_system_lang = (IVolume::ELanguage)m_system_language_choice->GetSelection();
SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", wii_system_lang);
u8 country_code = GetSADRCountryCode(wii_system_lang);
@ -138,41 +139,33 @@ void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event)
SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", m_aspect_ratio_choice->GetSelection());
}
// Change from IPL.LNG value to IPL.SADR country code
u8 WiiConfigPane::GetSADRCountryCode(int language)
// Change from IPL.LNG value to IPL.SADR country code.
// http://wiibrew.org/wiki/Country_Codes
u8 WiiConfigPane::GetSADRCountryCode(IVolume::ELanguage language)
{
//http://wiibrew.org/wiki/Country_Codes
u8 country_code = language;
switch (country_code)
switch (language)
{
case 0: //Japanese
country_code = 1; //Japan
break;
case 1: //English
country_code = 49; //USA
break;
case 2: //German
country_code = 78; //Germany
break;
case 3: //French
country_code = 77; //France
break;
case 4: //Spanish
country_code = 105; //Spain
break;
case 5: //Italian
country_code = 83; //Italy
break;
case 6: //Dutch
country_code = 94; //Netherlands
break;
case 7: //Simplified Chinese
case 8: //Traditional Chinese
country_code = 157; //China
break;
case 9: //Korean
country_code = 136; //Korea
break;
case IVolume::LANGUAGE_JAPANESE:
return 1; // Japan
case IVolume::LANGUAGE_ENGLISH:
return 49; // USA
case IVolume::LANGUAGE_GERMAN:
return 78; // Germany
case IVolume::LANGUAGE_FRENCH:
return 77; // France
case IVolume::LANGUAGE_SPANISH:
return 105; // Spain
case IVolume::LANGUAGE_ITALIAN:
return 83; // Italy
case IVolume::LANGUAGE_DUTCH:
return 94; // Netherlands
case IVolume::LANGUAGE_SIMPLIFIED_CHINESE:
case IVolume::LANGUAGE_TRADITIONAL_CHINESE:
return 157; // China
case IVolume::LANGUAGE_KOREAN:
return 136; // Korea
}
return country_code;
PanicAlert("Invalid language");
return 1;
}