Main Configuration: Fixed the game specific Wii settings so that they don't cause the global settings to be forgotten

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2389 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-02-23 09:34:28 +00:00
parent 366e2ad276
commit 4beff606d7
5 changed files with 62 additions and 51 deletions

View file

@ -101,6 +101,10 @@ void SConfig::SaveSettings()
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
// Wii
ini.Set("Wii", "Widescreen", &m_LocalCoreStartupParameter.bWidescreen);
ini.Set("Wii", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressiveScan);
// Plugins
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
@ -212,6 +216,10 @@ void SConfig::LoadSettings()
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0);
// Wii
ini.Get("Wii", "Widescreen", &m_LocalCoreStartupParameter.bWidescreen, false);
ini.Get("Wii", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressiveScan, true);
// Plugins
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());

View file

@ -71,6 +71,7 @@ struct SCoreStartupParameter
// Wii settings
bool bWii; bool bWiiLeds; bool bWiiSpeakers;
bool bWidescreen, bProgressiveScan;
// Interface settings
bool bConfirmStop, bHideCursor, bAutoHideCursor;

View file

@ -134,60 +134,52 @@ bool BootCore(const std::string& _rFilename)
ini.Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
// ------------------------------------------------
// Wii settings
// ----------------
if (StartUp.bWii)
{
// ------------------------------------------------
// Update SYSCONF with game specific settings
// ----------------
bool bEnableProgressiveScan, bEnableWideScreen;
//bRefreshList = false;
FILE* pStream; // file handle
u8 m_SYSCONF[0x4000]; // SYSCONF file
u16 IPL_PGS = 0x17CC; // pregressive scan
u16 IPL_PGS = 0x17CC; // progressive scan
u16 IPL_AR = 0x04D9; // widescreen
std::string FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF";
// Load Wii SYSCONF
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
ini.Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan);
ini.Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen);
m_SYSCONF[IPL_PGS] = StartUp.bProgressiveScan;
m_SYSCONF[IPL_AR] = StartUp.bWidescreen;
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
// Save the update Wii SYSCONF settings
pStream = NULL;
pStream = fopen(FullSYSCONFPath.c_str(), "rb");
pStream = fopen(FullSYSCONFPath.c_str(), "r+b");
if (pStream != NULL)
{
fread(m_SYSCONF, 1, 0x4000, pStream);
fseek(pStream, IPL_PGS, 0);
fputc(StartUp.bProgressiveScan ? 1 : 0, pStream);
fseek(pStream, IPL_AR, 0);
fputc(StartUp.bWidescreen ? 1 : 0, pStream);
fclose(pStream);
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
ini.Get("Core", "EnableProgressiveScan", &bEnableProgressiveScan, m_SYSCONF[IPL_PGS] != 0);
ini.Get("Core", "EnableWideScreen", &bEnableWideScreen, m_SYSCONF[IPL_AR] != 0);
m_SYSCONF[IPL_PGS] = bEnableProgressiveScan;
m_SYSCONF[IPL_AR] = bEnableWideScreen;
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
// Enable custom Wii SYSCONF settings by saving the file to shared2
pStream = NULL;
pStream = fopen(FullSYSCONFPath.c_str(), "wb");
if (pStream != NULL)
{
fwrite(m_SYSCONF, 1, 0x4000, pStream);
fclose(pStream);
}
else
{
PanicAlert("Could not write to %s", FullSYSCONFPath.c_str());
}
}
}
else
{
PanicAlert("Could not read %s", FullSYSCONFPath.c_str());
PanicAlert("Could not write to %s", FullSYSCONFPath.c_str());
}
// ---------
}
// ---------------
}
// ==============
// =====================
// =================================================================
// Run the game
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#if defined(HAVE_WX) && HAVE_WX
if(main_frame)
{
@ -198,7 +190,7 @@ bool BootCore(const std::string& _rFilename)
main_frame->ModifyStatusBar();
}
#endif
// init the core
// Init the core
if (!Core::Init())
{
PanicAlert("Couldn't init the core.\nCheck your configuration.");
@ -212,14 +204,16 @@ bool BootCore(const std::string& _rFilename)
#else
Core::SetState(Core::CORE_RUN);
#endif
// =====================
//////////////////////////////////////////////////////////////////////////////////////////
// =================================================================
// Music mod
// ¯¯¯¯¯¯¯¯¯¯
#ifdef MUSICMOD
MusicMod::Main(StartUp.m_strFilename);
#endif
///////////////////////////////////
// ===================
return true;

View file

@ -397,13 +397,13 @@ void CConfigMain::CreateGUIControls()
WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiiScreenSaver->SetValue(m_SYSCONF[IPL_SSV]!=0);
WiiProgressiveScan = new wxCheckBox(WiiPage, ID_WII_IPL_PGS, wxT("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiiProgressiveScan->SetValue(m_SYSCONF[IPL_PGS]!=0);
WiiProgressiveScan->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressiveScan);
WiiEuRGB60 = new wxCheckBox(WiiPage, ID_WII_IPL_E60, wxT("Use EuRGB60 Mode (PAL6)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiiEuRGB60->SetValue(m_SYSCONF[IPL_E60]!=0);
arrayStringFor_WiiAspectRatio.Add(wxT("4:3")); arrayStringFor_WiiAspectRatio.Add(wxT("16:9"));
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]);
WiiAspectRatio->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.bWidescreen);
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]);
@ -623,8 +623,9 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
}
}
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
// GC settings
// -----------------------
void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
{
int sidevice = 0;
@ -709,9 +710,12 @@ void CConfigMain::ChooseSIDevice(std::string deviceName, int deviceNum)
SConfig::GetInstance().m_SIDevice[deviceNum] = tempType;
}
///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Wii settings
// -------------------
void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
{
switch (event.GetId())
@ -721,7 +725,7 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
break;
case ID_WII_IPL_AR: // IPL settings
m_SYSCONF[IPL_AR] = WiiAspectRatio->GetSelection();
SConfig::GetInstance().m_LocalCoreStartupParameter.bWidescreen = WiiAspectRatio->GetSelection();
break;
case ID_WII_IPL_SSV:
m_SYSCONF[IPL_SSV] = WiiScreenSaver->IsChecked();
@ -730,16 +734,20 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
m_SYSCONF[IPL_LNG] = WiiSystemLang->GetSelection();
break;
case ID_WII_IPL_PGS:
m_SYSCONF[IPL_PGS] = WiiProgressiveScan->IsChecked();
SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressiveScan = WiiProgressiveScan->IsChecked();
break;
case ID_WII_IPL_E60:
m_SYSCONF[IPL_E60] = WiiEuRGB60->IsChecked();
break;
}
}
///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Paths settings
// -------------------
void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event))
{
if (!ISOPaths->GetStringSelection().empty())

View file

@ -510,12 +510,12 @@ void CISOProperties::LoadGameConfig()
else
OptimizeQuantizers->Set3StateValue(wxCHK_UNDETERMINED);
if (GameIni.Get("Core", "EnableProgressiveScan", &bTemp))
if (GameIni.Get("Wii", "ProgressiveScan", &bTemp))
EnableProgressiveScan->Set3StateValue((wxCheckBoxState)bTemp);
else
EnableProgressiveScan->Set3StateValue(wxCHK_UNDETERMINED);
if (GameIni.Get("Core", "EnableWideScreen", &bTemp))
if (GameIni.Get("Wii", "Widescreen", &bTemp))
EnableWideScreen->Set3StateValue((wxCheckBoxState)bTemp);
else
EnableWideScreen->Set3StateValue(wxCHK_UNDETERMINED);
@ -557,14 +557,14 @@ bool CISOProperties::SaveGameConfig()
GameIni.Set("Core", "OptimizeQuantizers", OptimizeQuantizers->Get3StateValue());
if (EnableProgressiveScan->Get3StateValue() == wxCHK_UNDETERMINED)
GameIni.DeleteKey("Core", "EnableProgressiveScan");
GameIni.DeleteKey("Wii", "ProgressiveScan");
else
GameIni.Set("Core", "EnableProgressiveScan", EnableProgressiveScan->Get3StateValue());
GameIni.Set("Wii", "ProgressiveScan", EnableProgressiveScan->Get3StateValue());
if (EnableWideScreen->Get3StateValue() == wxCHK_UNDETERMINED)
GameIni.DeleteKey("Core", "EnableWideScreen");
GameIni.DeleteKey("Wii", "Widescreen");
else
GameIni.Set("Core", "EnableWideScreen", EnableWideScreen->Get3StateValue());
GameIni.Set("Wii", "Widescreen", EnableWideScreen->Get3StateValue());
GameIni.Set("EmuState", "EmulationStateId", EmuState->GetSelection());
GameIni.Set("EmuState", "EmulationIssues", EmuIssues->GetValue());