Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make IsValidBluetoothName just check for "Nintendo RVL-" rather than …
…having a bunch of hardcoded names.
  • Loading branch information
jordan-woyak committed Jan 14, 2013
1 parent 8cf3ea3 commit 032013c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
19 changes: 6 additions & 13 deletions Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
Expand Up @@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/

#include <queue>
#include <algorithm>
#include <stdlib.h>

#include "Common.h"
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h
Expand Up @@ -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

Expand Down

0 comments on commit 032013c

Please sign in to comment.