diff options
Diffstat (limited to 'src/core/hid/emulated_devices.cpp')
| -rw-r--r-- | src/core/hid/emulated_devices.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index e421828d2..836f32c0f 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp | |||
| @@ -14,7 +14,6 @@ EmulatedDevices::EmulatedDevices() = default; | |||
| 14 | EmulatedDevices::~EmulatedDevices() = default; | 14 | EmulatedDevices::~EmulatedDevices() = default; |
| 15 | 15 | ||
| 16 | void EmulatedDevices::ReloadFromSettings() { | 16 | void EmulatedDevices::ReloadFromSettings() { |
| 17 | ring_params = Common::ParamPackage(Settings::values.ringcon_analogs); | ||
| 18 | ReloadInput(); | 17 | ReloadInput(); |
| 19 | } | 18 | } |
| 20 | 19 | ||
| @@ -66,8 +65,6 @@ void EmulatedDevices::ReloadInput() { | |||
| 66 | key_index++; | 65 | key_index++; |
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | ring_analog_device = Common::Input::CreateInputDevice(ring_params); | ||
| 70 | |||
| 71 | for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) { | 68 | for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) { |
| 72 | if (!mouse_button_devices[index]) { | 69 | if (!mouse_button_devices[index]) { |
| 73 | continue; | 70 | continue; |
| @@ -122,13 +119,6 @@ void EmulatedDevices::ReloadInput() { | |||
| 122 | }, | 119 | }, |
| 123 | }); | 120 | }); |
| 124 | } | 121 | } |
| 125 | |||
| 126 | if (ring_analog_device) { | ||
| 127 | ring_analog_device->SetCallback({ | ||
| 128 | .on_change = | ||
| 129 | [this](const Common::Input::CallbackStatus& callback) { SetRingAnalog(callback); }, | ||
| 130 | }); | ||
| 131 | } | ||
| 132 | } | 122 | } |
| 133 | 123 | ||
| 134 | void EmulatedDevices::UnloadInput() { | 124 | void EmulatedDevices::UnloadInput() { |
| @@ -145,7 +135,6 @@ void EmulatedDevices::UnloadInput() { | |||
| 145 | for (auto& button : keyboard_modifier_devices) { | 135 | for (auto& button : keyboard_modifier_devices) { |
| 146 | button.reset(); | 136 | button.reset(); |
| 147 | } | 137 | } |
| 148 | ring_analog_device.reset(); | ||
| 149 | } | 138 | } |
| 150 | 139 | ||
| 151 | void EmulatedDevices::EnableConfiguration() { | 140 | void EmulatedDevices::EnableConfiguration() { |
| @@ -165,7 +154,6 @@ void EmulatedDevices::SaveCurrentConfig() { | |||
| 165 | if (!is_configuring) { | 154 | if (!is_configuring) { |
| 166 | return; | 155 | return; |
| 167 | } | 156 | } |
| 168 | Settings::values.ringcon_analogs = ring_params.Serialize(); | ||
| 169 | } | 157 | } |
| 170 | 158 | ||
| 171 | void EmulatedDevices::RestoreConfig() { | 159 | void EmulatedDevices::RestoreConfig() { |
| @@ -175,15 +163,6 @@ void EmulatedDevices::RestoreConfig() { | |||
| 175 | ReloadFromSettings(); | 163 | ReloadFromSettings(); |
| 176 | } | 164 | } |
| 177 | 165 | ||
| 178 | Common::ParamPackage EmulatedDevices::GetRingParam() const { | ||
| 179 | return ring_params; | ||
| 180 | } | ||
| 181 | |||
| 182 | void EmulatedDevices::SetRingParam(Common::ParamPackage param) { | ||
| 183 | ring_params = std::move(param); | ||
| 184 | ReloadInput(); | ||
| 185 | } | ||
| 186 | |||
| 187 | void EmulatedDevices::SetKeyboardButton(const Common::Input::CallbackStatus& callback, | 166 | void EmulatedDevices::SetKeyboardButton(const Common::Input::CallbackStatus& callback, |
| 188 | std::size_t index) { | 167 | std::size_t index) { |
| 189 | if (index >= device_status.keyboard_values.size()) { | 168 | if (index >= device_status.keyboard_values.size()) { |
| @@ -430,23 +409,6 @@ void EmulatedDevices::SetMouseStick(const Common::Input::CallbackStatus& callbac | |||
| 430 | TriggerOnChange(DeviceTriggerType::Mouse); | 409 | TriggerOnChange(DeviceTriggerType::Mouse); |
| 431 | } | 410 | } |
| 432 | 411 | ||
| 433 | void EmulatedDevices::SetRingAnalog(const Common::Input::CallbackStatus& callback) { | ||
| 434 | std::lock_guard lock{mutex}; | ||
| 435 | const auto force_value = TransformToStick(callback); | ||
| 436 | |||
| 437 | device_status.ring_analog_value = force_value.x; | ||
| 438 | |||
| 439 | if (is_configuring) { | ||
| 440 | device_status.ring_analog_value = {}; | ||
| 441 | TriggerOnChange(DeviceTriggerType::RingController); | ||
| 442 | return; | ||
| 443 | } | ||
| 444 | |||
| 445 | device_status.ring_analog_state.force = force_value.x.value; | ||
| 446 | |||
| 447 | TriggerOnChange(DeviceTriggerType::RingController); | ||
| 448 | } | ||
| 449 | |||
| 450 | KeyboardValues EmulatedDevices::GetKeyboardValues() const { | 412 | KeyboardValues EmulatedDevices::GetKeyboardValues() const { |
| 451 | std::scoped_lock lock{mutex}; | 413 | std::scoped_lock lock{mutex}; |
| 452 | return device_status.keyboard_values; | 414 | return device_status.keyboard_values; |
| @@ -462,10 +424,6 @@ MouseButtonValues EmulatedDevices::GetMouseButtonsValues() const { | |||
| 462 | return device_status.mouse_button_values; | 424 | return device_status.mouse_button_values; |
| 463 | } | 425 | } |
| 464 | 426 | ||
| 465 | RingAnalogValue EmulatedDevices::GetRingSensorValues() const { | ||
| 466 | return device_status.ring_analog_value; | ||
| 467 | } | ||
| 468 | |||
| 469 | KeyboardKey EmulatedDevices::GetKeyboard() const { | 427 | KeyboardKey EmulatedDevices::GetKeyboard() const { |
| 470 | std::scoped_lock lock{mutex}; | 428 | std::scoped_lock lock{mutex}; |
| 471 | return device_status.keyboard_state; | 429 | return device_status.keyboard_state; |
| @@ -491,10 +449,6 @@ AnalogStickState EmulatedDevices::GetMouseWheel() const { | |||
| 491 | return device_status.mouse_wheel_state; | 449 | return device_status.mouse_wheel_state; |
| 492 | } | 450 | } |
| 493 | 451 | ||
| 494 | RingSensorForce EmulatedDevices::GetRingSensorForce() const { | ||
| 495 | return device_status.ring_analog_state; | ||
| 496 | } | ||
| 497 | |||
| 498 | void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) { | 452 | void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) { |
| 499 | std::scoped_lock lock{callback_mutex}; | 453 | std::scoped_lock lock{callback_mutex}; |
| 500 | for (const auto& poller_pair : callback_list) { | 454 | for (const auto& poller_pair : callback_list) { |