Merge the pad plugin into Dolphin. Since there's only one plugin left under active development, and it's awesome, we no longer have a need for a pad plugin mechanism.

In the future if we merge wiimote too, this will bring the advantage that the two will be able to cooperate, to no longer fight over control of input devices which can sometimes cause problems.

Thanks shuffle2 for the patience.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5670 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2010-06-13 09:14:40 +00:00
parent 615d4e1df8
commit 8cae2fee56
33 changed files with 247 additions and 712 deletions

View File

@ -71,7 +71,6 @@ dirs = [
'Source/Plugins/Plugin_VideoSoftware/Src',
'Source/Plugins/Plugin_DSP_HLE/Src',
'Source/Plugins/Plugin_DSP_LLE/Src',
'Source/Plugins/Plugin_GCPadNew/Src',
'Source/Plugins/Plugin_Wiimote/Src',
'Source/Plugins/Plugin_WiimoteNew/Src/',
'Source/Core/DolphinWX/Src',

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="Common"
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
RootNamespace="Common"
@ -471,14 +471,6 @@
RelativePath=".\Src\PluginDSP.h"
>
</File>
<File
RelativePath=".\Src\PluginPAD.cpp"
>
</File>
<File
RelativePath=".\Src\PluginPAD.h"
>
</File>
<File
RelativePath=".\Src\PluginVideo.cpp"
>

View File

@ -132,7 +132,6 @@
// Plugin files
#define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX
#define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX
#define DEFAULT_PAD_PLUGIN PLUGIN_PREFIX "Plugin_GCPadNew" PLUGIN_SUFFIX
#define DEFAULT_WIIMOTE_PLUGIN PLUGIN_PREFIX "Plugin_Wiimote" PLUGIN_SUFFIX
// Sys files

View File

@ -1,40 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "PluginPAD.h"
namespace Common
{
PluginPAD::PluginPAD(const char *_Filename) : CPlugin(_Filename), validPAD(false)
{
PAD_GetStatus = reinterpret_cast<TPAD_GetStatus>
(LoadSymbol("PAD_GetStatus"));
PAD_Input = reinterpret_cast<TPAD_Input>
(LoadSymbol("PAD_Input"));
PAD_Rumble = reinterpret_cast<TPAD_Rumble>
(LoadSymbol("PAD_Rumble"));
if ((PAD_GetStatus != 0) &&
(PAD_Input != 0) &&
(PAD_Rumble != 0))
validPAD = true;
}
PluginPAD::~PluginPAD() {}
} // Namespace

View File

@ -1,47 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _PLUGINPAD_H_
#define _PLUGINPAD_H_
#include "pluginspecs_pad.h"
#include "Plugin.h"
namespace Common {
typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*);
typedef void (__cdecl* TPAD_Input)(u16, u8);
typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int);
class PluginPAD : public CPlugin {
public:
PluginPAD(const char *_Filename);
virtual ~PluginPAD();
virtual bool IsValid() {return validPAD;};
TPAD_GetStatus PAD_GetStatus;
TPAD_Input PAD_Input;
TPAD_Rumble PAD_Rumble;
private:
bool validPAD;
};
} // namespace
#endif // _PLUGINPAD_H_

View File

@ -26,7 +26,6 @@ files = [
"PluginDSP.cpp",
"PluginWiimote.cpp",
"PluginVideo.cpp",
"PluginPAD.cpp",
"SDCardUtil.cpp",
"StringUtil.cpp",
"SymbolDB.cpp",

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="Core"
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
RootNamespace="Core"
@ -773,6 +773,26 @@
>
</File>
</Filter>
<Filter
Name="GCPad"
>
<File
RelativePath=".\Src\HW\GCPad.cpp"
>
</File>
<File
RelativePath=".\Src\HW\GCPad.h"
>
</File>
<File
RelativePath=".\Src\HW\GCPadEmu.cpp"
>
</File>
<File
RelativePath=".\Src\HW\GCPadEmu.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="PowerPC"

View File

@ -168,7 +168,6 @@ void SConfig::SaveSettings()
// Plugins
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin);
ini.Set("Core", "WiiMotePlugin",m_LocalCoreStartupParameter.m_strWiimotePlugin);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
@ -185,7 +184,6 @@ void SConfig::LoadSettings()
// Hard coded defaults
m_DefaultGFXPlugin = DEFAULT_GFX_PLUGIN;
m_DefaultDSPPlugin = DEFAULT_DSP_PLUGIN;
m_DefaultPADPlugin = DEFAULT_PAD_PLUGIN;
m_DefaultWiiMotePlugin = DEFAULT_WIIMOTE_PLUGIN;
// General
@ -296,10 +294,7 @@ void SConfig::LoadSettings()
// Plugins
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin, m_DefaultPADPlugin.c_str());
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin, m_DefaultWiiMotePlugin.c_str());
}
m_SYSCONF = new SysConf();

View File

@ -49,7 +49,6 @@ struct SConfig
// hard coded default plugins ...
std::string m_DefaultGFXPlugin;
std::string m_DefaultDSPPlugin;
std::string m_DefaultPADPlugin;
std::string m_DefaultWiiMotePlugin;
// name of the last used filename

View File

