New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix netplay rumble #3792

Merged
merged 1 commit into from Apr 30, 2016
Jump to file or symbol
Failed to load files and symbols.
+13 −43
Diff settings

Always

Just for now

@@ -8,6 +8,7 @@
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/SI_DeviceGCAdapter.h"
#include "InputCommon/GCAdapter.h"
@@ -32,45 +33,11 @@ GCPadStatus CSIDevice_GCAdapter::GetPadStatus()
return PadStatus;
}
void CSIDevice_GCAdapter::SendCommand(u32 _Cmd, u8 _Poll)
void CSIDevice_GCController::Rumble(u8 numPad, ControlState strength)
{
UCommand command(_Cmd);
switch (command.Command)
{
// Costis sent it in some demos :)
case 0x00:
break;
case CMD_WRITE:
{
unsigned int uType = command.Parameter1; // 0 = stop, 1 = rumble, 2 = stop hard
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);
if (numPAD < 4)
{
if (uType == 1 && uStrength > 2)
GCAdapter::Output(numPAD, 1);
else
GCAdapter::Output(numPAD, 0);
}
if (!_Poll)
{
m_Mode = command.Parameter2;
INFO_LOG(SERIALINTERFACE, "PAD %i set to mode %i", ISIDevice::m_iDeviceNumber, m_Mode);
}
}
break;
default:
{
ERROR_LOG(SERIALINTERFACE, "Unknown direct command (0x%x)", _Cmd);
PanicAlert("SI: Unknown direct command");
}
break;
}
SIDevices device = SConfig::GetInstance().m_SIDevice[numPad];
if (device == SIDEVICE_WIIU_ADAPTER)
GCAdapter::Output(numPad, static_cast<u8>(strength));
else if (SIDevice_IsGCController(device))
Pad::Rumble(numPad, strength);
}
@@ -14,5 +14,4 @@ class CSIDevice_GCAdapter : public CSIDevice_GCController
CSIDevice_GCAdapter(SIDevices device, int _iDeviceNumber);
GCPadStatus GetPadStatus() override;
void SendCommand(u32 _Cmd, u8 _Poll) override;
};
@@ -290,9 +290,9 @@ void CSIDevice_GCController::SendCommand(u32 _Cmd, u8 _Poll)
if (numPAD < 4)
{
if (uType == 1 && uStrength > 2)
Pad::Rumble(numPAD, 1.0);
CSIDevice_GCController::Rumble(numPAD, 1.0);
else
Pad::Rumble(numPAD, 0.0);
CSIDevice_GCController::Rumble(numPAD, 0.0);
}
if (!_Poll)
@@ -4,6 +4,7 @@
#pragma once
#include "Core/HW/GCPad.h"
#include "Core/HW/SI_Device.h"
#include "InputCommon/GCPadStatus.h"
@@ -107,6 +108,9 @@ class CSIDevice_GCController : public ISIDevice
static bool NetPlay_GetInput(u8 numPAD, GCPadStatus* status);
static u8 NetPlay_InGamePadToLocalPad(u8 numPAD);
// Direct rumble to the right GC Controller
static void Rumble(u8 numPad, ControlState strength);
protected:
void Calibrate();
void HandleMoviePadStatus(GCPadStatus* PadStatus);
ProTip! Use n and p to navigate between commits in a pull request.