summaryrefslogtreecommitdiff
path: root/src/common/key_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/key_map.h')
-rw-r--r--src/common/key_map.h46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/common/key_map.h b/src/common/key_map.h
index 7e94df618..b5acfbab0 100644
--- a/src/common/key_map.h
+++ b/src/common/key_map.h
@@ -1,4 +1,4 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 2// Licensed under GPLv2
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
@@ -8,28 +8,38 @@
8 8
9namespace KeyMap { 9namespace KeyMap {
10 10
11class CitraKey { 11/**
12public: 12 * Represents a key for a specific host device.
13 CitraKey() : keyCode(0) {} 13 */
14 CitraKey(int code) : keyCode(code) {} 14struct HostDeviceKey {
15 15 int key_code;
16 int keyCode; 16 int device_id; ///< Uniquely identifies a host device
17 17
18 bool operator < (const CitraKey &other) const { 18 bool operator < (const HostDeviceKey &other) const {
19 return keyCode < other.keyCode; 19 if (device_id == other.device_id) {
20 return key_code < other.key_code;
21 }
22 return device_id < other.device_id;
20 } 23 }
21 24
22 bool operator == (const CitraKey &other) const { 25 bool operator == (const HostDeviceKey &other) const {
23 return keyCode == other.keyCode; 26 return device_id == other.device_id && key_code == other.key_code;
24 } 27 }
25}; 28};
26 29
27struct DefaultKeyMapping { 30/**
28 KeyMap::CitraKey key; 31 * Generates a new device id, which uniquely identifies a host device within KeyMap.
29 HID_User::PADState state; 32 */
30}; 33int NewDeviceId();
34
35/**
36 * Maps a device-specific key to a PadState.
37 */
38void SetKeyMapping(HostDeviceKey key, HID_User::PadState padState);
31 39
32void SetKeyMapping(CitraKey key, HID_User::PADState padState); 40/**
33HID_User::PADState Get3DSKey(CitraKey key); 41 * Gets the PadState that's mapped to the provided device-specific key.
42 */
43HID_User::PadState GetPadKey(HostDeviceKey key);
34 44
35} 45}