diff options
| author | 2021-11-01 14:17:53 -0600 | |
|---|---|---|
| committer | 2021-11-24 20:30:26 -0600 | |
| commit | 77fa4d4bf60526826ef8b53ee3870f7d2a761976 (patch) | |
| tree | 3c6c07d535bd912ed085be9b826103a6eabe718f /src/core/hid | |
| parent | settings: Fix Debug controller type options (diff) | |
| download | yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.gz yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.xz yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.zip | |
second commit lion review
Diffstat (limited to 'src/core/hid')
| -rw-r--r-- | src/core/hid/emulated_console.cpp | 5 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 5 | ||||
| -rw-r--r-- | src/core/hid/emulated_devices.cpp | 5 | ||||
| -rw-r--r-- | src/core/hid/hid_core.cpp | 3 | ||||
| -rw-r--r-- | src/core/hid/hid_core.h | 10 | ||||
| -rw-r--r-- | src/core/hid/input_converter.h | 12 |
6 files changed, 29 insertions, 11 deletions
diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp index 012909954..dfbaa3f8c 100644 --- a/src/core/hid/emulated_console.cpp +++ b/src/core/hid/emulated_console.cpp | |||
| @@ -209,10 +209,11 @@ int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) { | |||
| 209 | 209 | ||
| 210 | void EmulatedConsole::DeleteCallback(int key) { | 210 | void EmulatedConsole::DeleteCallback(int key) { |
| 211 | std::lock_guard lock{mutex}; | 211 | std::lock_guard lock{mutex}; |
| 212 | if (!callback_list.contains(key)) { | 212 | const auto& iterator = callback_list.find(key); |
| 213 | if (iterator == callback_list.end()) { | ||
| 213 | LOG_ERROR(Input, "Tried to delete non-existent callback {}", key); | 214 | LOG_ERROR(Input, "Tried to delete non-existent callback {}", key); |
| 214 | return; | 215 | return; |
| 215 | } | 216 | } |
| 216 | callback_list.erase(key); | 217 | callback_list.erase(iterator); |
| 217 | } | 218 | } |
| 218 | } // namespace Core::HID | 219 | } // namespace Core::HID |
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 9a1864279..7bab00bb1 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -993,10 +993,11 @@ int EmulatedController::SetCallback(ControllerUpdateCallback update_callback) { | |||
| 993 | 993 | ||
| 994 | void EmulatedController::DeleteCallback(int key) { | 994 | void EmulatedController::DeleteCallback(int key) { |
| 995 | std::lock_guard lock{mutex}; | 995 | std::lock_guard lock{mutex}; |
| 996 | if (!callback_list.contains(key)) { | 996 | const auto& iterator = callback_list.find(key); |
| 997 | if (iterator == callback_list.end()) { | ||
| 997 | LOG_ERROR(Input, "Tried to delete non-existent callback {}", key); | 998 | LOG_ERROR(Input, "Tried to delete non-existent callback {}", key); |
| 998 | return; | 999 | return; |
| 999 | } | 1000 | } |
| 1000 | callback_list.erase(key); | 1001 | callback_list.erase(iterator); |
| 1001 | } | 1002 | } |
| 1002 | } // namespace Core::HID | 1003 | } // namespace Core::HID |
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index c76a86b6c..e97470240 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp | |||
| @@ -362,10 +362,11 @@ int EmulatedDevices::SetCallback(InterfaceUpdateCallback update_callback) { | |||
| 362 | 362 | ||
| 363 | void EmulatedDevices::DeleteCallback(int key) { | 363 | void EmulatedDevices::DeleteCallback(int key) { |
| 364 | std::lock_guard lock{mutex}; | 364 | std::lock_guard lock{mutex}; |
| 365 | if (!callback_list.contains(key)) { | 365 | const auto& iterator = callback_list.find(key); |
| 366 | if (iterator == callback_list.end()) { | ||
| 366 | LOG_ERROR(Input, "Tried to delete non-existent callback {}", key); | 367 | LOG_ERROR(Input, "Tried to delete non-existent callback {}", key); |
| 367 | return; | 368 | return; |
| 368 | } | 369 | } |
| 369 | callback_list.erase(key); | 370 | callback_list.erase(iterator); |
| 370 | } | 371 | } |
| 371 | } // namespace Core::HID | 372 | } // namespace Core::HID |
diff --git a/src/core/hid/hid_core.cpp b/src/core/hid/hid_core.cpp index 3cb26e1e7..741a69c3c 100644 --- a/src/core/hid/hid_core.cpp +++ b/src/core/hid/hid_core.cpp | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
| 6 | #include "core/hid/emulated_console.h" | ||
| 7 | #include "core/hid/emulated_controller.h" | ||
| 8 | #include "core/hid/emulated_devices.h" | ||
| 6 | #include "core/hid/hid_core.h" | 9 | #include "core/hid/hid_core.h" |
| 7 | 10 | ||
| 8 | namespace Core::HID { | 11 | namespace Core::HID { |
diff --git a/src/core/hid/hid_core.h b/src/core/hid/hid_core.h index a4a66a3a4..1fe2fd89b 100644 --- a/src/core/hid/hid_core.h +++ b/src/core/hid/hid_core.h | |||
| @@ -6,9 +6,13 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | 8 | ||
| 9 | #include "core/hid/emulated_console.h" | 9 | #include "core/hid/hid_types.h" |
| 10 | #include "core/hid/emulated_controller.h" | 10 | |
| 11 | #include "core/hid/emulated_devices.h" | 11 | namespace Core::HID { |
| 12 | class EmulatedConsole; | ||
| 13 | class EmulatedController; | ||
| 14 | class EmulatedDevices; | ||
| 15 | } // namespace Core::HID | ||
| 12 | 16 | ||
| 13 | namespace Core::HID { | 17 | namespace Core::HID { |
| 14 | 18 | ||
diff --git a/src/core/hid/input_converter.h b/src/core/hid/input_converter.h index b38e657b0..2a722b39f 100644 --- a/src/core/hid/input_converter.h +++ b/src/core/hid/input_converter.h | |||
| @@ -4,9 +4,17 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | namespace Input { | 7 | namespace Common::Input { |
| 8 | struct CallbackStatus; | 8 | struct CallbackStatus; |
| 9 | }; | 9 | enum class BatteryLevel : u32; |
| 10 | using BatteryStatus = BatteryLevel; | ||
| 11 | struct AnalogStatus; | ||
| 12 | struct ButtonStatus; | ||
| 13 | struct MotionStatus; | ||
| 14 | struct StickStatus; | ||
| 15 | struct TouchStatus; | ||
| 16 | struct TriggerStatus; | ||
| 17 | }; // namespace Common::Input | ||
| 10 | 18 | ||
| 11 | namespace Core::HID { | 19 | namespace Core::HID { |
| 12 | 20 | ||