revamp handling of wii sysconf. it's in Common lib so that plugins can (possibly) utilize it if they like

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4268 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-09-14 06:26:49 +00:00
parent a08c801256
commit aff34e6789
10 changed files with 508 additions and 337 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="Common" Name="Common"
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}" ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
RootNamespace="Common" RootNamespace="Common"
@ -812,6 +812,14 @@
RelativePath=".\Src\SymbolDB.h" RelativePath=".\Src\SymbolDB.h"
> >
</File> </File>
<File
RelativePath=".\Src\SysConf.cpp"
>
</File>
<File
RelativePath=".\Src\SysConf.h"
>
</File>
<File <File
RelativePath=".\Src\Thread.cpp" RelativePath=".\Src\Thread.cpp"
> >

View File

@ -0,0 +1,156 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "FileUtil.h"
#include "SysConf.h"
SysConf::SysConf()
: m_IsValid(false)
{
if (LoadFromFile(WII_SYSCONF_FILE))
m_IsValid = true;
}
SysConf::~SysConf()
{
if (!m_IsValid)
return;
Save();
for (size_t i = 0; i < m_Entries.size() - 1; i++)
{
delete [] m_Entries.at(i).data;
m_Entries.at(i).data = NULL;
}
}
bool SysConf::LoadFromFile(const char *filename)
{
FILE* f = fopen(filename, "rb");
if (f == NULL)
return false;
// Basic check
if (File::GetSize(filename) != SYSCONF_SIZE)
{
PanicAlert("Your SYSCONF file is the wrong size - should be 0x%04x", SYSCONF_SIZE);
return false;
}
// Fill in infos
if (fread(&m_Header.version, sizeof(m_Header.version), 1, f) != 1) return false;
if (fread(&m_Header.numEntries, sizeof(m_Header.numEntries), 1, f) != 1) return false;
m_Header.numEntries = Common::swap16(m_Header.numEntries) + 1;
for (u16 index = 0; index < m_Header.numEntries; index++)
{
SSysConfEntry tmpEntry;
if (fread(&tmpEntry.offset, sizeof(tmpEntry.offset), 1, f) != 1) return false;
tmpEntry.offset = Common::swap16(tmpEntry.offset);
m_Entries.push_back(tmpEntry);
}
// Last offset is an invalid entry. We ignore it throughout this class
for (size_t i = 0; i < m_Entries.size() - 1; i++)
{
SSysConfEntry& curEntry = m_Entries.at(i);
if (fseek(f, curEntry.offset, SEEK_SET) != 0) return false;
u8 description = 0;
if (fread(&description, sizeof(description), 1, f) != 1) return false;
// Data type
curEntry.type = (SysconfType)((description & 0xe0) >> 5);
// Length of name in bytes - 1
curEntry.nameLength = (description & 0x1f) + 1;
// Name
if (fread(&curEntry.name, curEntry.nameLength, 1, f) != 1) return false;
curEntry.name[curEntry.nameLength] = '\0';
// Get length of data
curEntry.dataLength = 0;
switch (curEntry.type)
{
case Type_BigArray:
if (fread(&curEntry.dataLength, 2, 1, f) != 1) return false;
curEntry.dataLength = Common::swap16(curEntry.dataLength);
break;
case Type_SmallArray:
if (fread(&curEntry.dataLength, 1, 1, f) != 1) return false;
break;
case Type_Byte:
case Type_Bool:
curEntry.dataLength = 1;
break;
case Type_Short:
curEntry.dataLength = 2;
break;
case Type_Long:
curEntry.dataLength = 4;
break;
default:
PanicAlert("Unknown entry type %i in SYSCONF (%s@%x)!",
curEntry.type, curEntry.name, curEntry.offset);
return false;
}
// Fill in the actual data
if (curEntry.dataLength)
{
curEntry.data = new u8[curEntry.dataLength];
if (fread(curEntry.data, curEntry.dataLength, 1, f) != 1) return false;
}
}
// OK!, done!
m_Filename = filename;
fclose(f);
return true;
}
bool SysConf::SaveToFile(const char *filename)
{
FILE *f = fopen(filename, "r+b");
if (f == NULL)
return false;
for (size_t i = 0; i < m_Entries.size() - 1; i++)
{
// Seek to after the name of this entry
if (fseek(f, m_Entries.at(i).offset + m_Entries.at(i).nameLength + 1, SEEK_SET) != 0) return false;
// We may have to write array length value...
if (m_Entries.at(i).type == Type_BigArray)
{
u16 tmpDataLength = Common::swap16(m_Entries.at(i).dataLength);
if (fwrite(&tmpDataLength, 2, 1, f) != 1) return false;
}
else if (m_Entries.at(i).type == Type_SmallArray)
{
if (fwrite(&m_Entries.at(i).dataLength, 1, 1, f) != 1) return false;
}
// Now write the actual data
if (fwrite(m_Entries.at(i).data, m_Entries.at(i).dataLength, 1, f) != 1) return false;
}
fclose(f);
return true;
}
bool SysConf::Save()
{
return SaveToFile(m_Filename.c_str());
}

