continue working on display gamecube game name and description.

now we can select Config -> General -> Game List Language to choose the language of PAL games for displaying

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1979 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hyperiris 2009-01-22 07:42:17 +00:00
parent bb06dfb823
commit 189285f071
11 changed files with 175 additions and 43 deletions

View File

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

View File

@ -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();

View File

@ -17,6 +17,9 @@
#include "stdafx.h"
// HyperIris: need clean code
#include "../../Core/Src/ConfigManager.h"
#include "BannerLoaderGC.h"
namespace DiscIO
@ -101,10 +104,13 @@ CBannerLoaderGC::GetName(std::string& _rName, DiscIO::IVolume::ECountry language
}
// find Banner type
if (DiscIO::IVolume::COUNTRY_JAP == language)
switch (getBannerType())
{
case CBannerLoaderGC::BANNER_BNR1:
{
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))
{
@ -113,13 +119,26 @@ CBannerLoaderGC::GetName(std::string& _rName, DiscIO::IVolume::ECountry language
}
else
{
DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile;
if (CopyToStringAndCheck(_rName, pBanner->comment[0].shortTitle))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle))
if (CopyToStringAndCheck(_rName, pBanner->comment.shortTitle))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle))
{
returnCode = true;
}
}
}
break;
case CBannerLoaderGC::BANNER_BNR2:
{
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,10 +177,13 @@ CBannerLoaderGC::GetDescription(std::string& _rDescription, DiscIO::IVolume::ECo
}
// find Banner type
if (DiscIO::IVolume::COUNTRY_JAP == language)
switch (getBannerType())
{
case CBannerLoaderGC::BANNER_BNR1:
{
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))
{
@ -170,13 +192,25 @@ CBannerLoaderGC::GetDescription(std::string& _rDescription, DiscIO::IVolume::ECo
}
else
{
DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile;
if (CopyToStringAndCheck(_rDescription, pBanner->comment[0].comment))
if (CopyToStringAndCheck(_rDescription, pBanner->comment.comment))//language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle))
{
returnCode = true;
}
}
}
break;
case CBannerLoaderGC::BANNER_BNR2:
{
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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()

View File

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

View File

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