From 06140e8083921a61d00ba111f6a636da531f2c00 Mon Sep 17 00:00:00 2001 From: comex Date: Mon, 9 Sep 2013 02:39:28 -0400 Subject: [PATCH] Revert "NetPlay: Use the correct pad mappings for rumble" This reverts commit 92c846de458150d516ce623147e1c8ff0bbb6551. It breaks NetPlay entirely for me. --- Source/Core/Core/Src/HW/SI_DeviceDanceMat.cpp | 2 +- Source/Core/Core/Src/HW/SI_DeviceDanceMat.h | 2 +- .../Core/Src/HW/SI_DeviceGCController.cpp | 2 +- .../Core/Core/Src/HW/SI_DeviceGCController.h | 2 +- .../Core/Src/HW/SI_DeviceGCSteeringWheel.cpp | 4 +- .../Core/Src/HW/SI_DeviceGCSteeringWheel.h | 2 +- Source/Core/Core/Src/NetPlayClient.cpp | 37 +++++-------------- Source/Core/Core/Src/NetPlayClient.h | 3 +- 8 files changed, 18 insertions(+), 36 deletions(-) diff --git a/Source/Core/Core/Src/HW/SI_DeviceDanceMat.cpp b/Source/Core/Core/Src/HW/SI_DeviceDanceMat.cpp index d21371fe36..30237286e6 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceDanceMat.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceDanceMat.cpp @@ -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_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber); + const u8 numPAD = NetPlay_GetPadNum(ISIDevice::m_iDeviceNumber); if (numPAD < 4) Pad::Rumble(numPAD, uType, uStrength); diff --git a/Source/Core/Core/Src/HW/SI_DeviceDanceMat.h b/Source/Core/Core/Src/HW/SI_DeviceDanceMat.h index 7c413026ec..b30c107847 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceDanceMat.h +++ b/Source/Core/Core/Src/HW/SI_DeviceDanceMat.h @@ -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_InGamePadToLocalPad(u8 numPAD); + static u8 NetPlay_GetPadNum(u8 numPAD); // Return true on new data virtual bool GetData(u32& _Hi, u32& _Low); diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp index 0c4bf48dcb..f6e0846b51 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp @@ -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_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber); + const u8 numPAD = NetPlay_GetPadNum(ISIDevice::m_iDeviceNumber); if (numPAD < 4) Pad::Rumble(numPAD, uType, uStrength); diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.h b/Source/Core/Core/Src/HW/SI_DeviceGCController.h index 9673041c6f..a43e5027ce 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.h +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.h @@ -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_InGamePadToLocalPad(u8 numPAD); + static u8 NetPlay_GetPadNum(u8 numPAD); // Return true on new data virtual bool GetData(u32& _Hi, u32& _Low); diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.cpp index 4102d29193..562a450422 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.cpp @@ -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_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber); + const u8 numPAD = NetPlay_GetPadNum(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_InGamePadToLocalPad(ISIDevice::m_iDeviceNumber); + const u8 numPAD = NetPlay_GetPadNum(ISIDevice::m_iDeviceNumber); if (numPAD < 4) Pad::Rumble(numPAD, uType, uStrength); diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.h b/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.h index 2398b8f321..2c539e56d4 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.h +++ b/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.h @@ -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_InGamePadToLocalPad(u8 numPAD); + static u8 NetPlay_GetPadNum(u8 numPAD); // Return true on new data virtual bool GetData(u32& _Hi, u32& _Low); diff --git a/Source/Core/Core/Src/NetPlayClient.cpp b/Source/Core/Core/Src/NetPlayClient.cpp index be259ae8af..7a3febe030 100644 --- a/Source/Core/Core/Src/NetPlayClient.cpp +++ b/Source/Core/Core/Src/NetPlayClient.cpp @@ -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 = InGamePadToLocalPad(pad_nb); + int in_game_num = GetPadNum(pad_nb); // If this in-game pad is one of ours, then update from the // information given. @@ -623,25 +623,8 @@ void NetPlayClient::Stop() } } -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) +// called from ---CPU--- thread +u8 NetPlayClient::GetPadNum(u8 numPAD) { // Figure out which in-game pad maps to which local pad. // The logic we have here is that the local slots always @@ -653,7 +636,7 @@ u8 NetPlayClient::LocalPadToInGamePad(u8 local_pad) if (m_pad_map[ingame_pad] == m_local_player->pid) local_pad_count++; - if (local_pad_count == local_pad) + if (local_pad_count == numPAD) break; } @@ -698,24 +681,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_InGamePadToLocalPad(u8 numPAD) +u8 CSIDevice_GCController::NetPlay_GetPadNum(u8 numPAD) { std::lock_guard lk(crit_netplay_client); if (netplay_client) - return netplay_client->InGamePadToLocalPad(numPAD); + return netplay_client->GetPadNum(numPAD); else return numPAD; } -u8 CSIDevice_GCSteeringWheel::NetPlay_InGamePadToLocalPad(u8 numPAD) +u8 CSIDevice_GCSteeringWheel::NetPlay_GetPadNum(u8 numPAD) { - return CSIDevice_GCController::NetPlay_InGamePadToLocalPad(numPAD); + return CSIDevice_GCController::NetPlay_GetPadNum(numPAD); } -u8 CSIDevice_DanceMat::NetPlay_InGamePadToLocalPad(u8 numPAD) +u8 CSIDevice_DanceMat::NetPlay_GetPadNum(u8 numPAD) { - return CSIDevice_GCController::NetPlay_InGamePadToLocalPad(numPAD); + return CSIDevice_GCController::NetPlay_GetPadNum(numPAD); } // called from ---CPU--- thread diff --git a/Source/Core/Core/Src/NetPlayClient.h b/Source/Core/Core/Src/NetPlayClient.h index fa53154b7e..d6b121a18d 100644 --- a/Source/Core/Core/Src/NetPlayClient.h +++ b/Source/Core/Core/Src/NetPlayClient.h @@ -82,8 +82,7 @@ public: void WiimoteUpdate(int _number); bool GetNetPads(const u8 pad_nb, const SPADStatus* const, NetPad* const netvalues); - u8 LocalPadToInGamePad(u8 localPad); - u8 InGamePadToLocalPad(u8 localPad); + u8 GetPadNum(u8 numPAD); protected: void ClearBuffers();