summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2015-11-29 00:58:18 +1300
committerScott Mansell <phiren@gmail.com>2015-11-29 00:58:18 +1300
commit97cd723492941005690e8ddcac53e58d7e795f10 (patch)
tree63fd94c3c6e59d2cd32aa9fb65a1bf111973df23 /Source/Core
parent861bd98e3a36df52f1a12aba2816281267d42cb3 (diff)
parent31a4b2ed03dddc4bb1496dcae8758d2ace24618c (diff)
Merge pull request #3286 from jloehr/Wiimote-Rumble-LED-Fix
Fix Prepare (Set LEDs and Rumble) on Connect and Refresh
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/WiimoteReal/IOdarwin.mm6
-rw-r--r--Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp19
-rw-r--r--Source/Core/Core/HW/WiimoteReal/WiimoteReal.h7
3 files changed, 20 insertions, 12 deletions
diff --git a/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm
index ed2e254732..4c5787f250 100644
--- a/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm
+++ b/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm
@@ -518,13 +518,13 @@ void WiimoteDarwinHid::RemoveCallback(void* context, IOReturn result, void*)
if (length > MAX_PAYLOAD) {
WARN_LOG(WIIMOTE, "Dropping packet for Wiimote %i, too large",
- wm->m_index + 1);
+ wm->GetIndex() + 1);
return;
}
if (wm->m_inputlen != -1) {
WARN_LOG(WIIMOTE, "Dropping packet for Wiimote %i, queue full",
- wm->m_index + 1);
+ wm->GetIndex() + 1);
return;
}
@@ -556,7 +556,7 @@ void WiimoteDarwinHid::RemoveCallback(void* context, IOReturn result, void*)
return;
}
- WARN_LOG(WIIMOTE, "Lost channel to Wiimote %i", wm->m_index + 1);
+ WARN_LOG(WIIMOTE, "Lost channel to Wiimote %i", wm->GetIndex() + 1);
wm->DisconnectInternal();
}
diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
index fafa2dfd40..4360112834 100644
--- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
+++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
@@ -338,10 +338,10 @@ void Wiimote::ConnectOnInput()
}
}
-void Wiimote::Prepare(int _index)
+void Wiimote::Prepare()
{
- m_index = _index;
m_need_prepare.store(true);
+ IOWakeup();
}
bool Wiimote::PrepareOnThread()
@@ -523,8 +523,11 @@ void WiimoteScanner::ThreadFunc()
NOTICE_LOG(WIIMOTE, "Wiimote scanning has stopped.");
}
-bool Wiimote::Connect()
+bool Wiimote::Connect(int index)
{
+ m_index = index;
+ m_need_prepare.store(true);
+
if (!m_run_thread.load())
{
m_thread_ready.store(false);
@@ -605,6 +608,11 @@ void Wiimote::ThreadFunc()
DisconnectInternal();
}
+int Wiimote::GetIndex() const
+{
+ return m_index;
+}
+
void LoadSettings()
{
std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini";
@@ -725,9 +733,8 @@ static bool TryToConnectWiimoteN(Wiimote* wm, unsigned int i)
{
if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] && !g_wiimotes[i])
{
- if (wm->Connect())
+ if (wm->Connect(i))
{
- wm->Prepare(i);
NOTICE_LOG(WIIMOTE, "Connected to Wiimote %i.", i + 1);
g_wiimotes[i] = wm;
Host_ConnectWiimote(i, true);
@@ -840,7 +847,7 @@ void Refresh()
{
if (g_wiimotes[i])
{
- g_wiimotes[i]->Prepare(i);
+ g_wiimotes[i]->Prepare();
}
}
diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h
index 5d3a135787..0e68219462 100644
--- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h
+++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h
@@ -60,12 +60,12 @@ public:
virtual bool ConnectInternal() = 0;
virtual void DisconnectInternal() = 0;
- bool Connect();
+ bool Connect(int index);
// TODO: change to something like IsRelevant
virtual bool IsConnected() const = 0;
- void Prepare(int index);
+ void Prepare();
bool PrepareOnThread();
void DisableDataReporting();
@@ -74,10 +74,11 @@ public:
void QueueReport(u8 rpt_id, const void* data, unsigned int size);
- int m_index;
+ int GetIndex() const;
protected:
Wiimote();
+ int m_index;
Report m_last_input_report;
u16 m_channel;
u8 m_last_connect_request_counter;