mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
nJoy and PluginManager:
1. Avoided LoadLibrary() and FreeLibrary() in favor of using an existing LoadLibrary() because of an unresolved crash related to LoadLibrary() and nJoy. After several times of LoadLibrary() and FreeLibrary() of nJoy these seems to be some kind of memory corruption that brings up several error boxes from different places (not just nJoy) and then cause a crash. 2. Slowed down the moving of the pad initialization to InputCommon. I'm not against InputCommon at all, but I have to spend some more time with it before it works on Windows 3. Partly fixed a somewhat frequent failure of nJoy with SDL 1.3 that would give a strange DirectInput error message and cause the pads to not function. It's still present before the nJoy config windows is opened. It's only fixed on booting a game. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1991 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -191,7 +191,7 @@
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="false"
|
||||
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
|
||||
AdditionalIncludeDirectories="..\..\..\Externals\SDL\Include;.\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -155,8 +155,6 @@ bool GetRealWiimote()
|
||||
// -----------------
|
||||
bool Init()
|
||||
{
|
||||
//Console::Open();
|
||||
|
||||
if (g_pThread != NULL)
|
||||
{
|
||||
PanicAlert("ERROR: Emu Thread already running. Report this bug.");
|
||||
@ -347,7 +345,18 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
PADInitialize.pLog = Callback_PADLog;
|
||||
PADInitialize.padNumber = i;
|
||||
// Check if we should init the plugin
|
||||
Plugins.GetPAD(i)->Initialize((void *)&PADInitialize);
|
||||
if(Plugins.OkayToInitPlugin(i))
|
||||
{
|
||||
Plugins.GetPad(i)->Initialize(&PADInitialize);
|
||||
|
||||
// Check if joypad open failed, in that case try again
|
||||
if(PADInitialize.padNumber == -1)
|
||||
{
|
||||
Plugins.GetPad(i)->Shutdown();
|
||||
Plugins.FreePad();
|
||||
Plugins.GetPad(i)->Initialize(&PADInitialize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load and Init WiimotePlugin - only if we are booting in wii mode
|
||||
|
@ -254,9 +254,8 @@ void Init()
|
||||
g_Channel[i].m_InHi.Hex = 0;
|
||||
g_Channel[i].m_InLo.Hex = 0;
|
||||
|
||||
// Access the pad and check the MAXPADS limit
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD((i >= MAXPADS) ? (MAXPADS - 1): i);
|
||||
//Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(i);
|
||||
// Access the pap
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(i);
|
||||
|
||||
// Check if this pad is attached for the current plugin
|
||||
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))
|
||||
|
@ -120,8 +120,7 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||
SPADStatus PadStatus;
|
||||
memset(&PadStatus, 0 ,sizeof(PadStatus));
|
||||
Common::PluginPAD* pad =
|
||||
//CPluginManager::GetInstance().GetPAD(ISIDevice::m_iDeviceNumber);
|
||||
CPluginManager::GetInstance().GetPAD((ISIDevice::m_iDeviceNumber >= MAXPADS) ? (MAXPADS - 1): ISIDevice::m_iDeviceNumber);
|
||||
CPluginManager::GetInstance().GetPad(ISIDevice::m_iDeviceNumber);
|
||||
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
|
||||
|
||||
_Hi = (u32)((u8)PadStatus.stickY);
|
||||
@ -148,7 +147,7 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||
void
|
||||
CSIDevice_GCController::SendCommand(u32 _Cmd)
|
||||
{
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0);
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(0);
|
||||
UCommand command(_Cmd);
|
||||
|
||||
switch(command.Command)
|
||||
|
@ -15,20 +15,31 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Include
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include <string> // System
|
||||
#include <vector>
|
||||
|
||||
//#include "Globals.h"
|
||||
#include "FileSearch.h"
|
||||
#include "FileUtil.h"
|
||||
//#include "Globals.h" // Local
|
||||
#include "PluginManager.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "LogManager.h"
|
||||
#include "Core.h"
|
||||
|
||||
#include "FileSearch.h" // Common
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtil.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
CPluginManager CPluginManager::m_Instance;
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The Plugin Manager Class
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CPluginManager::CPluginManager() :
|
||||
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
||||
{
|
||||
@ -37,113 +48,189 @@ CPluginManager::CPluginManager() :
|
||||
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
||||
m_PluginGlobals->messageLogger = NULL;
|
||||
|
||||
m_InputManager = new InputManager();
|
||||
m_PluginGlobals->inputManager = m_InputManager;
|
||||
}
|
||||
|
||||
|
||||
// Function: FreeLibrary()
|
||||
// Called from: This will be called when Dolphin is closed, not when we Stop a game
|
||||
CPluginManager::~CPluginManager()
|
||||
{
|
||||
if (m_PluginGlobals)
|
||||
delete m_PluginGlobals;
|
||||
Console::Print("Delete CPluginManager\n");
|
||||
|
||||
ShutdownPlugins();
|
||||
if (m_PluginGlobals) delete m_PluginGlobals;
|
||||
|
||||
delete m_InputManager;
|
||||
if (m_dsp) delete m_dsp;
|
||||
|
||||
if (m_video) delete m_video;
|
||||
|
||||
/**/
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
{
|
||||
if (m_pad[i] && OkayToInitPlugin(i))
|
||||
{
|
||||
Console::Print("Delete: %i\n", i);
|
||||
delete m_pad[i];
|
||||
}
|
||||
m_pad[i] = NULL;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||
if (m_wiimote[i]) delete m_wiimote[i];
|
||||
}
|
||||
//////////////////////////////////////////////
|
||||
|
||||
bool CPluginManager::InitPlugins() {
|
||||
|
||||
if (! GetVideo()) {
|
||||
PanicAlert("Can't init Video Plugin");
|
||||
return false;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Init and ShutDown Plugins
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// Point the m_pad[] and other variables to a certain plugin
|
||||
bool CPluginManager::InitPlugins()
|
||||
{
|
||||
|
||||
if (! GetVideo())
|
||||
{
|
||||
PanicAlert("Can't init Video Plugin");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! GetDSP()) {
|
||||
PanicAlert("Can't init DSP Plugin");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! m_InputManager->Init()) {
|
||||
PanicAlert("Can't init input manager");
|
||||
return false;
|
||||
if (! GetDSP())
|
||||
{
|
||||
PanicAlert("Can't init DSP Plugin");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if we get at least one pad or wiimote
|
||||
bool pad = false;
|
||||
bool wiimote = false;
|
||||
|
||||
// Init pad
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
{
|
||||
if (! m_params.m_strPadPlugin[i].empty())
|
||||
GetPAD(i);
|
||||
|
||||
if (m_pad[i] != NULL)
|
||||
pad = true;
|
||||
if (! m_params.m_strPadPlugin[i].empty())
|
||||
GetPad(i);
|
||||
if (m_pad[i] != NULL)
|
||||
pad = true;
|
||||
}
|
||||
|
||||
if (! pad) {
|
||||
PanicAlert("Can't init any PAD Plugins");
|
||||
return false;
|
||||
}
|
||||
if (m_params.bWii) {
|
||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||
if (! pad)
|
||||
{
|
||||
if (! m_params.m_strWiimotePlugin[i].empty())
|
||||
GetWiimote(i);
|
||||
PanicAlert("Can't init any PAD Plugins");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_wiimote[i] != NULL)
|
||||
wiimote = true;
|
||||
}
|
||||
// Init wiimote
|
||||
if (m_params.bWii)
|
||||
{
|
||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||
{
|
||||
if (! m_params.m_strWiimotePlugin[i].empty())
|
||||
GetWiimote(i);
|
||||
|
||||
if (! wiimote) {
|
||||
PanicAlert("Can't init any Wiimote Plugins");
|
||||
return false;
|
||||
}
|
||||
if (m_wiimote[i] != NULL)
|
||||
wiimote = true;
|
||||
}
|
||||
if (! wiimote)
|
||||
{
|
||||
PanicAlert("Can't init any Wiimote Plugins");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPluginManager::ShutdownPlugins()
|
||||
{
|
||||
for (int i = 0; i < MAXPADS; i++) {
|
||||
if (m_pad[i]) {
|
||||
m_pad[i]->Shutdown();
|
||||
delete m_pad[i];
|
||||
m_pad[i] = NULL;
|
||||
{
|
||||
// Check if we can shutdown the plugin
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
{
|
||||
if (m_pad[i] && OkayToInitPlugin(i))
|
||||
{
|
||||
//Console::Print("Shutdown: %i\n", i);
|
||||
m_pad[i]->Shutdown();
|
||||
//delete m_pad[i];
|
||||
}
|
||||
//m_pad[i] = NULL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||
if (m_wiimote[i]) m_wiimote[i]->Shutdown();
|
||||
|
||||
if (m_video)
|
||||
m_video->Shutdown();
|
||||
|
||||
if (m_dsp)
|
||||
m_dsp->Shutdown();
|
||||
}
|
||||
//////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Supporting functions
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Called from: Get__() functions in this file only (not from anywhere else)
|
||||
void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)//, PLUGIN_TYPE type)
|
||||
{
|
||||
CPluginInfo info(_rFilename);
|
||||
PLUGIN_TYPE type = info.GetPluginInfo().Type;
|
||||
//std::string Filename = info.GetPluginInfo().Filename;
|
||||
std::string Filename = _rFilename;
|
||||
Common::CPlugin *plugin = NULL;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case PLUGIN_TYPE_VIDEO:
|
||||
plugin = new Common::PluginVideo(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_DSP:
|
||||
plugin = new Common::PluginDSP(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_PAD:
|
||||
plugin = new Common::PluginPAD(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_WIIMOTE:
|
||||
plugin = new Common::PluginWiimote(_rFilename);
|
||||
break;
|
||||
|
||||
default:
|
||||
PanicAlert("Trying to load unsupported type %d", type);
|
||||
}
|
||||
|
||||
if (! m_InputManager->Shutdown()) {
|
||||
PanicAlert("Error cleaning after input manager");
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXWIIMOTES; i++) {
|
||||
if (m_wiimote[i]) {
|
||||
m_wiimote[i]->Shutdown();
|
||||
delete m_wiimote[i];
|
||||
m_wiimote[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_video) {
|
||||
m_video->Shutdown();
|
||||
delete m_video;
|
||||
m_video = NULL;
|
||||
}
|
||||
|
||||
if (m_dsp) {
|
||||
m_dsp->Shutdown();
|
||||
delete m_dsp;
|
||||
m_dsp = NULL;
|
||||
}
|
||||
if (!plugin->IsValid())
|
||||
{
|
||||
PanicAlert("Can't open %s", _rFilename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
plugin->SetGlobals(m_PluginGlobals);
|
||||
return plugin;
|
||||
}
|
||||
|
||||
PLUGIN_GLOBALS* CPluginManager::GetGlobals() {
|
||||
// ----------------------------------------
|
||||
/* Check if the plugin has already been initialized. If so, return the Id of the duplicate pad
|
||||
so we can point the new m_pad[] to that */
|
||||
// -------------
|
||||
int CPluginManager::OkayToInitPlugin(int Plugin)
|
||||
{
|
||||
// Compare it to the earlier plugins
|
||||
for(int i = 0; i < Plugin; i++)
|
||||
if (m_params.m_strPadPlugin[Plugin] == m_params.m_strPadPlugin[i])
|
||||
return i;
|
||||
|
||||
// No there is no duplicate plugin
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
PLUGIN_GLOBALS* CPluginManager::GetGlobals()
|
||||
{
|
||||
return m_PluginGlobals;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
// Create list of available plugins
|
||||
// -------------
|
||||
@ -181,88 +268,102 @@ void CPluginManager::ScanForPlugins()
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
Common::PluginPAD *CPluginManager::GetPAD(int controller)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Create or return the already created plugin pointers. This will be called often for the
|
||||
Pad and Wiimote from the SI_.cpp files. */
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Common::PluginPAD *CPluginManager::GetPad(int controller)
|
||||
{
|
||||
if (m_pad[controller] == NULL)
|
||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str());
|
||||
|
||||
return m_pad[controller];
|
||||
if (m_pad[controller] != NULL)
|
||||
if (m_pad[controller]->GetFilename() == m_params.m_strPadPlugin[controller])
|
||||
return m_pad[controller];
|
||||
|
||||
// Else do this
|
||||
if(OkayToInitPlugin(controller) == -1)
|
||||
{
|
||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str(), controller);
|
||||
Console::Print("LoadPlugin: %i\n", controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
||||
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
||||
}
|
||||
return m_pad[controller];
|
||||
}
|
||||
|
||||
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
|
||||
{
|
||||
if (m_wiimote[controller] == NULL)
|
||||
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin
|
||||
(m_params.m_strWiimotePlugin[controller].c_str());
|
||||
if (m_pad[controller] != NULL)
|
||||
if (m_wiimote[controller]->GetFilename() == m_params.m_strWiimotePlugin[controller])
|
||||
return m_wiimote[controller];
|
||||
|
||||
// Else load a new plugin
|
||||
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params.m_strWiimotePlugin[controller].c_str());
|
||||
return m_wiimote[controller];
|
||||
}
|
||||
|
||||
Common::PluginDSP *CPluginManager::GetDSP()
|
||||
{
|
||||
if (m_dsp == NULL)
|
||||
if (m_dsp != NULL)
|
||||
if (m_dsp->GetFilename() == m_params.m_strDSPPlugin)
|
||||
return m_dsp;
|
||||
// Else load a new plugin
|
||||
m_dsp = (Common::PluginDSP*)LoadPlugin(m_params.m_strDSPPlugin.c_str());
|
||||
|
||||
return m_dsp;
|
||||
}
|
||||
|
||||
Common::PluginVideo *CPluginManager::GetVideo() {
|
||||
Common::PluginVideo *CPluginManager::GetVideo()
|
||||
{
|
||||
if (m_video != NULL)
|
||||
if (m_video->GetFilename() == m_params.m_strVideoPlugin)
|
||||
return m_video;
|
||||
|
||||
if (m_video == NULL)
|
||||
// Else load a new plugin
|
||||
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str());
|
||||
|
||||
return m_video;
|
||||
}
|
||||
|
||||
void *CPluginManager::LoadPlugin(const char *_rFilename)//, PLUGIN_TYPE type)
|
||||
Common::PluginPAD *CPluginManager::FreePad()
|
||||
{
|
||||
CPluginInfo info(_rFilename);
|
||||
PLUGIN_TYPE type = info.GetPluginInfo().Type;
|
||||
Common::CPlugin *plugin = NULL;
|
||||
switch (type) {
|
||||
case PLUGIN_TYPE_VIDEO:
|
||||
plugin = new Common::PluginVideo(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_PAD:
|
||||
plugin = new Common::PluginPAD(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_DSP:
|
||||
plugin = new Common::PluginDSP(_rFilename);
|
||||
break;
|
||||
|
||||
case PLUGIN_TYPE_WIIMOTE:
|
||||
plugin = new Common::PluginWiimote(_rFilename);
|
||||
break;
|
||||
default:
|
||||
PanicAlert("Trying to load unsupported type %d", type);
|
||||
}
|
||||
|
||||
if (!plugin->IsValid()) {
|
||||
PanicAlert("Can't open %s", _rFilename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
plugin->SetGlobals(m_PluginGlobals);
|
||||
|
||||
|
||||
return plugin;
|
||||
delete m_pad[0];
|
||||
m_pad[0] = NULL; m_pad[1] = NULL; m_pad[2] = NULL; m_pad[3] = NULL;
|
||||
m_pad[0] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[0].c_str(), 0);
|
||||
return m_pad[0];
|
||||
}
|
||||
///////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Call DLL functions
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// ----------------------------------------
|
||||
// Open config window. _rFilename = plugin filename ,ret = the dll slot number
|
||||
// Open config window. Input: _rFilename = Plugin filename , Type = Plugin type
|
||||
// -------------
|
||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type)
|
||||
{
|
||||
//m_InputManager->Init();
|
||||
|
||||
Common::CPlugin *plugin = new Common::CPlugin(_rFilename);
|
||||
m_InputManager->Init();
|
||||
plugin->SetGlobals(m_PluginGlobals);
|
||||
plugin->Config((HWND)_Parent);
|
||||
delete plugin;
|
||||
m_InputManager->Shutdown();
|
||||
switch(Type)
|
||||
{
|
||||
case PLUGIN_TYPE_VIDEO:
|
||||
GetVideo()->Config((HWND)_Parent);
|
||||
break;
|
||||
case PLUGIN_TYPE_DSP:
|
||||
GetDSP()->Config((HWND)_Parent);
|
||||
break;
|
||||
case PLUGIN_TYPE_PAD:
|
||||
GetPad(0)->Config((HWND)_Parent);
|
||||
break;
|
||||
case PLUGIN_TYPE_WIIMOTE:
|
||||
GetWiimote(0)->Config((HWND)_Parent);
|
||||
break;
|
||||
}
|
||||
|
||||
//m_InputManager->Shutdown();
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
@ -270,10 +371,14 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
||||
// -------------
|
||||
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
|
||||
{
|
||||
if (Type == PLUGIN_TYPE_VIDEO) {
|
||||
GetVideo()->Debug((HWND)_Parent, Show);
|
||||
} else if (Type == PLUGIN_TYPE_DSP) {
|
||||
GetDSP()->Debug((HWND)_Parent, Show);
|
||||
switch(Type)
|
||||
{
|
||||
case PLUGIN_TYPE_VIDEO:
|
||||
GetVideo()->Debug((HWND)_Parent, Show);
|
||||
break;
|
||||
case PLUGIN_TYPE_DSP:
|
||||
GetDSP()->Debug((HWND)_Parent, Show);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,13 +390,15 @@ CPluginInfo::CPluginInfo(const char *_rFileName)
|
||||
, m_Valid(false)
|
||||
{
|
||||
Common::CPlugin *plugin = new Common::CPlugin(_rFileName);
|
||||
if (plugin->IsValid()) {
|
||||
if (plugin->GetInfo(m_PluginInfo))
|
||||
m_Valid = true;
|
||||
else
|
||||
PanicAlert("Could not get info about plugin %s", _rFileName);
|
||||
delete plugin;
|
||||
}
|
||||
if (plugin->IsValid())
|
||||
{
|
||||
if (plugin->GetInfo(m_PluginInfo))
|
||||
m_Valid = true;
|
||||
else
|
||||
PanicAlert("Could not get info about plugin %s", _rFileName);
|
||||
|
||||
delete plugin;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
|
||||
|
@ -47,20 +47,23 @@ class CPluginManager
|
||||
{
|
||||
public:
|
||||
static CPluginManager& GetInstance() {return(m_Instance);}
|
||||
Common::PluginPAD *GetPAD(int controller);
|
||||
Common::PluginPAD *GetPad(int controller);
|
||||
Common::PluginWiimote *GetWiimote(int controller);
|
||||
Common::PluginDSP *GetDSP();
|
||||
Common::PluginVideo *GetVideo();
|
||||
Common::PluginPAD *FreePad();
|
||||
|
||||
bool InitPlugins();
|
||||
void ShutdownPlugins();
|
||||
int OkayToInitPlugin(int Plugin);
|
||||
void ScanForPlugins();
|
||||
void OpenConfig(void* _Parent, const char *_rFilename);
|
||||
void OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type);
|
||||
void OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show);
|
||||
const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);}
|
||||
PLUGIN_GLOBALS* GetGlobals();
|
||||
|
||||
private:
|
||||
|
||||
static CPluginManager m_Instance;
|
||||
bool m_Initialized;
|
||||
|
||||
@ -75,7 +78,7 @@ private:
|
||||
SCoreStartupParameter& m_params;
|
||||
CPluginManager();
|
||||
~CPluginManager();
|
||||
void *LoadPlugin(const char *_rFilename);
|
||||
void *LoadPlugin(const char *_rFilename, int Number = 0);
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user