mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Treat the keyboard and pads differently.
We basically never want two pads active at once, but keyboard is different. So, they need to be treated differently. Fixes #1212.
This commit is contained in:
1 parent
5427f20b90
commit
dcd2c26214
7 files changed
+15
-9
No files matched your search
@@ -150,8 +150,6 @@ int DinputDevice::UpdateState(InputState &input_state)
|
||||
}
|
||||
}
|
||||
|
||||
if (js.lX != 0.0f || js.lY != 0.0f)
|
||||
return UPDATESTATE_SKIP_NEXT;
|
||||
return 0;
|
||||
return UPDATESTATE_SKIP_PAD;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
DinputDevice();
|
||||
~DinputDevice();
|
||||
virtual int UpdateState(InputState &input_state);
|
||||
virtual bool IsPad() { return true; }
|
||||
private:
|
||||
LPDIRECTINPUT8 pDI;
|
||||
LPDIRECTINPUTDEVICE8 pJoystick;
|
||||
|
||||
@@ -10,8 +10,9 @@ struct InputState;
|
||||
class InputDevice
|
||||
{
|
||||
public:
|
||||
enum { UPDATESTATE_SKIP_NEXT = 0x1234};
|
||||
enum { UPDATESTATE_SKIP_PAD = 0x1234};
|
||||
virtual int UpdateState(InputState &input_state) = 0;
|
||||
virtual bool IsPad() = 0;
|
||||
};
|
||||
|
||||
std::list<std::shared_ptr<InputDevice>> getInputDevices();
|
||||
@@ -4,4 +4,5 @@
|
||||
class KeyboardDevice : public InputDevice {
|
||||
public:
|
||||
virtual int UpdateState(InputState &input_state);
|
||||
virtual bool IsPad() { return false; }
|
||||
};
|
||||
@@ -130,9 +130,15 @@ void WindowsHost::SetDebugMode(bool mode)
|
||||
|
||||
void WindowsHost::PollControllers(InputState &input_state)
|
||||
{
|
||||
bool doPad = true;
|
||||
for (auto iter = this->input.begin(); iter != this->input.end(); iter++)
|
||||
if ((*iter)->UpdateState(input_state) == InputDevice::UPDATESTATE_SKIP_NEXT)
|
||||
break;
|
||||
{
|
||||
auto device = *iter;
|
||||
if (!doPad && device->IsPad())
|
||||
continue;
|
||||
if (device->UpdateState(input_state) == InputDevice::UPDATESTATE_SKIP_PAD)
|
||||
doPad = false;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowsHost::BootDone()
|
||||
|
||||
@@ -55,9 +55,7 @@ int XinputDevice::UpdateState(InputState &input_state) {
|
||||
|
||||
// If there's an XInput pad, skip following pads. This prevents DInput and XInput
|
||||
// from colliding.
|
||||
if (left.x != 0.0f || left.y != 0.0f)
|
||||
return UPDATESTATE_SKIP_NEXT;
|
||||
return 0;
|
||||
return UPDATESTATE_SKIP_PAD;
|
||||
} else {
|
||||
// wait check_delay frames before polling the controller again
|
||||
this->gamepad_idx = -1;
|
||||
|
||||
@@ -8,6 +8,7 @@ class XinputDevice :
|
||||
public:
|
||||
XinputDevice();
|
||||
virtual int UpdateState(InputState &input_state);
|
||||
virtual bool IsPad() { return true; }
|
||||
private:
|
||||
void ApplyDiff(XINPUT_STATE &state, InputState &input_state);
|
||||
int gamepad_idx;
|
||||
|
||||
Reference in new issue
Block a user