Video and DSP plugin management: Fixed Stop and Start again, it was necessary to call FreeLibrary() on Start instead of on Stop, I don't know why but that's how it works

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2139 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-08 10:09:26 +00:00
parent 54798713a0
commit f610f7e197
8 changed files with 280 additions and 177 deletions

View File

@ -16,9 +16,15 @@
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
File description: This is the common Plugin class that links to the functions that are
common to all plugins. This class is inherited by all plugin classes. But it's only created
directly in PluginManager.cpp when we check if a plugin is valid or not.
///////////////////////////////////////////////*/
/* This file is a simpler version of Plugin_...cpp found in Core. This file
only loads the config and debugging windows and works with all plugins. */
#include "Plugin.h"
@ -41,50 +47,52 @@ CPlugin::CPlugin(const char* _szName) : valid(false)
m_Shutdown = NULL;
m_DoState = NULL;
if (m_hInstLib.Load(_szName)) {
m_GetDllInfo = reinterpret_cast<TGetDllInfo>
(m_hInstLib.Get("GetDllInfo"));
m_DllConfig = reinterpret_cast<TDllConfig>
(m_hInstLib.Get("DllConfig"));
m_DllDebugger = reinterpret_cast<TDllDebugger>
(m_hInstLib.Get("DllDebugger"));
m_SetDllGlobals = reinterpret_cast<TSetDllGlobals>
(m_hInstLib.Get("SetDllGlobals"));
m_Initialize = reinterpret_cast<TInitialize>
(m_hInstLib.Get("Initialize"));
m_Shutdown = reinterpret_cast<TShutdown>
(m_hInstLib.Get("Shutdown"));
m_DoState = reinterpret_cast<TDoState>
(m_hInstLib.Get("DoState"));
if (m_hInstLib.Load(_szName))
{
m_GetDllInfo = reinterpret_cast<TGetDllInfo>
(m_hInstLib.Get("GetDllInfo"));
m_DllConfig = reinterpret_cast<TDllConfig>
(m_hInstLib.Get("DllConfig"));
m_DllDebugger = reinterpret_cast<TDllDebugger>
(m_hInstLib.Get("DllDebugger"));
m_SetDllGlobals = reinterpret_cast<TSetDllGlobals>
(m_hInstLib.Get("SetDllGlobals"));
m_Initialize = reinterpret_cast<TInitialize>
(m_hInstLib.Get("Initialize"));
m_Shutdown = reinterpret_cast<TShutdown>
(m_hInstLib.Get("Shutdown"));
m_DoState = reinterpret_cast<TDoState>
(m_hInstLib.Get("DoState"));
}
// Check if the plugin has all the functions it shold have
if (m_GetDllInfo != 0 &&
m_DllConfig != 0 &&
m_DllDebugger != 0 &&
m_SetDllGlobals != 0 &&
m_Initialize != 0 &&
m_Shutdown != 0 &&
m_DoState != 0)
m_DllConfig != 0 &&
m_DllDebugger != 0 &&
m_SetDllGlobals != 0 &&
m_Initialize != 0 &&
m_Shutdown != 0 &&
m_DoState != 0)
valid = true;
// Save the filename for this plugin
Filename = _szName;
}
void *CPlugin::LoadSymbol(const char *sym) {
void *CPlugin::LoadSymbol(const char *sym)
{
return m_hInstLib.Get(sym);
}
// GetInfo: Get DLL info
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) {
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo)
{
if (m_GetDllInfo != NULL) {
m_GetDllInfo(&_pluginInfo);
return(true);
}
}
return(false);
}

View File

@ -36,37 +36,39 @@ class CPlugin
{
public:
CPlugin(const char* _szName);
~CPlugin();
CPlugin(const char* _szName);
~CPlugin();
virtual bool IsValid() {return valid;};
virtual std::string GetFilename() {return Filename;};
// This functions is only used when CPlugin is called directly, when a parent class like PluginVideo
// is called its own IsValid() will be called.
virtual bool IsValid() {return valid;};
std::string GetFilename() {return Filename;};
bool GetInfo(PLUGIN_INFO& _pluginInfo);
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
void *LoadSymbol(const char *sym);
bool GetInfo(PLUGIN_INFO& _pluginInfo);
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
void *LoadSymbol(const char *sym);
void Config(HWND _hwnd);
void About(HWND _hwnd);
void Debug(HWND _hwnd, bool Show);
void DoState(unsigned char **ptr, int mode);
void Initialize(void *init);
void Shutdown();
void Config(HWND _hwnd);
void About(HWND _hwnd);
void Debug(HWND _hwnd, bool Show);
void DoState(unsigned char **ptr, int mode);
void Initialize(void *init);
void Shutdown();
private:
DynamicLibrary m_hInstLib;
bool valid;
std::string Filename;
DynamicLibrary m_hInstLib;
bool valid;
std::string Filename;
// Functions
TGetDllInfo m_GetDllInfo;
TDllConfig m_DllConfig;
TDllDebugger m_DllDebugger;
TSetDllGlobals m_SetDllGlobals;
TInitialize m_Initialize;
TShutdown m_Shutdown;
TDoState m_DoState;
// Functions
TGetDllInfo m_GetDllInfo;
TDllConfig m_DllConfig;
TDllDebugger m_DllDebugger;
TSetDllGlobals m_SetDllGlobals;
TInitialize m_Initialize;
TShutdown m_Shutdown;
TDoState m_DoState;
};
} // end of namespace Common

View File

@ -1,7 +1,9 @@
#include "PluginVideo.h"
namespace Common {
PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo(false) {
namespace Common
{
PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo(false)
{
Video_Prepare = 0;
Video_SendFifoData = 0;