Cleaned up plugin class
This commit is contained in:
parent
ffb69091a1
commit
7ed9b14975
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
CPlugins::CPlugins (const stdstr & PluginDir):
|
CPlugins::CPlugins (const stdstr & PluginDir):
|
||||||
m_PluginDir(PluginDir),
|
m_PluginDir(PluginDir),
|
||||||
m_Gfx(NULL), m_Audio(NULL), m_RSP(NULL), m_Control(NULL)
|
m_Gfx(NULL), m_Audio(NULL), m_RSP(NULL), m_Control(NULL),
|
||||||
|
m_RenderWindow(NULL), m_DummyWindow(NULL)
|
||||||
{
|
{
|
||||||
CreatePlugins();
|
CreatePlugins();
|
||||||
_Settings->RegisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
_Settings->RegisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||||
|
@ -122,14 +123,15 @@ void CPlugins::ShutDownPlugins( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::SetRenderWindows( CMainGui * RenderWindow, CMainGui * DummyWindow ) {
|
void CPlugins::SetRenderWindows( CMainGui * RenderWindow, CMainGui * DummyWindow )
|
||||||
_RenderWindow = RenderWindow;
|
{
|
||||||
_DummyWindow = DummyWindow;
|
m_RenderWindow = RenderWindow;
|
||||||
|
m_DummyWindow = DummyWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlugins::Initiate ( void )
|
bool CPlugins::Initiate ( void )
|
||||||
{
|
{
|
||||||
bool bResult = _RenderWindow->InitiatePlugins();
|
bool bResult = m_RenderWindow->InitiatePlugins();
|
||||||
if (bResult)
|
if (bResult)
|
||||||
{
|
{
|
||||||
m_Gfx->RomOpened();
|
m_Gfx->RomOpened();
|
||||||
|
@ -160,12 +162,12 @@ bool CPlugins::InitiateMainThread( void )
|
||||||
WriteTrace(TraceDebug,"CPlugins::Initiate 6");
|
WriteTrace(TraceDebug,"CPlugins::Initiate 6");
|
||||||
|
|
||||||
WriteTrace(TraceGfxPlugin,"Initiate: Starting");
|
WriteTrace(TraceGfxPlugin,"Initiate: Starting");
|
||||||
if (!m_Gfx->Initiate(_System,_RenderWindow)) { return false; }
|
if (!m_Gfx->Initiate(_System,m_RenderWindow)) { return false; }
|
||||||
WriteTrace(TraceGfxPlugin,"Initiate: Done");
|
WriteTrace(TraceGfxPlugin,"Initiate: Done");
|
||||||
WriteTrace(TraceDebug,"CPlugins::Initiate 7");
|
WriteTrace(TraceDebug,"CPlugins::Initiate 7");
|
||||||
if (!m_Audio->Initiate(_System,_RenderWindow)) { return false; }
|
if (!m_Audio->Initiate(_System,m_RenderWindow)) { return false; }
|
||||||
WriteTrace(TraceDebug,"CPlugins::Initiate 8");
|
WriteTrace(TraceDebug,"CPlugins::Initiate 8");
|
||||||
if (!m_Control->Initiate(_System,_RenderWindow)) { return false; }
|
if (!m_Control->Initiate(_System,m_RenderWindow)) { return false; }
|
||||||
WriteTrace(TraceRSP ,"Initiate: Starting");
|
WriteTrace(TraceRSP ,"Initiate: Starting");
|
||||||
if (!m_RSP->Initiate(this,_System)) { return false; }
|
if (!m_RSP->Initiate(this,_System)) { return false; }
|
||||||
WriteTrace(TraceRSP,"Initiate: Done");
|
WriteTrace(TraceRSP,"Initiate: Done");
|
||||||
|
@ -289,7 +291,7 @@ void CPlugins::ConfigPlugin ( DWORD hParent, PLUGIN_TYPE Type ) {
|
||||||
case PLUGIN_TYPE_GFX:
|
case PLUGIN_TYPE_GFX:
|
||||||
if (m_Gfx == NULL || m_Gfx->Config == NULL) { break; }
|
if (m_Gfx == NULL || m_Gfx->Config == NULL) { break; }
|
||||||
if (!m_Gfx->Initilized()) {
|
if (!m_Gfx->Initilized()) {
|
||||||
if (!m_Gfx->Initiate(NULL,_DummyWindow)) {
|
if (!m_Gfx->Initiate(NULL,m_DummyWindow)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +300,7 @@ void CPlugins::ConfigPlugin ( DWORD hParent, PLUGIN_TYPE Type ) {
|
||||||
case PLUGIN_TYPE_AUDIO:
|
case PLUGIN_TYPE_AUDIO:
|
||||||
if (m_Audio == NULL || m_Audio->Config == NULL) { break; }
|
if (m_Audio == NULL || m_Audio->Config == NULL) { break; }
|
||||||
if (!m_Audio->Initilized()) {
|
if (!m_Audio->Initilized()) {
|
||||||
if (!m_Audio->Initiate(NULL,_DummyWindow)) {
|
if (!m_Audio->Initiate(NULL,m_DummyWindow)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,7 +309,7 @@ void CPlugins::ConfigPlugin ( DWORD hParent, PLUGIN_TYPE Type ) {
|
||||||
case PLUGIN_TYPE_CONTROLLER:
|
case PLUGIN_TYPE_CONTROLLER:
|
||||||
if (m_Control == NULL || m_Control->Config == NULL) { break; }
|
if (m_Control == NULL || m_Control->Config == NULL) { break; }
|
||||||
if (!m_Control->Initilized()) {
|
if (!m_Control->Initilized()) {
|
||||||
if (!m_Control->Initiate(NULL,_DummyWindow)) {
|
if (!m_Control->Initiate(NULL,m_DummyWindow)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,28 +70,6 @@ class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
|
||||||
class CPlugins :
|
class CPlugins :
|
||||||
private CDebugSettings
|
private CDebugSettings
|
||||||
{
|
{
|
||||||
//Common Classes
|
|
||||||
CMainGui * _RenderWindow;
|
|
||||||
CMainGui * _DummyWindow;
|
|
||||||
|
|
||||||
stdstr const m_PluginDir;
|
|
||||||
|
|
||||||
void CreatePlugins ( void );
|
|
||||||
void CreatePluginDir ( const stdstr & DstDir ) const;
|
|
||||||
|
|
||||||
static void PluginChanged ( CPlugins * _this );
|
|
||||||
|
|
||||||
//Plugins
|
|
||||||
CGfxPlugin * m_Gfx;
|
|
||||||
CAudioPlugin * m_Audio;
|
|
||||||
CRSP_Plugin * m_RSP;
|
|
||||||
CControl_Plugin * m_Control;
|
|
||||||
|
|
||||||
stdstr m_GfxFile;
|
|
||||||
stdstr m_AudioFile;
|
|
||||||
stdstr m_RSPFile;
|
|
||||||
stdstr m_ControlFile;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//Functions
|
//Functions
|
||||||
CPlugins (const stdstr & PluginDir );
|
CPlugins (const stdstr & PluginDir );
|
||||||
|
@ -111,6 +89,33 @@ public:
|
||||||
inline CAudioPlugin * Audio ( void) const { return m_Audio; };
|
inline CAudioPlugin * Audio ( void) const { return m_Audio; };
|
||||||
inline CRSP_Plugin * RSP ( void) const { return m_RSP; };
|
inline CRSP_Plugin * RSP ( void) const { return m_RSP; };
|
||||||
inline CControl_Plugin * Control ( void) const { return m_Control; };
|
inline CControl_Plugin * Control ( void) const { return m_Control; };
|
||||||
|
|
||||||
|
private:
|
||||||
|
CPlugins(void); // Disable default constructor
|
||||||
|
CPlugins(const CPlugins&); // Disable copy constructor
|
||||||
|
CPlugins& operator=(const CPlugins&); // Disable assignment
|
||||||
|
|
||||||
|
void CreatePlugins ( void );
|
||||||
|
void CreatePluginDir ( const stdstr & DstDir ) const;
|
||||||
|
|
||||||
|
static void PluginChanged ( CPlugins * _this );
|
||||||
|
|
||||||
|
//Common Classes
|
||||||
|
CMainGui * m_RenderWindow;
|
||||||
|
CMainGui * m_DummyWindow;
|
||||||
|
|
||||||
|
stdstr const m_PluginDir;
|
||||||
|
|
||||||
|
//Plugins
|
||||||
|
CGfxPlugin * m_Gfx;
|
||||||
|
CAudioPlugin * m_Audio;
|
||||||
|
CRSP_Plugin * m_RSP;
|
||||||
|
CControl_Plugin * m_Control;
|
||||||
|
|
||||||
|
stdstr m_GfxFile;
|
||||||
|
stdstr m_AudioFile;
|
||||||
|
stdstr m_RSPFile;
|
||||||
|
stdstr m_ControlFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Dummy Functions
|
//Dummy Functions
|
||||||
|
|
Loading…
Reference in New Issue