Core now uses SConfig and not startup params

Please check everything is working well


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1911 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-01-18 00:45:48 +00:00
parent 426d868adc
commit 8fdf439c9a
4 changed files with 52 additions and 78 deletions

View File

@ -53,6 +53,7 @@
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "PluginManager.h" #include "PluginManager.h"
#include "ConfigManager.h"
#include "MemTools.h" #include "MemTools.h"
#include "Host.h" #include "Host.h"
@ -173,10 +174,10 @@ bool Init(const SCoreStartupParameter _CoreParameter)
// start the thread again // start the thread again
_dbg_assert_(HLE, g_pThread == NULL); _dbg_assert_(HLE, g_pThread == NULL);
if (!pManager.InitPlugins(_CoreParameter)) if (!pManager.InitPlugins())
return false; return false;
g_CoreStartupParameter = _CoreParameter; g_CoreStartupParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
emuThreadGoing.Init(); emuThreadGoing.Init();
// This will execute EmuThread() further down in this file // This will execute EmuThread() further down in this file

View File

@ -22,18 +22,22 @@
#include "FileSearch.h" #include "FileSearch.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "PluginManager.h" #include "PluginManager.h"
#include "ConfigManager.h"
#include "LogManager.h"
#include "StringUtil.h" #include "StringUtil.h"
CPluginManager CPluginManager::m_Instance; CPluginManager CPluginManager::m_Instance;
CPluginManager::CPluginManager() CPluginManager::CPluginManager() :
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
{ {
m_PluginGlobals = new PLUGIN_GLOBALS; m_PluginGlobals = new PLUGIN_GLOBALS;
m_PluginGlobals->eventHandler = EventHandler::GetInstance(); m_PluginGlobals->eventHandler = EventHandler::GetInstance();
m_PluginGlobals->config = NULL; m_PluginGlobals->config = (void *)&SConfig::GetInstance();
m_PluginGlobals->messageLogger = NULL; m_PluginGlobals->messageLogger = NULL;
} }
@ -48,54 +52,57 @@ CPluginManager::~CPluginManager()
if (m_video) if (m_video)
delete m_video; delete m_video;
for (int i=0;i<1;i++) { for (int i=0;i<MAXPADS;i++) {
if (m_pad[i]) if (m_pad[i])
delete m_pad[i]; delete m_pad[i];
}
for (int i=0;i<MAXWIIMOTES;i++) {
if (m_wiimote[i]) if (m_wiimote[i])
delete m_wiimote[i]; delete m_wiimote[i];
} }
} }
bool CPluginManager::InitPlugins(SCoreStartupParameter scsp) { bool CPluginManager::InitPlugins() {
// TODO error checking if (! GetVideo()) {
m_dsp = (Common::PluginDSP*)LoadPlugin(scsp.m_strDSPPlugin.c_str()); PanicAlert("Can't init Video Plugin");
if (!m_dsp) {
return false; return false;
} }
m_video = (Common::PluginVideo*)LoadPlugin(scsp.m_strVideoPlugin.c_str()); if (! GetDSP()) {
if (!m_video) PanicAlert("Can't init DSP Plugin");
return false; return false;
}
bool pad = false; bool pad = false;
bool wiimote = false; bool wiimote = false;
for (int i=0;i<MAXPADS;i++) { for (int i=0;i<MAXPADS;i++) {
if (! scsp.m_strPadPlugin[i].empty()) if (! m_params.m_strPadPlugin[i].empty())
m_pad[i] = GetPAD(i);
(Common::PluginPAD*)LoadPlugin(scsp.m_strPadPlugin[i].c_str());
if (m_pad[i] != NULL) if (m_pad[i] != NULL)
pad = true; pad = true;
} }
if (! pad) if (! pad) {
PanicAlert("Can't init any PAD Plugins");
return false; return false;
}
if (scsp.bWii) { if (m_params.bWii) {
for (int i=0;i<MAXWIIMOTES;i++) { for (int i=0;i<MAXWIIMOTES;i++) {
if (! scsp.m_strWiimotePlugin[i].empty()) if (! m_params.m_strWiimotePlugin[i].empty())
m_wiimote[i] = (Common::PluginWiimote*)LoadPlugin GetWiimote(i);
(scsp.m_strWiimotePlugin[i].c_str());
if (m_wiimote[i] == NULL) if (m_wiimote[i] != NULL)
wiimote = true; wiimote = true;
} }
if (! wiimote) if (! wiimote) {
PanicAlert("Can't init any Wiimote Plugins");
return false; return false;
}
} }
return true; return true;
@ -159,29 +166,32 @@ void CPluginManager::ScanForPlugins()
} }
Common::PluginPAD *CPluginManager::GetPAD(int controller) { Common::PluginPAD *CPluginManager::GetPAD(int controller) {
// if (m_pad[controller] == NULL) if (m_pad[controller] == NULL)
// InitPlugins(); m_pad[controller] = (Common::PluginPAD*)LoadPlugin
(m_params.m_strPadPlugin[controller].c_str());
return m_pad[controller]; return m_pad[controller];
} }
Common::PluginWiimote *CPluginManager::GetWiimote(int controller) { Common::PluginWiimote *CPluginManager::GetWiimote(int controller) {
// if (m_wiimote[controller] == NULL) if (m_wiimote[controller] == NULL)
// InitPlugins(); m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin
(m_params.m_strWiimotePlugin[controller].c_str());
return m_wiimote[controller]; return m_wiimote[controller];
} }
Common::PluginDSP *CPluginManager::GetDSP() { Common::PluginDSP *CPluginManager::GetDSP() {
// if (m_dsp == NULL) if (m_dsp == NULL)
// InitPlugins(); m_dsp = (Common::PluginDSP*)LoadPlugin(m_params.m_strDSPPlugin.c_str());
return m_dsp; return m_dsp;
} }
Common::PluginVideo *CPluginManager::GetVideo() { Common::PluginVideo *CPluginManager::GetVideo() {
// if (m_video == NULL)
// InitPlugins(); if (m_video == NULL)
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str());
return m_video; return m_video;
} }
@ -239,12 +249,6 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
// ------------- // -------------
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show) void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
{ {
//int ret = 1;
//int ret = Common::CPlugin::Load(_rFilename, true);
//int ret = PluginVideo::LoadPlugin(_rFilename);
//int ret = PluginDSP::LoadPlugin(_rFilename);
if (Type == PLUGIN_TYPE_VIDEO) { if (Type == PLUGIN_TYPE_VIDEO) {
if(!m_video) if(!m_video)
m_video = (Common::PluginVideo*)LoadPlugin(_rFilename); m_video = (Common::PluginVideo*)LoadPlugin(_rFilename);
@ -254,27 +258,6 @@ void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYP
m_dsp = (Common::PluginDSP*)LoadPlugin(_rFilename); m_dsp = (Common::PluginDSP*)LoadPlugin(_rFilename);
m_dsp->Debug((HWND)_Parent, Show); m_dsp->Debug((HWND)_Parent, Show);
} }
/* if (Type)
{
//Common::CPlugin::Debug((HWND)_Parent);
if (!PluginVideo::IsLoaded())
PluginVideo::LoadPlugin(_rFilename);
//PluginVideo::SetDllGlobals(m_PluginGlobals);
PluginVideo::Debug((HWND)_Parent, Show);
}
else
{
if(!PluginDSP::IsLoaded())
PluginDSP::LoadPlugin(_rFilename);
//PluginDSP::SetDllGlobals(m_PluginGlobals);
PluginDSP::Debug((HWND)_Parent, Show);
}*/
//Common::CPlugin::Release(); // this is only if the wx dialog is called with ShowModal()
//m_DllDebugger = (void (__cdecl*)(HWND))PluginVideo::plugin.Get("DllDebugger");
//m_DllDebugger(NULL);
} }
// ---------------------------------------- // ----------------------------------------
@ -294,17 +277,6 @@ CPluginInfo::CPluginInfo(const char *_rFileName)
delete plugin; delete plugin;
} }
/*
The DLL loading code provides enough error messages already. Possibly make some return codes
and handle messages here instead?
else
{
if (!File::Exists(_rFileName)) {
PanicAlert("Could not load plugin %s - file does not exist", _rFileName);
} else {
PanicAlert("Failed to load plugin %s - unknown error.\n", _rFileName);
}
}*/
} }

