[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.
This commit is contained in:
mathieui 2016-01-26 00:21:13 +01:00
parent 9199539798
commit 24cb6487d4
1 changed files with 21 additions and 5 deletions

View File

@ -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++;
}
}
}