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
This commit is contained in:
Shawn Hoffman 2008-10-11 00:23:26 +00:00
parent 92f661b390
commit 540539ee27
2 changed files with 25 additions and 34 deletions

View File

@ -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"));
m_DeviceName[i]->Append(_("Keyboard"));
#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);

View File

@ -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);