Move Config.cpp to Core renamed it to ConfigManager

Todo: Use it from core.cpp instead of the params


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1905 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-01-17 23:41:21 +00:00
parent ee2bf31e56
commit 4433e06447
16 changed files with 77 additions and 37 deletions

View File

@ -17,10 +17,9 @@
#include <string> #include <string>
#include "Globals.h"
#include "Common.h" #include "Common.h"
#include "IniFile.h" #include "IniFile.h"
#include "Config.h" #include "ConfigManager.h"
#ifdef __APPLE__ #ifdef __APPLE__
#include <CoreFoundation/CFString.h> #include <CoreFoundation/CFString.h>
#include <CoreFoundation/CFUrl.h> #include <CoreFoundation/CFUrl.h>
@ -92,8 +91,14 @@ void SConfig::SaveSettings()
// 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);
ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin); ini.Set("Core", "Pad1Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[0]);
ini.Set("Core", "WiiMotePlugin", m_LocalCoreStartupParameter.m_strWiimotePlugin); ini.Set("Core", "Pad2Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[1]);
ini.Set("Core", "Pad3Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[2]);
ini.Set("Core", "Pad4Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[3]);
ini.Set("Core", "WiiMote1Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
ini.Set("Core", "WiiMote2Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[1]);
ini.Set("Core", "WiiMote3Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[2]);
ini.Set("Core", "WiiMote4Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[3]);
} }
ini.Save(CONFIG_FILE); ini.Save(CONFIG_FILE);
@ -186,7 +191,13 @@ void SConfig::LoadSettings()
// 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());
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin, m_DefaultPADPlugin.c_str()); ini.Get("Core", "Pad1Plugin", &m_LocalCoreStartupParameter.m_strPadPlugin[0], m_DefaultPADPlugin.c_str());
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin, m_DefaultWiiMotePlugin.c_str()); ini.Get("Core", "Pad2Plugin", &m_LocalCoreStartupParameter.m_strPadPlugin[1], m_DefaultPADPlugin.c_str());
ini.Get("Core", "Pad3Plugin", &m_LocalCoreStartupParameter.m_strPadPlugin[2], m_DefaultPADPlugin.c_str());
ini.Get("Core", "Pad4Plugin", &m_LocalCoreStartupParameter.m_strPadPlugin[3], m_DefaultPADPlugin.c_str());
ini.Get("Core", "WiiMote1Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[0], m_DefaultWiiMotePlugin.c_str());
ini.Get("Core", "WiiMote2Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[1], m_DefaultWiiMotePlugin.c_str());
ini.Get("Core", "WiiMote3Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[2], m_DefaultWiiMotePlugin.c_str());
ini.Get("Core", "WiiMote4Plugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[3], m_DefaultWiiMotePlugin.c_str());
} }
} }

View File

@ -24,6 +24,8 @@
#include <string> #include <string>
#define MAXPADS 4
#define MAXWIIMOTES 4
struct SCoreStartupParameter struct SCoreStartupParameter
{ {
@ -89,9 +91,9 @@ struct SCoreStartupParameter
// files // files
std::string m_strVideoPlugin; std::string m_strVideoPlugin;
std::string m_strPadPlugin; std::string m_strPadPlugin[MAXPADS];
std::string m_strDSPPlugin; std::string m_strDSPPlugin;
std::string m_strWiimotePlugin; std::string m_strWiimotePlugin[MAXWIIMOTES];
std::string m_strFilename; std::string m_strFilename;
std::string m_strBios; std::string m_strBios;

View File

@ -69,17 +69,33 @@ bool CPluginManager::InitPlugins(SCoreStartupParameter scsp) {
if (!m_video) if (!m_video)
return false; return false;
for (int i=0;i<1;i++) { bool pad = false;
m_pad[i] = (Common::PluginPAD*)LoadPlugin(scsp.m_strPadPlugin.c_str()); bool wiimote = false;
if (m_pad[i] == NULL)
return false; for (int i=0;i<MAXPADS;i++) {
if (! scsp.m_strPadPlugin[i].empty())
m_pad[i] =
(Common::PluginPAD*)LoadPlugin(scsp.m_strPadPlugin[i].c_str());
if (m_pad[i] != NULL)
pad = true;
}
if (! pad)
return false;
if (scsp.bWii) {
for (int i=0;i<MAXWIIMOTES;i++) {
if (! scsp.m_strWiimotePlugin[i].empty())
m_wiimote[i] = (Common::PluginWiimote*)LoadPlugin
(scsp.m_strWiimotePlugin[i].c_str());
if (scsp.bWii) {
m_wiimote[i] = (Common::PluginWiimote*)LoadPlugin
(scsp.m_strWiimotePlugin.c_str());
if (m_wiimote[i] == NULL) if (m_wiimote[i] == NULL)
return false; wiimote = true;
} }
if (! wiimote)
return false;
} }
return true; return true;

View File

@ -3,6 +3,7 @@
Import('env') Import('env')
files = ["Console.cpp", files = ["Console.cpp",
"ConfigManager.cpp",
"Core.cpp", "Core.cpp",
"CoreTiming.cpp", "CoreTiming.cpp",
"CoreParameter.cpp", "CoreParameter.cpp",

View File

@ -64,7 +64,7 @@
#include "PowerPC/Jit64/JitCache.h" // for ClearCache() #include "PowerPC/Jit64/JitCache.h" // for ClearCache()
#include "PluginManager.h" #include "PluginManager.h"
#include "../../DolphinWX/Src/Config.h" #include "ConfigManager.h"
extern "C" // Bitmaps extern "C" // Bitmaps

View File

@ -18,7 +18,7 @@
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Include // Include
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
#include "Common.h" #include "Common.h"
#include <wx/button.h> #include <wx/button.h>
@ -64,7 +64,7 @@
#include "PowerPC/Jit64/JitCache.h" // for ClearCache() #include "PowerPC/Jit64/JitCache.h" // for ClearCache()
#include "PluginManager.h" #include "PluginManager.h"
#include "../../DolphinWX/Src/Config.h" #include "ConfigManager.h"
extern "C" // Bitmaps extern "C" // Bitmaps
@ -80,7 +80,7 @@ extern "C" // Bitmaps
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions // Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
// and here are the classes // and here are the classes
class CPluginInfo; class CPluginInfo;
class CPluginManager; class CPluginManager;

View File

@ -49,7 +49,7 @@
#include "ISOFile.h" #include "ISOFile.h"
#include "Volume.h" #include "Volume.h"
#include "VolumeCreator.h" #include "VolumeCreator.h"
#include "Config.h" #include "ConfigManager.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"

View File

@ -26,6 +26,7 @@
#include "Globals.h" // Local #include "Globals.h" // Local
#include "ConfigMain.h" #include "ConfigMain.h"
#include "PluginManager.h" #include "PluginManager.h"
#include "ConfigManager.h"
#include "Frame.h" #include "Frame.h"
////////////////////////////////////// //////////////////////////////////////
@ -407,8 +408,11 @@ void CConfigMain::CreateGUIControls()
FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin); FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin); FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin); for (int i=0;i<MAXPADS;i++)
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin); FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
for (int i=0;i<MAXWIIMOTES;i++)
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
sPlugins = new wxBoxSizer(wxVERTICAL); sPlugins = new wxBoxSizer(wxVERTICAL);
sbGraphicsPlugin->Add(GraphicSelection, 1, wxEXPAND|wxALL, 5); sbGraphicsPlugin->Add(GraphicSelection, 1, wxEXPAND|wxALL, 5);
@ -646,8 +650,14 @@ void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
{ {
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin); GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin); GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin); GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0]);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin); GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[1]);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[2]);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[3]);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[1]);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[2]);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[3]);
} }
void CConfigMain::OnConfig(wxCommandEvent& event) void CConfigMain::OnConfig(wxCommandEvent& event)

