diff options
| author | 2022-11-28 09:19:01 -0500 | |
|---|---|---|
| committer | 2022-11-28 10:00:37 -0500 | |
| commit | 2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0 (patch) | |
| tree | c61fdcf120b96a0487e24f16c6f48b5fb44fafb5 /src/core/hid/emulated_devices.cpp | |
| parent | common/input: Pass ParamPackage by const reference in CreateDevice (diff) | |
| download | yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.tar.gz yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.tar.xz yuzu-2ec7d0b5fda0fe6cbafcc235e3d8cc91b0dc81e0.zip | |
common/input: Add helpers functions for creating input and output devices
Avoids the redundancy of needing to explictly specify the common
namespace and the type.
Diffstat (limited to 'src/core/hid/emulated_devices.cpp')
| -rw-r--r-- | src/core/hid/emulated_devices.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index 658dbd318..e421828d2 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp | |||
| @@ -25,12 +25,12 @@ void EmulatedDevices::ReloadInput() { | |||
| 25 | Common::ParamPackage mouse_params; | 25 | Common::ParamPackage mouse_params; |
| 26 | mouse_params.Set("engine", "mouse"); | 26 | mouse_params.Set("engine", "mouse"); |
| 27 | mouse_params.Set("button", static_cast<int>(key_index)); | 27 | mouse_params.Set("button", static_cast<int>(key_index)); |
| 28 | mouse_device = Common::Input::CreateDevice<Common::Input::InputDevice>(mouse_params); | 28 | mouse_device = Common::Input::CreateInputDevice(mouse_params); |
| 29 | key_index++; | 29 | key_index++; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | mouse_stick_device = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>( | 32 | mouse_stick_device = |
| 33 | "engine:mouse,axis_x:0,axis_y:1"); | 33 | Common::Input::CreateInputDeviceFromString("engine:mouse,axis_x:0,axis_y:1"); |
| 34 | 34 | ||
| 35 | // First two axis are reserved for mouse position | 35 | // First two axis are reserved for mouse position |
| 36 | key_index = 2; | 36 | key_index = 2; |
| @@ -38,7 +38,7 @@ void EmulatedDevices::ReloadInput() { | |||
| 38 | Common::ParamPackage mouse_params; | 38 | Common::ParamPackage mouse_params; |
| 39 | mouse_params.Set("engine", "mouse"); | 39 | mouse_params.Set("engine", "mouse"); |
| 40 | mouse_params.Set("axis", static_cast<int>(key_index)); | 40 | mouse_params.Set("axis", static_cast<int>(key_index)); |
| 41 | mouse_device = Common::Input::CreateDevice<Common::Input::InputDevice>(mouse_params); | 41 | mouse_device = Common::Input::CreateInputDevice(mouse_params); |
| 42 | key_index++; | 42 | key_index++; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| @@ -50,7 +50,7 @@ void EmulatedDevices::ReloadInput() { | |||
| 50 | keyboard_params.Set("button", static_cast<int>(key_index)); | 50 | keyboard_params.Set("button", static_cast<int>(key_index)); |
| 51 | keyboard_params.Set("port", 1); | 51 | keyboard_params.Set("port", 1); |
| 52 | keyboard_params.Set("pad", 0); | 52 | keyboard_params.Set("pad", 0); |
| 53 | keyboard_device = Common::Input::CreateDevice<Common::Input::InputDevice>(keyboard_params); | 53 | keyboard_device = Common::Input::CreateInputDevice(keyboard_params); |
| 54 | key_index++; | 54 | key_index++; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| @@ -62,11 +62,11 @@ void EmulatedDevices::ReloadInput() { | |||
| 62 | keyboard_params.Set("button", static_cast<int>(key_index)); | 62 | keyboard_params.Set("button", static_cast<int>(key_index)); |
| 63 | keyboard_params.Set("port", 1); | 63 | keyboard_params.Set("port", 1); |
| 64 | keyboard_params.Set("pad", 1); | 64 | keyboard_params.Set("pad", 1); |
| 65 | keyboard_device = Common::Input::CreateDevice<Common::Input::InputDevice>(keyboard_params); | 65 | keyboard_device = Common::Input::CreateInputDevice(keyboard_params); |
| 66 | key_index++; | 66 | key_index++; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | ring_analog_device = Common::Input::CreateDevice<Common::Input::InputDevice>(ring_params); | 69 | ring_analog_device = Common::Input::CreateInputDevice(ring_params); |
| 70 | 70 | ||
| 71 | for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) { | 71 | for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) { |
| 72 | if (!mouse_button_devices[index]) { | 72 | if (!mouse_button_devices[index]) { |