@ -39,6 +39,7 @@
#include "HW/ProcessorInterface.h"
#include "HW/GPFifo.h"
#include "HW/CPU.h"
#include "HW/GCPad.h"
#include "HW/HW.h"
#include "HW/DSP.h"
#include "HW/GPFifo.h"
@ -382,17 +383,7 @@ THREAD_RETURN EmuThread(void *pArg)
Plugins.GetDSP()->Initialize((void *)&dspInit);
// Load and init GCPadPlugin
SPADInitialize PADInitialize;
PADInitialize.hWnd = g_pWindowHandle;
#if defined(HAVE_X11) && HAVE_X11
PADInitialize.pXWindow = g_pXWindow;
#endif
PADInitialize.pLog = Callback_PADLog;
PADInitialize.pRendererHasFocus = Callback_RendererHasFocus;
// This is may be needed to avoid a SDL problem
//Plugins.FreeWiimote();
Plugins.GetPad()->Initialize(&PADInitialize);
GCPad_Init(g_pWindowHandle);
// Load and Init WiimotePlugin - only if we are booting in wii mode
if (_CoreParameter.bWii)
@ -521,7 +512,9 @@ THREAD_RETURN EmuThread(void *pArg)
if (_CoreParameter.bCPUThread)
Plugins.ShutdownVideoPlugin();
GCPad_Deinit();
Plugins.ShutdownPlugins();
NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "Plugins shutdown").c_str());
NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Main thread stopped").c_str());

View File

@ -118,7 +118,6 @@ struct SCoreStartupParameter
// files
std::string m_strVideoPlugin;
std::string m_strPadPlugin;
std::string m_strDSPPlugin;
std::string m_strWiimotePlugin;

View File

