From 24cb6487d4e5f4a0f9bc50f3bc356175e57465b7 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 26 Jan 2016 00:21:13 +0100 Subject: [PATCH] [netplay] Fix a regression Introduced in 6e13496d8, pads would get assigned to their netplay position, which breaks assumptions. With this behavior, the SI devices should be mapped properly. --- Source/Core/Core/NetPlayClient.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index ff94151f2b..de5e8a901a 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -758,13 +758,29 @@ bool NetPlayClient::ChangeGame(const std::string&) // called from ---NETPLAY--- thread void NetPlayClient::UpdateDevices() { - for (PadMapping i = 0; i < 4; i++) + u8 local_pad = 0; + // Add local pads first: + // As stated in the comment in NetPlayClient::GetNetPads, the pads pertaining + // to the local user are always locally mapped to the first gamecube ports, + // so they should be added first. + for (auto player_id : m_pad_map) { // Use local controller types for local controllers - if (m_pad_map[i] == m_local_player->pid) - SerialInterface::AddDevice(SConfig::GetInstance().m_SIDevice[i], i); - else - SerialInterface::AddDevice(m_pad_map[i] > 0 ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i); + if (player_id == m_local_player->pid) + { + SerialInterface::AddDevice(SConfig::GetInstance().m_SIDevice[local_pad], local_pad); + local_pad++; + } + } + for (auto player_id : m_pad_map) + { + if (player_id != m_local_player->pid) + { + // Only GCController-like controllers are supported, GBA and similar + // exotic devices are not supported on netplay. + SerialInterface::AddDevice(player_id > 0 ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, local_pad); + local_pad++; + } } }