NetPlay: Use the correct pad mappings for rumble
Rename the functions around so we don't get confused again, too.
This commit is contained in:
parent
ba0c52b104
commit
92c846de45
|
@ -231,7 +231,7 @@ void CSIDevice_DanceMat::SendCommand(u32 _Cmd, u8 _Poll)
|
|||
unsigned int uStrength = command.Parameter2;
|
||||
|
||||
// get the correct pad number that should rumble locally when using netplay
|
||||
const u8 numPAD = NetPlay_GetPadNum(ISIDevice::m_iDeviceNumber);
|
||||
const u8 numPAD = NetPlay_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber);
|
||||
|
||||
if (numPAD < 4)
|
||||
Pad::Rumble(numPAD, uType, uStrength);
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
// Send and Receive pad input from network
|
||||
static bool NetPlay_GetInput(u8 numPAD, SPADStatus status, u32 *PADStatus);
|
||||
static u8 NetPlay_GetPadNum(u8 numPAD);
|
||||
static u8 NetPlay_InGamePadToLocalPad(u8 numPAD);
|
||||
|
||||
// Return true on new data
|
||||
virtual bool GetData(u32& _Hi, u32& _Low);
|
||||
|
|
|
@ -249,7 +249,7 @@ void CSIDevice_GCController::SendCommand(u32 _Cmd, u8 _Poll)
|
|||
unsigned int uStrength = command.Parameter2;
|
||||
|
||||
// get the correct pad number that should rumble locally when using netplay
|
||||
const u8 numPAD = NetPlay_GetPadNum(ISIDevice::m_iDeviceNumber);
|
||||
const u8 numPAD = NetPlay_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber);
|
||||
|
||||
if (numPAD < 4)
|
||||
Pad::Rumble(numPAD, uType, uStrength);
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
// Send and Receive pad input from network
|
||||
static bool NetPlay_GetInput(u8 numPAD, SPADStatus status, u32 *PADStatus);
|
||||
static u8 NetPlay_GetPadNum(u8 numPAD);
|
||||
static u8 NetPlay_InGamePadToLocalPad(u8 numPAD);
|
||||
|
||||
// Return true on new data
|
||||
virtual bool GetData(u32& _Hi, u32& _Low);
|
||||
|
|
|
@ -254,7 +254,7 @@ void CSIDevice_GCSteeringWheel::SendCommand(u32 _Cmd, u8 _Poll)
|
|||
unsigned int uType = command.Parameter2; // 06 = motor on, 04 = motor off
|
||||
|
||||
// get the correct pad number that should rumble locally when using netplay
|
||||
const u8 numPAD = NetPlay_GetPadNum(ISIDevice::m_iDeviceNumber);
|
||||
const u8 numPAD = NetPlay_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber);
|
||||
|
||||
if (numPAD < 4)
|
||||
Pad::Motor(numPAD, uType, uStrength);
|
||||
|
@ -273,7 +273,7 @@ void CSIDevice_GCSteeringWheel::SendCommand(u32 _Cmd, u8 _Poll)
|
|||
unsigned int uStrength = command.Parameter2;
|
||||
|
||||
// get the correct pad number that should rumble locally when using netplay
|
||||
const u8 numPAD = NetPlay_GetPadNum(ISIDevice::m_iDeviceNumber);
|
||||
const u8 numPAD = NetPlay_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber);
|
||||
|
||||
if (numPAD < 4)
|
||||
Pad::Rumble(numPAD, uType, uStrength);
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
// Send and Receive pad input from network
|
||||
static bool NetPlay_GetInput(u8 numPAD, SPADStatus status, u32 *PADStatus);
|
||||
static u8 NetPlay_GetPadNum(u8 numPAD);
|
||||
static u8 NetPlay_InGamePadToLocalPad(u8 numPAD);
|
||||
|
||||
// Return true on new data
|
||||
virtual bool GetData(u32& _Hi, u32& _Low);
|
||||
|
|
|
@ -515,7 +515,7 @@ bool NetPlayClient::GetNetPads(const u8 pad_nb, const SPADStatus* const pad_stat
|
|||
// We should add this split between "in-game" pads and "local"
|
||||
// pads higher up.
|
||||
|
||||
int in_game_num = GetPadNum(pad_nb);
|
||||
int in_game_num = InGamePadToLocalPad(pad_nb);
|
||||
|
||||
// If this in-game pad is one of ours, then update from the
|
||||
// information given.
|
||||
|
@ -623,8 +623,25 @@ void NetPlayClient::Stop()
|
|||
}
|
||||
}
|
||||
|
||||
// called from ---CPU--- thread
|
||||
u8 NetPlayClient::GetPadNum(u8 numPAD)
|
||||
u8 NetPlayClient::InGamePadToLocalPad(u8 ingame_pad)
|
||||
{
|
||||
// not our pad
|
||||
if (m_pad_map[ingame_pad] != m_local_player->pid)
|
||||
return 4;
|
||||
|
||||
int local_pad = 0;
|
||||
int pad = 0;
|
||||
|
||||
for (; pad < ingame_pad; pad++)
|
||||
{
|
||||
if (m_pad_map[pad] == m_local_player->pid)
|
||||
local_pad++;
|
||||
}
|
||||
|
||||
return local_pad;
|
||||
}
|
||||
|
||||
u8 NetPlayClient::LocalPadToInGamePad(u8 local_pad)
|
||||
{
|
||||
// Figure out which in-game pad maps to which local pad.
|
||||
// The logic we have here is that the local slots always
|
||||
|
@ -636,7 +653,7 @@ u8 NetPlayClient::GetPadNum(u8 numPAD)
|
|||
if (m_pad_map[ingame_pad] == m_local_player->pid)
|
||||
local_pad_count++;
|
||||
|
||||
if (local_pad_count == numPAD)
|
||||
if (local_pad_count == local_pad)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -681,24 +698,24 @@ u32 CEXIIPL::NetPlay_GetGCTime()
|
|||
|
||||
// called from ---CPU--- thread
|
||||
// return the local pad num that should rumble given a ingame pad num
|
||||
u8 CSIDevice_GCController::NetPlay_GetPadNum(u8 numPAD)
|
||||
u8 CSIDevice_GCController::NetPlay_InGamePadToLocalPad(u8 numPAD)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(crit_netplay_client);
|
||||
|
||||
if (netplay_client)
|
||||
return netplay_client->GetPadNum(numPAD);
|
||||
return netplay_client->InGamePadToLocalPad(numPAD);
|
||||
else
|
||||
return numPAD;
|
||||
}
|
||||
|
||||
u8 CSIDevice_GCSteeringWheel::NetPlay_GetPadNum(u8 numPAD)
|
||||
u8 CSIDevice_GCSteeringWheel::NetPlay_InGamePadToLocalPad(u8 numPAD)
|
||||
{
|
||||
return CSIDevice_GCController::NetPlay_GetPadNum(numPAD);
|
||||
return CSIDevice_GCController::NetPlay_InGamePadToLocalPad(numPAD);
|
||||
}
|
||||
|
||||
u8 CSIDevice_DanceMat::NetPlay_GetPadNum(u8 numPAD)
|
||||
u8 CSIDevice_DanceMat::NetPlay_InGamePadToLocalPad(u8 numPAD)
|
||||
{
|
||||
return CSIDevice_GCController::NetPlay_GetPadNum(numPAD);
|
||||
return CSIDevice_GCController::NetPlay_InGamePadToLocalPad(numPAD);
|
||||
}
|
||||
|
||||
// called from ---CPU--- thread
|
||||
|
|
|
@ -82,7 +82,8 @@ public:
|
|||
void WiimoteUpdate(int _number);
|
||||
bool GetNetPads(const u8 pad_nb, const SPADStatus* const, NetPad* const netvalues);
|
||||
|
||||
u8 GetPadNum(u8 numPAD);
|
||||
u8 LocalPadToInGamePad(u8 localPad);
|
||||
u8 InGamePadToLocalPad(u8 localPad);
|
||||
|
||||
protected:
|
||||
void ClearBuffers();
|
||||
|
|
Loading…
Reference in New Issue