mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-29 02:40:15 +00:00
fixup! Refactor input system
This commit is contained in:
parent
416faa20d1
commit
6d49e4621c
2 changed files with 24 additions and 20 deletions
|
@ -19,11 +19,11 @@ const std::array<KeyTarget, Settings::NativeInput::NUM_INPUTS> mapping_targets =
|
||||||
Service::HID::PAD_UP, Service::HID::PAD_DOWN, Service::HID::PAD_LEFT, Service::HID::PAD_RIGHT,
|
Service::HID::PAD_UP, Service::HID::PAD_DOWN, Service::HID::PAD_LEFT, Service::HID::PAD_RIGHT,
|
||||||
Service::HID::PAD_C_UP, Service::HID::PAD_C_DOWN, Service::HID::PAD_C_LEFT, Service::HID::PAD_C_RIGHT,
|
Service::HID::PAD_C_UP, Service::HID::PAD_C_DOWN, Service::HID::PAD_C_LEFT, Service::HID::PAD_C_RIGHT,
|
||||||
|
|
||||||
IndirectTarget::CIRCLE_PAD_UP,
|
IndirectTarget::CirclePadUp,
|
||||||
IndirectTarget::CIRCLE_PAD_DOWN,
|
IndirectTarget::CirclePadDown,
|
||||||
IndirectTarget::CIRCLE_PAD_LEFT,
|
IndirectTarget::CirclePadLeft,
|
||||||
IndirectTarget::CIRCLE_PAD_RIGHT,
|
IndirectTarget::CirclePadRight,
|
||||||
IndirectTarget::CIRCLE_PAD_MODIFIER,
|
IndirectTarget::CirclePadModifier,
|
||||||
}};
|
}};
|
||||||
|
|
||||||
static std::map<HostDeviceKey, KeyTarget> key_map;
|
static std::map<HostDeviceKey, KeyTarget> key_map;
|
||||||
|
@ -79,23 +79,23 @@ void PressKey(EmuWindow& emu_window, HostDeviceKey key) {
|
||||||
emu_window.ButtonPressed({{target->second.target.direct_target_hex}});
|
emu_window.ButtonPressed({{target->second.target.direct_target_hex}});
|
||||||
} else {
|
} else {
|
||||||
switch (target->second.target.indirect_target) {
|
switch (target->second.target.indirect_target) {
|
||||||
case IndirectTarget::CIRCLE_PAD_UP:
|
case IndirectTarget::CirclePadUp:
|
||||||
circle_pad_up = true;
|
circle_pad_up = true;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
case IndirectTarget::CIRCLE_PAD_DOWN:
|
case IndirectTarget::CirclePadDown:
|
||||||
circle_pad_down = true;
|
circle_pad_down = true;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
case IndirectTarget::CIRCLE_PAD_LEFT:
|
case IndirectTarget::CirclePadLeft:
|
||||||
circle_pad_left = true;
|
circle_pad_left = true;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
case IndirectTarget::CIRCLE_PAD_RIGHT:
|
case IndirectTarget::CirclePadRight:
|
||||||
circle_pad_right = true;
|
circle_pad_right = true;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
case IndirectTarget::CIRCLE_PAD_MODIFIER:
|
case IndirectTarget::CirclePadModifier:
|
||||||
circle_pad_modifier = true;
|
circle_pad_modifier = true;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
|
@ -112,23 +112,23 @@ void ReleaseKey(EmuWindow& emu_window,HostDeviceKey key) {
|
||||||
emu_window.ButtonReleased({{target->second.target.direct_target_hex}});
|
emu_window.ButtonReleased({{target->second.target.direct_target_hex}});
|
||||||
} else {
|
} else {
|
||||||
switch (target->second.target.indirect_target) {
|
switch (target->second.target.indirect_target) {
|
||||||
case IndirectTarget::CIRCLE_PAD_UP:
|
case IndirectTarget::CirclePadUp:
|
||||||
circle_pad_up = false;
|
circle_pad_up = false;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
case IndirectTarget::CIRCLE_PAD_DOWN:
|
case IndirectTarget::CirclePadDown:
|
||||||
circle_pad_down = false;
|
circle_pad_down = false;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
case IndirectTarget::CIRCLE_PAD_LEFT:
|
case IndirectTarget::CirclePadLeft:
|
||||||
circle_pad_left = false;
|
circle_pad_left = false;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
case IndirectTarget::CIRCLE_PAD_RIGHT:
|
case IndirectTarget::CirclePadRight:
|
||||||
circle_pad_right = false;
|
circle_pad_right = false;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
case IndirectTarget::CIRCLE_PAD_MODIFIER:
|
case IndirectTarget::CirclePadModifier:
|
||||||
circle_pad_modifier = false;
|
circle_pad_modifier = false;
|
||||||
UpdateCirclePad(emu_window);
|
UpdateCirclePad(emu_window);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,12 +12,16 @@ class EmuWindow;
|
||||||
|
|
||||||
namespace KeyMap {
|
namespace KeyMap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a key mapping target that are not 3DS real buttons.
|
||||||
|
* They will be handled by KeyMap and translated to 3DS input.
|
||||||
|
*/
|
||||||
enum class IndirectTarget {
|
enum class IndirectTarget {
|
||||||
CIRCLE_PAD_UP,
|
CirclePadUp,
|
||||||
CIRCLE_PAD_DOWN,
|
CirclePadDown,
|
||||||
CIRCLE_PAD_LEFT,
|
CirclePadLeft,
|
||||||
CIRCLE_PAD_RIGHT,
|
CirclePadRight,
|
||||||
CIRCLE_PAD_MODIFIER,
|
CirclePadModifier,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue