From ef0f164343b021804472c42d951241cb60ac025d Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 28 Apr 2016 20:59:40 +0200 Subject: [PATCH] Disable wiimotes on game start if running in netplay And restore the settings on game quit --- Source/Core/Core/NetPlayClient.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 2fffbfb505..759c02c216 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -17,11 +17,13 @@ #include "Core/HW/SI_DeviceGCController.h" #include "Core/HW/Sram.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h" +#include "Core/HW/WiimoteReal/WiimoteReal.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h" static const char* NETPLAY_VERSION = scm_rev_git_str; static std::mutex crit_netplay_client; static NetPlayClient * netplay_client = nullptr; +static std::array s_wiimote_sources_cache; NetSettings g_NetPlaySettings; // called from ---GUI--- thread @@ -725,6 +727,17 @@ bool NetPlayClient::StartGame(const std::string &path) m_dialog->BootGame(path); + // Disable wiimotes on game start + // TODO: remove this when re-implementing wiimote netplay + if (SConfig::GetInstance().bWii) + { + for (unsigned int i = 0; i < 4; ++i) + { + s_wiimote_sources_cache[i] = g_wiimote_sources[i]; + WiimoteReal::ChangeWiimoteSource(i, WIIMOTE_SRC_NONE); + } + } + UpdateDevices(); return true; @@ -1019,6 +1032,17 @@ bool NetPlayClient::StopGame() // stop game m_dialog->StopGame(); + // Restore wiimote settings on game stop + // TODO: remove this when re-implementing wiimote netplay + if (SConfig::GetInstance().bWii) + { + for (unsigned int i = 0; i < 4; ++i) + { + g_wiimote_sources[i] = s_wiimote_sources_cache[i]; + WiimoteReal::ChangeWiimoteSource(i, s_wiimote_sources_cache[i]); + } + } + return true; }