Fix changing wiimotes when starting netplay.

AccessWiiMote() crashed for some users. Not sure why...
This commit is contained in:
Rachel Bryk 2013-09-25 05:44:16 -04:00
parent ebe4448749
commit 93f7622e16
1 changed files with 13 additions and 14 deletions

View File

@ -19,6 +19,7 @@
#include "ConfigManager.h" #include "ConfigManager.h"
#include "Movie.h" #include "Movie.h"
#include "HW/WiimoteEmu/WiimoteEmu.h" #include "HW/WiimoteEmu/WiimoteEmu.h"
#include "HW/WiimoteReal/WiimoteReal.h"
std::mutex crit_netplay_client; std::mutex crit_netplay_client;
static NetPlayClient * netplay_client = NULL; static NetPlayClient * netplay_client = NULL;
@ -498,6 +499,7 @@ bool NetPlayClient::StartGame(const std::string &path)
} }
// boot game // boot game
m_dialog->BootGame(path); m_dialog->BootGame(path);
UpdateDevices(); UpdateDevices();
@ -505,11 +507,7 @@ bool NetPlayClient::StartGame(const std::string &path)
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{ {
for (unsigned int i = 0; i < 4; ++i) for (unsigned int i = 0; i < 4; ++i)
{ WiimoteReal::ChangeWiimoteSource(i, m_wiimote_map[i] > 0 ? WIIMOTE_SRC_EMU : WIIMOTE_SRC_NONE);
g_wiimote_sources[i] = m_wiimote_map[i] > 0 ? WIIMOTE_SRC_EMU : WIIMOTE_SRC_NONE;
GetUsbPointer()->AccessWiiMote(i | 0x100)->Activate(m_wiimote_map[i] > 0);
}
}
// Needed to prevent locking up at boot if (when) the wiimotes connect out of order. // Needed to prevent locking up at boot if (when) the wiimotes connect out of order.
NetWiimote nw; NetWiimote nw;
@ -522,6 +520,7 @@ bool NetPlayClient::StartGame(const std::string &path)
for (unsigned int i = 0; i < 7; ++i) for (unsigned int i = 0; i < 7; ++i)
m_wiimote_buffer[w].Push(nw); m_wiimote_buffer[w].Push(nw);
} }
}
return true; return true;
} }