From c84d30c782107c5f462e3dcda568b76627b2b12d Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 30 Sep 2025 18:29:00 -0500 Subject: [PATCH] WiimoteReal/IOAndroid: Don't "find" already in-use Wii remotes. --- Source/Core/Core/HW/WiimoteReal/IOAndroid.cpp | 17 +++++++++++++++++ Source/Core/Core/HW/WiimoteReal/IOAndroid.h | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/HW/WiimoteReal/IOAndroid.cpp b/Source/Core/Core/HW/WiimoteReal/IOAndroid.cpp index 84d9c2615a0..e4697176eca 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOAndroid.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IOAndroid.cpp @@ -5,6 +5,8 @@ #include +#include + #include "Common/CommonTypes.h" #include "Common/Event.h" #include "Common/Flag.h" @@ -37,7 +39,12 @@ void WiimoteScannerAndroid::FindWiimotes(std::vector& found_wiimotes, env->CallStaticBooleanMethod(s_adapter_class, openadapter_func)) { for (int i = 0; i < MAX_WIIMOTES; ++i) + { + if (!IsNewWiimote(WiimoteAndroid::GetIdFromDolphinBarIndex(i))) + continue; + found_wiimotes.emplace_back(new WiimoteAndroid(i)); + } } } @@ -50,6 +57,16 @@ WiimoteAndroid::~WiimoteAndroid() Shutdown(); } +std::string WiimoteAndroid::GetId() const +{ + return GetIdFromDolphinBarIndex(m_mayflash_index); +} + +std::string WiimoteAndroid::GetIdFromDolphinBarIndex(int index) +{ + return fmt::format("Android {}", index); +} + // Connect to a Wiimote with a known address. bool WiimoteAndroid::ConnectInternal() { diff --git a/Source/Core/Core/HW/WiimoteReal/IOAndroid.h b/Source/Core/Core/HW/WiimoteReal/IOAndroid.h index 7581a6dbd1d..ada33fa69d8 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOAndroid.h +++ b/Source/Core/Core/HW/WiimoteReal/IOAndroid.h @@ -17,7 +17,9 @@ class WiimoteAndroid final : public Wiimote public: WiimoteAndroid(int index); ~WiimoteAndroid() override; - std::string GetId() const override { return "Android " + std::to_string(m_mayflash_index); } + + std::string GetId() const override; + static std::string GetIdFromDolphinBarIndex(int index); protected: bool ConnectInternal() override;