View File

@ -0,0 +1,122 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __SYSCONF_MANAGER_h__
#define __SYSCONF_MANAGER_h__
// This class is meant to edit the values in a given Wii SYSCONF file
// It currently does not add/remove/rearrange sections,
// instead only modifies exiting sections' data
#define SYSCONF_SIZE 0x4000
enum SysconfType
{
Type_BigArray = 1,
Type_SmallArray,
Type_Byte,
Type_Short,
Type_Long,
Type_Unknown,
Type_Bool
};
struct SSysConfHeader
{
char version[4];
u16 numEntries;
};
struct SSysConfEntry
{
u16 offset;
SysconfType type;
u8 nameLength;
char name[32];
u16 dataLength;
u8* data;
template<class T>
T GetData() { return *(T*)data; }
};
class SysConf
{
private:
SSysConfHeader m_Header;
std::string m_Filename;
std::vector<SSysConfEntry> m_Entries;
bool m_IsValid;
public:
SysConf();
~SysConf();
bool IsValid() { return m_IsValid; }
template<class T>
T GetData(const char* sectionName)
{
if (!m_IsValid)
{
PanicAlert("Trying to read from invalid SYSCONF");
return 0;
}
size_t index = 0;
for (index; index < m_Entries.size() - 1; index++)
{
if (strcmp(m_Entries.at(index).name, sectionName) == 0)
break;
}
if (index == m_Entries.size() - 1)
{
PanicAlert("Section %s not found in SYSCONF", sectionName);
return 0;
}
return m_Entries.at(index).GetData<T>();
}
template<class T>
bool SetData(const char* sectionName, T newValue)
{
if (!m_IsValid)
return false;
size_t index = 0;
for (index; index < m_Entries.size() - 1; index++)
{
if (strcmp(m_Entries.at(index).name, sectionName) == 0)
break;
}
if (index == m_Entries.size() - 1)
{
PanicAlert("Section %s not found in SYSCONF", sectionName);
return false;
}
*(T*)m_Entries.at(index).data = newValue;
return true;
}
bool Save();
bool SaveToFile(const char* filename);
bool LoadFromFile(const char* filename);
};
#endif // __SYSCONF_MANAGER_h__

View File

@ -38,6 +38,7 @@ SConfig::SConfig()
SConfig::~SConfig() SConfig::~SConfig()
{ {
SaveSettings(); SaveSettings();
delete m_SYSCONF;
} }
@ -122,10 +123,6 @@ void SConfig::SaveSettings()
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
ini.Set("Core", "FrameLimit", m_Framelimit); ini.Set("Core", "FrameLimit", m_Framelimit);
// Wii
ini.Set("Wii", "Widescreen", m_LocalCoreStartupParameter.bWidescreen);
ini.Set("Wii", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressiveScan);
// Plugins // Plugins
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin); ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin); ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
@ -141,12 +138,13 @@ void SConfig::SaveSettings()
#else #else
ini.Save(CONFIG_FILE); ini.Save(CONFIG_FILE);
#endif #endif
m_SYSCONF->Save();
} }
void SConfig::LoadSettings() void SConfig::LoadSettings()
{ {
NOTICE_LOG(BOOT, "Loading Settings from %s", CONFIG_FILE); NOTICE_LOG(BOOT, "Loading Settings from %s", CONFIG_FILE);
IniFile ini; IniFile ini;
#if defined(__APPLE__) #if defined(__APPLE__)
@ -239,10 +237,6 @@ void SConfig::LoadSettings()
ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0); ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0);
ini.Get("Core", "FrameLimit", &m_Framelimit, 1); ini.Get("Core", "FrameLimit", &m_Framelimit, 1);
// Wii
ini.Get("Wii", "Widescreen", &m_LocalCoreStartupParameter.bWidescreen, false);
ini.Get("Wii", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressiveScan, false);
// Plugins // Plugins
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str()); ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str()); ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
@ -253,14 +247,12 @@ void SConfig::LoadSettings()
} }
ini.Get("Core", "WiiMote1Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[0], m_DefaultWiiMotePlugin.c_str()); ini.Get("Core", "WiiMote1Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[0], m_DefaultWiiMotePlugin.c_str());
} }
m_SYSCONF = new SysConf();
} }
void SConfig::LoadSettingsHLE() void SConfig::LoadSettingsHLE()
{ {
IniFile ini; IniFile ini;
//
ini.Load(FULL_CONFIG_DIR "DSP.ini"); ini.Load(FULL_CONFIG_DIR "DSP.ini");
ini.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack ini.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack
} }

