mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
win: Fix X360 button problems by skipping DInput if there's a 360 pad available.
This commit is contained in:
parent
e95b43a12d
commit
09d1f3c1fa
@ -94,7 +94,7 @@ int DinputDevice::UpdateState(InputState &input_state)
|
||||
}
|
||||
|
||||
if(FAILED(pJoystick->GetDeviceState(sizeof(DIJOYSTATE2), &js)))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
switch (js.rgdwPOV[0])
|
||||
{
|
||||
|
@ -8,8 +8,8 @@
|
||||
#define PUSH_BACK(Cls) do { list.push_back(std::shared_ptr<InputDevice>(new Cls())); } while (0)
|
||||
std::list<std::shared_ptr<InputDevice>> getInputDevices() {
|
||||
std::list<std::shared_ptr<InputDevice>> list;
|
||||
PUSH_BACK(KeyboardDevice);
|
||||
PUSH_BACK(XinputDevice);
|
||||
PUSH_BACK(DinputDevice);
|
||||
PUSH_BACK(KeyboardDevice);
|
||||
return list;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ struct InputState;
|
||||
class InputDevice
|
||||
{
|
||||
public:
|
||||
enum { UPDATESTATE_SKIP_NEXT = 0x1234};
|
||||
virtual int UpdateState(InputState &input_state) = 0;
|
||||
};
|
||||
|
||||
|
@ -132,7 +132,8 @@ void WindowsHost::SetDebugMode(bool mode)
|
||||
void WindowsHost::PollControllers(InputState &input_state)
|
||||
{
|
||||
for (auto iter = this->input.begin(); iter != this->input.end(); iter++)
|
||||
(*iter)->UpdateState(input_state);
|
||||
if ((*iter)->UpdateState(input_state) == InputDevice::UPDATESTATE_SKIP_NEXT)
|
||||
break;
|
||||
}
|
||||
|
||||
void WindowsHost::BootDone()
|
||||
|
@ -52,7 +52,10 @@ int XinputDevice::UpdateState(InputState &input_state) {
|
||||
|
||||
this->prevState = state;
|
||||
this->check_delay = 0;
|
||||
return 0;
|
||||
|
||||
// If there's an XInput pad, skip following pads. This prevents DInput and XInput
|
||||
// from colliding.
|
||||
return UPDATESTATE_SKIP_NEXT;
|
||||
} else {
|
||||
// wait check_delay frames before polling the controller again
|
||||
this->gamepad_idx = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user