From 94ecf4df390071aecba9091e0e3335d7399d325b Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sat, 27 Sep 2025 01:46:07 -0500 Subject: [PATCH] WiimoteReal: Add function to test specifically for a wii remote name. --- Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 12 ++++++++---- Source/Core/Core/HW/WiimoteReal/WiimoteReal.h | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index 03341941b5..53e8a05a18 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -965,13 +965,17 @@ void Refresh() s_wiimote_scanner.SetScanMode(WiimoteScanMode::SCAN_ONCE); } -bool IsValidDeviceName(const std::string& name) +bool IsValidDeviceName(std::string_view name) { - return "Nintendo RVL-CNT-01" == name || "Nintendo RVL-CNT-01-TR" == name || - IsBalanceBoardName(name); + return IsWiimoteName(name) || IsBalanceBoardName(name); } -bool IsBalanceBoardName(const std::string& name) +bool IsWiimoteName(std::string_view name) +{ + return name == "Nintendo RVL-CNT-01" || name == "Nintendo RVL-CNT-01-TR"; +} + +bool IsBalanceBoardName(std::string_view name) { return "Nintendo RVL-WBC-01" == name; } diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h index 04c1e0246f..a54cca3a6c 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -225,8 +226,10 @@ extern std::unique_ptr g_wiimotes[MAX_BBMOTES]; void AddWiimoteToPool(std::unique_ptr); -bool IsValidDeviceName(const std::string& name); -bool IsBalanceBoardName(const std::string& name); +bool IsValidDeviceName(std::string_view name); +bool IsWiimoteName(std::string_view name); +bool IsBalanceBoardName(std::string_view name); + bool IsNewWiimote(const std::string& identifier); bool IsKnownDeviceId(const USBUtils::DeviceInfo&);