mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
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:
parent
a08c801256
commit
aff34e6789
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="Common"
|
||||
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
|
||||
RootNamespace="Common"
|
||||
@ -812,6 +812,14 @@
|
||||
RelativePath=".\Src\SymbolDB.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SysConf.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SysConf.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Thread.cpp"
|
||||
>
|
||||
|
156
Source/Core/Common/Src/SysConf.cpp
Normal file
156
Source/Core/Common/Src/SysConf.cpp
Normal 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());
|
||||
}
|
122
Source/Core/Common/Src/SysConf.h
Normal file
122
Source/Core/Common/Src/SysConf.h
Normal 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__
|
@ -38,6 +38,7 @@ SConfig::SConfig()
|
||||
SConfig::~SConfig()
|
||||
{
|
||||
SaveSettings();
|
||||
delete m_SYSCONF;
|
||||
}
|
||||
|
||||
|
||||
@ -122,10 +123,6 @@ void SConfig::SaveSettings()
|
||||
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
||||
ini.Set("Core", "FrameLimit", m_Framelimit);
|
||||
|
||||
// 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);
|
||||
@ -141,12 +138,13 @@ void SConfig::SaveSettings()
|
||||
#else
|
||||
ini.Save(CONFIG_FILE);
|
||||
#endif
|
||||
|
||||
m_SYSCONF->Save();
|
||||
}
|
||||
|
||||
|
||||
void SConfig::LoadSettings()
|
||||
{
|
||||
|
||||
NOTICE_LOG(BOOT, "Loading Settings from %s", CONFIG_FILE);
|
||||
IniFile ini;
|
||||
#if defined(__APPLE__)
|
||||
@ -239,10 +237,6 @@ void SConfig::LoadSettings()
|
||||
ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0);
|
||||
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
|
||||
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.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());
|
||||
}
|
||||
|
||||
m_SYSCONF = new SysConf();
|
||||
}
|
||||
void SConfig::LoadSettingsHLE()
|
||||
{
|
||||
IniFile ini;
|
||||
//
|
||||
ini.Load(FULL_CONFIG_DIR "DSP.ini");
|
||||
ini.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "Boot/Boot.h"
|
||||
#include "HW/EXI_Device.h"
|
||||
#include "HW/SI_Device.h"
|
||||
#include "SysConf.h"
|
||||
|
||||
// HyperIris: not sure but a temporary implement
|
||||
enum INTERFACE_LANGUAGE
|
||||
@ -80,6 +81,8 @@ struct SConfig
|
||||
bool m_ListUsa;
|
||||
bool m_ListJap;
|
||||
|
||||
SysConf* m_SYSCONF;
|
||||
|
||||
// save settings
|
||||
void SaveSettings();
|
||||
|
||||
|
@ -75,8 +75,7 @@ struct SCoreStartupParameter
|
||||
int SelectedLanguage;
|
||||
|
||||
// Wii settings
|
||||
bool bWii; bool bWiiLeds; bool bWiiSpeakers;
|
||||
bool bWidescreen, bProgressiveScan;
|
||||
bool bWii, bWiiLeds, bWiiSpeakers;
|
||||
|
||||
// Interface settings
|
||||
bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers;
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "Volume.h"
|
||||
#include "VolumeCreator.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "SysConf.h"
|
||||
#include "Core.h"
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "ConfigMain.h"
|
||||
@ -127,24 +128,8 @@ bool BootCore(const std::string& _rFilename)
|
||||
// Wii settings
|
||||
if (StartUp.bWii)
|
||||
{
|
||||
game_ini.Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan);
|
||||
game_ini.Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen);
|
||||
// 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);
|
||||
}
|
||||
// Flush possible changes to SYSCONF to file
|
||||
SConfig::GetInstance().m_SYSCONF->Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "ConfigMain.h"
|
||||
#include "PluginManager.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "SysConf.h"
|
||||
#include "Frame.h"
|
||||
|
||||
|
||||
@ -98,21 +99,6 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
|
||||
// Control refreshing of the ISOs list
|
||||
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();
|
||||
|
||||
// Update selected ISO paths
|
||||
@ -437,29 +423,27 @@ void CConfigMain::CreateGUIControls()
|
||||
GamecubePage->SetSizer(sGamecube);
|
||||
sGamecube->Layout();
|
||||
|
||||
|
||||
|
||||
// Wii page
|
||||
sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
|
||||
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);
|
||||
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->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->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->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"));
|
||||
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]!=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);
|
||||
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
|
||||
sWii = new wxBoxSizer(wxVERTICAL);
|
||||
@ -594,22 +578,8 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE);
|
||||
|
||||
// First check that we did successfully populate m_SYSCONF earlier, otherwise don't
|
||||
// save anything, it will be a corrupted file
|
||||
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);
|
||||
}
|
||||
}
|
||||
// Sysconf saves when it gets deleted
|
||||
//delete SConfig::GetInstance().m_SYSCONF;
|
||||
|
||||
// Save the config. Dolphin crashes to often to save the settings on closing only
|
||||
SConfig::GetInstance().SaveSettings();
|
||||
@ -820,25 +790,23 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_WII_BT_BAR: // Wiimote settings
|
||||
m_SYSCONF[BT_BAR] = WiiSensBarPos->GetSelection();
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", WiiSensBarPos->GetSelection());
|
||||
break;
|
||||
|
||||
case ID_WII_IPL_AR: // IPL settings
|
||||
m_SYSCONF[IPL_AR] = WiiAspectRatio->GetSelection();
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bWidescreen = WiiAspectRatio->GetSelection() ? true : false;
|
||||
case ID_WII_IPL_AR: // SYSCONF settings
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", WiiAspectRatio->GetSelection());
|
||||
break;
|
||||
case ID_WII_IPL_SSV:
|
||||
m_SYSCONF[IPL_SSV] = WiiScreenSaver->IsChecked();
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", WiiScreenSaver->IsChecked());
|
||||
break;
|
||||
case ID_WII_IPL_LNG:
|
||||
m_SYSCONF[IPL_LNG] = WiiSystemLang->GetSelection();
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", WiiSystemLang->GetSelection());
|
||||
break;
|
||||
case ID_WII_IPL_PGS:
|
||||
m_SYSCONF[IPL_PGS] = WiiProgressiveScan->IsChecked();
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressiveScan = WiiProgressiveScan->IsChecked();
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", WiiProgressiveScan->IsChecked());
|
||||
break;
|
||||
case ID_WII_IPL_E60:
|
||||
m_SYSCONF[IPL_E60] = WiiEuRGB60->IsChecked();
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", WiiEuRGB60->IsChecked());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,9 @@
|
||||
#include <wx/filepicker.h>
|
||||
#include "ConfigManager.h"
|
||||
|
||||
class CConfigMain
|
||||
: public wxDialog
|
||||
class CConfigMain : public wxDialog
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
CConfigMain(wxWindow* parent,
|
||||
wxWindowID id = 1,
|
||||
@ -44,7 +43,7 @@ class CConfigMain
|
||||
|
||||
bool bRefreshList;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
@ -106,68 +105,8 @@ class CConfigMain
|
||||
|
||||
wxButton* m_Close;
|
||||
|
||||
|
||||
FILE* pStream;
|
||||
u8 m_SYSCONF[0x4000];
|
||||
bool m_bSysconfOK;
|
||||
|
||||
enum
|
||||
{
|
||||
BT_DINF = 0x0044,
|
||||
BT_SENS = 0x04AF,
|
||||
BT_BAR = 0x04E1,
|
||||
BT_SPKV = 0x151A,
|
||||
BT_MOT = 0x1807
|
||||
};
|
||||
enum
|
||||
{
|
||||
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
|
||||
0x17C3 1 IPL.UPT Update Type
|
||||
0x04BB 0x16 IPL.NIK Console Nickname
|
||||
0x04D9 1 IPL.AR Aspect ratio setting. 0: 4:3 1: 16:9
|
||||
0x04EA 1 IPL.SSV Screen Saver off/on (burn-in reduction)
|
||||
0x04F3 1 IPL.LNG System Language, see conf.c for some values
|
||||
0x04FD 0x1007 IPL.SADR "Simple Address" Contains some region info
|
||||
0x150E 4 IPL.CB Counter Bias -- difference between RTC and local time, in seconds
|
||||
0x1522 0x50 IPL.PC Parental Control password/setting
|
||||
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 ?
|
||||
? ? DEV.VIM ?
|
||||
? ? DEV.CTC ?
|
||||
? ? DEV.DSM ?
|
||||
? ? DVD.CNF ?
|
||||
0x1582 ? WWW.RST WWW Restriction
|
||||
? ? NET.CNF ?
|
||||
? ? NET.CFG ?
|
||||
0x1576 4 NET.CTPC Net Content Restrictions ("Content Parental Control"?)
|
||||
0x17E7 4 NET.WCFG WC24 Configuration flags
|
||||
*/
|
||||
wxArrayString arrayStringFor_WiiSensBarPos; // Wiimote Settings
|
||||
wxStaticText* WiiSensBarPosText;
|
||||
wxChoice* WiiSensBarPos;
|
||||
@ -303,5 +242,4 @@ class CConfigMain
|
||||
void CallConfig(wxChoice* _pChoice);
|
||||
bool GetFilename(wxChoice* _pChoice, std::string& _rFilename);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -95,8 +95,8 @@ std::string Summarize_Settings()
|
||||
Core::GetStartupParameter().bRunCompareClient?"True":"False",
|
||||
Core::GetStartupParameter().iTLBHack?"True":"False",
|
||||
SConfig::GetInstance().m_Framelimit*5,
|
||||
Core::GetStartupParameter().bWidescreen?"True":"False",
|
||||
Core::GetStartupParameter().bProgressiveScan?"True":"False"
|
||||
SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR")?"True":"False",
|
||||
SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.PGS")?"True":"False"
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user