View File

@ -24,6 +24,7 @@
#include "Boot/Boot.h" #include "Boot/Boot.h"
#include "HW/EXI_Device.h" #include "HW/EXI_Device.h"
#include "HW/SI_Device.h" #include "HW/SI_Device.h"
#include "SysConf.h"
// HyperIris: not sure but a temporary implement // HyperIris: not sure but a temporary implement
enum INTERFACE_LANGUAGE enum INTERFACE_LANGUAGE
@ -80,6 +81,8 @@ struct SConfig
bool m_ListUsa; bool m_ListUsa;
bool m_ListJap; bool m_ListJap;
SysConf* m_SYSCONF;
// save settings // save settings
void SaveSettings(); void SaveSettings();

View File

@ -72,11 +72,10 @@ struct SCoreStartupParameter
int iTLBHack; int iTLBHack;
int SelectedLanguage; int SelectedLanguage;
// Wii settings // Wii settings
bool bWii; bool bWiiLeds; bool bWiiSpeakers; bool bWii, bWiiLeds, bWiiSpeakers;
bool bWidescreen, bProgressiveScan;
// Interface settings // Interface settings
bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers; bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers;

View File

@ -52,6 +52,7 @@
#include "Volume.h" #include "Volume.h"
#include "VolumeCreator.h" #include "VolumeCreator.h"
#include "ConfigManager.h" #include "ConfigManager.h"
#include "SysConf.h"
#include "Core.h" #include "Core.h"
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include "ConfigMain.h" #include "ConfigMain.h"
@ -127,24 +128,8 @@ bool BootCore(const std::string& _rFilename)
// Wii settings // Wii settings
if (StartUp.bWii) if (StartUp.bWii)
{ {
game_ini.Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan); // Flush possible changes to SYSCONF to file
game_ini.Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen); SConfig::GetInstance().m_SYSCONF->Save();
// Save the update Wii SYSCONF settings
FILE* pStream = fopen(WII_SYSCONF_FILE, "r+b");
if (pStream)
{
const int IPL_PGS = 0x17CC; // progressive scan
const int IPL_AR = 0x04D9; // widescreen
fseek(pStream, IPL_PGS, 0);
fputc(StartUp.bProgressiveScan ? 1 : 0, pStream);
fseek(pStream, IPL_AR, 0);
fputc(StartUp.bWidescreen ? 1 : 0, pStream);
fclose(pStream);
}
else
{
PanicAlert("Could not write to %s", WII_SYSCONF_FILE);
}
} }
} }

View File

