Add a virtual controller to merge Joy-Cons. #434

Open
madwind wants to merge 34 commits from madwind/master into master
Showing only changes of commit 6dec7ff8ba - Show all commits

View File

@ -1,5 +1,6 @@
using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Common.Configuration.Hid.Controller; using Ryujinx.Common.Configuration.Hid.Controller;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
@ -81,12 +82,23 @@ namespace Ryujinx.Input.SDL2
public Vector3 GetMotionData(MotionInputId inputId) public Vector3 GetMotionData(MotionInputId inputId)
{ {
return inputId switch Vector3 motionData;
switch (inputId)
{ {
MotionInputId.SecondAccelerometer => right.GetMotionData(MotionInputId.Accelerometer), case MotionInputId.Accelerometer:
MotionInputId.SecondGyroscope => right.GetMotionData(MotionInputId.Gyroscope), case MotionInputId.Gyroscope:
_ => left.GetMotionData(inputId) motionData = left.GetMotionData(inputId);
}; return new Vector3(-motionData.Z, motionData.Y, motionData.X);
case MotionInputId.SecondAccelerometer:
motionData = right.GetMotionData(MotionInputId.Accelerometer);
return new Vector3(motionData.Z, motionData.Y, -motionData.X);
case MotionInputId.SecondGyroscope:
motionData = right.GetMotionData(MotionInputId.Gyroscope);
return new Vector3(motionData.Z, motionData.Y, -motionData.X);
case MotionInputId.Invalid:
default:
return Vector3.Zero;
}
} }
public GamepadStateSnapshot GetStateSnapshot() public GamepadStateSnapshot GetStateSnapshot()