CPlugin had a non-virtual destructor. This fixes that, plus reindents a bunch of code.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2332 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
76a78dd60d
commit
28cbd0a6ba
|
@ -461,14 +461,6 @@
|
||||||
<Filter
|
<Filter
|
||||||
Name="Plugins"
|
Name="Plugins"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath=".\Src\DynamicLibrary.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\DynamicLibrary.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\Plugin.cpp"
|
RelativePath=".\Src\Plugin.cpp"
|
||||||
>
|
>
|
||||||
|
@ -590,6 +582,14 @@
|
||||||
RelativePath=".\Src\DriveUtil.h"
|
RelativePath=".\Src\DriveUtil.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\DynamicLibrary.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\DynamicLibrary.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\ExtendedTrace.cpp"
|
RelativePath=".\Src\ExtendedTrace.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -121,7 +121,7 @@ int DynamicLibrary::Unload()
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
retval = FreeLibrary(library);
|
retval = FreeLibrary(library);
|
||||||
#else
|
#else
|
||||||
retval = dlclose(library)?0:1;
|
retval = dlclose(library) ? 0 : 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!retval)
|
if (!retval)
|
||||||
|
|
|
@ -83,9 +83,9 @@ bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo)
|
||||||
{
|
{
|
||||||
if (m_GetDllInfo != NULL) {
|
if (m_GetDllInfo != NULL) {
|
||||||
m_GetDllInfo(&_pluginInfo);
|
m_GetDllInfo(&_pluginInfo);
|
||||||
return(true);
|
return true;
|
||||||
}
|
}
|
||||||
return(false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config: Open the Config window
|
// Config: Open the Config window
|
||||||
|
@ -112,12 +112,8 @@ void CPlugin::DoState(unsigned char **ptr, int mode) {
|
||||||
m_DoState(ptr, mode);
|
m_DoState(ptr, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run Initialize() in the plugin
|
|
||||||
void CPlugin::Initialize(void *init)
|
void CPlugin::Initialize(void *init)
|
||||||
{
|
{
|
||||||
/* We first check that we have found the Initialize() function, but there
|
|
||||||
is no restriction on running this several times */
|
|
||||||
// Uh, the above comment sounds extremely dubious.
|
|
||||||
if (m_Initialize != NULL)
|
if (m_Initialize != NULL)
|
||||||
m_Initialize(init);
|
m_Initialize(init);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,16 +34,14 @@ namespace Common
|
||||||
|
|
||||||
class CPlugin
|
class CPlugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CPlugin(const char* _szName);
|
CPlugin(const char* _szName);
|
||||||
~CPlugin();
|
virtual ~CPlugin();
|
||||||
|
|
||||||
// This functions is only used when CPlugin is called directly, when a parent class like PluginVideo
|
// This functions is only used when CPlugin is called directly, when a parent class like PluginVideo
|
||||||
// is called its own IsValid() will be called.
|
// is called its own IsValid() will be called.
|
||||||
virtual bool IsValid() {return valid;};
|
virtual bool IsValid() { return valid; };
|
||||||
std::string GetFilename() {return Filename;};
|
std::string GetFilename() const { return Filename; }
|
||||||
|
|
||||||
bool GetInfo(PLUGIN_INFO& _pluginInfo);
|
bool GetInfo(PLUGIN_INFO& _pluginInfo);
|
||||||
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
|
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
|
||||||
void *LoadSymbol(const char *sym);
|
void *LoadSymbol(const char *sym);
|
||||||
|
@ -55,11 +53,10 @@ class CPlugin
|
||||||
void Initialize(void *init);
|
void Initialize(void *init);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DynamicLibrary m_hInstLib;
|
DynamicLibrary m_hInstLib;
|
||||||
bool valid;
|
|
||||||
std::string Filename;
|
std::string Filename;
|
||||||
|
bool valid;
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
TGetDllInfo m_GetDllInfo;
|
TGetDllInfo m_GetDllInfo;
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
PluginDSP::PluginDSP(const char *_Filename) : CPlugin(_Filename), validDSP(false) {
|
PluginDSP::PluginDSP(const char *_Filename)
|
||||||
|
: CPlugin(_Filename), validDSP(false)
|
||||||
|
{
|
||||||
DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox>
|
DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox>
|
||||||
(LoadSymbol("DSP_ReadMailboxHigh"));
|
(LoadSymbol("DSP_ReadMailboxHigh"));
|
||||||
DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox>
|
DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox>
|
||||||
|
|
|
@ -18,7 +18,7 @@ class PluginDSP : public CPlugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PluginDSP(const char *_Filename);
|
PluginDSP(const char *_Filename);
|
||||||
~PluginDSP();
|
virtual ~PluginDSP();
|
||||||
virtual bool IsValid() {return validDSP;};
|
virtual bool IsValid() {return validDSP;};
|
||||||
|
|
||||||
TDSP_ReadMailBox DSP_ReadMailboxHigh;
|
TDSP_ReadMailBox DSP_ReadMailboxHigh;
|
||||||
|
|
|
@ -5,15 +5,16 @@
|
||||||
#include "Plugin.h"
|
#include "Plugin.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*);
|
|
||||||
typedef void (__cdecl* TPAD_Input)(u16, u8);
|
|
||||||
typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int);
|
|
||||||
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
|
||||||
|
|
||||||
class PluginPAD : public CPlugin {
|
typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*);
|
||||||
public:
|
typedef void (__cdecl* TPAD_Input)(u16, u8);
|
||||||
|
typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int);
|
||||||
|
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
||||||
|
|
||||||
|
class PluginPAD : public CPlugin {
|
||||||
|
public:
|
||||||
PluginPAD(const char *_Filename);
|
PluginPAD(const char *_Filename);
|
||||||
~PluginPAD();
|
virtual ~PluginPAD();
|
||||||
virtual bool IsValid() {return validPAD;};
|
virtual bool IsValid() {return validPAD;};
|
||||||
|
|
||||||
TPAD_GetStatus PAD_GetStatus;
|
TPAD_GetStatus PAD_GetStatus;
|
||||||
|
@ -21,10 +22,11 @@ namespace Common {
|
||||||
TPAD_Rumble PAD_Rumble;
|
TPAD_Rumble PAD_Rumble;
|
||||||
TPAD_GetAttachedPads PAD_GetAttachedPads;
|
TPAD_GetAttachedPads PAD_GetAttachedPads;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool validPAD;
|
bool validPAD;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,19 +5,20 @@
|
||||||
#include "Plugin.h"
|
#include "Plugin.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
typedef void (__cdecl* TVideo_Prepare)();
|
|
||||||
typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32);
|
|
||||||
typedef void (__cdecl* TVideo_UpdateXFB)(u8*, u32, u32, s32, bool);
|
|
||||||
typedef bool (__cdecl* TVideo_Screenshot)(const char* filename);
|
|
||||||
typedef void (__cdecl* TVideo_EnterLoop)();
|
|
||||||
typedef void (__cdecl* TVideo_ExitLoop)();
|
|
||||||
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
|
|
||||||
|
|
||||||
class PluginVideo : public CPlugin
|
typedef void (__cdecl* TVideo_Prepare)();
|
||||||
{
|
typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32);
|
||||||
public:
|
typedef void (__cdecl* TVideo_UpdateXFB)(u8*, u32, u32, s32, bool);
|
||||||
|
typedef bool (__cdecl* TVideo_Screenshot)(const char* filename);
|
||||||
|
typedef void (__cdecl* TVideo_EnterLoop)();
|
||||||
|
typedef void (__cdecl* TVideo_ExitLoop)();
|
||||||
|
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
|
||||||
|
|
||||||
|
class PluginVideo : public CPlugin
|
||||||
|
{
|
||||||
|
public:
|
||||||
PluginVideo(const char *_Filename);
|
PluginVideo(const char *_Filename);
|
||||||
~PluginVideo();
|
virtual ~PluginVideo();
|
||||||
virtual bool IsValid() {return validVideo;};
|
virtual bool IsValid() {return validVideo;};
|
||||||
|
|
||||||
TVideo_Prepare Video_Prepare;
|
TVideo_Prepare Video_Prepare;
|
||||||
|
@ -29,9 +30,10 @@ namespace Common {
|
||||||
TVideo_AddMessage Video_AddMessage;
|
TVideo_AddMessage Video_AddMessage;
|
||||||
TVideo_Screenshot Video_Screenshot;
|
TVideo_Screenshot Video_Screenshot;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool validVideo;
|
bool validVideo;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#include "PluginWiimote.h"
|
#include "PluginWiimote.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
PluginWiimote::PluginWiimote(const char *_Filename) : CPlugin(_Filename), validWiimote(false) {
|
|
||||||
|
|
||||||
|
PluginWiimote::PluginWiimote(const char *_Filename)
|
||||||
|
: CPlugin(_Filename), validWiimote(false)
|
||||||
|
{
|
||||||
Wiimote_ControlChannel = reinterpret_cast<TWiimote_Output>
|
Wiimote_ControlChannel = reinterpret_cast<TWiimote_Output>
|
||||||
(LoadSymbol("Wiimote_ControlChannel"));
|
(LoadSymbol("Wiimote_ControlChannel"));
|
||||||
Wiimote_InterruptChannel = reinterpret_cast<TWiimote_Input>
|
Wiimote_InterruptChannel = reinterpret_cast<TWiimote_Input>
|
||||||
|
@ -17,8 +19,9 @@ namespace Common {
|
||||||
(Wiimote_Update != 0) &&
|
(Wiimote_Update != 0) &&
|
||||||
(Wiimote_GetAttachedControllers != 0))
|
(Wiimote_GetAttachedControllers != 0))
|
||||||
validWiimote = true;
|
validWiimote = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginWiimote::~PluginWiimote() {
|
PluginWiimote::~PluginWiimote() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,16 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
||||||
typedef void (__cdecl* TWiimote_Update)();
|
typedef void (__cdecl* TWiimote_Update)();
|
||||||
typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size);
|
typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size);
|
||||||
typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size);
|
typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size);
|
||||||
typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)();
|
typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)();
|
||||||
|
|
||||||
class PluginWiimote : public CPlugin {
|
class PluginWiimote : public CPlugin {
|
||||||
public:
|
public:
|
||||||
PluginWiimote(const char *_Filename);
|
PluginWiimote(const char *_Filename);
|
||||||
~PluginWiimote();
|
virtual ~PluginWiimote();
|
||||||
virtual bool IsValid() {return validWiimote;};
|
virtual bool IsValid() {return validWiimote;};
|
||||||
|
|
||||||
TWiimote_Output Wiimote_ControlChannel;
|
TWiimote_Output Wiimote_ControlChannel;
|
||||||
|
@ -23,10 +23,10 @@ namespace Common {
|
||||||
TWiimote_Update Wiimote_Update;
|
TWiimote_Update Wiimote_Update;
|
||||||
TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers;
|
TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool validWiimote;
|
bool validWiimote;
|
||||||
|
};
|
||||||
|
|
||||||
};
|
} // namespace
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -79,6 +79,8 @@ CPluginManager CPluginManager::m_Instance;
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// The Plugin Manager Class
|
// The Plugin Manager Class
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
|
|
||||||
|
// The plugin manager is some sort of singleton that runs during Dolphin's entire lifespan.
|
||||||
CPluginManager::CPluginManager() :
|
CPluginManager::CPluginManager() :
|
||||||
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
||||||
{
|
{
|
||||||
|
@ -87,7 +89,7 @@ CPluginManager::CPluginManager() :
|
||||||
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
||||||
m_PluginGlobals->messageLogger = NULL;
|
m_PluginGlobals->messageLogger = NULL;
|
||||||
|
|
||||||
// Set initial values to NULL, this is only done when Dolphin is started
|
// Set initial values to NULL.
|
||||||
m_video = NULL;
|
m_video = NULL;
|
||||||
m_dsp = NULL;
|
m_dsp = NULL;
|
||||||
for (int i = 0; i < MAXPADS; i++)
|
for (int i = 0; i < MAXPADS; i++)
|
||||||
|
@ -104,8 +106,10 @@ CPluginManager::~CPluginManager()
|
||||||
delete m_PluginGlobals;
|
delete m_PluginGlobals;
|
||||||
delete m_dsp;
|
delete m_dsp;
|
||||||
|
|
||||||
for (int i = 0; i < MAXPADS; i++) {
|
for (int i = 0; i < MAXPADS; i++)
|
||||||
if (m_pad[i] && OkayToInitPlugin(i)) {
|
{
|
||||||
|
if (m_pad[i] && OkayToInitPlugin(i))
|
||||||
|
{
|
||||||
Console::Print("Delete: %i\n", i);
|
Console::Print("Delete: %i\n", i);
|
||||||
delete m_pad[i];
|
delete m_pad[i];
|
||||||
}
|
}
|
||||||
|
@ -183,7 +187,7 @@ bool CPluginManager::InitPlugins()
|
||||||
void CPluginManager::ShutdownPlugins()
|
void CPluginManager::ShutdownPlugins()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAXPADS; i++) {
|
for (int i = 0; i < MAXPADS; i++) {
|
||||||
if (m_pad[i] && OkayToInitPlugin(i)) {
|
if (m_pad[i]) {
|
||||||
m_pad[i]->Shutdown();
|
m_pad[i]->Shutdown();
|
||||||
//delete m_pad[i];
|
//delete m_pad[i];
|
||||||
}
|
}
|
||||||
|
@ -201,7 +205,6 @@ void CPluginManager::ShutdownPlugins()
|
||||||
if (m_video)
|
if (m_video)
|
||||||
{
|
{
|
||||||
m_video->Shutdown();
|
m_video->Shutdown();
|
||||||
// This is needed for Stop and Start to work
|
|
||||||
delete m_video;
|
delete m_video;
|
||||||
m_video = NULL;
|
m_video = NULL;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +212,6 @@ void CPluginManager::ShutdownPlugins()
|
||||||
if (m_dsp)
|
if (m_dsp)
|
||||||
{
|
{
|
||||||
m_dsp->Shutdown();
|
m_dsp->Shutdown();
|
||||||
// This is needed for Stop and Start to work
|
|
||||||
delete m_dsp;
|
delete m_dsp;
|
||||||
m_dsp = NULL;
|
m_dsp = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,16 +111,16 @@ void HandleGLError();
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define ERROR_LOG(...) LOG(VIDEO, __VA_ARGS__)
|
#define ERROR_LOG(...) {LOG(VIDEO, __VA_ARGS__)}
|
||||||
#define INFO_LOG(...) LOG(VIDEO, __VA_ARGS__)
|
#define INFO_LOG(...) {LOG(VIDEO, __VA_ARGS__)}
|
||||||
#define PRIM_LOG(...) LOG(VIDEO, __VA_ARGS__)
|
#define PRIM_LOG(...) {LOG(VIDEO, __VA_ARGS__)}
|
||||||
#define DEBUG_LOG(...) LOG(VIDEO, __VA_ARGS__)
|
#define DEBUG_LOG(...) {LOG(VIDEO, __VA_ARGS__)}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define ERROR_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
|
#define ERROR_LOG(...) {LOG(VIDEO, ##__VA_ARGS__)}
|
||||||
#define INFO_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
|
#define INFO_LOG(...) {LOG(VIDEO, ##__VA_ARGS__)}
|
||||||
#define PRIM_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
|
#define PRIM_LOG(...) {LOG(VIDEO, ##__VA_ARGS__)}
|
||||||
#define DEBUG_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
|
#define DEBUG_LOG(...) {LOG(VIDEO, ##__VA_ARGS__)}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LOGGING
|
#ifdef LOGGING
|
||||||
|
|
Loading…
Reference in New Issue