@ -26,6 +26,7 @@
#include "ConfigMain.h" #include "ConfigMain.h"
#include "PluginManager.h" #include "PluginManager.h"
#include "ConfigManager.h" #include "ConfigManager.h"
#include "SysConf.h"
#include "Frame.h" #include "Frame.h"
@ -98,21 +99,6 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
// Control refreshing of the ISOs list // Control refreshing of the ISOs list
bRefreshList = false; bRefreshList = false;
// Load Wii SYSCONF
pStream = NULL;
pStream = fopen(WII_SYSCONF_FILE, "rb");
if (pStream != NULL)
{
fread(m_SYSCONF, 1, 0x4000, pStream);
fclose(pStream);
m_bSysconfOK = true;
}
else
{
PanicAlert("Could not read %s. Please recover the SYSCONF file to that location.", WII_SYSCONF_FILE);
m_bSysconfOK = false;
}
CreateGUIControls(); CreateGUIControls();
// Update selected ISO paths // Update selected ISO paths
@ -437,29 +423,27 @@ void CConfigMain::CreateGUIControls()
GamecubePage->SetSizer(sGamecube); GamecubePage->SetSizer(sGamecube);
sGamecube->Layout(); sGamecube->Layout();
// Wii page // Wii page
sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings")); sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top")); arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize); WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator); WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator);
WiiSensBarPos->SetSelection(m_SYSCONF[BT_BAR]); WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("IPL Settings")); sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Misc Settings"));
WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); 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); WiiScreenSaver->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
WiiProgressiveScan = new wxCheckBox(WiiPage, ID_WII_IPL_PGS, wxT("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); WiiProgressiveScan = new wxCheckBox(WiiPage, ID_WII_IPL_PGS, wxT("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiiProgressiveScan->SetValue(m_SYSCONF[IPL_PGS]!=0 || SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressiveScan); WiiProgressiveScan->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.PGS"));
WiiEuRGB60 = new wxCheckBox(WiiPage, ID_WII_IPL_E60, wxT("Use EuRGB60 Mode (PAL6)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); WiiEuRGB60 = new wxCheckBox(WiiPage, ID_WII_IPL_E60, wxT("Use EuRGB60 Mode (PAL6)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiiEuRGB60->SetValue(m_SYSCONF[IPL_E60]!=0); WiiEuRGB60->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.E60"));
arrayStringFor_WiiAspectRatio.Add(wxT("4:3")); arrayStringFor_WiiAspectRatio.Add(wxT("16:9")); 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); 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 = new wxChoice(WiiPage, ID_WII_IPL_AR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiAspectRatio, 0, wxDefaultValidator);
WiiAspectRatio->SetSelection(m_SYSCONF[IPL_AR]!=0 || SConfig::GetInstance().m_LocalCoreStartupParameter.bWidescreen); WiiAspectRatio->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
WiiSystemLangText = new wxStaticText(WiiPage, ID_WII_IPL_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize); 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 = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator);
WiiSystemLang->SetSelection(m_SYSCONF[IPL_LNG]); WiiSystemLang->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"));
// Populate sbWiimoteSettings // Populate sbWiimoteSettings
sWii = new wxBoxSizer(wxVERTICAL); sWii = new wxBoxSizer(wxVERTICAL);
@ -594,22 +578,8 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
{ {
EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE); EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE);
// First check that we did successfully populate m_SYSCONF earlier, otherwise don't // Sysconf saves when it gets deleted
// save anything, it will be a corrupted file //delete SConfig::GetInstance().m_SYSCONF;
if(m_bSysconfOK)
{
// Save SYSCONF with the new settings
pStream = fopen(WII_SYSCONF_FILE, "wb");
if (pStream != NULL)
{
fwrite(m_SYSCONF, 1, 0x4000, pStream);
fclose(pStream);
}
else
{
PanicAlert("Could not write to %s", WII_SYSCONF_FILE);
}
}
// Save the config. Dolphin crashes to often to save the settings on closing only // Save the config. Dolphin crashes to often to save the settings on closing only
SConfig::GetInstance().SaveSettings(); SConfig::GetInstance().SaveSettings();
@ -820,25 +790,23 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case ID_WII_BT_BAR: // Wiimote settings case ID_WII_BT_BAR: // Wiimote settings
m_SYSCONF[BT_BAR] = WiiSensBarPos->GetSelection(); SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", WiiSensBarPos->GetSelection());
break; break;
case ID_WII_IPL_AR: // IPL settings case ID_WII_IPL_AR: // SYSCONF settings
m_SYSCONF[IPL_AR] = WiiAspectRatio->GetSelection(); SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", WiiAspectRatio->GetSelection());
SConfig::GetInstance().m_LocalCoreStartupParameter.bWidescreen = WiiAspectRatio->GetSelection() ? true : false;
break; break;
case ID_WII_IPL_SSV: case ID_WII_IPL_SSV:
m_SYSCONF[IPL_SSV] = WiiScreenSaver->IsChecked(); SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", WiiScreenSaver->IsChecked());
break; break;
case ID_WII_IPL_LNG: case ID_WII_IPL_LNG:
m_SYSCONF[IPL_LNG] = WiiSystemLang->GetSelection(); SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", WiiSystemLang->GetSelection());
break; break;
case ID_WII_IPL_PGS: case ID_WII_IPL_PGS:
m_SYSCONF[IPL_PGS] = WiiProgressiveScan->IsChecked(); SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", WiiProgressiveScan->IsChecked());
SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressiveScan = WiiProgressiveScan->IsChecked();
break; break;
case ID_WII_IPL_E60: case ID_WII_IPL_E60:
m_SYSCONF[IPL_E60] = WiiEuRGB60->IsChecked(); SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", WiiEuRGB60->IsChecked());
break; break;
} }
} }

View File

