diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 5565975ae5..dc4e96785b 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -16,6 +16,7 @@ // http://code.google.com/p/dolphin-emu/ #include +#include #include #include "Common.h" @@ -512,19 +513,11 @@ void StateChange(EMUSTATE_CHANGE newState) // TODO: disable/enable auto reporting, maybe } -bool IsValidBluetoothName(const char* name) { - static const char* kValidWiiRemoteBluetoothNames[] = { - "Nintendo RVL-CNT-01", - "Nintendo RVL-CNT-01-TR", - "Nintendo RVL-WBC-01", - }; - if (name == NULL) - return false; - for (size_t i = 0; i < ARRAYSIZE(kValidWiiRemoteBluetoothNames); i++) - if (strcmp(name, kValidWiiRemoteBluetoothNames[i]) == 0) - return true; - return false; +bool IsValidBluetoothName(const std::string& name) +{ + std::string const prefix("Nintendo RVL-"); + return name.size() > prefix.size() && + std::equal(prefix.begin(), prefix.end(), name.begin()); } - }; // end of namespace diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index f932e2bfd2..9fdb305a56 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -117,7 +117,7 @@ void StateChange(EMUSTATE_CHANGE newState); int FindWiimotes(Wiimote** wm, int max_wiimotes); -bool IsValidBluetoothName(const char* name); +bool IsValidBluetoothName(const std::string& name); }; // WiimoteReal