Added input manager handles the sdl init/quit for now
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1984 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
57c5f00337
commit
87bfe821eb
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "../../../PluginSpecs/CommonTypes.h"
|
#include "../../../PluginSpecs/CommonTypes.h"
|
||||||
#define HAVE_WIIUSE 1
|
#define HAVE_WIIUSE 1
|
||||||
|
#define HAVE_SDL 1
|
||||||
#define HAVE_WX 1
|
#define HAVE_WX 1
|
||||||
#else
|
#else
|
||||||
#include "CommonTypes.h"
|
#include "CommonTypes.h"
|
||||||
|
|
|
@ -1244,6 +1244,14 @@
|
||||||
RelativePath=".\Src\PluginManager.h"
|
RelativePath=".\Src\PluginManager.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\InputManager.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\InputManager.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\SConscript"
|
RelativePath=".\Src\SConscript"
|
||||||
>
|
>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#include "InputManager.h"
|
||||||
|
|
||||||
|
bool InputManager::Init() {
|
||||||
|
#ifdef HAVE_SDL
|
||||||
|
// Move also joystick opening code here.
|
||||||
|
if (! sdlInit) {
|
||||||
|
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API,
|
||||||
|
and with this we need the SDL_INIT_VIDEO flag as well */
|
||||||
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
||||||
|
PanicAlert("Could not initialize SDL! (%s)\n", SDL_GetError());
|
||||||
|
} else {
|
||||||
|
sdlInit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InputManager::Shutdown() {
|
||||||
|
#ifdef HAVE_SDL
|
||||||
|
SDL_Quit();
|
||||||
|
sdlInit = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef INPUTMANAGER_H
|
||||||
|
#define INPUTMANAGER_H
|
||||||
|
|
||||||
|
class InputManager {
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool Init();
|
||||||
|
bool Shutdown();
|
||||||
|
|
||||||
|
InputManager(): sdlInit(false) {}
|
||||||
|
~InputManager() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool sdlInit;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -15,31 +15,20 @@
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Include
|
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
#include <string> // System
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
//#include "Globals.h" // Local
|
//#include "Globals.h"
|
||||||
|
#include "FileSearch.h"
|
||||||
|
#include "FileUtil.h"
|
||||||
#include "PluginManager.h"
|
#include "PluginManager.h"
|
||||||
#include "ConfigManager.h"
|
#include "ConfigManager.h"
|
||||||
#include "LogManager.h"
|
#include "LogManager.h"
|
||||||
#include "Core.h"
|
|
||||||
|
|
||||||
#include "FileSearch.h" // Common
|
|
||||||
#include "FileUtil.h"
|
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
#include "ConsoleWindow.h"
|
|
||||||
|
|
||||||
CPluginManager CPluginManager::m_Instance;
|
CPluginManager CPluginManager::m_Instance;
|
||||||
//////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// The Plugin Manager Class
|
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
CPluginManager::CPluginManager() :
|
CPluginManager::CPluginManager() :
|
||||||
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
||||||
{
|
{
|
||||||
|
@ -47,189 +36,113 @@ CPluginManager::CPluginManager() :
|
||||||
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
|
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
|
||||||
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
||||||
m_PluginGlobals->messageLogger = NULL;
|
m_PluginGlobals->messageLogger = NULL;
|
||||||
|
m_InputManager = new InputManager();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function: FreeLibrary()
|
|
||||||
// Called from: This will be called when Dolphin is closed, not when we Stop a game
|
|
||||||
CPluginManager::~CPluginManager()
|
CPluginManager::~CPluginManager()
|
||||||
{
|
{
|
||||||
Console::Print("Delete CPluginManager\n");
|
if (m_PluginGlobals)
|
||||||
|
delete m_PluginGlobals;
|
||||||
|
|
||||||
if (m_PluginGlobals) delete m_PluginGlobals;
|
ShutdownPlugins();
|
||||||
|
|
||||||
if (m_dsp) delete m_dsp;
|
delete m_InputManager;
|
||||||
|
|
||||||
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()) {
|
||||||
// Init and ShutDown Plugins
|
PanicAlert("Can't init Video Plugin");
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
return false;
|
||||||
|
|
||||||
// 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())
|
if (! GetDSP()) {
|
||||||
{
|
PanicAlert("Can't init DSP Plugin");
|
||||||
PanicAlert("Can't init DSP Plugin");
|
return false;
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
if (! m_InputManager->Init()) {
|
||||||
|
PanicAlert("Can't init input manager");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we get at least one pad or wiimote
|
|
||||||
bool pad = false;
|
bool pad = false;
|
||||||
bool wiimote = false;
|
bool wiimote = false;
|
||||||
|
|
||||||
// Init pad
|
|
||||||
for (int i = 0; i < MAXPADS; i++)
|
for (int i = 0; i < MAXPADS; i++)
|
||||||
{
|
{
|
||||||
if (! m_params.m_strPadPlugin[i].empty())
|
if (! m_params.m_strPadPlugin[i].empty())
|
||||||
GetPAD(i);
|
GetPAD(i);
|
||||||
if (m_pad[i] != NULL)
|
|
||||||
pad = true;
|
if (m_pad[i] != NULL)
|
||||||
}
|
pad = true;
|
||||||
if (! pad)
|
|
||||||
{
|
|
||||||
PanicAlert("Can't init any PAD Plugins");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init wiimote
|
if (! pad) {
|
||||||
if (m_params.bWii)
|
PanicAlert("Can't init any PAD Plugins");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (m_params.bWii) {
|
||||||
|
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
if (! m_params.m_strWiimotePlugin[i].empty())
|
||||||
{
|
GetWiimote(i);
|
||||||
if (! m_params.m_strWiimotePlugin[i].empty())
|
|
||||||
GetWiimote(i);
|
|
||||||
|
|
||||||
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");
|
PanicAlert("Can't init any Wiimote Plugins");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPluginManager::ShutdownPlugins()
|
void CPluginManager::ShutdownPlugins()
|
||||||
{
|
{
|
||||||
// Check if we can shutdown the plugin
|
for (int i = 0; i < MAXPADS; i++) {
|
||||||
for (int i = 0; i < MAXPADS; i++)
|
if (m_pad[i]) {
|
||||||
{
|
m_pad[i]->Shutdown();
|
||||||
if (m_pad[i] && OkayToInitPlugin(i))
|
delete m_pad[i];
|
||||||
{
|
m_pad[i] = NULL;
|
||||||
//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
|
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
|
|
||||||
|
|
||||||
void *CPluginManager::LoadPlugin(const char *_rFilename)//, PLUGIN_TYPE type)
|
|
||||||
{
|
|
||||||
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())
|
if (! m_InputManager->Shutdown()) {
|
||||||
{
|
PanicAlert("Error cleaning after input manager");
|
||||||
PanicAlert("Can't open %s", _rFilename);
|
}
|
||||||
return NULL;
|
|
||||||
}
|
for (int i = 0; i < MAXWIIMOTES; i++) {
|
||||||
|
if (m_wiimote[i]) {
|
||||||
plugin->SetGlobals(m_PluginGlobals);
|
m_wiimote[i]->Shutdown();
|
||||||
return plugin;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------
|
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)
|
|
||||||
{
|
|
||||||
//Console::Print("OkayToInitShutdown: %i", 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])
|
|
||||||
{
|
|
||||||
//Console::Print("(%i %i) %s\n", Plugin, i, g_CoreStartupParameter.m_strPadPlugin[Plugin].c_str());
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PLUGIN_GLOBALS* CPluginManager::GetGlobals()
|
|
||||||
{
|
|
||||||
return m_PluginGlobals;
|
return m_PluginGlobals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// Create list of available plugins
|
// Create list of available plugins
|
||||||
// -------------
|
// -------------
|
||||||
|
@ -267,29 +180,12 @@ void CPluginManager::ScanForPlugins()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Create or return the already created plugin pointers
|
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
Common::PluginPAD *CPluginManager::GetPAD(int controller)
|
Common::PluginPAD *CPluginManager::GetPAD(int controller)
|
||||||
{
|
{
|
||||||
if (m_pad[controller] == NULL)
|
if (m_pad[controller] == NULL)
|
||||||
{
|
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str());
|
||||||
if(OkayToInitPlugin(controller) == -1)
|
|
||||||
{
|
|
||||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str());
|
|
||||||
Console::Print("LoadPlugin: %i\n", controller);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
|
||||||
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Console::Print("Returned: %i\n", controller);
|
|
||||||
return m_pad[controller];
|
return m_pad[controller];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,15 +213,45 @@ Common::PluginVideo *CPluginManager::GetVideo() {
|
||||||
|
|
||||||
return m_video;
|
return m_video;
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////
|
|
||||||
|
void *CPluginManager::LoadPlugin(const char *_rFilename)//, PLUGIN_TYPE type)
|
||||||
|
{
|
||||||
|
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;
|
||||||
// Call DLL functions
|
}
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// Open config window. _rFilename = plugin filename , ret = the dll slot number
|
// Open config window. _rFilename = plugin filename ,ret = the dll slot number
|
||||||
// -------------
|
// -------------
|
||||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
||||||
{
|
{
|
||||||
|
@ -342,9 +268,9 @@ 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)
|
||||||
{
|
{
|
||||||
if (Type == PLUGIN_TYPE_VIDEO) {
|
if (Type == PLUGIN_TYPE_VIDEO) {
|
||||||
GetVideo()->Debug((HWND)_Parent, Show);
|
GetVideo()->Debug((HWND)_Parent, Show);
|
||||||
} else if (Type == PLUGIN_TYPE_DSP) {
|
} else if (Type == PLUGIN_TYPE_DSP) {
|
||||||
GetDSP()->Debug((HWND)_Parent, Show);
|
GetDSP()->Debug((HWND)_Parent, Show);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,15 +282,13 @@ CPluginInfo::CPluginInfo(const char *_rFileName)
|
||||||
, m_Valid(false)
|
, m_Valid(false)
|
||||||
{
|
{
|
||||||
Common::CPlugin *plugin = new Common::CPlugin(_rFileName);
|
Common::CPlugin *plugin = new Common::CPlugin(_rFileName);
|
||||||
if (plugin->IsValid())
|
if (plugin->IsValid()) {
|
||||||
{
|
if (plugin->GetInfo(m_PluginInfo))
|
||||||
if (plugin->GetInfo(m_PluginInfo))
|
m_Valid = true;
|
||||||
m_Valid = true;
|
else
|
||||||
else
|
PanicAlert("Could not get info about plugin %s", _rFileName);
|
||||||
PanicAlert("Could not get info about plugin %s", _rFileName);
|
delete plugin;
|
||||||
|
}
|
||||||
delete plugin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "PluginWiimote.h"
|
#include "PluginWiimote.h"
|
||||||
#include "EventHandler.h"
|
#include "EventHandler.h"
|
||||||
#include "CoreParameter.h"
|
#include "CoreParameter.h"
|
||||||
|
#include "InputManager.h"
|
||||||
|
|
||||||
class CPluginInfo
|
class CPluginInfo
|
||||||
{
|
{
|
||||||
|
@ -70,6 +71,7 @@ private:
|
||||||
Common::PluginWiimote *m_wiimote[4];
|
Common::PluginWiimote *m_wiimote[4];
|
||||||
Common::PluginDSP *m_dsp;
|
Common::PluginDSP *m_dsp;
|
||||||
|
|
||||||
|
InputManager *m_InputManager;
|
||||||
SCoreStartupParameter& m_params;
|
SCoreStartupParameter& m_params;
|
||||||
CPluginManager();
|
CPluginManager();
|
||||||
~CPluginManager();
|
~CPluginManager();
|
||||||
|
|
|
@ -15,7 +15,8 @@ files = ["Console.cpp",
|
||||||
"PatchEngine.cpp",
|
"PatchEngine.cpp",
|
||||||
"State.cpp",
|
"State.cpp",
|
||||||
"Tracer.cpp",
|
"Tracer.cpp",
|
||||||
'PluginManager.cpp',
|
"PluginManager.cpp",
|
||||||
|
"InputManager.cpp",
|
||||||
"VolumeHandler.cpp",
|
"VolumeHandler.cpp",
|
||||||
"Boot/Boot.cpp",
|
"Boot/Boot.cpp",
|
||||||
"Boot/Boot_BIOSEmu.cpp",
|
"Boot/Boot_BIOSEmu.cpp",
|
||||||
|
|
|
@ -181,12 +181,11 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
||||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call config dialog
|
// Call config dialog
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
void DllConfig(HWND _hParent)
|
void DllConfig(HWND _hParent)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
|
||||||
|
|
||||||
// Start the pads so we can use them in the configuration and advanced controls
|
// Start the pads so we can use them in the configuration and advanced controls
|
||||||
if(!emulator_running)
|
if(!emulator_running)
|
||||||
{
|
{
|
||||||
|
@ -197,32 +196,11 @@ void DllConfig(HWND _hParent)
|
||||||
emulator_running = false; // Set it back to false
|
emulator_running = false; // Set it back to false
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Config.Load(); // Load settings
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
|
|
||||||
// We don't need a parent for this wxDialog
|
|
||||||
//wxWindow win;
|
|
||||||
//win.SetHWND(_hParent);
|
|
||||||
//ConfigBox frame(&win);
|
|
||||||
//win.SetHWND(0);
|
|
||||||
|
|
||||||
m_frame = new ConfigBox(NULL);
|
m_frame = new ConfigBox(NULL);
|
||||||
m_frame->ShowModal();
|
m_frame->ShowModal();
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
if (SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
|
||||||
{
|
|
||||||
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_Config.Load(); // load settings
|
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
|
||||||
ConfigBox frame(NULL);
|
|
||||||
frame.ShowModal();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DllDebugger(HWND _hParent, bool Show) {
|
void DllDebugger(HWND _hParent, bool Show) {
|
||||||
|
@ -249,18 +227,6 @@ void Initialize(void *init)
|
||||||
DEBUG_INIT();
|
DEBUG_INIT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API, and with this we need
|
|
||||||
the SDL_INIT_VIDEO flag to */
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
|
||||||
#else
|
|
||||||
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_hWnd = (HWND)_PADInitialize.hWnd;
|
m_hWnd = (HWND)_PADInitialize.hWnd;
|
||||||
#endif
|
#endif
|
||||||
|
@ -302,12 +268,8 @@ int Search_Devices()
|
||||||
// Warn the user if no PadMapping are detected
|
// Warn the user if no PadMapping are detected
|
||||||
if (numjoy == 0)
|
if (numjoy == 0)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
PanicAlert("No Joystick detected!\n");
|
||||||
//MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
|
return 0;
|
||||||
#else
|
|
||||||
printf("No Joystick detected!\n");
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -361,8 +323,6 @@ void Shutdown()
|
||||||
if (PadMapping[3].enabled && SDL_JoystickOpened(PadMapping[3].ID))
|
if (PadMapping[3].enabled && SDL_JoystickOpened(PadMapping[3].ID))
|
||||||
SDL_JoystickClose(joystate[3].joy);
|
SDL_JoystickClose(joystate[3].joy);
|
||||||
|
|
||||||
SDL_Quit();
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DEBUG_QUIT();
|
DEBUG_QUIT();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -164,37 +164,22 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||||
// Call config dialog
|
// Call config dialog
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
void DllConfig(HWND _hParent)
|
void DllConfig(HWND _hParent)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
// Start the pads so we can use them in the configuration and advanced controls
|
||||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
if(!emulator_running)
|
||||||
{
|
{
|
||||||
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
SPADInitialize _PADInitialize;
|
||||||
return;
|
_PADInitialize.hWnd = NULL;
|
||||||
|
_PADInitialize.pLog = NULL;
|
||||||
|
Initialize((void*)&_PADInitialize);
|
||||||
|
emulator_running = false; // Set it back to false
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadConfig(); // load settings
|
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
wxWindow win;
|
m_frame = new ConfigBox(NULL);
|
||||||
win.SetHWND(_hParent);
|
m_frame->ShowModal();
|
||||||
ConfigBox frame(&win);
|
|
||||||
frame.ShowModal();
|
|
||||||
win.SetHWND(0);
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
|
||||||
{
|
|
||||||
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadConfig(); // load settings
|
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
|
||||||
ConfigBox frame(NULL);
|
|
||||||
frame.ShowModal();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DllDebugger(HWND _hParent, bool Show) {
|
void DllDebugger(HWND _hParent, bool Show) {
|
||||||
|
@ -210,16 +195,6 @@ void Initialize(void *init)
|
||||||
DEBUG_INIT();
|
DEBUG_INIT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
|
||||||
#else
|
|
||||||
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_hWnd = (HWND)_PADInitialize.hWnd;
|
m_hWnd = (HWND)_PADInitialize.hWnd;
|
||||||
#endif
|
#endif
|
||||||
|
@ -249,8 +224,6 @@ void Shutdown()
|
||||||
if(joysticks[3].enabled)
|
if(joysticks[3].enabled)
|
||||||
SDL_JoystickClose(joystate[3].joy);
|
SDL_JoystickClose(joystate[3].joy);
|
||||||
|
|
||||||
SDL_Quit();
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DEBUG_QUIT();
|
DEBUG_QUIT();
|
||||||
#endif
|
#endif
|
||||||
|
@ -700,13 +673,9 @@ int Search_Devices()
|
||||||
int numjoy = SDL_NumJoysticks();
|
int numjoy = SDL_NumJoysticks();
|
||||||
|
|
||||||
if(numjoy == 0)
|
if(numjoy == 0)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
PanicAlert("No Joystick detected!\n");
|
||||||
MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
|
return 0;
|
||||||
#else
|
|
||||||
printf("No Joystick detected!\n");
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(joyinfo)
|
if(joyinfo)
|
||||||
|
|
Loading…
Reference in New Issue