2018-11-19 19:01:36 -05:00
|
|
|
|
namespace Ryujinx.HLE.Input
|
|
|
|
|
{
|
|
|
|
|
public class HidProController : HidControllerBase
|
|
|
|
|
{
|
2018-12-04 19:52:39 -05:00
|
|
|
|
bool Wired = false;
|
2018-11-19 19:01:36 -05:00
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
public HidProController(Switch Device) : base(HidControllerType.ProController, Device)
|
2018-11-19 19:01:36 -05:00
|
|
|
|
{
|
2018-12-04 19:52:39 -05:00
|
|
|
|
Wired = true;
|
2018-11-19 19:01:36 -05:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
public override void Connect(HidControllerId ControllerId)
|
2018-11-19 19:01:36 -05:00
|
|
|
|
{
|
2018-12-04 19:52:39 -05:00
|
|
|
|
base.Connect(ControllerId);
|
2018-11-19 19:01:36 -05:00
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
HidControllerColorDesc SingleColorDesc =
|
|
|
|
|
HidControllerColorDesc.ColorDesc_ColorsNonexistent;
|
2018-11-19 19:01:36 -05:00
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
HidControllerColorDesc SplitColorDesc = 0;
|
2018-11-19 19:01:36 -05:00
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
NpadColor SingleColorBody = NpadColor.Black;
|
|
|
|
|
NpadColor SingleColorButtons = NpadColor.Black;
|
2018-11-19 19:01:36 -05:00
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
Device.Memory.WriteInt32(Offset + 0x08, (int)SingleColorDesc);
|
|
|
|
|
Device.Memory.WriteInt32(Offset + 0x0c, (int)SingleColorBody);
|
|
|
|
|
Device.Memory.WriteInt32(Offset + 0x10, (int)SingleColorButtons);
|
|
|
|
|
Device.Memory.WriteInt32(Offset + 0x14, (int)SplitColorDesc);
|
2018-11-19 19:01:36 -05:00
|
|
|
|
|
|
|
|
|
Connected = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SendInput(
|
2018-12-04 19:52:39 -05:00
|
|
|
|
HidControllerButtons Buttons,
|
|
|
|
|
HidJoystickPosition LeftStick,
|
|
|
|
|
HidJoystickPosition RightStick)
|
2018-11-19 19:01:36 -05:00
|
|
|
|
{
|
2018-12-04 19:52:39 -05:00
|
|
|
|
long ControllerOffset = WriteInput(Buttons, LeftStick, RightStick, HidControllerLayouts.Pro_Controller);
|
2018-11-19 19:01:36 -05:00
|
|
|
|
|
2018-12-04 19:52:39 -05:00
|
|
|
|
Device.Memory.WriteInt64(ControllerOffset + 0x28,
|
|
|
|
|
(Connected ? (uint)HidControllerConnState.Controller_State_Connected : 0) |
|
|
|
|
|
(Wired ? (uint)HidControllerConnState.Controller_State_Wired : 0));
|
2018-11-19 19:01:36 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|