View File

@ -51,7 +51,7 @@ public:
Common::PluginDSP *GetDSP(); Common::PluginDSP *GetDSP();
Common::PluginVideo *GetVideo(); Common::PluginVideo *GetVideo();
bool InitPlugins(SCoreStartupParameter scsp); bool InitPlugins();
void ShutdownPlugins(); void ShutdownPlugins();
void ScanForPlugins(); void ScanForPlugins();
void OpenConfig(void* _Parent, const char *_rFilename); void OpenConfig(void* _Parent, const char *_rFilename);
@ -69,6 +69,7 @@ private:
Common::PluginWiimote *m_wiimote[4]; Common::PluginWiimote *m_wiimote[4];
Common::PluginDSP *m_dsp; Common::PluginDSP *m_dsp;
SCoreStartupParameter& m_params;
CPluginManager(); CPluginManager();
~CPluginManager(); ~CPluginManager();
void *LoadPlugin(const char *_rFilename); void *LoadPlugin(const char *_rFilename);

View File

@ -78,7 +78,7 @@ extern "C" HINSTANCE wxGetInstance();
bool BootCore(const std::string& _rFilename) bool BootCore(const std::string& _rFilename)
{ {
SCoreStartupParameter StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter; SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
// Use custom settings for debugging mode // Use custom settings for debugging mode
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
@ -100,7 +100,7 @@ bool BootCore(const std::string& _rFilename)
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO; StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
StartUp.m_strFilename = _rFilename; StartUp.m_strFilename = _rFilename;
SConfig::GetInstance().m_LastFilename = StartUp.m_strFilename; // SConfig::GetInstance().m_LastFilename = StartUp.m_strFilename;
StartUp.bRunCompareClient = false; StartUp.bRunCompareClient = false;
StartUp.bRunCompareServer = false; StartUp.bRunCompareServer = false;
std::string BaseDataPath; std::string BaseDataPath;
@ -184,9 +184,9 @@ bool BootCore(const std::string& _rFilename)
// --------- // ---------
// Save some values to our local version of SCoreStartupParameter // Save some values to our local version of SCoreStartupParameter
SConfig::GetInstance().m_LocalCoreStartupParameter.bWii = StartUp.bWii; // SConfig::GetInstance().m_LocalCoreStartupParameter.bWii = StartUp.bWii;
SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC = StartUp.bNTSC; // SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC = StartUp.bNTSC;
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID = StartUp.m_strUniqueID; // SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID = StartUp.m_strUniqueID;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(main_frame) if(main_frame)