diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index e1290d951e..32c32e7013 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -72,6 +72,8 @@ void SConfig::SaveSettings() ini.Set("Interface", "Theme", m_LocalCoreStartupParameter.iTheme); ini.Set("Interface", "ShowWiimoteLeds", m_LocalCoreStartupParameter.bWiiLeds); ini.Set("Interface", "ShowWiimoteSpeakers", m_LocalCoreStartupParameter.bWiiSpeakers); + // interface(UI) language + ini.Set("Interface", "Language", m_InterfaceLanguage); // Core ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios); @@ -172,6 +174,8 @@ void SConfig::LoadSettings() ini.Get("Interface", "Theme", &m_LocalCoreStartupParameter.iTheme, 0); ini.Get("Interface", "ShowWiimoteLeds", &m_LocalCoreStartupParameter.bWiiLeds, false); ini.Get("Interface", "ShowWiimoteSpeakers", &m_LocalCoreStartupParameter.bWiiSpeakers, false); + // interface(UI) language + ini.Get("Interface", "Language", (int*)&m_InterfaceLanguage, 0); // Core ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true); diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index 9f0239f4d7..7bd84f93b7 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -23,6 +23,19 @@ #include "Boot/Boot.h" +// HyperIris: not sure but a temporary implement +enum INTERFACE_LANGUAGE +{ + INTERFACE_ENGLISH = 0, + INTERFACE_GERMAN, + INTERFACE_FRENCH, + INTERFACE_SPANISH, + INTERFACE_ITALIAN, + INTERFACE_DUTCH, + + INTERFACE_OTHER, +}; + struct SConfig { // hard coded default plugins ... @@ -39,6 +52,8 @@ struct SConfig SCoreStartupParameter m_LocalCoreStartupParameter; + // interface language + INTERFACE_LANGUAGE m_InterfaceLanguage; // save settings void SaveSettings(); diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp index 62adc6eb97..9d1ad055d7 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp @@ -17,6 +17,9 @@ #include "stdafx.h" +// HyperIris: need clean code +#include "../../Core/Src/ConfigManager.h" + #include "BannerLoaderGC.h" namespace DiscIO @@ -101,25 +104,41 @@ CBannerLoaderGC::GetName(std::string& _rName, DiscIO::IVolume::ECountry language } // find Banner type - if (DiscIO::IVolume::COUNTRY_JAP == language) + switch (getBannerType()) { - DVDBanner* pBanner = (DVDBanner*)m_pBannerFile; - - // dunno, if dolphin using unicode, it will be better = =; - if (CopySJISToString(_rName, pBanner->comment.shortTitle)) + case CBannerLoaderGC::BANNER_BNR1: { - returnCode = true; + DVDBanner* pBanner = (DVDBanner*)m_pBannerFile; + if (DiscIO::IVolume::COUNTRY_JAP == language) + { + // dunno, if dolphin using unicode, it will be better = =; + if (CopySJISToString(_rName, pBanner->comment.shortTitle)) + { + returnCode = true; + } + } + else + { + if (CopyToStringAndCheck(_rName, pBanner->comment.shortTitle))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) + { + returnCode = true; + } + } } - } - else - { - DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile; - - if (CopyToStringAndCheck(_rName, pBanner->comment[0].shortTitle))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) + break; + case CBannerLoaderGC::BANNER_BNR2: { - returnCode = true; + DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile; + + u32 languageID = SConfig::GetInstance().m_InterfaceLanguage; + if (CopyToStringAndCheck(_rName, pBanner->comment[languageID].shortTitle))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) + { + returnCode = true; + } } + break; } + return returnCode; } @@ -158,24 +177,39 @@ CBannerLoaderGC::GetDescription(std::string& _rDescription, DiscIO::IVolume::ECo } // find Banner type - if (DiscIO::IVolume::COUNTRY_JAP == language) + switch (getBannerType()) { - DVDBanner* pBanner = (DVDBanner*)m_pBannerFile; - - // dunno, if dolphin using unicode, it will be better = =; - if (CopySJISToString(_rDescription, pBanner->comment.comment)) + case CBannerLoaderGC::BANNER_BNR1: { - returnCode = true; + DVDBanner* pBanner = (DVDBanner*)m_pBannerFile; + if (DiscIO::IVolume::COUNTRY_JAP == language) + { + // dunno, if dolphin using unicode, it will be better = =; + if (CopySJISToString(_rDescription, pBanner->comment.comment)) + { + returnCode = true; + } + } + else + { + if (CopyToStringAndCheck(_rDescription, pBanner->comment.comment))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) + { + returnCode = true; + } + } } - } - else - { - DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile; - - if (CopyToStringAndCheck(_rDescription, pBanner->comment[0].comment)) + break; + case CBannerLoaderGC::BANNER_BNR2: { - returnCode = true; + DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile; + + u32 languageID = SConfig::GetInstance().m_InterfaceLanguage; + if (CopyToStringAndCheck(_rDescription, pBanner->comment[languageID].comment))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle)) + { + returnCode = true; + } } + break; } return returnCode; } @@ -226,4 +260,20 @@ CBannerLoaderGC::decode5A3image(u32* dst, u16* src, int width, int height) } } } + +CBannerLoaderGC::BANNER_TYPE CBannerLoaderGC::getBannerType() +{ + u32 bannerSignature = *(u32*)m_pBannerFile; + CBannerLoaderGC::BANNER_TYPE type = CBannerLoaderGC::BANNER_UNKNOWN; + switch (bannerSignature) + { + case 0x31524e42: + type = CBannerLoaderGC::BANNER_BNR1; + break; + case 0x32524e42: + type = CBannerLoaderGC::BANNER_BNR2; + break; + } + return type; +} } // namespace diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.h b/Source/Core/DiscIO/Src/BannerLoaderGC.h index ab99db118b..0e3f7ba0ef 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderGC.h +++ b/Source/Core/DiscIO/Src/BannerLoaderGC.h @@ -50,6 +50,13 @@ class CBannerLoaderGC DVD_BANNER_HEIGHT = 32 }; + enum BANNER_TYPE + { + BANNER_UNKNOWN, + BANNER_BNR1, + BANNER_BNR2, + }; + // Banner Comment struct DVDBannerComment { @@ -90,6 +97,7 @@ class CBannerLoaderGC u32 decode5A3(u16 val); void decode5A3image(u32* dst, u16* src, int width, int height); + BANNER_TYPE getBannerType(); }; } // namespace diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 97b0e79c1d..cbe147539e 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -53,6 +53,8 @@ EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_LEDS, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_SPEAKERS, CConfigMain::CoreSettingsChanged) +EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::InterfaceLanguageChanged) + EVT_CHECKBOX(ID_ALLWAYS_HLEBIOS, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_USEDYNAREC, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_USEDUALCORE, CConfigMain::CoreSettingsChanged) @@ -97,7 +99,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, { // Control refreshing of the ISOs list bRefreshList = false; - + bRefreshCache = false; // Load Wii SYSCONF FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF"; pStream = NULL; @@ -155,6 +157,21 @@ void CConfigMain::UpdateGUI() void CConfigMain::CreateGUIControls() { + // Deal with all the language arrayStrings here + // GC + arrayStringFor_GCSystemLang.Add(wxT("English")); + arrayStringFor_GCSystemLang.Add(wxT("German")); + arrayStringFor_GCSystemLang.Add(wxT("French")); + arrayStringFor_GCSystemLang.Add(wxT("Spanish")); + arrayStringFor_GCSystemLang.Add(wxT("Italian")); + arrayStringFor_GCSystemLang.Add(wxT("Dutch")); + // Wii + arrayStringFor_WiiSystemLang = arrayStringFor_GCSystemLang; + arrayStringFor_WiiSystemLang.Insert(wxT("Japanese"), 0); + // GUI + arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang; + + // Create the notebook and pages Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); GeneralPage = new wxPanel(Notebook, ID_GENERALPAGE, wxDefaultPosition, wxDefaultSize); GamecubePage = new wxPanel(Notebook, ID_GAMECUBEPAGE, wxDefaultPosition, wxDefaultSize); @@ -211,6 +228,15 @@ void CConfigMain::CreateGUIControls() WiimoteStatusLEDs->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds); WiimoteStatusSpeakers = new wxCheckBox(GeneralPage, ID_INTERFACE_WIIMOTE_SPEAKERS, wxT("Speakers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); WiimoteStatusSpeakers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers); + + // Interface Language + // At the moment this only changes the language displayed in m_gamelistctrl + // If someone wants to control the whole GUI's language, it should be set here too + wxStaticText *InterfaceLangText = new wxStaticText(GeneralPage, ID_INTERFACE_LANG_TEXT, wxT("Game List Language:"), wxDefaultPosition, wxDefaultSize); + InterfaceLang = new wxChoice(GeneralPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator); + // need redesign + InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage); + // Themes wxArrayString ThemeChoices; ThemeChoices.Add(wxT("Boomy")); @@ -231,6 +257,8 @@ void CConfigMain::CreateGUIControls() WiimoteStatusLEDs->SetToolTip(wxT("Show which wiimotes are connected in the statusbar.")); WiimoteStatusSpeakers->SetToolTip(wxT("Show wiimote speaker status in the statusbar.")); + InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in" + "\nthe game list of PAL GC games.")); // Copyright notice Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]")); Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com")); @@ -265,6 +293,10 @@ void CConfigMain::CreateGUIControls() sWiimoteStatus->Add(WiimoteStatusSpeakers, 0, wxLEFT, 5); sbInterface->Add(sWiimoteStatus, 0, wxALL, 5); sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5); + wxBoxSizer *sInterfaceLanguage = new wxBoxSizer(wxHORIZONTAL); + sInterfaceLanguage->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + sInterfaceLanguage->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5); + sbInterface->Add(sInterfaceLanguage, 0, wxEXPAND | wxALL, 5); // Populate the entire page sGeneralPage = new wxBoxSizer(wxVERTICAL); @@ -279,12 +311,14 @@ void CConfigMain::CreateGUIControls() // Gamecube page // -------- sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings")); +/* arrayStringFor_GCSystemLang.Add(wxT("English")); arrayStringFor_GCSystemLang.Add(wxT("German")); arrayStringFor_GCSystemLang.Add(wxT("French")); arrayStringFor_GCSystemLang.Add(wxT("Spanish")); arrayStringFor_GCSystemLang.Add(wxT("Italian")); arrayStringFor_GCSystemLang.Add(wxT("Dutch")); +*/ GCSystemLangText = new wxStaticText(GamecubePage, ID_GC_SRAM_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize); GCSystemLang = new wxChoice(GamecubePage, ID_GC_SRAM_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_GCSystemLang, 0, wxDefaultValidator); GCSystemLang->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage); @@ -319,8 +353,10 @@ void CConfigMain::CreateGUIControls() WiiAspectRatioText = new wxStaticText(WiiPage, ID_WII_IPL_AR_TEXT, wxT("Aspect Ratio:"), wxDefaultPosition, wxDefaultSize); WiiAspectRatio = new wxChoice(WiiPage, ID_WII_IPL_AR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiAspectRatio, 0, wxDefaultValidator); WiiAspectRatio->SetSelection(m_SYSCONF[IPL_AR]); +/* arrayStringFor_WiiSystemLang = arrayStringFor_GCSystemLang; arrayStringFor_WiiSystemLang.Insert(wxT("Japanese"), 0); +*/ WiiSystemLangText = new wxStaticText(WiiPage, ID_WII_IPL_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize); WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator); WiiSystemLang->SetSelection(m_SYSCONF[IPL_LNG]); @@ -744,4 +780,16 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename) return(false); } + +void CConfigMain::InterfaceLanguageChanged( wxCommandEvent& event ) +{ + switch (event.GetId()) + { + case ID_INTERFACE_LANG: + SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection(); + break; + } + bRefreshList = true; + bRefreshCache = true; +} // ========================== diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index 7688e07089..8df07a8410 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -42,6 +42,7 @@ class CConfigMain void OnConfig(wxCommandEvent& event); bool bRefreshList; + bool bRefreshCache; private: @@ -50,6 +51,10 @@ class CConfigMain wxBoxSizer* sGeneralPage; // General Settings wxCheckBox* ConfirmStop, * AutoHideCursor, *HideCursor; wxCheckBox* WiimoteStatusLEDs, * WiimoteStatusSpeakers; + + wxArrayString arrayStringFor_InterfaceLang; + wxChoice* InterfaceLang; + wxRadioBox* Theme; wxBoxSizer* sCore; @@ -215,6 +220,7 @@ class CConfigMain ID_INTERFACE_CONFIRMSTOP, // Interface settings ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR, ID_INTERFACE_WIIMOTE_TEXT, ID_INTERFACE_WIIMOTE_LEDS, ID_INTERFACE_WIIMOTE_SPEAKERS, + ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG, ID_INTERFACE_THEME, ID_WII_BT_BAR_TEXT, @@ -255,6 +261,7 @@ class CConfigMain void CreateGUIControls(); void UpdateGUI(); void OnClose(wxCloseEvent& event); void CoreSettingsChanged(wxCommandEvent& event); + void InterfaceLanguageChanged(wxCommandEvent& event); void GCSettingsChanged(wxCommandEvent& event); void WiiSettingsChanged(wxCommandEvent& event); void ISOPathsSelectionChanged(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 49412aa510..d25dafc9e8 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -181,8 +181,8 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar) toolBar->AddTool(wxID_OPEN, _T("Open"), m_Bitmaps[Toolbar_FileOpen], _T("Open file...")); toolBar->AddTool(wxID_REFRESH, _T("Refresh"), m_Bitmaps[Toolbar_Refresh], _T("Refresh")); toolBar->AddTool(IDM_BROWSE, _T("Browse"), m_Bitmaps[Toolbar_Browse], _T("Browse for an ISO directory...")); - toolBar->AddSeparator(); - + toolBar->AddSeparator(); + m_pToolPlay = toolBar->AddTool(IDM_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play")); @@ -219,8 +219,8 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar) // Delete and recreate the toolbar // ¯¯¯¯¯¯¯¯¯¯ void CFrame::RecreateToolbar() -{ - +{ + wxToolBarBase* toolBar = GetToolBar(); long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE; @@ -531,7 +531,7 @@ void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event)) CConfigMain ConfigMain(this); ConfigMain.ShowModal(); if (ConfigMain.bRefreshList) - m_GameListCtrl->Update(); + m_GameListCtrl->Update(ConfigMain.bRefreshCache); } @@ -655,8 +655,8 @@ void CFrame::OnSaveState(wxCommandEvent& event) // ------------- void CFrame::OnToggleToolbar(wxCommandEvent& event) { - wxToolBarBase* toolBar = GetToolBar(); - + wxToolBarBase* toolBar = GetToolBar(); + if (event.IsChecked()) { CFrame::RecreateToolbar(); diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index bf425275e7..5108c0e80c 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -125,7 +125,7 @@ void CGameListCtrl::BrowseForDirectory() } } -void CGameListCtrl::Update() +void CGameListCtrl::Update(bool bUpdateCache) { if (m_imageListSmall) { @@ -135,7 +135,7 @@ void CGameListCtrl::Update() Hide(); - ScanForISOs(); + ScanForISOs(bUpdateCache); ClearAll(); @@ -363,7 +363,7 @@ void CGameListCtrl::SetBackgroundColor() } } -void CGameListCtrl::ScanForISOs() +void CGameListCtrl::ScanForISOs(bool bUpdateCache) { m_ISOFiles.clear(); CFileSearch::XStringVector Directories(SConfig::GetInstance().m_ISOFolder); @@ -407,7 +407,7 @@ void CGameListCtrl::ScanForISOs() { break; } - GameListItem ISOFile(rFilenames[i]); + GameListItem ISOFile(rFilenames[i], bUpdateCache); if (ISOFile.IsValid()) { m_ISOFiles.push_back(ISOFile); diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.h b/Source/Core/DolphinWX/Src/GameListCtrl.h index 0c6799547c..a707059f29 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.h +++ b/Source/Core/DolphinWX/Src/GameListCtrl.h @@ -31,7 +31,7 @@ public: CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); ~CGameListCtrl(); - void Update(); + void Update(bool bUpdateCache = false); void BrowseForDirectory(); const GameListItem *GetSelectedISO(); const GameListItem *GetISO(int index) const; @@ -60,7 +60,7 @@ private: void InitBitmaps(); void InsertItemInReportView(long _Index); void SetBackgroundColor(); - void ScanForISOs(); + void ScanForISOs(bool bUpdateCache); DECLARE_EVENT_TABLE() diff --git a/Source/Core/DolphinWX/Src/ISOFile.cpp b/Source/Core/DolphinWX/Src/ISOFile.cpp index b34e3b5573..8abe3858ac 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.cpp +++ b/Source/Core/DolphinWX/Src/ISOFile.cpp @@ -39,7 +39,7 @@ static u32 g_ImageTemp[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; -GameListItem::GameListItem(const std::string& _rFileName) +GameListItem::GameListItem(const std::string& _rFileName, bool bUpdateCache) : m_FileName(_rFileName) , m_FileSize(0) , m_Valid(false) @@ -48,7 +48,7 @@ GameListItem::GameListItem(const std::string& _rFileName) , m_ImageSize(0) { - if (LoadFromCache()) + if ((bUpdateCache == false) && LoadFromCache()) { m_Valid = true; } diff --git a/Source/Core/DolphinWX/Src/ISOFile.h b/Source/Core/DolphinWX/Src/ISOFile.h index 21332eca91..4e83d4ce54 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.h +++ b/Source/Core/DolphinWX/Src/ISOFile.h @@ -24,7 +24,7 @@ class PointerWrap; class GameListItem { public: - GameListItem(const std::string& _rFileName); + GameListItem(const std::string& _rFileName, bool bUpdateCache = false); ~GameListItem(); bool IsValid() const {return m_Valid;}