diff --git a/input/input_state.cpp b/input/input_state.cpp index 9cf5315733..c6923d338e 100644 --- a/input/input_state.cpp +++ b/input/input_state.cpp @@ -4,6 +4,7 @@ const char *GetDeviceName(int deviceId) { switch (deviceId) { + case DEVICE_ID_ANY: return "any"; case DEVICE_ID_DEFAULT: return "built-in"; case DEVICE_ID_KEYBOARD: return "kbd"; case DEVICE_ID_PAD_0: return "pad1"; diff --git a/input/input_state.h b/input/input_state.h index e839053a59..bf4cd7b5b5 100644 --- a/input/input_state.h +++ b/input/input_state.h @@ -19,6 +19,7 @@ // Default device IDs enum { + DEVICE_ID_ANY = -1, // Represents any device ID DEVICE_ID_DEFAULT = 0, // Old Android DEVICE_ID_KEYBOARD = 1, // PC keyboard, android keyboards DEVICE_ID_MOUSE = 2, // PC mouse only (not touchscreen!) @@ -94,7 +95,7 @@ public: return false; } bool operator == (const KeyDef &other) const { - if (deviceId != other.deviceId) return false; + if (deviceId != other.deviceId && deviceId != DEVICE_ID_ANY && other.deviceId != DEVICE_ID_ANY) return false; if (keyCode != other.keyCode) return false; return true; }