added better support to simplepad for using a combination of xpads and a keyboard
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@735 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
0100d74aa3
commit
b2378b592f
|
@ -138,13 +138,14 @@ void ConfigDialog::CreateGUIControls()
|
||||||
m_Attached[i]->SetValue(pad[i].attached);
|
m_Attached[i]->SetValue(pad[i].attached);
|
||||||
m_Disable[i]->SetValue(pad[i].disable);
|
m_Disable[i]->SetValue(pad[i].disable);
|
||||||
m_Rumble[i]->SetValue(pad[i].rumble);
|
m_Rumble[i]->SetValue(pad[i].rumble);
|
||||||
m_Rumble[i]->Enable(pad[i].type);
|
m_Rumble[i]->Enable(!pad[i].keyboard);
|
||||||
//TEMP
|
|
||||||
m_DeviceName[i]->SetSelection(pad[i].XPad);
|
// This should be considered TEMPORARY until polling x360 pads is implemented
|
||||||
for(int x = 0; x < 5; x++)
|
m_DeviceName[i]->Append(_("Keyboard"));
|
||||||
{
|
m_DeviceName[i]->Append(_("XPAD1"));
|
||||||
m_DeviceName[i]->Append(wxString::Format(wxT("%i"), x));
|
m_DeviceName[i]->Append(_("XPAD2"));
|
||||||
}
|
m_DeviceName[i]->Append(_("XPAD3"));
|
||||||
|
m_DeviceName[i]->Append(_("XPAD4"));
|
||||||
|
|
||||||
sDeviceTop[i]->Add(m_DeviceName[i], 1, wxEXPAND|wxALL, 1);
|
sDeviceTop[i]->Add(m_DeviceName[i], 1, wxEXPAND|wxALL, 1);
|
||||||
sDeviceTop[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
|
sDeviceTop[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
|
||||||
|
@ -206,6 +207,17 @@ void ConfigDialog::CreateGUIControls()
|
||||||
sPage[i]->Add(sCStick[i], wxGBPosition(1, 4), wxGBSpan(2, 1), wxALL, 1);
|
sPage[i]->Add(sCStick[i], wxGBPosition(1, 4), wxGBSpan(2, 1), wxALL, 1);
|
||||||
m_Controller[i]->SetSizer(sPage[i]);
|
m_Controller[i]->SetSizer(sPage[i]);
|
||||||
sPage[i]->Layout();
|
sPage[i]->Layout();
|
||||||
|
|
||||||
|
if (pad[i].keyboard)
|
||||||
|
{
|
||||||
|
m_DeviceName[i]->SetSelection(0);
|
||||||
|
EnableKeyboardConfig(i, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_DeviceName[i]->SetSelection(pad[i].xpadplayer + 1);
|
||||||
|
EnableKeyboardConfig(i, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetIcon(wxNullIcon);
|
SetIcon(wxNullIcon);
|
||||||
|
@ -262,18 +274,45 @@ void ConfigDialog::DeviceChanged(wxCommandEvent& event)
|
||||||
if(event.GetSelection() == 0)
|
if(event.GetSelection() == 0)
|
||||||
{
|
{
|
||||||
// Keyboard
|
// Keyboard
|
||||||
pad[page].type = 0;
|
pad[page].keyboard = true;
|
||||||
m_Rumble[page]->Disable();
|
m_Rumble[page]->Disable();
|
||||||
|
EnableKeyboardConfig(page, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// XPad, so also set xpad number
|
// XPad, so also set xpadplayer
|
||||||
pad[page].type = 1;
|
pad[page].keyboard = false;
|
||||||
pad[page].XPad = event.GetSelection() - 1;
|
pad[page].xpadplayer = event.GetSelection() - 1;
|
||||||
m_Rumble[page]->Enable();
|
m_Rumble[page]->Enable();
|
||||||
|
EnableKeyboardConfig(page, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigDialog::EnableKeyboardConfig(int page, bool a)
|
||||||
|
{
|
||||||
|
m_ButtonA[page]->Enable(a);
|
||||||
|
m_ButtonB[page]->Enable(a);
|
||||||
|
m_ButtonX[page]->Enable(a);
|
||||||
|
m_ButtonY[page]->Enable(a);
|
||||||
|
m_ButtonZ[page]->Enable(a);
|
||||||
|
m_ButtonStart[page]->Enable(a);
|
||||||
|
m_ButtonL[page]->Enable(a);
|
||||||
|
m_ButtonR[page]->Enable(a);
|
||||||
|
m_HalfPress[page]->Enable(a);
|
||||||
|
m_StickUp[page]->Enable(a);
|
||||||
|
m_StickDown[page]->Enable(a);
|
||||||
|
m_StickLeft[page]->Enable(a);
|
||||||
|
m_StickRight[page]->Enable(a);
|
||||||
|
m_CStickUp[page]->Enable(a);
|
||||||
|
m_CStickDown[page]->Enable(a);
|
||||||
|
m_CStickLeft[page]->Enable(a);
|
||||||
|
m_CStickRight[page]->Enable(a);
|
||||||
|
m_DPadUp[page]->Enable(a);
|
||||||
|
m_DPadDown[page]->Enable(a);
|
||||||
|
m_DPadLeft[page]->Enable(a);
|
||||||
|
m_DPadRight[page]->Enable(a);
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigDialog::AttachedCheck(wxCommandEvent& event)
|
void ConfigDialog::AttachedCheck(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
int page = m_Notebook->GetSelection();
|
int page = m_Notebook->GetSelection();
|
||||||
|
|
|
@ -113,6 +113,7 @@ class ConfigDialog : public wxDialog
|
||||||
void OnCloseClick(wxCommandEvent& event);
|
void OnCloseClick(wxCommandEvent& event);
|
||||||
void OnKeyDown(wxKeyEvent& event);
|
void OnKeyDown(wxKeyEvent& event);
|
||||||
void DeviceChanged(wxCommandEvent& event);
|
void DeviceChanged(wxCommandEvent& event);
|
||||||
|
void EnableKeyboardConfig(int page, bool a);
|
||||||
void AttachedCheck(wxCommandEvent& event);
|
void AttachedCheck(wxCommandEvent& event);
|
||||||
void DisableCheck(wxCommandEvent& event);
|
void DisableCheck(wxCommandEvent& event);
|
||||||
void RumbleCheck(wxCommandEvent& event);
|
void RumbleCheck(wxCommandEvent& event);
|
||||||
|
|
|
@ -181,6 +181,7 @@ void DllConfig(HWND _hParent)
|
||||||
wxWindow win;
|
wxWindow win;
|
||||||
win.SetHWND(_hParent);
|
win.SetHWND(_hParent);
|
||||||
ConfigDialog frame(&win);
|
ConfigDialog frame(&win);
|
||||||
|
// TODO add devices
|
||||||
frame.ShowModal();
|
frame.ShowModal();
|
||||||
win.SetHWND(0);
|
win.SetHWND(0);
|
||||||
#else
|
#else
|
||||||
|
@ -255,89 +256,75 @@ void ScaleStickValues(unsigned char* outx,
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void DInput_Read(int _numPad, SPADStatus* _pPADStatus)
|
void DInput_Read(int _numPAD, SPADStatus* _pPADStatus)
|
||||||
{
|
{
|
||||||
dinput.Read();
|
dinput.Read();
|
||||||
|
|
||||||
int stickvalue = (dinput.diks[pad[_numPad].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 40 : 100;
|
int stickvalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 40 : 100;
|
||||||
int triggervalue = (dinput.diks[pad[_numPad].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 100 : 255;
|
int triggervalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 100 : 255;
|
||||||
|
|
||||||
// get the new keys
|
// get the new keys
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= stickvalue;}
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= stickvalue;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINRIGHT]] & 0xFF){_pPADStatus->stickX += stickvalue;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINDOWN]] & 0xFF){_pPADStatus->stickY -= stickvalue;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINUP]] & 0xFF){_pPADStatus->stickY += stickvalue;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_SUBLEFT]] & 0xFF){_pPADStatus->substickX -= stickvalue;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_SUBRIGHT]] & 0xFF){_pPADStatus->substickX += stickvalue;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_SUBDOWN]] & 0xFF){_pPADStatus->substickY -= stickvalue;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_SUBUP]] & 0xFF){_pPADStatus->substickY += stickvalue;}
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINRIGHT]] & 0xFF){_pPADStatus->stickX += stickvalue;}
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_L]] & 0xFF)
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINDOWN]] & 0xFF){_pPADStatus->stickY -= stickvalue;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_MAINUP]] & 0xFF){_pPADStatus->stickY += stickvalue;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBLEFT]] & 0xFF){_pPADStatus->substickX -= stickvalue;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBRIGHT]] & 0xFF){_pPADStatus->substickX += stickvalue;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBDOWN]] & 0xFF){_pPADStatus->substickY -= stickvalue;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_SUBUP]] & 0xFF){_pPADStatus->substickY += stickvalue;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_L]] & 0xFF)
|
|
||||||
{
|
{
|
||||||
_pPADStatus->button |= PAD_TRIGGER_L;
|
_pPADStatus->button |= PAD_TRIGGER_L;
|
||||||
_pPADStatus->triggerLeft = triggervalue;
|
_pPADStatus->triggerLeft = triggervalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_R]] & 0xFF)
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_R]] & 0xFF)
|
||||||
{
|
{
|
||||||
_pPADStatus->button |= PAD_TRIGGER_R;
|
_pPADStatus->button |= PAD_TRIGGER_R;
|
||||||
_pPADStatus->triggerRight = triggervalue;
|
_pPADStatus->triggerRight = triggervalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_A]] & 0xFF)
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_A]] & 0xFF)
|
||||||
{
|
{
|
||||||
_pPADStatus->button |= PAD_BUTTON_A;
|
_pPADStatus->button |= PAD_BUTTON_A;
|
||||||
_pPADStatus->analogA = 255;
|
_pPADStatus->analogA = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_B]] & 0xFF)
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_B]] & 0xFF)
|
||||||
{
|
{
|
||||||
_pPADStatus->button |= PAD_BUTTON_B;
|
_pPADStatus->button |= PAD_BUTTON_B;
|
||||||
_pPADStatus->analogB = 255;
|
_pPADStatus->analogB = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_X]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_X;}
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_X]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_X;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_Y]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_Y;}
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_Y]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_Y;}
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_Z]] & 0xFF){_pPADStatus->button |= PAD_TRIGGER_Z;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_DPADUP]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_UP;}
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_Z]] & 0xFF){_pPADStatus->button |= PAD_TRIGGER_Z;}
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_DPADDOWN]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_DOWN;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_DPADLEFT]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_LEFT;}
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_DPADUP]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_UP;}
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_DPADRIGHT]]& 0xFF){_pPADStatus->button |= PAD_BUTTON_RIGHT;}
|
||||||
|
if (dinput.diks[pad[_numPAD].keyForControl[CTL_START]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_START;}
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_DPADDOWN]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_DOWN;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_DPADLEFT]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_LEFT;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_DPADRIGHT]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_RIGHT;}
|
|
||||||
|
|
||||||
if (dinput.diks[pad[_numPad].keyForControl[CTL_START]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_START;}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XInput_Read(int _numPAD, SPADStatus* _pPADStatus)
|
bool XInput_Read(int xpadplayer, SPADStatus* _pPADStatus)
|
||||||
{
|
{
|
||||||
#ifdef XINPUT_ENABLE
|
#ifdef XINPUT_ENABLE
|
||||||
const int base = 0x80;
|
const int base = 0x80;
|
||||||
XINPUT_STATE xstate;
|
XINPUT_STATE xstate;
|
||||||
DWORD xresult = XInputGetState(_numPAD, &xstate);
|
DWORD xresult = XInputGetState(xpadplayer, &xstate);
|
||||||
|
|
||||||
if(xresult != ERROR_SUCCESS)
|
if (xresult != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In addition, let's .. yes, let's use XINPUT!
|
// In addition, let's .. yes, let's use XINPUT!
|
||||||
if(xresult == ERROR_SUCCESS)
|
if (xresult == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
const XINPUT_GAMEPAD& xpad = xstate.Gamepad;
|
const XINPUT_GAMEPAD& xpad = xstate.Gamepad;
|
||||||
|
|
||||||
if((_pPADStatus->stickX == base) && (_pPADStatus->stickY == base))
|
if ((_pPADStatus->stickX == base) && (_pPADStatus->stickY == base))
|
||||||
{
|
{
|
||||||
ScaleStickValues(
|
ScaleStickValues(
|
||||||
&_pPADStatus->stickX,
|
&_pPADStatus->stickX,
|
||||||
|
@ -346,7 +333,7 @@ void XInput_Read(int _numPAD, SPADStatus* _pPADStatus)
|
||||||
xpad.sThumbLY);
|
xpad.sThumbLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((_pPADStatus->substickX == base) && (_pPADStatus->substickY == base))
|
if ((_pPADStatus->substickX == base) && (_pPADStatus->substickY == base))
|
||||||
{
|
{
|
||||||
ScaleStickValues(
|
ScaleStickValues(
|
||||||
&_pPADStatus->substickX,
|
&_pPADStatus->substickX,
|
||||||
|
@ -358,34 +345,25 @@ void XInput_Read(int _numPAD, SPADStatus* _pPADStatus)
|
||||||
_pPADStatus->triggerLeft = xpad.bLeftTrigger;
|
_pPADStatus->triggerLeft = xpad.bLeftTrigger;
|
||||||
_pPADStatus->triggerRight = xpad.bRightTrigger;
|
_pPADStatus->triggerRight = xpad.bRightTrigger;
|
||||||
|
|
||||||
if (xpad.bLeftTrigger > 20){_pPADStatus->button |= PAD_TRIGGER_L;}
|
if (xpad.bLeftTrigger > 20) {_pPADStatus->button |= PAD_TRIGGER_L;}
|
||||||
|
if (xpad.bRightTrigger > 20) {_pPADStatus->button |= PAD_TRIGGER_R;}
|
||||||
if (xpad.bRightTrigger > 20){_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_A){_pPADStatus->button |= PAD_BUTTON_A;}
|
if (xpad.wButtons & XINPUT_GAMEPAD_B) {_pPADStatus->button |= PAD_BUTTON_X;}
|
||||||
|
if (xpad.wButtons & XINPUT_GAMEPAD_Y) {_pPADStatus->button |= PAD_BUTTON_Y;}
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_X){_pPADStatus->button |= PAD_BUTTON_B;}
|
|
||||||
|
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_B){_pPADStatus->button |= PAD_BUTTON_X;}
|
|
||||||
|
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_Y){_pPADStatus->button |= PAD_BUTTON_Y;}
|
|
||||||
|
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER){_pPADStatus->button |= PAD_TRIGGER_Z;}
|
if (xpad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER){_pPADStatus->button |= PAD_TRIGGER_Z;}
|
||||||
|
if (xpad.wButtons & XINPUT_GAMEPAD_START) {_pPADStatus->button |= PAD_BUTTON_START;}
|
||||||
|
if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) {_pPADStatus->button |= PAD_BUTTON_LEFT;}
|
||||||
|
if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) {_pPADStatus->button |= PAD_BUTTON_RIGHT;}
|
||||||
|
if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_UP) {_pPADStatus->button |= PAD_BUTTON_UP;}
|
||||||
|
if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) {_pPADStatus->button |= PAD_BUTTON_DOWN;}
|
||||||
|
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_START){_pPADStatus->button |= PAD_BUTTON_START;}
|
return true;
|
||||||
|
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT){_pPADStatus->button |= PAD_BUTTON_LEFT;}
|
|
||||||
|
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT){_pPADStatus->button |= PAD_BUTTON_RIGHT;}
|
|
||||||
|
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_UP){_pPADStatus->button |= PAD_BUTTON_UP;}
|
|
||||||
|
|
||||||
if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN){_pPADStatus->button |= PAD_BUTTON_DOWN;}
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
@ -405,7 +383,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
|
||||||
int num_events;
|
int num_events;
|
||||||
for (num_events = XPending(GXdsp);num_events > 0;num_events--) {
|
for (num_events = XPending(GXdsp);num_events > 0;num_events--) {
|
||||||
XNextEvent(GXdsp, &E);
|
XNextEvent(GXdsp, &E);
|
||||||
switch (E.type) {
|
switch (E.keyboard) {
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
//_KeyPress(pad, XLookupKeysym((XKeyEvent *)&E, 0)); break;
|
//_KeyPress(pad, XLookupKeysym((XKeyEvent *)&E, 0)); break;
|
||||||
|
|
||||||
|
@ -537,24 +515,30 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Just update pad on focus
|
// Just update pad on focus
|
||||||
// TODO fix g_PADInitialize.hWnd != DolphinWX frame
|
// TODO fix g_PADInitialize.hWnd != DolphinWX frame
|
||||||
if(pad[_numPAD].disable)
|
if (pad[_numPAD].disable)
|
||||||
{
|
{
|
||||||
if(g_PADInitialize.hWnd != GetForegroundWindow())
|
if (g_PADInitialize.hWnd != GetForegroundWindow())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
_pPADStatus->err = PAD_ERR_NONE;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
if (pad[_numPAD].keyboard)
|
||||||
if(pad[_numPAD].type == 0)
|
|
||||||
{
|
{
|
||||||
|
// Keyboard, so we assume it's ok
|
||||||
|
_pPADStatus->err = PAD_ERR_NONE;
|
||||||
DInput_Read(_numPAD, _pPADStatus);
|
DInput_Read(_numPAD, _pPADStatus);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XInput_Read(_numPAD, _pPADStatus);
|
// It's an xpad, so error if it's not connected
|
||||||
|
// shuffle2: pretty sure this does nothing for now, dolphin
|
||||||
|
// seems to ignore changes to the connected mask after init...
|
||||||
|
if (XInput_Read(pad[_numPAD].xpadplayer, _pPADStatus))
|
||||||
|
_pPADStatus->err = PAD_ERR_NONE;
|
||||||
|
else
|
||||||
|
_pPADStatus->err = PAD_ERR_NO_CONTROLLER;
|
||||||
}
|
}
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
|
_pPADStatus->err = PAD_ERR_NONE;
|
||||||
X11_Read(_numPAD, _pPADStatus);
|
X11_Read(_numPAD, _pPADStatus);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -568,6 +552,8 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||||
void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
if (!pad[_numPAD].keyboard)
|
||||||
|
{
|
||||||
static int a = 0;
|
static int a = 0;
|
||||||
|
|
||||||
if ((_uType == 0) || (_uType == 2))
|
if ((_uType == 0) || (_uType == 2))
|
||||||
|
@ -590,8 +576,9 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
||||||
XINPUT_VIBRATION vib;
|
XINPUT_VIBRATION vib;
|
||||||
vib.wLeftMotorSpeed = a; //_uStrength*100;
|
vib.wLeftMotorSpeed = a; //_uStrength*100;
|
||||||
vib.wRightMotorSpeed = a; //_uStrength*100;
|
vib.wRightMotorSpeed = a; //_uStrength*100;
|
||||||
XInputSetState(_numPAD, &vib);
|
XInputSetState(pad[_numPAD].xpadplayer, &vib);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,11 +669,11 @@ void LoadConfig()
|
||||||
char SectionName[32];
|
char SectionName[32];
|
||||||
sprintf(SectionName, "PAD%i", i+1);
|
sprintf(SectionName, "PAD%i", i+1);
|
||||||
|
|
||||||
file.Get(SectionName, "Type", &pad[i].type);
|
file.Get(SectionName, "Keyboard", &pad[i].keyboard, i==0);
|
||||||
file.Get(SectionName, "Attached", &pad[i].attached, i==0);
|
file.Get(SectionName, "Attached", &pad[i].attached, i==0);
|
||||||
file.Get(SectionName, "DisableOnBackground", &pad[i].disable, false);
|
file.Get(SectionName, "DisableOnBackground", &pad[i].disable, false);
|
||||||
file.Get(SectionName, "Rumble", &pad[i].rumble, true);
|
file.Get(SectionName, "Rumble", &pad[i].rumble, true);
|
||||||
file.Get(SectionName, "XPad#", &pad[i].XPad);
|
file.Get(SectionName, "XPad#", &pad[i].xpadplayer);
|
||||||
|
|
||||||
for (int x = 0; x < NUMCONTROLS; x++)
|
for (int x = 0; x < NUMCONTROLS; x++)
|
||||||
{
|
{
|
||||||
|
@ -712,11 +699,11 @@ void SaveConfig()
|
||||||
char SectionName[32];
|
char SectionName[32];
|
||||||
sprintf(SectionName, "PAD%i", i+1);
|
sprintf(SectionName, "PAD%i", i+1);
|
||||||
|
|
||||||
file.Set(SectionName, "Type", pad[i].type);
|
file.Set(SectionName, "Keyboard", pad[i].keyboard);
|
||||||
file.Set(SectionName, "Attached", pad[i].attached);
|
file.Set(SectionName, "Attached", pad[i].attached);
|
||||||
file.Set(SectionName, "DisableOnBackground", pad[i].disable);
|
file.Set(SectionName, "DisableOnBackground", pad[i].disable);
|
||||||
file.Set(SectionName, "Rumble", pad[i].rumble);
|
file.Set(SectionName, "Rumble", pad[i].rumble);
|
||||||
file.Set(SectionName, "XPad#", pad[i].XPad);
|
file.Set(SectionName, "XPad#", pad[i].xpadplayer);
|
||||||
|
|
||||||
for (int x = 0; x < NUMCONTROLS; x++)
|
for (int x = 0; x < NUMCONTROLS; x++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,9 +15,10 @@
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
// controls
|
|
||||||
#ifndef __PADSIMPLE_H__
|
#ifndef __PADSIMPLE_H__
|
||||||
#define __PADSIMPLE_H__
|
#define __PADSIMPLE_H__
|
||||||
|
|
||||||
|
// Controls
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CTL_A = 0,
|
CTL_A = 0,
|
||||||
|
@ -44,7 +45,7 @@ enum
|
||||||
NUMCONTROLS
|
NUMCONTROLS
|
||||||
};
|
};
|
||||||
|
|
||||||
// control names
|
// Control names
|
||||||
static const char* controlNames[] =
|
static const char* controlNames[] =
|
||||||
{
|
{
|
||||||
"A_button",
|
"A_button",
|
||||||
|
@ -71,12 +72,12 @@ static const char* controlNames[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SPads {
|
struct SPads {
|
||||||
bool type; //keyboard = 0, xpad = 1
|
bool keyboard; // Is it a keyboard?
|
||||||
int XPad; //player# of the xpad
|
bool attached; // Pad is "attached" to the gamecube/wii
|
||||||
bool attached; //pad is "attached" to the gamecube/wii
|
bool disable; // Disabled when dolphin isn't in focus
|
||||||
bool disable; //disabled when dolphin isn't in focus
|
bool rumble; // Rumble for xpad
|
||||||
bool rumble; //rumble for xpad
|
int xpadplayer; // Player# of the xpad
|
||||||
unsigned int keyForControl[NUMCONTROLS];//keyboard mapping
|
unsigned int keyForControl[NUMCONTROLS];// Keyboard mapping
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SPads pad[];
|
extern SPads pad[];
|
||||||
|
|
Loading…
Reference in New Issue