@ -24,284 +24,222 @@
#include <wx/filepicker.h> #include <wx/filepicker.h>
#include "ConfigManager.h" #include "ConfigManager.h"
class CConfigMain class CConfigMain : public wxDialog
: public wxDialog
{ {
public: public:
CConfigMain(wxWindow* parent, CConfigMain(wxWindow* parent,
wxWindowID id = 1, wxWindowID id = 1,
const wxString& title = wxT("Dolphin Configuration"), const wxString& title = wxT("Dolphin Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE); long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CConfigMain(); virtual ~CConfigMain();
void OnClick(wxMouseEvent& event); void OnClick(wxMouseEvent& event);
void CloseClick(wxCommandEvent& event); void CloseClick(wxCommandEvent& event);
void OnSelectionChanged(wxCommandEvent& event); void OnSelectionChanged(wxCommandEvent& event);
void OnConfig(wxCommandEvent& event); void OnConfig(wxCommandEvent& event);
bool bRefreshList; bool bRefreshList;
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
wxBoxSizer* sGeneralPage; // General Settings wxBoxSizer* sGeneralPage; // General Settings
wxCheckBox* ConfirmStop, *AutoHideCursor; wxCheckBox* ConfirmStop, *AutoHideCursor;
wxCheckBox* HideCursor, *UsePanicHandlers; wxCheckBox* HideCursor, *UsePanicHandlers;
wxCheckBox* WiimoteStatusLEDs, * WiimoteStatusSpeakers; wxCheckBox* WiimoteStatusLEDs, * WiimoteStatusSpeakers;
wxArrayString arrayStringFor_InterfaceLang; wxArrayString arrayStringFor_InterfaceLang;
wxChoice* InterfaceLang; wxChoice* InterfaceLang;
wxArrayString arrayStringFor_Framelimit; wxArrayString arrayStringFor_Framelimit;
wxChoice* Framelimit; wxChoice* Framelimit;
wxRadioBox* Theme; wxRadioBox* Theme;
wxBoxSizer* sCore; wxBoxSizer* sCore;
wxStaticBoxSizer* sbBasic, *sbAdvanced, *sbInterface; wxStaticBoxSizer* sbBasic, *sbAdvanced, *sbInterface;
wxCheckBox* AlwaysUseHLEBIOS; wxCheckBox* AlwaysUseHLEBIOS;
wxCheckBox* UseDynaRec; wxCheckBox* UseDynaRec;
wxCheckBox* UseDualCore; wxCheckBox* UseDualCore;
wxCheckBox* DSPThread; wxCheckBox* DSPThread;
wxCheckBox* LockThreads; wxCheckBox* LockThreads;
wxCheckBox* OptimizeQuantizers; wxCheckBox* OptimizeQuantizers;
wxCheckBox* SkipIdle; wxCheckBox* SkipIdle;
wxCheckBox* EnableCheats; wxCheckBox* EnableCheats;
wxBoxSizer* sGamecube; // GC settings wxBoxSizer* sGamecube; // GC settings
wxStaticBoxSizer* sbGamecubeIPLSettings; wxStaticBoxSizer* sbGamecubeIPLSettings;
wxGridBagSizer* sGamecubeIPLSettings; wxGridBagSizer* sGamecubeIPLSettings;
wxArrayString arrayStringFor_GCSystemLang; wxArrayString arrayStringFor_GCSystemLang;
wxStaticText* GCSystemLangText; wxStaticText* GCSystemLangText;
wxChoice* GCSystemLang; wxChoice* GCSystemLang;
wxChoice *GCEXIDevice[3]; wxChoice *GCEXIDevice[3];
wxButton *GCMemcardPath[2]; wxButton *GCMemcardPath[2];
wxChoice *GCSIDevice[4]; wxChoice *GCSIDevice[4];
wxBoxSizer* sWii; // Wii settings wxBoxSizer* sWii; // Wii settings
wxStaticBoxSizer* sbWiimoteSettings; wxStaticBoxSizer* sbWiimoteSettings;
wxGridBagSizer* sWiimoteSettings; wxGridBagSizer* sWiimoteSettings;
wxStaticBoxSizer* sbWiiIPLSettings; wxStaticBoxSizer* sbWiiIPLSettings;
wxGridBagSizer* sWiiIPLSettings; wxGridBagSizer* sWiiIPLSettings;
wxBoxSizer* sPaths; wxBoxSizer* sPaths;
wxStaticBoxSizer* sbISOPaths; wxStaticBoxSizer* sbISOPaths;
wxBoxSizer* sISOButtons; wxBoxSizer* sISOButtons;
wxGridBagSizer* sOtherPaths; wxGridBagSizer* sOtherPaths;
wxBoxSizer* sPlugins; wxBoxSizer* sPlugins;
wxStaticBoxSizer* sbGraphicsPlugin; wxStaticBoxSizer* sbGraphicsPlugin;
wxStaticBoxSizer* sbDSPPlugin; wxStaticBoxSizer* sbDSPPlugin;
wxStaticBoxSizer* sbPadPlugin; wxStaticBoxSizer* sbPadPlugin;
wxStaticBoxSizer* sbWiimotePlugin; wxStaticBoxSizer* sbWiimotePlugin;
wxNotebook *Notebook; wxNotebook *Notebook;
wxPanel *GeneralPage; wxPanel *GeneralPage;
wxPanel *GamecubePage; wxPanel *GamecubePage;
wxPanel *WiiPage; wxPanel *WiiPage;
wxPanel *PathsPage; wxPanel *PathsPage;
wxPanel *PluginPage; wxPanel *PluginPage;
wxButton* m_Close; wxButton* m_Close;
FILE* pStream;
FILE* pStream; wxArrayString arrayStringFor_WiiSensBarPos; // Wiimote Settings
u8 m_SYSCONF[0x4000]; wxStaticText* WiiSensBarPosText;
bool m_bSysconfOK; wxChoice* WiiSensBarPos;
enum wxCheckBox* WiiScreenSaver; // IPL settings
{ wxCheckBox* WiiProgressiveScan;
BT_DINF = 0x0044, wxCheckBox* WiiEuRGB60;
BT_SENS = 0x04AF, wxArrayString arrayStringFor_WiiAspectRatio;
BT_BAR = 0x04E1, wxStaticText* WiiAspectRatioText;
BT_SPKV = 0x151A, wxChoice* WiiAspectRatio;
BT_MOT = 0x1807 wxArrayString arrayStringFor_WiiSystemLang;
}; wxStaticText* WiiSystemLangText;
enum wxChoice* WiiSystemLang;
{
IPL_AR = 0x04D9,
IPL_SSV = 0x04EA,
IPL_LNG = 0x04F3,
IPL_PGS = 0x17CC,
IPL_E60 = 0x17D5
};
/* Some offsets in SYSCONF: (taken from ector's SYSCONF)
Note: offset is where the actual data starts, not where the type or name begins
offset length name comment
0x0044 0x460 BT.DINF List of Wiimotes "synced" to the system
0x158B ? BT.CDIF ? -- Starts with 0x0204 followed by 0x210 of 0x00
0x04AF 4 BT.SENS Wiimote sensitivity setting
0x04E1 1 BT.BAR Sensor bar position (0:bottom)
0x151A 1 BT.SPKV Wiimote speaker volume
0x1807 1 BT.MOT Wiimote motor on/off
0x17F3 2 IPL.IDL Shutdown mode and idle LED mode wxArrayString arrayStringFor_ISOPaths;
0x17C3 1 IPL.UPT Update Type wxListBox* ISOPaths;
0x04BB 0x16 IPL.NIK Console Nickname wxButton* AddISOPath;
0x04D9 1 IPL.AR Aspect ratio setting. 0: 4:3 1: 16:9 wxButton* RemoveISOPath;
0x04EA 1 IPL.SSV Screen Saver off/on (burn-in reduction) wxCheckBox* RecersiveISOPath;
0x04F3 1 IPL.LNG System Language, see conf.c for some values wxStaticText* DefaultISOText;
0x04FD 0x1007 IPL.SADR "Simple Address" Contains some region info wxFilePickerCtrl* DefaultISO;
0x150E 4 IPL.CB Counter Bias -- difference between RTC and local time, in seconds wxStaticText* DVDRootText;
0x1522 0x50 IPL.PC Parental Control password/setting wxDirPickerCtrl* DVDRoot;
0x17B1 1 IPL.CD Config Done flag -- has initial setup been performed?
0x17BA 1 IPL.CD2 Config2 Done flag -- has network setup been performed?
0x17FF 1 IPL.EULA EULA Done flag -- has EULA been acknowledged?
0x17CC 1 IPL.PGS Use Progressive Scan
0x17D5 1 IPL.E60 Use EuRGB60 (PAL6)
? 1 IPL.SND Sound setting
0x17DD 1 IPL.DH Display Offset (Horiz)
0x179A 4 IPL.INC "Installed Channel App Count"
? ? IPL.ARN ?
0x17A7 4 IPL.FRC "Free Channel App Count"
? ? DEV.BTM ? wxStaticText* PADText;
? ? DEV.VIM ? wxButton* PADConfig;
? ? DEV.CTC ? wxChoice* PADSelection;
? ? DEV.DSM ? wxButton* DSPConfig;
? ? DVD.CNF ? wxStaticText* DSPText;
0x1582 ? WWW.RST WWW Restriction wxChoice* DSPSelection;
? ? NET.CNF ? wxButton* GraphicConfig;
? ? NET.CFG ? wxStaticText* GraphicText;
0x1576 4 NET.CTPC Net Content Restrictions ("Content Parental Control"?) wxChoice* GraphicSelection;
0x17E7 4 NET.WCFG WC24 Configuration flags wxButton* WiimoteConfig;
*/ wxStaticText* WiimoteText;
wxArrayString arrayStringFor_WiiSensBarPos; // Wiimote Settings wxChoice* WiimoteSelection;
wxStaticText* WiiSensBarPosText;
wxChoice* WiiSensBarPos;
wxCheckBox* WiiScreenSaver; // IPL settings enum
wxCheckBox* WiiProgressiveScan; {
wxCheckBox* WiiEuRGB60; ID_NOTEBOOK = 1000,
wxArrayString arrayStringFor_WiiAspectRatio; ID_GENERALPAGE,
wxStaticText* WiiAspectRatioText; ID_GAMECUBEPAGE,
wxChoice* WiiAspectRatio; ID_WIIPAGE,
wxArrayString arrayStringFor_WiiSystemLang; ID_PATHSPAGE,
wxStaticText* WiiSystemLangText; ID_PLUGINPAGE,
wxChoice* WiiSystemLang;
wxArrayString arrayStringFor_ISOPaths; ID_ALLWAYS_HLEBIOS,
wxListBox* ISOPaths; ID_USEDYNAREC,
wxButton* AddISOPath; ID_USEDUALCORE,
wxButton* RemoveISOPath; ID_DSPTHREAD,
wxCheckBox* RecersiveISOPath; ID_LOCKTHREADS,
wxStaticText* DefaultISOText; ID_OPTIMIZEQUANTIZERS,
wxFilePickerCtrl* DefaultISO; ID_IDLESKIP,
wxStaticText* DVDRootText; ID_ENABLECHEATS,
wxDirPickerCtrl* DVDRoot;
wxStaticText* PADText; ID_INTERFACE_CONFIRMSTOP, // Interface settings
wxButton* PADConfig; ID_INTERFACE_USEPANICHANDLERS,
wxChoice* PADSelection; ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR,
wxButton* DSPConfig; ID_INTERFACE_WIIMOTE_TEXT, ID_INTERFACE_WIIMOTE_LEDS, ID_INTERFACE_WIIMOTE_SPEAKERS,
wxStaticText* DSPText; ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG,
wxChoice* DSPSelection; ID_INTERFACE_THEME,
wxButton* GraphicConfig; ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT,
wxStaticText* GraphicText;
wxChoice* GraphicSelection;
wxButton* WiimoteConfig;
wxStaticText* WiimoteText;
wxChoice* WiimoteSelection;
enum ID_GC_SRAM_LNG_TEXT,
{ ID_GC_SRAM_LNG,
ID_NOTEBOOK = 1000, ID_GC_EXIDEVICE_SLOTA_TEXT,
ID_GENERALPAGE, ID_GC_EXIDEVICE_SLOTA,
ID_GAMECUBEPAGE, ID_GC_EXIDEVICE_SLOTA_PATH,
ID_WIIPAGE, ID_GC_EXIDEVICE_SLOTB_TEXT,
ID_PATHSPAGE, ID_GC_EXIDEVICE_SLOTB,
ID_PLUGINPAGE, ID_GC_EXIDEVICE_SLOTB_PATH,
ID_GC_EXIDEVICE_SP1_TEXT,
ID_GC_EXIDEVICE_SP1,
ID_GC_SIDEVICE_TEXT,
ID_GC_SIDEVICE0,
ID_GC_SIDEVICE1,
ID_GC_SIDEVICE2,
ID_GC_SIDEVICE3,
ID_ALLWAYS_HLEBIOS, ID_WII_BT_BAR_TEXT,
ID_USEDYNAREC, ID_WII_BT_BAR,
ID_USEDUALCORE, ID_WII_IPL_SSV,
ID_DSPTHREAD, ID_WII_IPL_PGS,
ID_LOCKTHREADS, ID_WII_IPL_E60,
ID_OPTIMIZEQUANTIZERS, ID_WII_IPL_AR_TEXT,
ID_IDLESKIP, ID_WII_IPL_AR,
ID_ENABLECHEATS, ID_WII_IPL_LNG_TEXT,
ID_WII_IPL_LNG,
ID_INTERFACE_CONFIRMSTOP, // Interface settings ID_ISOPATHS,
ID_INTERFACE_USEPANICHANDLERS, ID_ADDISOPATH,
ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR, ID_REMOVEISOPATH,
ID_INTERFACE_WIIMOTE_TEXT, ID_INTERFACE_WIIMOTE_LEDS, ID_INTERFACE_WIIMOTE_SPEAKERS, ID_RECERSIVEISOPATH,
ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG, ID_DEFAULTISO_TEXT,
ID_INTERFACE_THEME, ID_DEFAULTISO,
ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT, ID_DVDROOT_TEXT,
ID_DVDROOT,
ID_GC_SRAM_LNG_TEXT, ID_WIIMOTE_ABOUT,
ID_GC_SRAM_LNG, ID_WIIMOTE_CONFIG,
ID_GC_EXIDEVICE_SLOTA_TEXT, ID_WIIMOTE_TEXT,
ID_GC_EXIDEVICE_SLOTA, ID_WIIMOTE_CB,
ID_GC_EXIDEVICE_SLOTA_PATH, ID_PAD_TEXT,
ID_GC_EXIDEVICE_SLOTB_TEXT, ID_PAD_ABOUT ,
ID_GC_EXIDEVICE_SLOTB, ID_PAD_CONFIG,
ID_GC_EXIDEVICE_SLOTB_PATH, ID_PAD_CB,
ID_GC_EXIDEVICE_SP1_TEXT, ID_DSP_ABOUT,
ID_GC_EXIDEVICE_SP1, ID_DSP_CONFIG,
ID_GC_SIDEVICE_TEXT, ID_DSP_TEXT,
ID_GC_SIDEVICE0, ID_DSP_CB,
ID_GC_SIDEVICE1, ID_GRAPHIC_ABOUT,
ID_GC_SIDEVICE2, ID_GRAPHIC_CONFIG,
ID_GC_SIDEVICE3, ID_GRAPHIC_TEXT,
ID_GRAPHIC_CB
};
ID_WII_BT_BAR_TEXT, void CreateGUIControls();
ID_WII_BT_BAR, void UpdateGUI();
ID_WII_IPL_SSV, void OnClose(wxCloseEvent& event);
ID_WII_IPL_PGS, void CoreSettingsChanged(wxCommandEvent& event);
ID_WII_IPL_E60, void GCSettingsChanged(wxCommandEvent& event);
ID_WII_IPL_AR_TEXT, void ChooseMemcardPath(std::string& strMemcard, bool isSlotA);
ID_WII_IPL_AR, void ChooseSIDevice(std::string deviceName, int deviceNum);
ID_WII_IPL_LNG_TEXT, void ChooseEXIDevice(std::string deviceName, int deviceNum);
ID_WII_IPL_LNG, void WiiSettingsChanged(wxCommandEvent& event);
void ISOPathsSelectionChanged(wxCommandEvent& event);
void RecursiveDirectoryChanged(wxCommandEvent& event);
void AddRemoveISOPaths(wxCommandEvent& event);
void DefaultISOChanged(wxFileDirPickerEvent& event);
void DVDRootChanged(wxFileDirPickerEvent& event);
ID_ISOPATHS, void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename);
ID_ADDISOPATH, void CallConfig(wxChoice* _pChoice);
ID_REMOVEISOPATH, bool GetFilename(wxChoice* _pChoice, std::string& _rFilename);
ID_RECERSIVEISOPATH,
ID_DEFAULTISO_TEXT,
ID_DEFAULTISO,
ID_DVDROOT_TEXT,
ID_DVDROOT,
ID_WIIMOTE_ABOUT,
ID_WIIMOTE_CONFIG,
ID_WIIMOTE_TEXT,
ID_WIIMOTE_CB,
ID_PAD_TEXT,
ID_PAD_ABOUT ,
ID_PAD_CONFIG,
ID_PAD_CB,
ID_DSP_ABOUT,
ID_DSP_CONFIG,
ID_DSP_TEXT,
ID_DSP_CB,
ID_GRAPHIC_ABOUT,
ID_GRAPHIC_CONFIG,
ID_GRAPHIC_TEXT,
ID_GRAPHIC_CB
};
void CreateGUIControls();
void UpdateGUI();
void OnClose(wxCloseEvent& event);
void CoreSettingsChanged(wxCommandEvent& event);
void GCSettingsChanged(wxCommandEvent& event);
void ChooseMemcardPath(std::string& strMemcard, bool isSlotA);
void ChooseSIDevice(std::string deviceName, int deviceNum);
void ChooseEXIDevice(std::string deviceName, int deviceNum);
void WiiSettingsChanged(wxCommandEvent& event);
void ISOPathsSelectionChanged(wxCommandEvent& event);
void RecursiveDirectoryChanged(wxCommandEvent& event);
void AddRemoveISOPaths(wxCommandEvent& event);
void DefaultISOChanged(wxFileDirPickerEvent& event);
void DVDRootChanged(wxFileDirPickerEvent& event);
void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename);
void CallConfig(wxChoice* _pChoice);
bool GetFilename(wxChoice* _pChoice, std::string& _rFilename);
}; };
#endif #endif

View File

@ -95,8 +95,8 @@ std::string Summarize_Settings()
Core::GetStartupParameter().bRunCompareClient?"True":"False", Core::GetStartupParameter().bRunCompareClient?"True":"False",
Core::GetStartupParameter().iTLBHack?"True":"False", Core::GetStartupParameter().iTLBHack?"True":"False",
SConfig::GetInstance().m_Framelimit*5, SConfig::GetInstance().m_Framelimit*5,
Core::GetStartupParameter().bWidescreen?"True":"False", SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR")?"True":"False",
Core::GetStartupParameter().bProgressiveScan?"True":"False" SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.PGS")?"True":"False"
); );
} }