Warp back to 1983!!! (rev 1983, that is, not the year :P)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1997 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
7ecf884f9a
commit
70bc8167f8
|
@ -38,7 +38,6 @@
|
||||||
|
|
||||||
#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"
|
||||||
|
|
|
@ -37,10 +37,8 @@ CPlugin::~CPlugin()
|
||||||
|
|
||||||
CPlugin::CPlugin(const char* _szName) : valid(false)
|
CPlugin::CPlugin(const char* _szName) : valid(false)
|
||||||
{
|
{
|
||||||
if (m_hInstLib.Load(_szName))
|
if (m_hInstLib.Load(_szName)) {
|
||||||
{
|
|
||||||
|
|
||||||
// Create pointers to the DLL functions
|
|
||||||
m_GetDllInfo = reinterpret_cast<TGetDllInfo>
|
m_GetDllInfo = reinterpret_cast<TGetDllInfo>
|
||||||
(m_hInstLib.Get("GetDllInfo"));
|
(m_hInstLib.Get("GetDllInfo"));
|
||||||
m_DllConfig = reinterpret_cast<TDllConfig>
|
m_DllConfig = reinterpret_cast<TDllConfig>
|
||||||
|
@ -66,20 +64,16 @@ CPlugin::CPlugin(const char* _szName) : valid(false)
|
||||||
m_DoState != 0)
|
m_DoState != 0)
|
||||||
valid = true;
|
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);
|
return m_hInstLib.Get(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ______________________________________________________________________________________
|
// ______________________________________________________________________________________
|
||||||
// GetInfo: Get DLL info
|
// GetInfo: Get DLL info
|
||||||
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo)
|
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) {
|
||||||
{
|
|
||||||
if (m_GetDllInfo != 0)
|
if (m_GetDllInfo != 0)
|
||||||
{
|
{
|
||||||
m_GetDllInfo(&_pluginInfo);
|
m_GetDllInfo(&_pluginInfo);
|
||||||
|
|
|
@ -40,7 +40,6 @@ class CPlugin
|
||||||
~CPlugin();
|
~CPlugin();
|
||||||
|
|
||||||
virtual bool IsValid() {return valid;};
|
virtual bool IsValid() {return valid;};
|
||||||
virtual std::string GetFilename() {return Filename;};
|
|
||||||
|
|
||||||
bool GetInfo(PLUGIN_INFO& _pluginInfo);
|
bool GetInfo(PLUGIN_INFO& _pluginInfo);
|
||||||
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
|
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
|
||||||
|
@ -57,7 +56,6 @@ class CPlugin
|
||||||
|
|
||||||
DynamicLibrary m_hInstLib;
|
DynamicLibrary m_hInstLib;
|
||||||
bool valid;
|
bool valid;
|
||||||
std::string Filename;
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
TGetDllInfo m_GetDllInfo;
|
TGetDllInfo m_GetDllInfo;
|
||||||
|
|
|
@ -4,15 +4,13 @@
|
||||||
#include "pluginspecs_pad.h"
|
#include "pluginspecs_pad.h"
|
||||||
#include "Plugin.h"
|
#include "Plugin.h"
|
||||||
|
|
||||||
namespace Common
|
namespace Common {
|
||||||
{
|
|
||||||
typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*);
|
typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*);
|
||||||
typedef void (__cdecl* TPAD_Input)(u16, u8);
|
typedef void (__cdecl* TPAD_Input)(u16, u8);
|
||||||
typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int);
|
typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int);
|
||||||
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
||||||
|
|
||||||
class PluginPAD : public CPlugin
|
class PluginPAD : public CPlugin {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
PluginPAD(const char *_Filename);
|
PluginPAD(const char *_Filename);
|
||||||
~PluginPAD();
|
~PluginPAD();
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
#include "PluginVideo.h"
|
#include "PluginVideo.h"
|
||||||
|
|
||||||
namespace Common
|
namespace Common {
|
||||||
{
|
PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo(false) {
|
||||||
PluginVideo::PluginVideo(const char *_Filename) :
|
|
||||||
CPlugin(_Filename),
|
|
||||||
validVideo(false)
|
|
||||||
{
|
|
||||||
|
|
||||||
Video_Prepare = reinterpret_cast<TVideo_Prepare>
|
Video_Prepare = reinterpret_cast<TVideo_Prepare>
|
||||||
(LoadSymbol("Video_Prepare"));
|
(LoadSymbol("Video_Prepare"));
|
||||||
|
|
|
@ -13,8 +13,7 @@ namespace Common {
|
||||||
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
|
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
|
||||||
typedef void (__cdecl* TVideo_Stop)();
|
typedef void (__cdecl* TVideo_Stop)();
|
||||||
|
|
||||||
class PluginVideo : public CPlugin
|
class PluginVideo : public CPlugin {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
PluginVideo(const char *_Filename);
|
PluginVideo(const char *_Filename);
|
||||||
~PluginVideo();
|
~PluginVideo();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="9,00"
|
Version="9.00"
|
||||||
Name="Core"
|
Name="Core"
|
||||||
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
|
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
|
||||||
RootNamespace="Core"
|
RootNamespace="Core"
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
EnableFiberSafeOptimizations="false"
|
EnableFiberSafeOptimizations="false"
|
||||||
AdditionalIncludeDirectories="..\..\..\Externals\SDL\Include;.\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
|
AdditionalIncludeDirectories=".\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"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
|
|
|
@ -155,6 +155,8 @@ bool GetRealWiimote()
|
||||||
// -----------------
|
// -----------------
|
||||||
bool Init()
|
bool Init()
|
||||||
{
|
{
|
||||||
|
//Console::Open();
|
||||||
|
|
||||||
if (g_pThread != NULL)
|
if (g_pThread != NULL)
|
||||||
{
|
{
|
||||||
PanicAlert("ERROR: Emu Thread already running. Report this bug.");
|
PanicAlert("ERROR: Emu Thread already running. Report this bug.");
|
||||||
|
@ -345,18 +347,7 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||||
PADInitialize.pLog = Callback_PADLog;
|
PADInitialize.pLog = Callback_PADLog;
|
||||||
PADInitialize.padNumber = i;
|
PADInitialize.padNumber = i;
|
||||||
// Check if we should init the plugin
|
// Check if we should init the plugin
|
||||||
if(Plugins.OkayToInitPlugin(i))
|
if(Plugins.OkayToInitPlugin(i)) Plugins.GetPAD(i)->Initialize((void *)&PADInitialize);
|
||||||
{
|
|
||||||
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
|
// Load and Init WiimotePlugin - only if we are booting in wii mode
|
||||||
|
|
|
@ -254,8 +254,9 @@ void Init()
|
||||||
g_Channel[i].m_InHi.Hex = 0;
|
g_Channel[i].m_InHi.Hex = 0;
|
||||||
g_Channel[i].m_InLo.Hex = 0;
|
g_Channel[i].m_InLo.Hex = 0;
|
||||||
|
|
||||||
// Access the pap
|
// Access the pad and check the MAXPADS limit
|
||||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(i);
|
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD((i >= MAXPADS) ? (MAXPADS - 1): i);
|
||||||
|
//Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(i);
|
||||||
|
|
||||||
// Check if this pad is attached for the current plugin
|
// Check if this pad is attached for the current plugin
|
||||||
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))
|
if (pad != NULL && (pad->PAD_GetAttachedPads() & (1 << i)))
|
||||||
|
|
|
@ -120,7 +120,8 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||||
SPADStatus PadStatus;
|
SPADStatus PadStatus;
|
||||||
memset(&PadStatus, 0 ,sizeof(PadStatus));
|
memset(&PadStatus, 0 ,sizeof(PadStatus));
|
||||||
Common::PluginPAD* pad =
|
Common::PluginPAD* pad =
|
||||||
CPluginManager::GetInstance().GetPad(ISIDevice::m_iDeviceNumber);
|
//CPluginManager::GetInstance().GetPAD(ISIDevice::m_iDeviceNumber);
|
||||||
|
CPluginManager::GetInstance().GetPAD((ISIDevice::m_iDeviceNumber >= MAXPADS) ? (MAXPADS - 1): ISIDevice::m_iDeviceNumber);
|
||||||
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
|
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
|
||||||
|
|
||||||
_Hi = (u32)((u8)PadStatus.stickY);
|
_Hi = (u32)((u8)PadStatus.stickY);
|
||||||
|
@ -147,7 +148,7 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
||||||
void
|
void
|
||||||
CSIDevice_GCController::SendCommand(u32 _Cmd)
|
CSIDevice_GCController::SendCommand(u32 _Cmd)
|
||||||
{
|
{
|
||||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad(0);
|
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0);
|
||||||
UCommand command(_Cmd);
|
UCommand command(_Cmd);
|
||||||
|
|
||||||
switch(command.Command)
|
switch(command.Command)
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#include "ConsoleWindow.h"
|
#include "ConsoleWindow.h"
|
||||||
|
|
||||||
CPluginManager CPluginManager::m_Instance;
|
CPluginManager CPluginManager::m_Instance;
|
||||||
|
|
||||||
//#define INPUTCOMMON
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,26 +44,14 @@ CPluginManager::CPluginManager() :
|
||||||
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
||||||
{
|
{
|
||||||
m_PluginGlobals = new PLUGIN_GLOBALS;
|
m_PluginGlobals = new PLUGIN_GLOBALS;
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
#ifdef INPUTCOMMON
|
|
||||||
m_InputManager = new InputManager();
|
|
||||||
m_PluginGlobals->inputManager = m_InputManager;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function: FreeLibrary()
|
// Function: FreeLibrary()
|
||||||
Called from: In an attempt to avoid the crash that occurs when the use LoadLibrary() and
|
// Called from: This will be called when Dolphin is closed, not when we Stop a game
|
||||||
FreeLibrary() often (every game a game is stopped and started) these functions will only
|
|
||||||
be used when
|
|
||||||
1. Dolphin is started
|
|
||||||
2. A plugin is changed
|
|
||||||
3. Dolphin is closed
|
|
||||||
it will not be used when we Start and Stop games. */
|
|
||||||
CPluginManager::~CPluginManager()
|
CPluginManager::~CPluginManager()
|
||||||
{
|
{
|
||||||
Console::Print("Delete CPluginManager\n");
|
Console::Print("Delete CPluginManager\n");
|
||||||
|
@ -122,7 +108,7 @@ bool CPluginManager::InitPlugins()
|
||||||
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)
|
if (m_pad[i] != NULL)
|
||||||
pad = true;
|
pad = true;
|
||||||
}
|
}
|
||||||
|
@ -162,8 +148,8 @@ void CPluginManager::ShutdownPlugins()
|
||||||
{
|
{
|
||||||
//Console::Print("Shutdown: %i\n", i);
|
//Console::Print("Shutdown: %i\n", i);
|
||||||
m_pad[i]->Shutdown();
|
m_pad[i]->Shutdown();
|
||||||
//delete m_pad[i];
|
|
||||||
}
|
}
|
||||||
|
//delete m_pad[i];
|
||||||
//m_pad[i] = NULL;
|
//m_pad[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,33 +168,30 @@ void CPluginManager::ShutdownPlugins()
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Supporting functions
|
// Supporting functions
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
// Called from: Get__() functions in this file only (not from anywhere else)
|
|
||||||
void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)//, PLUGIN_TYPE type)
|
|
||||||
|
void *CPluginManager::LoadPlugin(const char *_rFilename)//, PLUGIN_TYPE type)
|
||||||
{
|
{
|
||||||
CPluginInfo info(_rFilename);
|
CPluginInfo info(_rFilename);
|
||||||
PLUGIN_TYPE type = info.GetPluginInfo().Type;
|
PLUGIN_TYPE type = info.GetPluginInfo().Type;
|
||||||
//std::string Filename = info.GetPluginInfo().Filename;
|
|
||||||
std::string Filename = _rFilename;
|
|
||||||
Common::CPlugin *plugin = NULL;
|
Common::CPlugin *plugin = NULL;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case PLUGIN_TYPE_VIDEO:
|
case PLUGIN_TYPE_VIDEO:
|
||||||
plugin = new Common::PluginVideo(_rFilename);
|
plugin = new Common::PluginVideo(_rFilename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLUGIN_TYPE_DSP:
|
|
||||||
plugin = new Common::PluginDSP(_rFilename);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PLUGIN_TYPE_PAD:
|
case PLUGIN_TYPE_PAD:
|
||||||
plugin = new Common::PluginPAD(_rFilename);
|
plugin = new Common::PluginPAD(_rFilename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PLUGIN_TYPE_DSP:
|
||||||
|
plugin = new Common::PluginDSP(_rFilename);
|
||||||
|
break;
|
||||||
|
|
||||||
case PLUGIN_TYPE_WIIMOTE:
|
case PLUGIN_TYPE_WIIMOTE:
|
||||||
plugin = new Common::PluginWiimote(_rFilename);
|
plugin = new Common::PluginWiimote(_rFilename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PanicAlert("Trying to load unsupported type %d", type);
|
PanicAlert("Trying to load unsupported type %d", type);
|
||||||
}
|
}
|
||||||
|
@ -229,12 +212,14 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)//, PLUGIN_T
|
||||||
// -------------
|
// -------------
|
||||||
int CPluginManager::OkayToInitPlugin(int Plugin)
|
int CPluginManager::OkayToInitPlugin(int Plugin)
|
||||||
{
|
{
|
||||||
|
//Console::Print("OkayToInitShutdown: %i", Plugin);
|
||||||
// Compare it to the earlier plugins
|
// Compare it to the earlier plugins
|
||||||
for(int i = 0; i < Plugin; i++)
|
for(int i = 0; i < Plugin; i++)
|
||||||
if (m_params.m_strPadPlugin[Plugin] == m_params.m_strPadPlugin[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 i;
|
||||||
|
}
|
||||||
// No there is no duplicate plugin
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,19 +271,15 @@ void CPluginManager::ScanForPlugins()
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/* Create or return the already created plugin pointers. This will be called often for the
|
// Create or return the already created plugin pointers
|
||||||
Pad and Wiimote from the SI_.cpp files. */
|
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
Common::PluginPAD *CPluginManager::GetPad(int controller)
|
Common::PluginPAD *CPluginManager::GetPAD(int controller)
|
||||||
|
{
|
||||||
|
if (m_pad[controller] == NULL)
|
||||||
{
|
{
|
||||||
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)
|
if(OkayToInitPlugin(controller) == -1)
|
||||||
{
|
{
|
||||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str(), controller);
|
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str());
|
||||||
Console::Print("LoadPlugin: %i\n", controller);
|
Console::Print("LoadPlugin: %i\n", controller);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -306,47 +287,36 @@ Common::PluginPAD *CPluginManager::GetPad(int controller)
|
||||||
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
||||||
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Console::Print("Returned: %i\n", controller);
|
||||||
return m_pad[controller];
|
return m_pad[controller];
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
|
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
|
||||||
{
|
{
|
||||||
if (m_pad[controller] != NULL)
|
if (m_wiimote[controller] == NULL)
|
||||||
if (m_wiimote[controller]->GetFilename() == m_params.m_strWiimotePlugin[controller])
|
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin
|
||||||
return m_wiimote[controller];
|
(m_params.m_strWiimotePlugin[controller].c_str());
|
||||||
|
|
||||||
// Else load a new plugin
|
|
||||||
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params.m_strWiimotePlugin[controller].c_str());
|
|
||||||
return m_wiimote[controller];
|
return m_wiimote[controller];
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::PluginDSP *CPluginManager::GetDSP()
|
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());
|
m_dsp = (Common::PluginDSP*)LoadPlugin(m_params.m_strDSPPlugin.c_str());
|
||||||
|
|
||||||
return m_dsp;
|
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;
|
|
||||||
|
|
||||||
// Else load a new plugin
|
if (m_video == NULL)
|
||||||
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str());
|
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str());
|
||||||
|
|
||||||
return m_video;
|
return m_video;
|
||||||
}
|
}
|
||||||
Common::PluginPAD *CPluginManager::FreePad()
|
|
||||||
{
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@ -355,33 +325,15 @@ Common::PluginPAD *CPluginManager::FreePad()
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// Open config window. Input: _rFilename = Plugin filename , Type = Plugin type
|
// Open config window. _rFilename = plugin filename , ret = the dll slot number
|
||||||
// -------------
|
// -------------
|
||||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type)
|
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
||||||
{
|
{
|
||||||
#ifdef INPUTCOMMON
|
|
||||||
m_InputManager->Init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch(Type)
|
Common::CPlugin *plugin = new Common::CPlugin(_rFilename);
|
||||||
{
|
plugin->SetGlobals(m_PluginGlobals);
|
||||||
case PLUGIN_TYPE_VIDEO:
|
plugin->Config((HWND)_Parent);
|
||||||
GetVideo()->Config((HWND)_Parent);
|
delete plugin;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef INPUTCOMMON
|
|
||||||
m_InputManager->Shutdown();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
@ -389,14 +341,10 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY
|
||||||
// -------------
|
// -------------
|
||||||
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)
|
||||||
{
|
{
|
||||||
switch(Type)
|
if (Type == PLUGIN_TYPE_VIDEO) {
|
||||||
{
|
|
||||||
case PLUGIN_TYPE_VIDEO:
|
|
||||||
GetVideo()->Debug((HWND)_Parent, Show);
|
GetVideo()->Debug((HWND)_Parent, Show);
|
||||||
break;
|
} else if (Type == PLUGIN_TYPE_DSP) {
|
||||||
case PLUGIN_TYPE_DSP:
|
|
||||||
GetDSP()->Debug((HWND)_Parent, Show);
|
GetDSP()->Debug((HWND)_Parent, Show);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#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
|
||||||
{
|
{
|
||||||
|
@ -47,23 +46,20 @@ class CPluginManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static CPluginManager& GetInstance() {return(m_Instance);}
|
static CPluginManager& GetInstance() {return(m_Instance);}
|
||||||
Common::PluginPAD *GetPad(int controller);
|
Common::PluginPAD *GetPAD(int controller);
|
||||||
Common::PluginWiimote *GetWiimote(int controller);
|
Common::PluginWiimote *GetWiimote(int controller);
|
||||||
Common::PluginDSP *GetDSP();
|
Common::PluginDSP *GetDSP();
|
||||||
Common::PluginVideo *GetVideo();
|
Common::PluginVideo *GetVideo();
|
||||||
Common::PluginPAD *FreePad();
|
|
||||||
|
|
||||||
bool InitPlugins();
|
bool InitPlugins();
|
||||||
void ShutdownPlugins();
|
void ShutdownPlugins();
|
||||||
int OkayToInitPlugin(int Plugin);
|
int OkayToInitPlugin(int Plugin);
|
||||||
void ScanForPlugins();
|
void ScanForPlugins();
|
||||||
void OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type);
|
void OpenConfig(void* _Parent, const char *_rFilename);
|
||||||
void OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show);
|
void OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show);
|
||||||
const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);}
|
const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);}
|
||||||
PLUGIN_GLOBALS* GetGlobals();
|
PLUGIN_GLOBALS* GetGlobals();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static CPluginManager m_Instance;
|
static CPluginManager m_Instance;
|
||||||
bool m_Initialized;
|
bool m_Initialized;
|
||||||
|
|
||||||
|
@ -74,11 +70,10 @@ 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();
|
||||||
void *LoadPlugin(const char *_rFilename, int Number = 0);
|
void *LoadPlugin(const char *_rFilename);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ files = ["Console.cpp",
|
||||||
"PatchEngine.cpp",
|
"PatchEngine.cpp",
|
||||||
"State.cpp",
|
"State.cpp",
|
||||||
"Tracer.cpp",
|
"Tracer.cpp",
|
||||||
"PluginManager.cpp",
|
'PluginManager.cpp',
|
||||||
"VolumeHandler.cpp",
|
"VolumeHandler.cpp",
|
||||||
"Boot/Boot.cpp",
|
"Boot/Boot.cpp",
|
||||||
"Boot/Boot_BIOSEmu.cpp",
|
"Boot/Boot_BIOSEmu.cpp",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="9,00"
|
Version="9.00"
|
||||||
Name="DebuggerWX"
|
Name="DebuggerWX"
|
||||||
ProjectGUID="{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}"
|
ProjectGUID="{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}"
|
||||||
RootNamespace="DebuggerWX"
|
RootNamespace="DebuggerWX"
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
WholeProgramOptimization="false"
|
WholeProgramOptimization="false"
|
||||||
AdditionalIncludeDirectories="..\..\..\Externals\SDL\Include;..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
|
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
|
|
|
@ -170,8 +170,8 @@ bool IBannerLoader::CopyUnicodeToString( std::string& _rDestination, const u16*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// FIXME completly broken on not windows!!!!!
|
// not implement other than windows
|
||||||
// _rDestination = _src;
|
_rDestination = _src;
|
||||||
returnCode = true;
|
returnCode = true;
|
||||||
#endif
|
#endif
|
||||||
return returnCode;
|
return returnCode;
|
||||||
|
|
|
@ -126,8 +126,6 @@ CBannerLoaderWii::GetName(std::string& _rName, DiscIO::IVolume::ECountry languag
|
||||||
|
|
||||||
// find Banner type
|
// find Banner type
|
||||||
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
|
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
|
||||||
#ifdef _WIN32 // FIXME this should NOT be windows specific!!!
|
|
||||||
|
|
||||||
if (DiscIO::IVolume::COUNTRY_JAP == language)
|
if (DiscIO::IVolume::COUNTRY_JAP == language)
|
||||||
{
|
{
|
||||||
return CopyUnicodeToString(_rName, pBanner->m_Comment[0]);
|
return CopyUnicodeToString(_rName, pBanner->m_Comment[0]);
|
||||||
|
@ -138,9 +136,6 @@ CBannerLoaderWii::GetName(std::string& _rName, DiscIO::IVolume::ECountry languag
|
||||||
_rName = StupidWideCharToString(pBanner->m_Comment[0], WII_BANNER_COMMENT_SIZE);
|
_rName = StupidWideCharToString(pBanner->m_Comment[0], WII_BANNER_COMMENT_SIZE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
_rName = StupidWideCharToString(pBanner->m_Comment[0], WII_BANNER_COMMENT_SIZE);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Core.h" // Core
|
#include "Core.h" // Core
|
||||||
#include "ConsoleWindow.h" // Core
|
|
||||||
|
|
||||||
#include "Globals.h" // Local
|
#include "Globals.h" // Local
|
||||||
#include "ConfigMain.h"
|
#include "ConfigMain.h"
|
||||||
|
@ -682,23 +681,18 @@ void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath().ToAscii();
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot = DVDRoot->GetPath().ToAscii();
|
||||||
}
|
}
|
||||||
// ==========================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =======================================================
|
|
||||||
// Plugins settings
|
|
||||||
// -------------
|
|
||||||
|
|
||||||
// Update plugin filenames
|
|
||||||
void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
|
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
|
||||||
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
|
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
|
||||||
|
|
||||||
for (int i = 0; i < MAXPADS; i++)
|
for (int i = 0; i < MAXPADS; i++)
|
||||||
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
|
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
|
||||||
|
|
||||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||||
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
|
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigMain::OnConfig(wxCommandEvent& event)
|
void CConfigMain::OnConfig(wxCommandEvent& event)
|
||||||
|
@ -722,25 +716,15 @@ void CConfigMain::OnConfig(wxCommandEvent& event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ==========================
|
||||||
|
|
||||||
void CConfigMain::CallConfig(wxChoice* _pChoice)
|
|
||||||
{
|
|
||||||
int Index = _pChoice->GetSelection();
|
|
||||||
Console::Print("CallConfig: %i\n", Index);
|
|
||||||
|
|
||||||
if (Index >= 0)
|
|
||||||
{
|
|
||||||
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
|
||||||
|
|
||||||
if (pInfo != NULL)
|
|
||||||
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFileName().c_str(), pInfo->GetPluginInfo().Type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// =======================================================
|
||||||
|
// Plugins settings
|
||||||
|
// -------------
|
||||||
void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
|
void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
|
||||||
{
|
{
|
||||||
Console::Print("FillChoiceBox\n");
|
|
||||||
|
|
||||||
_pChoice->Clear();
|
_pChoice->Clear();
|
||||||
|
|
||||||
int Index = -1;
|
int Index = -1;
|
||||||
|
@ -766,16 +750,31 @@ void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::
|
||||||
_pChoice->Select(Index);
|
_pChoice->Select(Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
|
void CConfigMain::CallConfig(wxChoice* _pChoice)
|
||||||
{
|
{
|
||||||
_rFilename.clear();
|
|
||||||
int Index = _pChoice->GetSelection();
|
int Index = _pChoice->GetSelection();
|
||||||
|
|
||||||
|
if (Index >= 0)
|
||||||
|
{
|
||||||
|
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
||||||
|
|
||||||
|
if (pInfo != NULL)
|
||||||
|
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFileName().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
|
||||||
|
{
|
||||||
|
_rFilename.clear();
|
||||||
|
|
||||||
|
int Index = _pChoice->GetSelection();
|
||||||
|
printf("%i\n", Index);
|
||||||
|
|
||||||
if (Index >= 0)
|
if (Index >= 0)
|
||||||
{
|
{
|
||||||
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
||||||
_rFilename = pInfo->GetFileName();
|
_rFilename = pInfo->GetFileName();
|
||||||
Console::Print("GetFilename: %i %s\n", Index, _rFilename.c_str());
|
printf("%s\n", _rFilename.c_str());
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||||
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
|
CPluginManager::GetInstance().GetPAD(0)->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
void CFrame::OnKeyUp(wxKeyEvent& event)
|
void CFrame::OnKeyUp(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||||
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
|
CPluginManager::GetInstance().GetPAD(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
|
||||||
double GetDoubleTime()
|
double GetDoubleTime()
|
||||||
{
|
{
|
||||||
wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
|
wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
|
||||||
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continuous timestamp
|
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous timestamp
|
||||||
|
|
||||||
/* Remove a few years. We only really want enough seconds to make sure that we are
|
/* Remove a few years. We only really want enough seconds to make sure that we are
|
||||||
detecting actual actions, perhaps 60 seconds is enough really, but I leave a
|
detecting actual actions, perhaps 60 seconds is enough really, but I leave a
|
||||||
|
|
|
@ -539,8 +539,7 @@ void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
CPluginManager::GetInstance().OpenConfig(
|
CPluginManager::GetInstance().OpenConfig(
|
||||||
GetHandle(),
|
GetHandle(),
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str()
|
||||||
PLUGIN_TYPE_VIDEO
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,8 +548,7 @@ void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
CPluginManager::GetInstance().OpenConfig(
|
CPluginManager::GetInstance().OpenConfig(
|
||||||
GetHandle(),
|
GetHandle(),
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str()
|
||||||
PLUGIN_TYPE_DSP
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,16 +556,14 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
CPluginManager::GetInstance().OpenConfig(
|
CPluginManager::GetInstance().OpenConfig(
|
||||||
GetHandle(),
|
GetHandle(),
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0].c_str(),
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0].c_str()
|
||||||
PLUGIN_TYPE_PAD
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
|
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
CPluginManager::GetInstance().OpenConfig(
|
CPluginManager::GetInstance().OpenConfig(
|
||||||
GetHandle(),
|
GetHandle(),
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[0].c_str(),
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[0].c_str()
|
||||||
PLUGIN_TYPE_WIIMOTE
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="9,00"
|
Version="9.00"
|
||||||
Name="InputCommon"
|
Name="InputCommon"
|
||||||
ProjectGUID="{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}"
|
ProjectGUID="{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}"
|
||||||
RootNamespace="VideoCommon"
|
RootNamespace="VideoCommon"
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_SECURE_SCL=0;_LIB;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_SECURE_SCL=0;_LIB;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
|
@ -175,7 +175,7 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;..\..\..\Externals\SDL\Include"
|
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
|
@ -245,7 +245,7 @@
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
OmitFramePointers="false"
|
OmitFramePointers="false"
|
||||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
|
@ -307,7 +307,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
|
@ -370,7 +370,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc;"$(SolutionDir)..\Externals\SDL\Include""
|
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
|
@ -431,14 +431,6 @@
|
||||||
RelativePath=".\Src\InputCommon.h"
|
RelativePath=".\Src\InputCommon.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\Src\InputManager.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\InputManager.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\SConscript"
|
RelativePath=".\Src\SConscript"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
#include "InputManager.h"
|
|
||||||
|
|
||||||
bool InputManager::Init() {
|
|
||||||
|
|
||||||
if (! SDLInit())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ScanDevices();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool InputManager::Shutdown() {
|
|
||||||
SDLShutdown();
|
|
||||||
sdlInit = false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool InputManager::SDLInit() {
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sdlInit;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
void InputManager::SDLShutdown() {
|
|
||||||
for(int i = 0; i < numjoy; i++ ) {
|
|
||||||
if (SDL_JoystickOpened(m_joyinfo[i].ID))
|
|
||||||
SDL_JoystickClose(m_joyinfo[i].joy);
|
|
||||||
}
|
|
||||||
SDL_Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
int InputManager::ScanDevices() {
|
|
||||||
|
|
||||||
int res = SDLScanDevices();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
int InputManager::SDLScanDevices() {
|
|
||||||
#if defined HAVE_SDL && HAVE_SDL
|
|
||||||
numjoy = SDL_NumJoysticks();
|
|
||||||
|
|
||||||
if(numjoy == 0) {
|
|
||||||
PanicAlert("No Joystick detected!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_joyinfo)
|
|
||||||
delete [] m_joyinfo;
|
|
||||||
|
|
||||||
m_joyinfo = new ControllerInfo[numjoy];
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
fprintf(pFile, "Scanning for devices\n");
|
|
||||||
fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for(int i = 0; i < numjoy; i++ ) {
|
|
||||||
m_joyinfo[i].joy = SDL_JoystickOpen(i);
|
|
||||||
m_joyinfo[i].ID = i;
|
|
||||||
m_joyinfo[i].NumAxes = SDL_JoystickNumAxes(m_joyinfo[i].joy);
|
|
||||||
m_joyinfo[i].NumButtons = SDL_JoystickNumButtons(m_joyinfo[i].joy);
|
|
||||||
m_joyinfo[i].NumBalls = SDL_JoystickNumBalls(m_joyinfo[i].joy);
|
|
||||||
m_joyinfo[i].NumHats = SDL_JoystickNumHats(m_joyinfo[i].joy);
|
|
||||||
m_joyinfo[i].Name = SDL_JoystickName(i);
|
|
||||||
|
|
||||||
printf("ID: %d\n", i);
|
|
||||||
printf("Name: %s\n", m_joyinfo[i].Name);
|
|
||||||
printf("Buttons: %d\n", m_joyinfo[i].NumButtons);
|
|
||||||
printf("Axises: %d\n", m_joyinfo[i].NumAxes);
|
|
||||||
printf("Hats: %d\n", m_joyinfo[i].NumHats);
|
|
||||||
printf("Balls: %d\n\n", m_joyinfo[i].NumBalls);
|
|
||||||
|
|
||||||
// Close if opened
|
|
||||||
if(SDL_JoystickOpened(i))
|
|
||||||
SDL_JoystickClose(m_joyinfo[i].joy);
|
|
||||||
}
|
|
||||||
|
|
||||||
return numjoy;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
#ifndef INPUTMANAGER_H
|
|
||||||
#define INPUTMANAGER_H
|
|
||||||
#include "Common.h"
|
|
||||||
|
|
||||||
#if defined HAVE_SDL && HAVE_SDL
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
|
|
||||||
struct ControllerInfo { // CONNECTED WINDOWS DEVICES INFO
|
|
||||||
int NumAxes; // Amount of Axes
|
|
||||||
int NumButtons; // Amount of Buttons
|
|
||||||
int NumBalls; // Amount of Balls
|
|
||||||
int NumHats; // Amount of Hats (POV)
|
|
||||||
const char *Name; // Joypad/stickname
|
|
||||||
int ID; // SDL joystick device ID
|
|
||||||
SDL_Joystick *joy; // SDL joystick device
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class InputManager {
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool Init();
|
|
||||||
bool Shutdown();
|
|
||||||
|
|
||||||
InputManager(): sdlInit(false) {}
|
|
||||||
~InputManager() {
|
|
||||||
if(m_joyinfo)
|
|
||||||
delete [] m_joyinfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool sdlInit;
|
|
||||||
int ScanDevices();
|
|
||||||
|
|
||||||
// sdl specific
|
|
||||||
bool SDLInit();
|
|
||||||
void SDLShutdown();
|
|
||||||
int SDLScanDevices();
|
|
||||||
ControllerInfo *m_joyinfo;
|
|
||||||
int numjoy;
|
|
||||||
};
|
|
||||||
#endif
|
|
|
@ -5,7 +5,6 @@ Import('env')
|
||||||
files = [
|
files = [
|
||||||
'EventHandler.cpp',
|
'EventHandler.cpp',
|
||||||
'InputCommon.cpp',
|
'InputCommon.cpp',
|
||||||
"InputManager.cpp",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
env_inputcommon = env.Clone()
|
env_inputcommon = env.Clone()
|
||||||
|
|
|
@ -146,9 +146,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Main", "..\Branches\MusicMo
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Player", "..\Branches\MusicMod\Player\Player.vcproj", "{0B72B5D6-5D72-4391-84A7-9CCA5392668A}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Player", "..\Branches\MusicMod\Player\Player.vcproj", "{0B72B5D6-5D72-4391-84A7-9CCA5392668A}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPlayer", "..\Branches\MusicMod\TestPlayer\TestPlayer.vcproj", "{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPlayer", "..\Branches\MusicMod\TestPlayer\TestPlayer.vcproj", "{0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
|
@ -82,7 +82,6 @@ typedef struct
|
||||||
void *eventHandler;
|
void *eventHandler;
|
||||||
void *config;
|
void *config;
|
||||||
void *messageLogger;
|
void *messageLogger;
|
||||||
void *inputManager;
|
|
||||||
} PLUGIN_GLOBALS;
|
} PLUGIN_GLOBALS;
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,8 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -195,10 +197,31 @@ void DllConfig(HWND _hParent)
|
||||||
emulator_running = false; // Set it back to false
|
emulator_running = false; // Set it back to false
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
|
||||||
g_Config.Load(); // Load settings
|
g_Config.Load(); // Load settings
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,24 +240,17 @@ void Initialize(void *init)
|
||||||
{
|
{
|
||||||
// Debugging
|
// Debugging
|
||||||
//Console::Open();
|
//Console::Open();
|
||||||
SPADInitialize *_PADInitialize = (SPADInitialize*)init;
|
|
||||||
#ifndef INPUTCOMMON
|
|
||||||
Console::Print("Initialize: %i, %i\n", _PADInitialize->padNumber, SDL_WasInit(0));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
//Console::Print("Initialize: %i\n", SDL_WasInit(0));
|
||||||
|
|
||||||
|
SPADInitialize _PADInitialize = *(SPADInitialize*)init;
|
||||||
emulator_running = true;
|
emulator_running = true;
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DEBUG_INIT();
|
DEBUG_INIT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
m_hWnd = (HWND)_PADInitialize->hWnd;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INPUTCOMMON
|
|
||||||
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API, and with this we need
|
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API, and with this we need
|
||||||
the SDL_INIT_VIDEO flag to */
|
the SDL_INIT_VIDEO flag to */
|
||||||
if (!SDL_WasInit(0))
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -244,6 +260,9 @@ void Initialize(void *init)
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
m_hWnd = (HWND)_PADInitialize.hWnd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Search_Devices(); // Populate joyinfo for all attached devices
|
Search_Devices(); // Populate joyinfo for all attached devices
|
||||||
|
@ -256,18 +275,6 @@ void Initialize(void *init)
|
||||||
joystate[2].joy = SDL_JoystickOpen(PadMapping[2].ID);
|
joystate[2].joy = SDL_JoystickOpen(PadMapping[2].ID);
|
||||||
if (PadMapping[3].enabled)
|
if (PadMapping[3].enabled)
|
||||||
joystate[3].joy = SDL_JoystickOpen(PadMapping[3].ID);
|
joystate[3].joy = SDL_JoystickOpen(PadMapping[3].ID);
|
||||||
|
|
||||||
//_PADInitialize->padNumber = 55;
|
|
||||||
/* Check if any of the pads failed to open. In Windows there is a strange "IDirectInputDevice2::
|
|
||||||
SetDataFormat() DirectX error -2147024809" after a few Open and Close */
|
|
||||||
if( (PadMapping[0].enabled && joystate[0].joy == NULL)
|
|
||||||
|| (PadMapping[1].enabled && joystate[1].joy == NULL)
|
|
||||||
|| (PadMapping[2].enabled && joystate[2].joy == NULL)
|
|
||||||
|| (PadMapping[3].enabled && joystate[3].joy == NULL))
|
|
||||||
{
|
|
||||||
_PADInitialize->padNumber = -1;
|
|
||||||
Console::Print("%s\n", SDL_GetError());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -295,7 +302,11 @@ 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)
|
||||||
{
|
{
|
||||||
PanicAlert("No Joystick detected");
|
#ifdef _WIN32
|
||||||
|
//MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
|
||||||
|
#else
|
||||||
|
printf("No Joystick detected!\n");
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +350,7 @@ int Search_Devices()
|
||||||
Called from: The Dolphin Core, ConfigBox::OnClose() */
|
Called from: The Dolphin Core, ConfigBox::OnClose() */
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
Console::Print("Shutdown: %i\n", SDL_WasInit(0));
|
//Console::Print("Shutdown: %i\n", SDL_WasInit(0));
|
||||||
|
|
||||||
if (PadMapping[0].enabled && SDL_JoystickOpened(PadMapping[0].ID))
|
if (PadMapping[0].enabled && SDL_JoystickOpened(PadMapping[0].ID))
|
||||||
SDL_JoystickClose(joystate[0].joy);
|
SDL_JoystickClose(joystate[0].joy);
|
||||||
|
@ -350,9 +361,7 @@ 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);
|
||||||
|
|
||||||
#ifndef INPUTCOMMON
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DEBUG_QUIT();
|
DEBUG_QUIT();
|
||||||
|
@ -544,14 +553,11 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||||
Console::ClearScreen();
|
Console::ClearScreen();
|
||||||
Console::Print(
|
Console::Print(
|
||||||
"Trigger type: %s Left:%04x Right:%04x Value:%i\n"
|
"Trigger type: %s Left:%04x Right:%04x Value:%i\n"
|
||||||
"D-Pad type: %s L:%i R:%i U:%i D:%i"
|
"D-Pad type: %s L:%i R:%i U:%i D:%i",
|
||||||
"Main stick x, y: %i %i",
|
|
||||||
|
|
||||||
(PadMapping[_numPAD].triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"),
|
(PadMapping[_numPAD].triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"),
|
||||||
TriggerLeft, TriggerRight, TriggerValue,
|
TriggerLeft, TriggerRight, TriggerValue,
|
||||||
(PadMapping[_numPAD].controllertype ? "CTL_DPAD_CUSTOM" : "CTL_DPAD_HAT"),
|
(PadMapping[_numPAD].controllertype ? "CTL_DPAD_CUSTOM" : "CTL_DPAD_HAT"),
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0
|
||||||
main_stick_x, main_stick_y
|
|
||||||
);*/
|
);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,7 +772,7 @@ void GetJoyState(int controller)
|
||||||
ReadButton(controller, CTL_START);
|
ReadButton(controller, CTL_START);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (PadMapping[controller].halfpress < Buttons)
|
if (PadMapping[controller].halfpress < joyinfo[controller].NumButtons)
|
||||||
joystate[controller].halfpress = SDL_JoystickGetButton(joystate[controller].joy, PadMapping[controller].halfpress);
|
joystate[controller].halfpress = SDL_JoystickGetButton(joystate[controller].joy, PadMapping[controller].halfpress);
|
||||||
|
|
||||||
// Check if we have an analog or digital joypad
|
// Check if we have an analog or digital joypad
|
||||||
|
|
|
@ -95,8 +95,6 @@
|
||||||
// Define
|
// Define
|
||||||
// ¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯
|
||||||
|
|
||||||
//#define INPUTCOMMON
|
|
||||||
|
|
||||||
#define INPUT_VERSION "0.3"
|
#define INPUT_VERSION "0.3"
|
||||||
#define INPUT_STATE "PUBLIC RELEASE"
|
#define INPUT_STATE "PUBLIC RELEASE"
|
||||||
#define RELDAY "21"
|
#define RELDAY "21"
|
||||||
|
|
|
@ -51,10 +51,7 @@ HWND m_hWnd;
|
||||||
#ifdef USE_RUMBLE_DINPUT_HACK
|
#ifdef USE_RUMBLE_DINPUT_HACK
|
||||||
bool g_rumbleEnable = FALSE;
|
bool g_rumbleEnable = FALSE;
|
||||||
#endif
|
#endif
|
||||||
// Declare config window so that we can write debugging info to it from functions in this file
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
|
||||||
ConfigBox* m_frame;
|
|
||||||
#endif
|
|
||||||
// Rumble in windows
|
// Rumble in windows
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HINSTANCE nJoy_hInst = NULL;
|
HINSTANCE nJoy_hInst = NULL;
|
||||||
|
@ -168,21 +165,36 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
void DllConfig(HWND _hParent)
|
void DllConfig(HWND _hParent)
|
||||||
{
|
{
|
||||||
// Start the pads so we can use them in the configuration and advanced controls
|
#ifdef _WIN32
|
||||||
if(!emulator_running)
|
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
||||||
{
|
{
|
||||||
SPADInitialize _PADInitialize;
|
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
||||||
_PADInitialize.hWnd = NULL;
|
return;
|
||||||
_PADInitialize.pLog = NULL;
|
|
||||||
Initialize((void*)&_PADInitialize);
|
|
||||||
emulator_running = false; // Set it back to false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
LoadConfig(); // load settings
|
||||||
m_frame = new ConfigBox(NULL);
|
|
||||||
m_frame->ShowModal();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
|
wxWindow win;
|
||||||
|
win.SetHWND(_hParent);
|
||||||
|
ConfigBox frame(&win);
|
||||||
|
frame.ShowModal();
|
||||||
|
win.SetHWND(0);
|
||||||
|
#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) {
|
||||||
|
@ -198,6 +210,16 @@ 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
|
||||||
|
@ -227,14 +249,14 @@ 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
|
||||||
|
|
||||||
if (joyinfo) {
|
|
||||||
delete [] joyinfo;
|
delete [] joyinfo;
|
||||||
joyinfo = NULL;
|
|
||||||
}
|
|
||||||
emulator_running = FALSE;
|
emulator_running = FALSE;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -679,7 +701,11 @@ int Search_Devices()
|
||||||
|
|
||||||
if(numjoy == 0)
|
if(numjoy == 0)
|
||||||
{
|
{
|
||||||
PanicAlert("No Joystick detected!\n");
|
#ifdef _WIN32
|
||||||
|
MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
|
||||||
|
#else
|
||||||
|
printf("No Joystick detected!\n");
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue