From da6c65bf3b83fa1cfe5da5dc5e43ec49b2786b52 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 6 Nov 2025 22:08:27 -0600 Subject: Common: Remove the string parameters from the HookableEvent interface. --- Source/Core/InputCommon/ControllerInterface/Android/Android.cpp | 2 +- .../Core/InputCommon/ControllerInterface/ControllerInterface.cpp | 5 ++--- .../Core/InputCommon/ControllerInterface/ControllerInterface.h | 5 ++--- Source/Core/InputCommon/InputConfig.cpp | 9 ++++----- 4 files changed, 9 insertions(+), 12 deletions(-) (limited to 'Source/Core/InputCommon') diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp index a11241d4f8..48eebbb7f6 100644 --- a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp @@ -455,7 +455,7 @@ void RegisterDevicesChangedCallbackIfNeeded(JNIEnv* env, jclass controller_inter env->GetStaticMethodID(global_controller_interface_class, "onDevicesChanged", "()V"); static Common::EventHook event_hook = g_controller_interface.RegisterDevicesChangedCallback( - "Android", [global_controller_interface_class, controller_interface_on_devices_changed] { + [global_controller_interface_class, controller_interface_on_devices_changed] { IDCache::GetEnvForThread()->CallStaticVoidMethod(global_controller_interface_class, controller_interface_on_devices_changed); }); diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 19ac7d3690..7393de9950 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -415,10 +415,9 @@ bool ControllerInterface::IsMouseCenteringRequested() const // Returns a handle for later removing the callback. Common::EventHook -ControllerInterface::RegisterDevicesChangedCallback(std::string_view name, - Common::HookableEvent<>::CallbackType callback) +ControllerInterface::RegisterDevicesChangedCallback(Common::HookableEvent<>::CallbackType callback) { - return m_devices_changed_event.Register(std::move(callback), name); + return m_devices_changed_event.Register(std::move(callback)); } // Invoke all callbacks that were registered diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 806c6b4b2a..05a3a99a05 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -115,8 +115,7 @@ public: bool IsMouseCenteringRequested() const; [[nodiscard]] Common::EventHook - RegisterDevicesChangedCallback(std::string_view name, - Common::HookableEvent<>::CallbackType callback); + RegisterDevicesChangedCallback(Common::HookableEvent<>::CallbackType callback); static void SetCurrentInputChannel(ciface::InputChannel); static ciface::InputChannel GetCurrentInputChannel(); @@ -128,7 +127,7 @@ private: void InvokeDevicesChangedCallbacks(); - Common::HookableEvent<> m_devices_changed_event{"Devices Changed"}; + Common::HookableEvent<> m_devices_changed_event; mutable std::recursive_mutex m_devices_population_mutex; std::atomic m_is_init; diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index 0e56adf378..6a6495c29c 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -172,11 +172,10 @@ void InputConfig::RegisterHotplugCallback() { // Update control references on all controllers // as configured devices may have been added or removed. - m_hotplug_event_hook = - g_controller_interface.RegisterDevicesChangedCallback("InputConfig", [this] { - for (auto& controller : m_controllers) - controller->UpdateReferences(g_controller_interface); - }); + m_hotplug_event_hook = g_controller_interface.RegisterDevicesChangedCallback([this] { + for (auto& controller : m_controllers) + controller->UpdateReferences(g_controller_interface); + }); } void InputConfig::UnregisterHotplugCallback() -- cgit v1.2.3