summaryrefslogtreecommitdiffstats
path: root/src/core/hid
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hid')
-rw-r--r--src/core/hid/emulated_console.cpp5
-rw-r--r--src/core/hid/emulated_controller.cpp5
-rw-r--r--src/core/hid/emulated_devices.cpp5
-rw-r--r--src/core/hid/hid_core.cpp3
-rw-r--r--src/core/hid/hid_core.h10
-rw-r--r--src/core/hid/input_converter.h12
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) {
void EmulatedConsole::DeleteCallback(int key) {
std::lock_guard lock{mutex};
- if (!callback_list.contains(key)) {
+ const auto& iterator = callback_list.find(key);
+ if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
- callback_list.erase(key);
+ callback_list.erase(iterator);
}
} // 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) {
void EmulatedController::DeleteCallback(int key) {
std::lock_guard lock{mutex};
- if (!callback_list.contains(key)) {
+ const auto& iterator = callback_list.find(key);
+ if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
- callback_list.erase(key);
+ callback_list.erase(iterator);
}
} // 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) {
void EmulatedDevices::DeleteCallback(int key) {
std::lock_guard lock{mutex};
- if (!callback_list.contains(key)) {
+ const auto& iterator = callback_list.find(key);
+ if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
- callback_list.erase(key);
+ callback_list.erase(iterator);
}
} // 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 @@
// Refer to the license.txt file included.
#include "common/assert.h"
+#include "core/hid/emulated_console.h"
+#include "core/hid/emulated_controller.h"
+#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
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 @@
#include <memory>
-#include "core/hid/emulated_console.h"
-#include "core/hid/emulated_controller.h"
-#include "core/hid/emulated_devices.h"
+#include "core/hid/hid_types.h"
+
+namespace Core::HID {
+class EmulatedConsole;
+class EmulatedController;
+class EmulatedDevices;
+} // namespace Core::HID
namespace Core::HID {
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 @@
#pragma once
-namespace Input {
+namespace Common::Input {
struct CallbackStatus;
-};
+enum class BatteryLevel : u32;
+using BatteryStatus = BatteryLevel;
+struct AnalogStatus;
+struct ButtonStatus;
+struct MotionStatus;
+struct StickStatus;
+struct TouchStatus;
+struct TriggerStatus;
+}; // namespace Common::Input
namespace Core::HID {