View File

@ -48,7 +48,7 @@ be accessed from Core::GetWindowHandle().
#include "FileUtil.h" #include "FileUtil.h"
#include "Timer.h" #include "Timer.h"
#include "Config.h" // Core #include "ConfigManager.h" // Core
#include "Core.h" #include "Core.h"
#include "HW/DVDInterface.h" #include "HW/DVDInterface.h"
#include "State.h" #include "State.h"

View File

@ -19,7 +19,7 @@
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Windows // Windows
/* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ /* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CFrame is the main parent window. Inside CFrame there is m_Panel which is the parent for CFrame is the main parent window. Inside CFrame there is m_Panel which is the parent for
the rendering window (when we render to the main window). In Windows the rendering window is the rendering window (when we render to the main window). In Windows the rendering window is
@ -48,7 +48,7 @@ be accessed from Core::GetWindowHandle().
#include "FileUtil.h" #include "FileUtil.h"
#include "Timer.h" #include "Timer.h"
#include "Config.h" // Core #include "ConfigManager.h" // Core
#include "Core.h" #include "Core.h"
#include "HW/DVDInterface.h" #include "HW/DVDInterface.h"
#include "State.h" #include "State.h"
@ -202,7 +202,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
////////////////////////////////////////////////// //////////////////////////////////////////////////
// Music mod // Music mod
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
#ifdef MUSICMOD #ifdef MUSICMOD
MM_PopulateGUI(); MM_PopulateGUI();
#endif #endif
@ -217,7 +217,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
////////////////////////////////////////////////// //////////////////////////////////////////////////
// Delete and recreate the toolbar // Delete and recreate the toolbar
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
void CFrame::RecreateToolbar() void CFrame::RecreateToolbar()
{ {
@ -556,14 +556,14 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
{ {
CPluginManager::GetInstance().OpenConfig( CPluginManager::GetInstance().OpenConfig(
GetHandle(), GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin.c_str() SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0].c_str()
); );
} }
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event)) void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
{ {
CPluginManager::GetInstance().OpenConfig( CPluginManager::GetInstance().OpenConfig(
GetHandle(), GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str() SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[0].c_str()
); );
} }

View File

@ -25,7 +25,7 @@
#include "BootManager.h" #include "BootManager.h"
#include "Common.h" #include "Common.h"
#include "Config.h" #include "ConfigManager.h"
#include "Core.h" #include "Core.h"
#include "State.h" #include "State.h"
#include "ConfigMain.h" #include "ConfigMain.h"

View File

@ -24,7 +24,7 @@
#include "FileSearch.h" #include "FileSearch.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "Config.h" #include "ConfigManager.h"
#include "GameListCtrl.h" #include "GameListCtrl.h"
#include "Blob.h" #include "Blob.h"
#include "ISOProperties.h" #include "ISOProperties.h"

View File

@ -41,7 +41,7 @@
#include "Main.h" // Local #include "Main.h" // Local
#include "Frame.h" #include "Frame.h"
#include "Config.h" #include "ConfigManager.h"
#include "CodeWindow.h" #include "CodeWindow.h"
#include "LogWindow.h" #include "LogWindow.h"
#include "ExtendedTrace.h" #include "ExtendedTrace.h"

View File

@ -7,7 +7,7 @@ wxenv = env.Clone()
files = [ files = [
'BootManager.cpp', 'BootManager.cpp',
'Config.cpp', # 'Config.cpp',
'cmdline.c', 'cmdline.c',
] ]

View File

@ -122,7 +122,7 @@ bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
// Might be not be registered yet // Might be not be registered yet
// eventHandler->RemoveEventListener(oldKey); eventHandler->RemoveEventListener(oldKey);
} }
pad[nPad].keyForControl[id] = code; pad[nPad].keyForControl[id] = code;