mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-28 16:11:38 +00:00
Wiimote: Remove useless disconnections
ChangeWiimoteSource does not need to disconnect a Wiimote if it isn't connected.
This commit is contained in:
parent
ee868e2362
commit
1c33dfc787
@ -777,6 +777,7 @@ void Pause()
|
|||||||
|
|
||||||
void ChangeWiimoteSource(unsigned int index, int source)
|
void ChangeWiimoteSource(unsigned int index, int source)
|
||||||
{
|
{
|
||||||
|
const int previous_source = g_wiimote_sources[index];
|
||||||
g_wiimote_sources[index] = source;
|
g_wiimote_sources[index] = source;
|
||||||
{
|
{
|
||||||
// kill real connection (or swap to different slot)
|
// kill real connection (or swap to different slot)
|
||||||
@ -796,9 +797,10 @@ void ChangeWiimoteSource(unsigned int index, int source)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reconnect to the emulator
|
// reconnect to the emulator
|
||||||
Core::RunAsCPUThread([index, source] {
|
Core::RunAsCPUThread([index, previous_source, source] {
|
||||||
|
if (previous_source != WIIMOTE_SRC_NONE)
|
||||||
::Wiimote::Connect(index, false);
|
::Wiimote::Connect(index, false);
|
||||||
if (WIIMOTE_SRC_EMU & source)
|
if (source & WIIMOTE_SRC_EMU)
|
||||||
::Wiimote::Connect(index, true);
|
::Wiimote::Connect(index, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user