summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2016-01-26 00:21:13 +0100
committermathieui <mathieui@mathieui.net>2016-01-27 01:43:31 +0100
commit24cb6487d4e5f4a0f9bc50f3bc356175e57465b7 (patch)
tree2a58c64d2d31103386208a93d74a18e96dbff0fa /Source
parent9199539798dddb623ee82e45814f119a9dece36e (diff)
[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.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/NetPlayClient.cpp26
1 files 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++;
+ }
}
}