mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-01 10:31:31 +02:00
Merge pull request #3569 from mathieui/netplay-gcpad-position
[netplay] Fix a regression
This commit is contained in:
commit
9da8593cf4
@ -269,7 +269,7 @@ bool BootCore(const std::string& _rFilename)
|
||||
{
|
||||
int source;
|
||||
controls_section->Get(StringFromFormat("PadType%u", i), &source, -1);
|
||||
if (source >= (int) SIDEVICE_NONE && source <= (int) SIDEVICE_AM_BASEBOARD)
|
||||
if (source >= (int) SIDEVICE_NONE && source <= (int) SIDEVICE_WIIU_ADAPTER)
|
||||
{
|
||||
SConfig::GetInstance().m_SIDevice[i] = (SIDevices) source;
|
||||
config_cache.bSetPads[i] = true;
|
||||
|
@ -16,7 +16,8 @@ CSIDevice_GCAdapter::CSIDevice_GCAdapter(SIDevices device, int _iDeviceNumber)
|
||||
{
|
||||
// get the correct pad number that should rumble locally when using netplay
|
||||
const u8 numPAD = NetPlay_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber);
|
||||
m_simulate_konga = SConfig::GetInstance().m_AdapterKonga[numPAD];
|
||||
if (numPAD < 4)
|
||||
m_simulate_konga = SConfig::GetInstance().m_AdapterKonga[numPAD];
|
||||
}
|
||||
|
||||
GCPadStatus CSIDevice_GCAdapter::GetPadStatus()
|
||||
@ -39,12 +40,14 @@ int CSIDevice_GCAdapter::RunBuffer(u8* _pBuffer, int _iLength)
|
||||
// Read the command
|
||||
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[3]);
|
||||
|
||||
// get the correct pad number that should rumble locally when using netplay
|
||||
const u8 numPAD = NetPlay_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber);
|
||||
if (!GCAdapter::DeviceConnected(numPAD))
|
||||
if (numPAD < 4)
|
||||
{
|
||||
reinterpret_cast<u32*>(_pBuffer)[0] = SI_NONE;
|
||||
return 4;
|
||||
if (!GCAdapter::DeviceConnected(numPAD))
|
||||
{
|
||||
reinterpret_cast<u32*>(_pBuffer)[0] = SI_NONE;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle it
|
||||
|
@ -758,13 +758,36 @@ 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)
|
||||
{
|
||||
if (SConfig::GetInstance().m_SIDevice[local_pad] != SIDEVICE_NONE)
|
||||
{
|
||||
SerialInterface::AddDevice(SConfig::GetInstance().m_SIDevice[local_pad], local_pad);
|
||||
}
|
||||
else
|
||||
{
|
||||
SerialInterface::AddDevice(SIDEVICE_GC_CONTROLLER, 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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user