mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-09 04:09:12 +00:00
Address Feedback
This commit is contained in:
parent
bf521b50ff
commit
e8dccaa7e2
5 changed files with 102 additions and 512 deletions
|
@ -1,11 +1,6 @@
|
||||||
using ChocolArm64.Memory;
|
|
||||||
using Ryujinx.HLE.Logging;
|
|
||||||
using Ryujinx.HLE.OsHle;
|
|
||||||
using Ryujinx.HLE.OsHle.Handles;
|
|
||||||
using Ryujinx;
|
|
||||||
using Ryujinx.HLE.OsHle;
|
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.Input
|
namespace Ryujinx.HLE.Input
|
||||||
{
|
{
|
||||||
|
@ -66,9 +61,14 @@ namespace Ryujinx.HLE.Input
|
||||||
|
|
||||||
private const int HidEntryCount = 17;
|
private const int HidEntryCount = 17;
|
||||||
|
|
||||||
|
private const JoyConColor BodyColorLeft = JoyConColor.Body_Neon_Red;
|
||||||
|
private const JoyConColor ButtonColorLeft = JoyConColor.Buttons_Neon_Red;
|
||||||
|
private const JoyConColor BodyColorRight = JoyConColor.Body_Neon_Blue;
|
||||||
|
private const JoyConColor ButtonColorRight = JoyConColor.Buttons_Neon_Blue;
|
||||||
|
|
||||||
private Switch Device;
|
private Switch Device;
|
||||||
|
|
||||||
private long HidPosition;
|
private readonly long HidPosition;
|
||||||
|
|
||||||
public Hid(Switch Device, long HidPosition)
|
public Hid(Switch Device, long HidPosition)
|
||||||
{
|
{
|
||||||
|
@ -76,120 +76,22 @@ namespace Ryujinx.HLE.Input
|
||||||
this.HidPosition = HidPosition;
|
this.HidPosition = HidPosition;
|
||||||
|
|
||||||
Device.Memory.FillWithZeros(HidPosition, Horizon.HidSize);
|
Device.Memory.FillWithZeros(HidPosition, Horizon.HidSize);
|
||||||
|
|
||||||
Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Init()
|
public void InitializeJoycons()
|
||||||
{
|
{
|
||||||
if (HidEmulatedDevices.Devices.Handheld != -2)
|
foreach (KeyValuePair<HidControllerId, HidEmulatedDevices.HostDevice> entry in HidEmulatedDevices.Devices)
|
||||||
{
|
{
|
||||||
InitializeJoyconPair(
|
if (entry.Value != HidEmulatedDevices.HostDevice.None)
|
||||||
HidControllerId.CONTROLLER_HANDHELD,
|
{
|
||||||
HidControllerType.ControllerType_Handheld,
|
InitializeJoyconPair(
|
||||||
JoyConColor.Body_Neon_Red,
|
entry.Key,
|
||||||
JoyConColor.Buttons_Neon_Red,
|
(entry.Key == HidControllerId.CONTROLLER_HANDHELD) ? HidControllerType.ControllerType_Handheld : HidControllerType.ControllerType_JoyconPair,
|
||||||
JoyConColor.Body_Neon_Blue,
|
BodyColorLeft,
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
ButtonColorLeft,
|
||||||
}
|
BodyColorRight,
|
||||||
|
ButtonColorRight);
|
||||||
if (HidEmulatedDevices.Devices.Player1 != -2)
|
}
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_1,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player2 != -2)
|
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_2,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player3 != -2)
|
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_3,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player4 != -2)
|
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_4,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player5 != -2)
|
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_5,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player6 != -2)
|
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_6,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player7 != -2)
|
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_7,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player8 != -2)
|
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_8,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.PlayerUnknown != -2)
|
|
||||||
{
|
|
||||||
InitializeJoyconPair(
|
|
||||||
HidControllerId.CONTROLLER_UNKNOWN,
|
|
||||||
HidControllerType.ControllerType_JoyconPair,
|
|
||||||
JoyConColor.Body_Neon_Red,
|
|
||||||
JoyConColor.Buttons_Neon_Red,
|
|
||||||
JoyConColor.Body_Neon_Blue,
|
|
||||||
JoyConColor.Buttons_Neon_Blue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,20 +6,21 @@ namespace Ryujinx.HLE.Input
|
||||||
{
|
{
|
||||||
public class HidEmulatedDevices
|
public class HidEmulatedDevices
|
||||||
{
|
{
|
||||||
public struct EmulatedDevices
|
public enum HostDevice
|
||||||
{
|
{
|
||||||
public int Handheld;
|
None,
|
||||||
public int Player1;
|
Keyboard,
|
||||||
public int Player2;
|
GamePad_0,
|
||||||
public int Player3;
|
GamePad_1,
|
||||||
public int Player4;
|
GamePad_2,
|
||||||
public int Player5;
|
GamePad_3,
|
||||||
public int Player6;
|
GamePad_4,
|
||||||
public int Player7;
|
GamePad_5,
|
||||||
public int Player8;
|
GamePad_6,
|
||||||
public int PlayerUnknown;
|
GamePad_7,
|
||||||
|
GamePad_8,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static EmulatedDevices Devices;
|
public static Dictionary<HidControllerId, HostDevice> Devices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,15 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Ryujinx
|
namespace Ryujinx
|
||||||
{
|
{
|
||||||
public static class Config
|
public static class Config
|
||||||
{
|
{
|
||||||
public static JoyConKeyboard JoyConKeyboard { get; private set; }
|
public static JoyConKeyboard JoyConKeyboard { get; private set; }
|
||||||
public static JoyConController[] JoyConControllers { get; private set; }
|
public static JoyConController[] JoyConControllers { get; private set; }
|
||||||
public static bool GamePadEnable { get; private set; }
|
public static bool GamePadEnable { get; private set; }
|
||||||
|
|
||||||
public static void Read(Switch Device)
|
public static void Read(Switch Device)
|
||||||
{
|
{
|
||||||
|
@ -39,17 +40,20 @@ namespace Ryujinx
|
||||||
|
|
||||||
GamePadEnable = Boolean.Parse(Parser.Value("GamePad_Enable"));
|
GamePadEnable = Boolean.Parse(Parser.Value("GamePad_Enable"));
|
||||||
|
|
||||||
//Device Mappings
|
HidEmulatedDevices.Devices = new Dictionary<HidControllerId, HidEmulatedDevices.HostDevice>
|
||||||
HidEmulatedDevices.Devices.Handheld = ToEmulatedDevice(Parser.Value("Handheld_Device")); // -2: None, -1: Keyboard, Everything Else: GamePad Index
|
{
|
||||||
HidEmulatedDevices.Devices.Player1 = ToEmulatedDevice(Parser.Value("Player1_Device"));
|
//Device Mappings
|
||||||
HidEmulatedDevices.Devices.Player2 = ToEmulatedDevice(Parser.Value("Player2_Device"));
|
{ HidControllerId.CONTROLLER_HANDHELD, ToHostDevice(Parser.Value("Handheld_Device")) },
|
||||||
HidEmulatedDevices.Devices.Player3 = ToEmulatedDevice(Parser.Value("Player3_Device"));
|
{ HidControllerId.CONTROLLER_PLAYER_1, ToHostDevice(Parser.Value("Player1_Device")) },
|
||||||
HidEmulatedDevices.Devices.Player4 = ToEmulatedDevice(Parser.Value("Player4_Device"));
|
{ HidControllerId.CONTROLLER_PLAYER_2, ToHostDevice(Parser.Value("Player2_Device")) },
|
||||||
HidEmulatedDevices.Devices.Player5 = ToEmulatedDevice(Parser.Value("Player5_Device"));
|
{ HidControllerId.CONTROLLER_PLAYER_3, ToHostDevice(Parser.Value("Player3_Device")) },
|
||||||
HidEmulatedDevices.Devices.Player6 = ToEmulatedDevice(Parser.Value("Player6_Device"));
|
{ HidControllerId.CONTROLLER_PLAYER_4, ToHostDevice(Parser.Value("Player4_Device")) },
|
||||||
HidEmulatedDevices.Devices.Player7 = ToEmulatedDevice(Parser.Value("Player7_Device"));
|
{ HidControllerId.CONTROLLER_PLAYER_5, ToHostDevice(Parser.Value("Player5_Device")) },
|
||||||
HidEmulatedDevices.Devices.Player8 = ToEmulatedDevice(Parser.Value("Player8_Device"));
|
{ HidControllerId.CONTROLLER_PLAYER_6, ToHostDevice(Parser.Value("Player6_Device")) },
|
||||||
HidEmulatedDevices.Devices.PlayerUnknown = ToEmulatedDevice(Parser.Value("PlayerUnknown_Device"));
|
{ HidControllerId.CONTROLLER_PLAYER_7, ToHostDevice(Parser.Value("Player7_Device")) },
|
||||||
|
{ HidControllerId.CONTROLLER_PLAYER_8, ToHostDevice(Parser.Value("Player8_Device")) },
|
||||||
|
{ HidControllerId.CONTROLLER_UNKNOWN, ToHostDevice(Parser.Value("PlayerUnknown_Device")) }
|
||||||
|
};
|
||||||
|
|
||||||
//When the classes are specified on the list, we only
|
//When the classes are specified on the list, we only
|
||||||
//enable the classes that are on the list.
|
//enable the classes that are on the list.
|
||||||
|
@ -115,7 +119,7 @@ namespace Ryujinx
|
||||||
List<JoyConController> JoyConControllerList = new List<JoyConController>();
|
List<JoyConController> JoyConControllerList = new List<JoyConController>();
|
||||||
|
|
||||||
//Populate the Controller List
|
//Populate the Controller List
|
||||||
for (int i = 0; i < 255; ++i)
|
for (int i = 0; i < 9; ++i)
|
||||||
{
|
{
|
||||||
if (Parser.Value(i + "_GamePad_Index") == null) break;
|
if (Parser.Value(i + "_GamePad_Index") == null) break;
|
||||||
|
|
||||||
|
@ -187,18 +191,31 @@ namespace Ryujinx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -2: None, -1: Keyboard, Everything Else: GamePad Index
|
private static HidEmulatedDevices.HostDevice ToHostDevice(string Key)
|
||||||
private static int ToEmulatedDevice(string Key)
|
|
||||||
{
|
{
|
||||||
switch (Key.ToUpper())
|
switch (Key.ToUpper())
|
||||||
{
|
{
|
||||||
case "NONE": return -2;
|
case "NONE": return HidEmulatedDevices.HostDevice.None;
|
||||||
case "KEYBOARD": return -1;
|
case "KEYBOARD": return HidEmulatedDevices.HostDevice.Keyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Key.ToUpper().StartsWith("GAMEPAD_")) return Int32.Parse(Key.Substring(Key.Length - 1));
|
if (Key.Split("GAMEPAD_").Length > 0 && Regex.IsMatch(""+Key[Key.Length-1], @"^\d+$"))
|
||||||
|
{
|
||||||
|
switch (Key[Key.Length - 1])
|
||||||
|
{
|
||||||
|
case '0': return HidEmulatedDevices.HostDevice.GamePad_0;
|
||||||
|
case '1': return HidEmulatedDevices.HostDevice.GamePad_1;
|
||||||
|
case '2': return HidEmulatedDevices.HostDevice.GamePad_2;
|
||||||
|
case '3': return HidEmulatedDevices.HostDevice.GamePad_3;
|
||||||
|
case '4': return HidEmulatedDevices.HostDevice.GamePad_4;
|
||||||
|
case '5': return HidEmulatedDevices.HostDevice.GamePad_5;
|
||||||
|
case '6': return HidEmulatedDevices.HostDevice.GamePad_6;
|
||||||
|
case '7': return HidEmulatedDevices.HostDevice.GamePad_7;
|
||||||
|
case '8': return HidEmulatedDevices.HostDevice.GamePad_8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -2;
|
return HidEmulatedDevices.HostDevice.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Ryujinx.Graphics.Gal;
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using Ryujinx.HLE.Input;
|
using Ryujinx.HLE.Input;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
using Stopwatch = System.Diagnostics.Stopwatch;
|
using Stopwatch = System.Diagnostics.Stopwatch;
|
||||||
|
@ -251,375 +252,42 @@ namespace Ryujinx
|
||||||
Device.Hid.SetTouchPoints();
|
Device.Hid.SetTouchPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Handheld != -2)
|
foreach (KeyValuePair<HidControllerId, HidEmulatedDevices.HostDevice> entry in HidEmulatedDevices.Devices)
|
||||||
{
|
{
|
||||||
switch (HidEmulatedDevices.Devices.Handheld)
|
if (entry.Value != HidEmulatedDevices.HostDevice.None)
|
||||||
{
|
{
|
||||||
case -1:
|
Device.Hid.SetJoyconButton(
|
||||||
Ns.Hid.SetJoyconButton(
|
entry.Key,
|
||||||
HidControllerId.CONTROLLER_HANDHELD,
|
(entry.Key == HidControllerId.CONTROLLER_HANDHELD) ? HidControllerLayouts.Handheld_Joined : HidControllerLayouts.Joined,
|
||||||
HidControllerLayouts.Handheld_Joined,
|
(entry.Value == HidEmulatedDevices.HostDevice.Keyboard) ? CurrentButtonsKeyboard : CurrentButtonsGamePad[GetGamePadIndexFromHostDevice(entry.Value)],
|
||||||
CurrentButtonsKeyboard,
|
(entry.Value == HidEmulatedDevices.HostDevice.Keyboard) ? LeftJoystickKeyboard : LeftJoystickGamePad [GetGamePadIndexFromHostDevice(entry.Value)],
|
||||||
LeftJoystickKeyboard,
|
(entry.Value == HidEmulatedDevices.HostDevice.Keyboard) ? RightJoystickKeyboard : RightJoystickGamePad [GetGamePadIndexFromHostDevice(entry.Value)]);
|
||||||
RightJoystickKeyboard);
|
Device.Hid.SetJoyconButton(
|
||||||
Ns.Hid.SetJoyconButton(
|
entry.Key,
|
||||||
HidControllerId.CONTROLLER_HANDHELD,
|
HidControllerLayouts.Main,
|
||||||
HidControllerLayouts.Main,
|
(entry.Value == HidEmulatedDevices.HostDevice.Keyboard) ? CurrentButtonsKeyboard : CurrentButtonsGamePad[GetGamePadIndexFromHostDevice(entry.Value)],
|
||||||
CurrentButtonsKeyboard,
|
(entry.Value == HidEmulatedDevices.HostDevice.Keyboard) ? LeftJoystickKeyboard : LeftJoystickGamePad [GetGamePadIndexFromHostDevice(entry.Value)],
|
||||||
LeftJoystickKeyboard,
|
(entry.Value == HidEmulatedDevices.HostDevice.Keyboard) ? RightJoystickKeyboard : RightJoystickGamePad [GetGamePadIndexFromHostDevice(entry.Value)]);
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Handheld < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Handheld + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_HANDHELD,
|
|
||||||
HidControllerLayouts.Handheld_Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Handheld],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Handheld],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Handheld]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_HANDHELD,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Handheld],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Handheld],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Handheld]);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (HidEmulatedDevices.Devices.Player1 != -2)
|
|
||||||
|
private int GetGamePadIndexFromHostDevice(HidEmulatedDevices.HostDevice hostDevice)
|
||||||
|
{
|
||||||
|
switch (hostDevice)
|
||||||
{
|
{
|
||||||
switch (HidEmulatedDevices.Devices.Player1)
|
case HidEmulatedDevices.HostDevice.GamePad_0: return 0;
|
||||||
{
|
case HidEmulatedDevices.HostDevice.GamePad_1: return 1;
|
||||||
case -1:
|
case HidEmulatedDevices.HostDevice.GamePad_2: return 2;
|
||||||
Ns.Hid.SetJoyconButton(
|
case HidEmulatedDevices.HostDevice.GamePad_3: return 3;
|
||||||
HidControllerId.CONTROLLER_PLAYER_1,
|
case HidEmulatedDevices.HostDevice.GamePad_4: return 4;
|
||||||
HidControllerLayouts.Joined,
|
case HidEmulatedDevices.HostDevice.GamePad_5: return 5;
|
||||||
CurrentButtonsKeyboard,
|
case HidEmulatedDevices.HostDevice.GamePad_6: return 6;
|
||||||
LeftJoystickKeyboard,
|
case HidEmulatedDevices.HostDevice.GamePad_7: return 7;
|
||||||
RightJoystickKeyboard);
|
case HidEmulatedDevices.HostDevice.GamePad_8: return 8;
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_1,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Player1 < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Player1 + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_1,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player1],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player1],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player1]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_1,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player1],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player1],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player1]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player2 != -2)
|
return -1;
|
||||||
{
|
|
||||||
switch (HidEmulatedDevices.Devices.Player2)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_2,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_2,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Player2 < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Player2 + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_2,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player2],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player2],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player2]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_2,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player2],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player2],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player2]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player3 != -2)
|
|
||||||
{
|
|
||||||
switch (HidEmulatedDevices.Devices.Player3)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_3,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_3,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Player3 < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Player3 + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_3,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player3],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player3],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player3]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_3,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player3],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player3],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player3]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player4 != -2)
|
|
||||||
{
|
|
||||||
switch (HidEmulatedDevices.Devices.Player4)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_4,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_4,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Player4 < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Player4 + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_4,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player4],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player4],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player4]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_4,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player4],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player4],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player4]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player5 != -2)
|
|
||||||
{
|
|
||||||
switch (HidEmulatedDevices.Devices.Player5)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_5,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_5,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Player5 < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Player5 + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_5,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player5],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player5],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player5]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_5,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player5],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player5],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player5]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player6 != -2)
|
|
||||||
{
|
|
||||||
switch (HidEmulatedDevices.Devices.Player6)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_6,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_6,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Player6 < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Player6 + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_6,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player6],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player6],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player6]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_6,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player6],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player6],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player6]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player7 != -2)
|
|
||||||
{
|
|
||||||
switch (HidEmulatedDevices.Devices.Player7)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_7,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_7,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Player7 < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Player7 + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_7,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player7],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player7],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player7]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_7,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player7],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player7],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player7]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.Player8 != -2)
|
|
||||||
{
|
|
||||||
switch (HidEmulatedDevices.Devices.Player8)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_8,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_8,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.Player8 < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.Player8 + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_8,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player8],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player8],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player8]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_PLAYER_8,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.Player8],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.Player8],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.Player8]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HidEmulatedDevices.Devices.PlayerUnknown != -2)
|
|
||||||
{
|
|
||||||
switch (HidEmulatedDevices.Devices.PlayerUnknown)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_UNKNOWN,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_UNKNOWN,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsKeyboard,
|
|
||||||
LeftJoystickKeyboard,
|
|
||||||
RightJoystickKeyboard);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (HidEmulatedDevices.Devices.PlayerUnknown < 0)
|
|
||||||
throw new ArgumentException("Unknown Emulated Device Code: " + HidEmulatedDevices.Devices.PlayerUnknown + ".");
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_UNKNOWN,
|
|
||||||
HidControllerLayouts.Joined,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.PlayerUnknown],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.PlayerUnknown],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.PlayerUnknown]);
|
|
||||||
Ns.Hid.SetJoyconButton(
|
|
||||||
HidControllerId.CONTROLLER_UNKNOWN,
|
|
||||||
HidControllerLayouts.Main,
|
|
||||||
CurrentButtonsGamePad[HidEmulatedDevices.Devices.PlayerUnknown],
|
|
||||||
LeftJoystickGamePad[HidEmulatedDevices.Devices.PlayerUnknown],
|
|
||||||
RightJoystickGamePad[HidEmulatedDevices.Devices.PlayerUnknown]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private new void RenderFrame()
|
private new void RenderFrame()
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace Ryujinx
|
||||||
|
|
||||||
Config.Read(Device);
|
Config.Read(Device);
|
||||||
|
|
||||||
|
Device.Hid.InitializeJoycons();
|
||||||
|
|
||||||
Device.Log.Updated += ConsoleLog.PrintLog;
|
Device.Log.Updated += ConsoleLog.PrintLog;
|
||||||
|
|
||||||
if (args.Length == 1)
|
if (args.Length == 1)
|
||||||
|
|
Loading…
Reference in a new issue