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 "Globals.h"
#include "Common.h"
#include "IniFile.h"
#include "Config.h"
#include "ConfigManager.h"
#ifdef __APPLE__
#include <CoreFoundation/CFString.h>
#include <CoreFoundation/CFUrl.h>
@ -92,8 +91,14 @@ void SConfig::SaveSettings()
// Plugins
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin);
ini.Set("Core", "WiiMotePlugin", m_LocalCoreStartupParameter.m_strWiimotePlugin);
ini.Set("Core", "Pad1Plugin", m_LocalCoreStartupParameter.m_strPadPlugin[0]);
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);
@ -186,7 +191,13 @@ void SConfig::LoadSettings()
// 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());
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin, m_DefaultPADPlugin.c_str());
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin, m_DefaultWiiMotePlugin.c_str());
ini.Get("Core", "Pad1Plugin", &m_LocalCoreStartupParameter.m_strPadPlugin[0], m_DefaultPADPlugin.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>
#define MAXPADS 4
#define MAXWIIMOTES 4
struct SCoreStartupParameter
{
@ -89,9 +91,9 @@ struct SCoreStartupParameter
// files
std::string m_strVideoPlugin;
std::string m_strPadPlugin;
std::string m_strPadPlugin[MAXPADS];
std::string m_strDSPPlugin;
std::string m_strWiimotePlugin;
std::string m_strWiimotePlugin[MAXWIIMOTES];
std::string m_strFilename;
std::string m_strBios;

View File

@ -69,17 +69,33 @@ bool CPluginManager::InitPlugins(SCoreStartupParameter scsp) {
if (!m_video)
return false;
for (int i=0;i<1;i++) {
m_pad[i] = (Common::PluginPAD*)LoadPlugin(scsp.m_strPadPlugin.c_str());
if (m_pad[i] == NULL)
return false;
bool pad = false;
bool wiimote = 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)
return false;
wiimote = true;
}
if (! wiimote)
return false;
}
return true;

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@
#include "ISOFile.h"
#include "Volume.h"
#include "VolumeCreator.h"
#include "Config.h"
#include "ConfigManager.h"
#include "Core.h"
#if defined(HAVE_WX) && HAVE_WX
#include "ConfigMain.h"

View File

@ -26,6 +26,7 @@
#include "Globals.h" // Local
#include "ConfigMain.h"
#include "PluginManager.h"
#include "ConfigManager.h"
#include "Frame.h"
//////////////////////////////////////
@ -407,8 +408,11 @@ void CConfigMain::CreateGUIControls()
FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
for (int i=0;i<MAXPADS;i++)
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);
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(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0]);
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)

View File

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

View File

@ -19,7 +19,7 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Windows
/* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
/* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
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
@ -48,7 +48,7 @@ be accessed from Core::GetWindowHandle().
#include "FileUtil.h"
#include "Timer.h"
#include "Config.h" // Core
#include "ConfigManager.h" // Core
#include "Core.h"
#include "HW/DVDInterface.h"
#include "State.h"
@ -202,7 +202,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
//////////////////////////////////////////////////
// Music mod
// ¯¯¯¯¯¯¯¯¯¯
// ¯¯¯¯¯¯¯¯¯¯
#ifdef MUSICMOD
MM_PopulateGUI();
#endif
@ -217,7 +217,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
//////////////////////////////////////////////////
// Delete and recreate the toolbar
// ¯¯¯¯¯¯¯¯¯¯
// ¯¯¯¯¯¯¯¯¯¯
void CFrame::RecreateToolbar()
{
@ -556,14 +556,14 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
{
CPluginManager::GetInstance().OpenConfig(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin.c_str()
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0].c_str()
);
}
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
{
CPluginManager::GetInstance().OpenConfig(
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 "Common.h"
#include "Config.h"
#include "ConfigManager.h"
#include "Core.h"
#include "State.h"
#include "ConfigMain.h"

View File

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

View File

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

View File

@ -7,7 +7,7 @@ wxenv = env.Clone()
files = [
'BootManager.cpp',
'Config.cpp',
# 'Config.cpp',
'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
// eventHandler->RemoveEventListener(oldKey);
eventHandler->RemoveEventListener(oldKey);
}
pad[nPad].keyForControl[id] = code;