summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2008-10-11 00:23:26 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2008-10-11 00:23:26 +0000
commit540539ee274bf2243b7fe28db280aa9e8b665b62 (patch)
tree2612b0fd4be00e0351c777521d6508b068ec102a /Source
parent92f661b3904831022314bacbd759eade561ae572 (diff)
padsimple: now shows only which xpads are connected (when the config is called), set all pads to keyboard as default, got rid of XINPUT_ENABLE #ifdefs, made the trigger buttons enabled at 200/255 instead of 20/255 :) hopefully that's a lot closer to how a gc controller acts.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@832 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp20
-rw-r--r--Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp37
2 files changed, 24 insertions, 33 deletions
diff --git a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp
index c72c5f2d5f..fc4bdcb95c 100644
--- a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp
+++ b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp
@@ -20,6 +20,7 @@
#include "../PadSimple.h"
#ifdef _WIN32
+#include "XInput.h"
#include "../DirectInputBase.h"
DInput m_dinput;
@@ -142,14 +143,21 @@ void ConfigDialog::CreateGUIControls()
m_Disable[i]->SetValue(pad[i].disable);
m_Rumble[i]->SetValue(pad[i].rumble);
m_Rumble[i]->Enable(!pad[i].keyboard);
-
- // This should be considered TEMPORARY until polling x360 pads is implemented
+
m_DeviceName[i]->Append(_("Keyboard"));
- m_DeviceName[i]->Append(_("XPAD1"));
- m_DeviceName[i]->Append(_("XPAD2"));
- m_DeviceName[i]->Append(_("XPAD3"));
- m_DeviceName[i]->Append(_("XPAD4"));
+#ifdef _WIN32
+ // Add connected XPads
+ for (int x = 0; x < 4; x++)
+ {
+ XINPUT_STATE xstate;
+ DWORD xresult = XInputGetState(x, &xstate);
+ if (xresult == ERROR_SUCCESS)
+ {
+ m_DeviceName[i]->Append(wxString::Format("XPad %i", x+1));
+ }
+ }
+#endif
sDeviceTop[i]->Add(m_DeviceName[i], 1, wxEXPAND|wxALL, 1);
sDeviceTop[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
sDeviceBottom[i]->AddStretchSpacer(1);
diff --git a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp
index 294c4d38fc..665bd51761 100644
--- a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp
+++ b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp
@@ -15,10 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-#ifdef _WIN32
-#define XINPUT_ENABLE
-#endif
-
#include <stdio.h>
#include <math.h>
@@ -29,12 +25,8 @@
#include "GUI/ConfigDlg.h"
-#ifdef XINPUT_ENABLE
-#include "XInput.h"
-#endif
-
#ifdef _WIN32
-
+#include "XInput.h"
#include "DirectInputBase.h"
DInput dinput;
@@ -169,7 +161,6 @@ void DllConfig(HWND _hParent)
wxWindow win;
win.SetHWND(_hParent);
ConfigDialog frame(&win);
- // TODO add devices
frame.ShowModal();
win.SetHWND(0);
#else
@@ -297,17 +288,11 @@ void DInput_Read(int _numPAD, SPADStatus* _pPADStatus)
bool XInput_Read(int xpadplayer, SPADStatus* _pPADStatus)
{
-#ifdef XINPUT_ENABLE
const int base = 0x80;
XINPUT_STATE xstate;
DWORD xresult = XInputGetState(xpadplayer, &xstate);
- if (xresult != ERROR_SUCCESS)
- {
- return false;
- }
-
- // In addition, let's .. yes, let's use XINPUT!
+ // Let's .. yes, let's use XINPUT!
if (xresult == ERROR_SUCCESS)
{
const XINPUT_GAMEPAD& xpad = xstate.Gamepad;
@@ -333,8 +318,8 @@ bool XInput_Read(int xpadplayer, SPADStatus* _pPADStatus)
_pPADStatus->triggerLeft = xpad.bLeftTrigger;
_pPADStatus->triggerRight = xpad.bRightTrigger;
- if (xpad.bLeftTrigger > 20) {_pPADStatus->button |= PAD_TRIGGER_L;}
- if (xpad.bRightTrigger > 20) {_pPADStatus->button |= PAD_TRIGGER_R;}
+ if (xpad.bLeftTrigger > 200) {_pPADStatus->button |= PAD_TRIGGER_L;}
+ if (xpad.bRightTrigger > 200) {_pPADStatus->button |= PAD_TRIGGER_R;}
if (xpad.wButtons & XINPUT_GAMEPAD_A) {_pPADStatus->button |= PAD_BUTTON_A;}
if (xpad.wButtons & XINPUT_GAMEPAD_X) {_pPADStatus->button |= PAD_BUTTON_B;}
if (xpad.wButtons & XINPUT_GAMEPAD_B) {_pPADStatus->button |= PAD_BUTTON_X;}
@@ -348,10 +333,10 @@ bool XInput_Read(int xpadplayer, SPADStatus* _pPADStatus)
return true;
}
- return false;
-#else
- return false;
-#endif
+ else
+ {
+ return false;
+ }
}
#endif
@@ -561,12 +546,10 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
a = 0;
}
-#ifdef XINPUT_ENABLE
XINPUT_VIBRATION vib;
vib.wLeftMotorSpeed = a; //_uStrength*100;
vib.wRightMotorSpeed = a; //_uStrength*100;
XInputSetState(pad[_numPAD].xpadplayer, &vib);
-#endif
}
#endif
}
@@ -598,7 +581,7 @@ unsigned int SaveLoadState(char* _ptr, BOOL _bSave)
void LoadConfig()
{
- // Initialize pads to standard controls
+ // Initialize first pad to standard controls
#ifdef _WIN32
const int defaultKeyForControl[NUMCONTROLS] =
{
@@ -658,7 +641,7 @@ void LoadConfig()
char SectionName[32];
sprintf(SectionName, "PAD%i", i+1);
- file.Get(SectionName, "Keyboard", &pad[i].keyboard, i==0);
+ file.Get(SectionName, "Keyboard", &pad[i].keyboard, true);
file.Get(SectionName, "Attached", &pad[i].attached, i==0);
file.Get(SectionName, "DisableOnBackground", &pad[i].disable, false);
file.Get(SectionName, "Rumble", &pad[i].rumble, true);