summaryrefslogtreecommitdiff
path: root/src/common/key_map.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/key_map.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/common/key_map.cpp b/src/common/key_map.cpp
index ad311d66b..e882f5f52 100644
--- a/src/common/key_map.cpp
+++ b/src/common/key_map.cpp
@@ -13,11 +13,25 @@ namespace KeyMap {
13// and map it directly to EmuWindow::ButtonPressed. 13// and map it directly to EmuWindow::ButtonPressed.
14// It should go the analog input way like circle pad does. 14// It should go the analog input way like circle pad does.
15const std::array<KeyTarget, Settings::NativeInput::NUM_INPUTS> mapping_targets = {{ 15const std::array<KeyTarget, Settings::NativeInput::NUM_INPUTS> mapping_targets = {{
16 Service::HID::PAD_A, Service::HID::PAD_B, Service::HID::PAD_X, Service::HID::PAD_Y, 16 Service::HID::PAD_A,
17 Service::HID::PAD_L, Service::HID::PAD_R, Service::HID::PAD_ZL, Service::HID::PAD_ZR, 17 Service::HID::PAD_B,
18 Service::HID::PAD_START, Service::HID::PAD_SELECT, Service::HID::PAD_NONE, 18 Service::HID::PAD_X,
19 Service::HID::PAD_UP, Service::HID::PAD_DOWN, Service::HID::PAD_LEFT, Service::HID::PAD_RIGHT, 19 Service::HID::PAD_Y,
20 Service::HID::PAD_C_UP, Service::HID::PAD_C_DOWN, Service::HID::PAD_C_LEFT, Service::HID::PAD_C_RIGHT, 20 Service::HID::PAD_L,
21 Service::HID::PAD_R,
22 Service::HID::PAD_ZL,
23 Service::HID::PAD_ZR,
24 Service::HID::PAD_START,
25 Service::HID::PAD_SELECT,
26 Service::HID::PAD_NONE,
27 Service::HID::PAD_UP,
28 Service::HID::PAD_DOWN,
29 Service::HID::PAD_LEFT,
30 Service::HID::PAD_RIGHT,
31 Service::HID::PAD_C_UP,
32 Service::HID::PAD_C_DOWN,
33 Service::HID::PAD_C_LEFT,
34 Service::HID::PAD_C_RIGHT,
21 35
22 IndirectTarget::CirclePadUp, 36 IndirectTarget::CirclePadUp,
23 IndirectTarget::CirclePadDown, 37 IndirectTarget::CirclePadDown,
@@ -49,7 +63,8 @@ static void UpdateCirclePad(EmuWindow& emu_window) {
49 --y; 63 --y;
50 64
51 float modifier = circle_pad_modifier ? Settings::values.pad_circle_modifier_scale : 1.0; 65 float modifier = circle_pad_modifier ? Settings::values.pad_circle_modifier_scale : 1.0;
52 emu_window.CirclePadUpdated(x * modifier * (y == 0 ? 1.0 : SQRT_HALF), y * modifier * (x == 0 ? 1.0 : SQRT_HALF)); 66 emu_window.CirclePadUpdated(x * modifier * (y == 0 ? 1.0 : SQRT_HALF),
67 y * modifier * (x == 0 ? 1.0 : SQRT_HALF));
53} 68}
54 69
55int NewDeviceId() { 70int NewDeviceId() {
@@ -103,7 +118,7 @@ void PressKey(EmuWindow& emu_window, HostDeviceKey key) {
103 } 118 }
104} 119}
105 120
106void ReleaseKey(EmuWindow& emu_window,HostDeviceKey key) { 121void ReleaseKey(EmuWindow& emu_window, HostDeviceKey key) {
107 auto target = key_map.find(key); 122 auto target = key_map.find(key);
108 if (target == key_map.end()) 123 if (target == key_map.end())
109 return; 124 return;
@@ -135,5 +150,4 @@ void ReleaseKey(EmuWindow& emu_window,HostDeviceKey key) {
135 } 150 }
136 } 151 }
137} 152}
138
139} 153}