1
1
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2025-01-29 02:56:47 -06:00
ryujinx/Ryujinx.HLE/Input/HidProController.cs
gdkchan 3615a70cae
Revert "Adjust naming conventions and general refactoring in HLE Project (#490)" (#526)
This reverts commit 85dbb9559ad317a657dafd24da27fec4b3f5250f.
2018-12-04 22:52:39 -02:00

45 lines
1.5 KiB
C#

namespace Ryujinx.HLE.Input
{
public class HidProController : HidControllerBase
{
bool Wired = false;
public HidProController(Switch Device) : base(HidControllerType.ProController, Device)
{
Wired = true;
}
public override void Connect(HidControllerId ControllerId)
{
base.Connect(ControllerId);
HidControllerColorDesc SingleColorDesc =
HidControllerColorDesc.ColorDesc_ColorsNonexistent;
HidControllerColorDesc SplitColorDesc = 0;
NpadColor SingleColorBody = NpadColor.Black;
NpadColor SingleColorButtons = NpadColor.Black;
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);
Connected = true;
}
public override void SendInput(
HidControllerButtons Buttons,
HidJoystickPosition LeftStick,
HidJoystickPosition RightStick)
{
long ControllerOffset = WriteInput(Buttons, LeftStick, RightStick, HidControllerLayouts.Pro_Controller);
Device.Memory.WriteInt64(ControllerOffset + 0x28,
(Connected ? (uint)HidControllerConnState.Controller_State_Connected : 0) |
(Wired ? (uint)HidControllerConnState.Controller_State_Wired : 0));
}
}
}