@ -0,0 +1,159 @@
// Copyright (C) 2010 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include "pluginspecs_pad.h"
#include "ControllerInterface/ControllerInterface.h"
#include "GCPadEmu.h"
#include "../../InputCommon/Src/InputConfig.h"
InputPlugin g_plugin("GCPadNew", "Pad", "GCPad");
InputPlugin *PAD_GetPlugin() {
return &g_plugin;
}
void GCPad_Deinit()
{
// i realize i am checking IsInit() twice, just too lazy to change it
if ( g_plugin.controller_interface.IsInit() )
{
std::vector<ControllerEmu*>::const_iterator
i = g_plugin.controllers.begin(),
e = g_plugin.controllers.end();
for ( ; i!=e; ++i )
delete *i;
g_plugin.controllers.clear();
g_plugin.controller_interface.DeInit();
}
}
// if plugin isn't initialized, init and load config
void GCPad_Init( void* const hwnd )
{
// i realize i am checking IsInit() twice, just too lazy to change it
if ( false == g_plugin.controller_interface.IsInit() )
{
// add 4 gcpads
for ( unsigned int i = 0; i<4; ++i )
g_plugin.controllers.push_back( new GCPad( i ) );
// needed for Xlib
g_plugin.controller_interface.SetHwnd(hwnd);
g_plugin.controller_interface.Init();
// load the saved controller config
if (false == g_plugin.LoadConfig())
{
// load default config for pad 1
g_plugin.controllers[0]->LoadDefaults();
// kinda silly, set default device(all controls) to first one found in ControllerInterface
// should be the keyboard device
if (g_plugin.controller_interface.Devices().size())
{
g_plugin.controllers[0]->default_device.FromDevice(g_plugin.controller_interface.Devices()[0]);
g_plugin.controllers[0]->UpdateDefaultDevice();
}
}
// update control refs
std::vector<ControllerEmu*>::const_iterator
i = g_plugin.controllers.begin(),
e = g_plugin.controllers.end();
for ( ; i!=e; ++i )
(*i)->UpdateReferences( g_plugin.controller_interface );
}
}
// I N T E R F A C E
// __________________________________________________________________________________________________
// Function:
// Purpose:
// input:
// output:
//
void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{
memset( _pPADStatus, 0, sizeof(*_pPADStatus) );
_pPADStatus->err = PAD_ERR_NONE;
// wtf is this?
_pPADStatus->button |= PAD_USE_ORIGIN;
// try lock
if ( false == g_plugin.controls_crit.TryEnter() )
{
// if gui has lock (messing with controls), skip this input cycle
// center axes and return
memset( &_pPADStatus->stickX, 0x80, 4 );
return;
}
// if we are on the next input cycle, update output and input
// if we can get a lock
static int _last_numPAD = 4;
if ( _numPAD <= _last_numPAD && g_plugin.interface_crit.TryEnter() )
{
g_plugin.controller_interface.UpdateOutput();
g_plugin.controller_interface.UpdateInput();
g_plugin.interface_crit.Leave();
}
_last_numPAD = _numPAD;
// get input
((GCPad*)g_plugin.controllers[ _numPAD ])->GetInput( _pPADStatus );
// leave
g_plugin.controls_crit.Leave();
}
// __________________________________________________________________________________________________
// Function: Send keyboard input to the plugin
// Purpose:
// input: The key and if it's pressed or released
// output: None
//
void PAD_Input(u16 _Key, u8 _UpDown)
{
// nofin
}
// __________________________________________________________________________________________________
// Function: PAD_Rumble
// Purpose: Pad rumble!
// input: PAD number, Command type (Stop=0, Rumble=1, Stop Hard=2) and strength of Rumble
// output: none
//
void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
{
// enter
if ( g_plugin.controls_crit.TryEnter() )
{
// TODO: this has potential to not stop rumble if user is messing with GUI at the perfect time
// set rumble
((GCPad*)g_plugin.controllers[ _numPAD ])->SetOutput( 1 == _uType && _uStrength > 2 );
// leave
g_plugin.controls_crit.Leave();
}
}

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/
#include "GCPadEmu.h"
#include "../Host.h"
const u16 button_bitmasks[] =
{
@ -93,7 +94,7 @@ std::string GCPad::GetName() const
void GCPad::GetInput( SPADStatus* const pad )
{
// if window has focus or background input enabled
if (g_PADInitialize->pRendererHasFocus() || m_options[0].settings[0]->value )
if (Host_RendererHasFocus() || m_options[0].settings[0]->value )
{
// buttons
m_buttons->GetState( &pad->button, button_bitmasks );
@ -120,7 +121,7 @@ void GCPad::GetInput( SPADStatus* const pad )
void GCPad::SetOutput( const bool on )
{
// only rumble if window has focus or background input is enabled
m_rumble->controls[0]->control_ref->State( on && (g_PADInitialize->pRendererHasFocus() || m_options[0].settings[0]->value) );
m_rumble->controls[0]->control_ref->State( on && (Host_RendererHasFocus() || m_options[0].settings[0]->value) );
}
void GCPad::LoadDefaults()

View File

@ -18,9 +18,9 @@
#ifndef _CONEMU_GCPAD_H_
#define _CONEMU_GCPAD_H_
#include <ControllerEmu.h>
#include <string>
extern SPADInitialize *g_PADInitialize;
#include "ControllerEmu.h"
class GCPad : public ControllerEmu
{
@ -48,5 +48,4 @@ private:
};
#endif

View File

@ -15,10 +15,14 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "pluginspecs_pad.h"
#include "SI.h"
#include "SI_Device.h"
#include "SI_DeviceAMBaseboard.h"
#include "GCPad.h"
#include "../PluginManager.h" // for pad state
// where to put baseboard debug
@ -144,8 +148,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
DEBUG_LOG(AMBASEBOARDDEBUG, "GC-AM: CMD 10, %02x (READ STATUS&SWITCHES)", ptr(1));
SPADStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(PadStatus));
CPluginManager::GetInstance().GetPad()
->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
res[resp++] = 0x10;
res[resp++] = 0x2;
int d10_0 = 0xdf;
@ -310,8 +313,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
for (i=0; i<nr_players; ++i)
{
SPADStatus PadStatus;
CPluginManager::GetInstance().GetPad()
->PAD_GetStatus(i, &PadStatus);
PAD_GetStatus(i, &PadStatus);
unsigned char player_data[2] = {0,0};
if (PadStatus.button & PAD_BUTTON_START)
player_data[0] |= 0x80;
@ -348,8 +350,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
int slots = *jvs_io++;
msg.addData(1);
SPADStatus PadStatus;
CPluginManager::GetInstance().GetPad()
->PAD_GetStatus(0, &PadStatus);
PAD_GetStatus(0, &PadStatus);
while (slots--)
{
msg.addData(0);

View File

@ -25,6 +25,8 @@
#include "EXI_Device.h"
#include "EXI_DeviceMic.h"
#include "GCPad.h"
#include "../OnFrame.h"
#include "Timer.h"
@ -128,8 +130,8 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
{
SPADStatus PadStatus;
memset(&PadStatus, 0, sizeof(PadStatus));
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad();
pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
u32 netValues[2] = {0};
int NetPlay = 2;
@ -258,7 +260,6 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
// SendCommand
void CSIDevice_GCController::SendCommand(u32 _Cmd, u8 _Poll)
{
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPad();
UCommand command(_Cmd);
switch (command.Command)
@ -280,8 +281,7 @@ void CSIDevice_GCController::SendCommand(u32 _Cmd, u8 _Poll)
#endif
if (numPAD < 4)
if (pad->PAD_Rumble)
pad->PAD_Rumble(numPAD, uType, uStrength);
PAD_Rumble(numPAD, uType, uStrength);
if (!_Poll)
{

View File

@ -20,6 +20,7 @@
#include "../PluginManager.h"
#include "SI_Device.h"
#include "pluginspecs_pad.h"
// standard gamecube controller
@ -102,7 +103,7 @@ public:
virtual int RunBuffer(u8* _pBuffer, int _iLength);
// Send and Receive pad input from network
static int NetPlay_GetInput(u8 numPAD, SPADStatus, u32 *PADStatus);
static int NetPlay_GetInput(u8 numPAD, SPADStatus status, u32 *PADStatus);
static u8 NetPlay_GetPadNum(u8 numPAD);
// Return true on new data

View File

@ -250,7 +250,6 @@ void EndRecordingInput()
// header.author;
// header.videoPlugin;
// header.audioPlugin;
// header.padPlugin;
fwrite(&header, sizeof(DTMHeader), 1, g_recordfd);

View File

@ -80,7 +80,6 @@ typedef struct {
u8 videoPlugin[16]; // UTF-8 representation of the video plugin
u8 audioPlugin[16]; // UTF-8 representation of the audio plugin
u8 padPlugin[16]; // UTF-8 representation of the input plugin
bool padding[102]; // Padding to align the header to 1024 bits

View File

@ -70,7 +70,6 @@ CPluginManager::CPluginManager()
// Set initial values to NULL.
m_video = NULL;
m_dsp = NULL;
m_pad = NULL;
m_wiimote = NULL;
}
@ -82,12 +81,6 @@ CPluginManager::~CPluginManager()
delete m_PluginGlobals;
delete m_dsp;
if (m_pad)
{
delete m_pad;
m_pad = NULL;
}
if (m_wiimote)
{
m_wiimote->Shutdown();
@ -124,18 +117,6 @@ bool CPluginManager::InitPlugins()
return false;
}
// Init pad
// Check that the plugin has a name
if (!m_params->m_strPadPlugin.empty())
GetPad();
// Check that GetPad succeeded
if (!m_pad)
{
PanicAlert("Can't init PAD Plugin");
return false;
}
// Init wiimote
if (m_params->bWii)
{
@ -156,12 +137,6 @@ bool CPluginManager::InitPlugins()
// for an explanation about the current LoadLibrary() and FreeLibrary() behavior.
void CPluginManager::ShutdownPlugins()
{
if (m_pad)
{
m_pad->Shutdown();
FreePad();
}
if (m_wiimote)
{
m_wiimote->Shutdown();
@ -246,7 +221,7 @@ void CPluginManager::GetPluginInfo(CPluginInfo *&info, std::string Filename)
void *CPluginManager::LoadPlugin(const char *_rFilename)
{
if (!File::Exists((File::GetPluginsDirectory() + _rFilename).c_str())) {
PanicAlert("Error loading %s: can't find file", _rFilename);
PanicAlert("Error loading plugin %s: can't find file. Please re-select your plugins.", _rFilename);
return NULL;
}
/* Avoid calling LoadLibrary() again and instead point to the plugin info that we found when
@ -271,10 +246,6 @@ void *CPluginManager::LoadPlugin(const char *_rFilename)
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;
@ -347,27 +318,11 @@ void CPluginManager::ScanForPlugins()
/* Create or return the already created plugin pointers. This will be called
often for the Pad and Wiimote from the SI_.cpp files. And often for the DSP
from the DSP files.
often for Wiimote. And often for the DSP from the DSP files.
We don't need to check if [Plugin]->IsValid() here because it will not be set by LoadPlugin()
if it's not valid.
*/
// ------------
Common::PluginPAD *CPluginManager::GetPad()
{
if (m_pad != NULL)
{
if (m_pad->GetFilename() == m_params->m_strPadPlugin)
return m_pad;
else
FreePad();
}
// Else load a new plugin
m_pad = (Common::PluginPAD*)LoadPlugin(m_params->m_strPadPlugin.c_str());
return m_pad;
}
Common::PluginWiimote *CPluginManager::GetWiimote()
{
@ -435,12 +390,6 @@ void CPluginManager::FreeDSP()
m_dsp = NULL;
}
void CPluginManager::FreePad()
{
delete m_pad;
m_pad = NULL;
}
void CPluginManager::FreeWiimote()
{
delete m_wiimote;
@ -451,11 +400,6 @@ void CPluginManager::EmuStateChange(PLUGIN_EMUSTATE newState)
{
GetVideo()->EmuStateChange(newState);
GetDSP()->EmuStateChange(newState);
//TODO: OpenConfig below only uses GetXxx(0) aswell
// Would we need to call all plugins?
// If yes, how would one check if the plugin was not
// just created by GetXxx(idx) because there was none?
GetPad()->EmuStateChange(newState);
GetWiimote()->EmuStateChange(newState);
}
@ -481,9 +425,6 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY
case PLUGIN_TYPE_DSP:
GetDSP()->Config((HWND)_Parent);
break;
case PLUGIN_TYPE_PAD:
GetPad()->Config((HWND)_Parent);
break;
case PLUGIN_TYPE_WIIMOTE:
GetWiimote()->Config((HWND)_Parent);
break;

View File

@ -20,7 +20,6 @@
#include "Plugin.h"
#include "PluginDSP.h"
#include "PluginPAD.h"
#include "PluginVideo.h"
#include "PluginWiimote.h"
#include "CoreParameter.h"
@ -46,17 +45,16 @@ class CPluginManager
{
public:
static CPluginManager& GetInstance() {return(*m_Instance);}
static void Init();
static void Shutdown();
Common::PluginVideo *GetVideo();
Common::PluginDSP *GetDSP();
Common::PluginPAD *GetPad();
Common::PluginWiimote *GetWiimote();
void FreeVideo();
void FreeDSP();
void FreePad();
void FreeWiimote();
void EmuStateChange(PLUGIN_EMUSTATE newState);
@ -77,7 +75,6 @@ private:
PLUGIN_GLOBALS *m_PluginGlobals;
Common::PluginVideo *m_video;
Common::PluginDSP *m_dsp;
Common::PluginPAD *m_pad;
Common::PluginWiimote *m_wiimote;
SCoreStartupParameter * m_params;

View File

@ -15,8 +15,8 @@ files = ["ActionReplay.cpp",
"MemTools.cpp",
"PatchEngine.cpp",
"PluginManager.cpp",
"LuaInterface.cpp",
"State.cpp",
"LuaInterface.cpp",
"State.cpp",1
"Tracer.cpp",
"VolumeHandler.cpp",
"Boot/Boot.cpp",
@ -41,7 +41,8 @@ files = ["ActionReplay.cpp",
"HW/EXI_DeviceMemoryCard.cpp",
"HW/EXI_DeviceMic.cpp",
"HW/EXI_DeviceEthernet.cpp",
"HW/GPFifo.cpp",
"HW/GCPad.cpp",
"HW/GCPadEmu.cpp",
"HW/HW.cpp",
"HW/Memmap.cpp",
"HW/MemmapFunctions.cpp",

View File

@ -92,7 +92,6 @@ void DoState(PointerWrap &p)
CPluginManager &pm = CPluginManager::GetInstance();
pm.GetVideo()->DoState(p.GetPPtr(), p.GetMode());
pm.GetDSP()->DoState(p.GetPPtr(), p.GetMode());
pm.GetPad()->DoState(p.GetPPtr(), p.GetMode());
if (Core::g_CoreStartupParameter.bWii)
pm.GetWiimote()->DoState(p.GetPPtr(), p.GetMode());
PowerPC::DoState(p);

View File

@ -90,11 +90,11 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib Bochs_disasm.lib LZO.lib SFML_Network.lib zlib.lib"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib Bochs_disasm.lib LZO.lib SFML_Network.lib zlib.lib"
OutputFile="../../../Binary/Win32/Dolphin.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="$(SolutionDir)\$(ConfigurationName)\$(PlatformName);..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32;../../../Externals/OpenAL/Win32/"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
@ -207,11 +207,11 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib"
OutputFile="../../../Binary/x64/Dolphin.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="$(SolutionDir)\$(ConfigurationName)\$(PlatformName);..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64;../../../Externals/OpenAL/Win64/"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
@ -320,11 +320,11 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/TLBID:1"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib Bochs_disasm.lib LZO.lib SFML_Network.lib zlib.lib"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib Bochs_disasm.lib LZO.lib SFML_Network.lib zlib.lib"
OutputFile="../../../Binary/Win32/DolphinD.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="$(SolutionDir)\$(ConfigurationName)\$(PlatformName);..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32;../../../Externals/OpenAL/Win32/"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
@ -431,11 +431,11 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/TLBID:1"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28ud.lib wxmsw28ud_core.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib"
OutputFile="../../../Binary/x64/DolphinD.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="$(SolutionDir)\$(ConfigurationName)\$(PlatformName);..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64;../../../Externals/OpenAL/Win64/"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
@ -545,11 +545,11 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NODEFAULTLIB:msvcrt.lib&#x0D;&#x0A;/NODEFAULTLIB:libcmtd.lib"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib Bochs_disasm.lib LZO.lib SFML_Network.lib zlib.lib"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib Bochs_disasm.lib LZO.lib SFML_Network.lib zlib.lib"
OutputFile="../../../Binary/Win32/DolphinDF.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="&quot;$(SolutionDir)\Release\$(PlatformName)&quot;;&quot;..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)&quot;"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32;../../../Externals/OpenAL/Win32/"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
@ -658,11 +658,11 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib Bochs_disasm.lib LZO.lib SFML_Network.lib zlib.lib"
AdditionalDependencies="SDL.lib xinput.lib Iphlpapi.lib comctl32.lib rpcrt4.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib wxmsw28u_adv.lib wxmsw28u_aui.lib Bochs_disasm.lib LZO.lib SFML_Network.lib zlib.lib"
OutputFile="../../../Binary/x64/DolphinDF.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="&quot;$(SolutionDir)\Release\$(PlatformName)&quot;;&quot;..\..\..\Externals\wxWidgets\lib\vc_lib\$(PlatformName)&quot;"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\x64;..\..\..\Externals\wxWidgets\lib\vc_lib\x64;../../../Externals/OpenAL/Win64/"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"

View File

@ -122,9 +122,6 @@ EVT_BUTTON(ID_GRAPHIC_CONFIG, CConfigMain::OnConfig)
EVT_CHOICE(ID_DSP_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_DSP_CONFIG, CConfigMain::OnConfig)
EVT_CHOICE(ID_PAD_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_PAD_CONFIG, CConfigMain::OnConfig)
EVT_CHOICE(ID_WIIMOTE_CB, CConfigMain::OnSelectionChanged)
EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
@ -191,7 +188,6 @@ void CConfigMain::UpdateGUI()
// Disable stuff on PluginsPage
GraphicSelection->Disable();
DSPSelection->Disable();
PADSelection->Disable();
WiimoteSelection->Disable();
}
}
@ -319,7 +315,6 @@ void CConfigMain::InitializeGUIValues()
// Plugins
FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
}
@ -727,10 +722,6 @@ void CConfigMain::CreateGUIControls()
DSPSelection = new wxChoice(PluginsPage, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
DSPConfig = new wxButton(PluginsPage, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
sbPadPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("Gamecube Pad"));
PADSelection = new wxChoice(PluginsPage, ID_PAD_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
PADConfig = new wxButton(PluginsPage, ID_PAD_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("Wiimote"));
WiimoteSelection = new wxChoice(PluginsPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
WiimoteConfig = new wxButton(PluginsPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -742,9 +733,6 @@ void CConfigMain::CreateGUIControls()
sbDSPPlugin->Add(DSPSelection, 1, wxEXPAND|wxALL, 5);
sbDSPPlugin->Add(DSPConfig, 0, wxALL, 5);
sbPadPlugin->Add(PADSelection, 1, wxEXPAND|wxALL, 5);
sbPadPlugin->Add(PADConfig, 0, wxALL, 5);
sbWiimotePlugin->Add(WiimoteSelection, 1, wxEXPAND|wxALL, 5);
sbWiimotePlugin->Add(WiimoteConfig, 0, wxALL, 5);
@ -752,14 +740,11 @@ void CConfigMain::CreateGUIControls()
sPluginsPage = new wxBoxSizer(wxVERTICAL);
sPluginsPage->Add(sbGraphicsPlugin, 0, wxEXPAND|wxALL, 5);
sPluginsPage->Add(sbDSPPlugin, 0, wxEXPAND|wxALL, 5);
sPluginsPage->Add(sbPadPlugin, 0, wxEXPAND|wxALL, 5);
sPluginsPage->Add(sbWiimotePlugin, 0, wxEXPAND|wxALL, 5);
PluginsPage->SetSizer(sPluginsPage);
sPluginsPage->Layout();
m_Ok = new wxButton(this, wxID_OK);
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
@ -1142,7 +1127,6 @@ void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
// Update plugin filenames
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
}
@ -1156,9 +1140,6 @@ void CConfigMain::OnConfig(wxCommandEvent& event)
case ID_DSP_CONFIG:
CallConfig(DSPSelection);
break;
case ID_PAD_CONFIG:
CallConfig(PADSelection);
break;
case ID_WIIMOTE_CONFIG:
CallConfig(WiimoteSelection);
break;

View File

@ -139,7 +139,7 @@ private:
wxBoxSizer* sPluginsPage; // Plugins settings
wxStaticBoxSizer* sbGraphicsPlugin, *sbDSPPlugin, *sbPadPlugin, *sbWiimotePlugin; // Graphics, DSP, Pad and Wiimote sections
wxStaticBoxSizer* sbGraphicsPlugin, *sbDSPPlugin, *sbWiimotePlugin; // Graphics, DSP, Wiimote sections
// Graphics
wxChoice* GraphicSelection;
@ -149,15 +149,10 @@ private:
wxChoice* DSPSelection;
wxButton* DSPConfig;
// Pad
wxChoice* PADSelection;
wxButton* PADConfig;
// Wiimote
wxChoice* WiimoteSelection;
wxButton* WiimoteConfig;
wxButton* m_Ok;
FILE* pStream;
@ -266,11 +261,6 @@ private:
ID_DSP_CONFIG,
ID_DSP_ABOUT,
ID_PAD_TEXT,
ID_PAD_CB,
ID_PAD_CONFIG,
ID_PAD_ABOUT,
ID_WIIMOTE_TEXT,
ID_WIIMOTE_CB,
ID_WIIMOTE_CONFIG,

View File

@ -42,6 +42,7 @@
#include "ConfigManager.h" // Core
#include "Core.h"
#include "HW/DVDInterface.h"
#include "HW/GCPad.h"
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "State.h"
#include "VolumeHandler.h"
@ -882,7 +883,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
#endif
// Send the keyboard status to the Input plugins
CPluginManager::GetInstance().GetPad()->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
PAD_Input(event.GetKeyCode(), 1); // 1 = Down
CPluginManager::GetInstance().GetWiimote()->Wiimote_Input(event.GetKeyCode(), 1); // 1 = Down
}
else
@ -894,7 +895,7 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
event.Skip();
if(Core::GetState() != Core::CORE_UNINITIALIZED) {
CPluginManager::GetInstance().GetPad()->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
PAD_Input(event.GetKeyCode(), 0); // 0 = Up
CPluginManager::GetInstance().GetWiimote()->Wiimote_Input(event.GetKeyCode(), 0); // 0 = Up
}
}

View File

@ -56,11 +56,13 @@ Core::GetWindowHandle().
#include "PowerPC/PowerPC.h"
#include "HW/DVDInterface.h"
#include "HW/ProcessorInterface.h"
#include "HW/GCPad.h"
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "State.h"
#include "VolumeHandler.h"
#include "NANDContentLoader.h"
#include "WXInputBase.h"
#include "../../InputUICommon/Src/ConfigDiag.h"
#include <wx/datetime.h> // wxWidgets
@ -942,12 +944,23 @@ void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event))
void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
{
CPluginManager::GetInstance().OpenConfig(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin.c_str(),
PLUGIN_TYPE_PAD
);
InputPlugin *pad_plugin = PAD_GetPlugin();
bool was_init = false;
if ( pad_plugin->controller_interface.IsInit() ) // check if game is running
was_init = true;
else
{
GCPad_Init(GetHandle());
}
InputConfigDialog* m_ConfigFrame = new InputConfigDialog(this, *pad_plugin, "GCPadNew", was_init );
m_ConfigFrame->ShowModal();
m_ConfigFrame->Destroy();
if ( !was_init ) // if game is running
{
GCPad_Deinit();
}
}
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
{
CPluginManager::GetInstance().OpenConfig(

View File

@ -95,13 +95,11 @@ bool DolphinApp::OnInit()
bool LoadElf = false;
bool selectVideoPlugin = false;
bool selectAudioPlugin = false;
bool selectPadPlugin = false;
bool selectWiimotePlugin = false;
wxString ElfFile;
wxString videoPluginFilename;
wxString audioPluginFilename;
wxString padPluginFilename;
wxString wiimotePluginFilename;
#if wxUSE_CMDLINE_PARSER // Parse command lines
@ -201,12 +199,10 @@ bool DolphinApp::OnInit()
#if wxCHECK_VERSION(2, 9, 0)
selectVideoPlugin = parser.Found("video_plugin", &videoPluginFilename);
selectAudioPlugin = parser.Found("audio_plugin", &audioPluginFilename);
selectPadPlugin = parser.Found("pad_plugin", &padPluginFilename);
selectWiimotePlugin = parser.Found("wiimote_plugin", &wiimotePluginFilename);
#else
selectVideoPlugin = parser.Found(wxT("video_plugin"), &videoPluginFilename);
selectAudioPlugin = parser.Found(wxT("audio_plugin"), &audioPluginFilename);
selectPadPlugin = parser.Found(_T("pad_plugin"), &padPluginFilename);
selectWiimotePlugin = parser.Found(wxT("wiimote_plugin"), &wiimotePluginFilename);
#endif
#endif // wxUSE_CMDLINE_PARSER
@ -353,10 +349,6 @@ bool DolphinApp::OnInit()
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin =
std::string(audioPluginFilename.mb_str());
if (selectPadPlugin && padPluginFilename != wxEmptyString)
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin =
std::string(padPluginFilename.mb_str());
if (selectWiimotePlugin && wiimotePluginFilename != wxEmptyString)
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin =
std::string(wiimotePluginFilename.mb_str());

View File

@ -185,17 +185,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VideoSoftware", "Plu
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_GCPadNew", "Plugins\Plugin_GCPadNew\Plugin_GCPadNew.vcproj", "{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}"
ProjectSection(ProjectDependencies) = postProject
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}
{05C75041-D67D-4903-A362-8395A7B35C75} = {05C75041-D67D-4903-A362-8395A7B35C75}
{11F55366-12EC-4C44-A8CB-1D4E315D61ED} = {11F55366-12EC-4C44-A8CB-1D4E315D61ED}
{0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E} = {0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E}
{374E2DB7-42DF-4E59-8474-62B6687F4978} = {374E2DB7-42DF-4E59-8474-62B6687F4978}
{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} = {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_WiimoteNew", "Plugins\Plugin_WiimoteNew\Plugin_WiimoteNew.vcproj", "{BB6CE47B-C676-44BB-AE93-2CF59B8C8BD4}"
ProjectSection(ProjectDependencies) = postProject
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}
@ -557,18 +546,6 @@ Global
{66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|Win32.Build.0 = Release|Win32
{66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|x64.ActiveCfg = Release|x64
{66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|x64.Build.0 = Release|x64
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.Debug|Win32.ActiveCfg = Debug|Win32
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.Debug|Win32.Build.0 = Debug|Win32
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.Debug|x64.ActiveCfg = Debug|x64
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.Debug|x64.Build.0 = Debug|x64
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.DebugFast|Win32.Build.0 = DebugFast|Win32
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.DebugFast|x64.ActiveCfg = DebugFast|x64
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.DebugFast|x64.Build.0 = DebugFast|x64
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.Release|Win32.ActiveCfg = Release|Win32
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.Release|Win32.Build.0 = Release|Win32
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.Release|x64.ActiveCfg = Release|x64
{1C3A7A91-A97F-4C7C-B45D-26F2242904D7}.Release|x64.Build.0 = Release|x64
{BB6CE47B-C676-44BB-AE93-2CF59B8C8BD4}.Debug|Win32.ActiveCfg = Debug|Win32
{BB6CE47B-C676-44BB-AE93-2CF59B8C8BD4}.Debug|Win32.Build.0 = Debug|Win32
{BB6CE47B-C676-44BB-AE93-2CF59B8C8BD4}.Debug|x64.ActiveCfg = Debug|x64

View File

@ -63,7 +63,7 @@ enum PLUGIN_COMM
enum PLUGIN_TYPE {
PLUGIN_TYPE_VIDEO = 1,
PLUGIN_TYPE_DVD,
PLUGIN_TYPE_PAD,
PLUGIN_TYPE_PAD_REMOVED,
PLUGIN_TYPE_AUDIO,
PLUGIN_TYPE_COMPILER,
PLUGIN_TYPE_DSP,

View File

@ -1,14 +1,8 @@
//__________________________________________________________________________________________________
// Common pad plugin spec, version #1.0 maintained by F|RES
//
// TODO: Move these defines somewhere else and delete this file.
#ifndef _PAD_H_INCLUDED__
#define _PAD_H_INCLUDED__
#include "PluginSpecs.h"
#include "ExportProlog.h"
#define PAD_ERR_NONE 0
#define PAD_ERR_NO_CONTROLLER -1
#define PAD_ERR_NOT_READY -2
@ -29,19 +23,6 @@
#define PAD_BUTTON_Y 0x0800
#define PAD_BUTTON_START 0x1000
typedef void (*TLog)(const char* _pMessage);
typedef bool (*TRendererHasFocus)(void);
typedef struct
{
HWND hWnd;
#if defined HAVE_X11 && HAVE_X11
void *pXWindow;
#endif
TLog pLog;
TRendererHasFocus pRendererHasFocus;
} SPADInitialize;
typedef struct
{
unsigned short button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
@ -58,31 +39,4 @@ typedef struct
} SPADStatus;
// I N T E R F A C E
// __________________________________________________________________________________________________
// Function:
// Purpose:
// input:
// output:
//
EXPORT void CALL PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus);
// __________________________________________________________________________________________________
// Function: Send keyboard input to the plugin
// Purpose:
// input: The key and if it's pressed or released
// output: None
//
EXPORT void CALL PAD_Input(u16 _Key, u8 _UpDown);
// __________________________________________________________________________________________________
// Function: PAD_Rumble
// Purpose: Pad rumble!
// input: PAD number, Command type (Stop=0, Rumble=1, Stop Hard=2) and strength of Rumble
// output: none
//
EXPORT void CALL PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength);
#include "ExportEpilog.h"
#endif

View File

@ -1,378 +0,0 @@
// Copyright (C) 2010 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include "pluginspecs_pad.h"
#include "ControllerInterface/ControllerInterface.h"
#include "GCPadEmu.h"
#if defined(HAVE_WX) && HAVE_WX
#include "../../InputUICommon/Src/ConfigDiag.h"
#endif
#include "../../InputCommon/Src/InputConfig.h"
#if defined(HAVE_X11) && HAVE_X11
#include <X11/Xlib.h>
#endif
#define PLUGIN_VERSION 0x0100
#define PLUGIN_NAME "Dolphin GCPad New"
#ifdef DEBUGFAST
#define PLUGIN_FULL_NAME PLUGIN_NAME" (DebugFast)"
#else
#ifdef _DEBUG
#define PLUGIN_FULL_NAME PLUGIN_NAME" (Debug)"
#else
#define PLUGIN_FULL_NAME PLUGIN_NAME
#endif
#endif
// plugin globals
static InputPlugin g_plugin( "GCPadNew", "Pad", "GCPad" );
SPADInitialize *g_PADInitialize = NULL;
#ifdef _WIN32
class wxDLLApp : public wxApp
{
bool OnInit()
{
return true;
};
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif
// copied from GCPad
HINSTANCE g_hInstance;
// copied from GCPad
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif
// /
#ifdef _WIN32
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
wxSetInstance(hinstDLL);
wxInitialize();
break;
case DLL_PROCESS_DETACH:
wxUninitialize();
break;
default:
break;
}
g_hInstance = hinstDLL;
return TRUE;
}
#endif
void DeInitPlugin()
{
// i realize i am checking IsInit() twice, just too lazy to change it
if ( g_plugin.controller_interface.IsInit() )
{
std::vector<ControllerEmu*>::const_iterator
i = g_plugin.controllers.begin(),
e = g_plugin.controllers.end();
for ( ; i!=e; ++i )
delete *i;
g_plugin.controllers.clear();
g_plugin.controller_interface.DeInit();
}
}
// if plugin isn't initialized, init and load config
void InitPlugin( void* const hwnd )
{
// i realize i am checking IsInit() twice, just too lazy to change it
if ( false == g_plugin.controller_interface.IsInit() )
{
// add 4 gcpads
for ( unsigned int i = 0; i<4; ++i )
g_plugin.controllers.push_back( new GCPad( i ) );
// needed for Xlib
g_plugin.controller_interface.SetHwnd(hwnd);
g_plugin.controller_interface.Init();
// load the saved controller config
if (false == g_plugin.LoadConfig())
{
// load default config for pad 1
g_plugin.controllers[0]->LoadDefaults();
// kinda silly, set default device(all controls) to first one found in ControllerInterface
// should be the keyboard device
if (g_plugin.controller_interface.Devices().size())
{
g_plugin.controllers[0]->default_device.FromDevice(g_plugin.controller_interface.Devices()[0]);
g_plugin.controllers[0]->UpdateDefaultDevice();
}
}
// update control refs
std::vector<ControllerEmu*>::const_iterator
i = g_plugin.controllers.begin(),
e = g_plugin.controllers.end();
for ( ; i!=e; ++i )
(*i)->UpdateReferences( g_plugin.controller_interface );
}
}
// I N T E R F A C E
// __________________________________________________________________________________________________
// Function:
// Purpose:
// input:
// output:
//
void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{
memset( _pPADStatus, 0, sizeof(*_pPADStatus) );
_pPADStatus->err = PAD_ERR_NONE;
// wtf is this?
_pPADStatus->button |= PAD_USE_ORIGIN;
// try lock
if ( false == g_plugin.controls_crit.TryEnter() )
{
// if gui has lock (messing with controls), skip this input cycle
// center axes and return
memset( &_pPADStatus->stickX, 0x80, 4 );
return;
}
// if we are on the next input cycle, update output and input
// if we can get a lock
static int _last_numPAD = 4;
if ( _numPAD <= _last_numPAD && g_plugin.interface_crit.TryEnter() )
{
g_plugin.controller_interface.UpdateOutput();
g_plugin.controller_interface.UpdateInput();
g_plugin.interface_crit.Leave();
}
_last_numPAD = _numPAD;
// get input
((GCPad*)g_plugin.controllers[ _numPAD ])->GetInput( _pPADStatus );
// leave
g_plugin.controls_crit.Leave();
}
// __________________________________________________________________________________________________
// Function: Send keyboard input to the plugin
// Purpose:
// input: The key and if it's pressed or released
// output: None
//
void PAD_Input(u16 _Key, u8 _UpDown)
{
// nofin
}
// __________________________________________________________________________________________________
// Function: PAD_Rumble
// Purpose: Pad rumble!
// input: PAD number, Command type (Stop=0, Rumble=1, Stop Hard=2) and strength of Rumble
// output: none
//
void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
{
// enter
if ( g_plugin.controls_crit.TryEnter() )
{
// TODO: this has potential to not stop rumble if user is messing with GUI at the perfect time
// set rumble
((GCPad*)g_plugin.controllers[ _numPAD ])->SetOutput( 1 == _uType && _uStrength > 2 );
// leave
g_plugin.controls_crit.Leave();
}
}
// GLOBAL I N T E R F A C E
// Function: GetDllInfo
// Purpose: This function allows the emulator to gather information
// about the DLL by filling in the PluginInfo structure.
// input: A pointer to a PLUGIN_INFO structure that needs to be
// filled by the function. (see def above)
// output: none
//
void GetDllInfo(PLUGIN_INFO* _pPluginInfo)
{
// don't feel like messing around with all those strcpy functions and warnings
//char *s1 = CIFACE_PLUGIN_FULL_NAME, *s2 = _pPluginInfo->Name;
//while ( *s2++ = *s1++ );
memcpy( _pPluginInfo->Name, PLUGIN_FULL_NAME, sizeof(PLUGIN_FULL_NAME) );
_pPluginInfo->Type = PLUGIN_TYPE_PAD;
_pPluginInfo->Version = PLUGIN_VERSION;
}
// ___________________________________________________________________________
// Function: DllConfig
// Purpose: This function is optional function that is provided
// to allow the user to configure the DLL
// input: A handle to the window that calls this function
// output: none
//
void DllConfig(HWND _hParent)
{
bool was_init = false;
#if defined(HAVE_X11) && HAVE_X11
Display *dpy = NULL;
#endif
if ( g_plugin.controller_interface.IsInit() ) // check if game is running
was_init = true;
else
{
#if defined(HAVE_X11) && HAVE_X11
dpy = XOpenDisplay(0);
InitPlugin(dpy);
#else
InitPlugin(_hParent);
#endif
}
// copied from GCPad
#if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent);
InputConfigDialog* m_ConfigFrame = new InputConfigDialog( frame, g_plugin, PLUGIN_FULL_NAME, was_init );
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
wxMilliSleep( 50 ); // hooray for hacks
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif
// /
if ( !was_init ) // if game is running
{
#if defined(HAVE_X11) && HAVE_X11
XCloseDisplay(dpy);
#endif
DeInitPlugin();
}
}
// ___________________________________________________________________________
// Function: DllDebugger
// Purpose: Open the debugger
// input: a handle to the window that calls this function
// output: none
//
void DllDebugger(HWND _hParent, bool Show)
{
// wut?
}
// ___________________________________________________________________________
// Function: DllSetGlobals
// Purpose: Set the pointer for globals variables
// input: a pointer to the global struct
// output: none
//
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
{
// wut?
}
// ___________________________________________________________________________
// Function: Initialize
// Purpose: Initialize the plugin
// input: Init
// output: none
//
void Initialize(void *init)
{
g_PADInitialize = (SPADInitialize*)init;
if ( false == g_plugin.controller_interface.IsInit() )
InitPlugin( g_PADInitialize->hWnd );
}
// ___________________________________________________________________________
// Function: Shutdown
// Purpose: This function is called when the emulator is shutting down
// a game allowing the dll to de-initialise.
// input: none
// output: none
//
void Shutdown(void)
{
if ( g_plugin.controller_interface.IsInit() )
DeInitPlugin();
}
// ___________________________________________________________________________
// Function: DoState
// Purpose: Saves/load state
// input/output: ptr
// input: mode
//
void DoState(unsigned char **ptr, int mode)
{
// prolly won't need this
}
// ___________________________________________________________________________
// Function: EmuStateChange
// Purpose: Notifies the plugin of a change in emulation state
// input: newState
// output: none
//
void EmuStateChange(PLUGIN_EMUSTATE newState)
{
// maybe use this later
}