Merge pull request #5873 from mimimi085181/fix-real-wiimote

Properly handle g_wiimotes_mutex again for real wiimotes
This commit is contained in:
Leo Lam 2017-08-03 13:09:57 +08:00 committed by GitHub
commit 6a76ca7bb7
1 changed files with 4 additions and 2 deletions

View File

@ -892,11 +892,13 @@ bool CheckForButtonPress(int wiimote_number)
if (!g_wiimotes_mutex.try_lock()) if (!g_wiimotes_mutex.try_lock())
return false; return false;
bool button_pressed = false;
if (g_wiimotes[wiimote_number]) if (g_wiimotes[wiimote_number])
return g_wiimotes[wiimote_number]->CheckForButtonPress(); button_pressed = g_wiimotes[wiimote_number]->CheckForButtonPress();
g_wiimotes_mutex.unlock(); g_wiimotes_mutex.unlock();
return false; return button_pressed;
} }
bool IsValidDeviceName(const std::string& name) bool IsValidDeviceName(const std::string& name)