diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2013-01-14 17:49:49 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2013-01-14 17:49:49 -0600 |
| commit | 032013c4bcbf4fa1451ea8be7c8c28f3200ae160 (patch) | |
| tree | 9df619fdc4443af9d0b3018a23197b0d9bbfef52 /Source/Core | |
| parent | 8cf3ea3eeaa92ae02b39a455cd4389b4b71844ef (diff) | |
Make IsValidBluetoothName just check for "Nintendo RVL-" rather than having a bunch of hardcoded names.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 19 | ||||
| -rw-r--r-- | Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h | 2 |
2 files changed, 7 insertions, 14 deletions
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 <queue> +#include <algorithm> #include <stdlib.h> #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 |
