diff --git a/CONFIG.md b/CONFIG.md index 6978f95c6..01a9524c6 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -62,7 +62,7 @@ - None = Disabled - Keyboard = The Keyboard Device - GamePad_X = X GamePad Configuration - + - `Controls_Left_JoyConKeyboard_XX` *(int)* ``` Controls_Left_JoyConKeyboard_Stick_Up (int) @@ -107,30 +107,30 @@ Ex: `Controls_Right_JoyConKeyboard_Button_A = 83` > A key (QWERTY Layout) / Q key (AZERTY Layout). -- `X_Controls_Left_JoyConController_XX` *(String)* +- `Controls_Left_JoyConController_XX_X` *(String)* ``` - X_Controls_Left_JoyConController_Stick (String) - X_Controls_Left_JoyConController_Stick_Button (String) - X_Controls_Left_JoyConController_DPad_Up (String) - X_Controls_Left_JoyConController_DPad_Down (String) - X_Controls_Left_JoyConController_DPad_Left (String) - X_Controls_Left_JoyConController_DPad_Right (String) - X_Controls_Left_JoyConController_Button_Minus (String) - X_Controls_Left_JoyConController_Button_L (String) - X_Controls_Left_JoyConController_Button_ZL (String) + Controls_Left_JoyConController_Stick_X (String) + Controls_Left_JoyConController_Stick_Button_X (String) + Controls_Left_JoyConController_DPad_Up_X (String) + Controls_Left_JoyConController_DPad_Down_X (String) + Controls_Left_JoyConController_DPad_Left_X (String) + Controls_Left_JoyConController_DPad_Right_X (String) + Controls_Left_JoyConController_Button_Minus_X (String) + Controls_Left_JoyConController_Button_L_X (String) + Controls_Left_JoyConController_Button_ZL_X (String) ``` -- `X_Controls_Right_JoyConController_XX` *(String)* +- `Controls_Right_JoyConController_XX_X` *(String)* ``` - X_Controls_Right_JoyConController_Stick (String) - X_Controls_Right_JoyConController_Stick_Button (String) - X_Controls_Right_JoyConController_Button_A (String) - X_Controls_Right_JoyConController_Button_B (String) - X_Controls_Right_JoyConController_Button_X (String) - X_Controls_Right_JoyConController_Button_Y (String) - X_Controls_Right_JoyConController_Button_Plus (String) - X_Controls_Right_JoyConController_Button_R (String) - X_Controls_Right_JoyConController_Button_ZR (String) + Controls_Right_JoyConController_Stick_X (String) + Controls_Right_JoyConController_Stick_Button_X (String) + Controls_Right_JoyConController_Button_A_X (String) + Controls_Right_JoyConController_Button_B_X (String) + Controls_Right_JoyConController_Button_X_X (String) + Controls_Right_JoyConController_Button_Y_X (String) + Controls_Right_JoyConController_Button_Plus_X (String) + Controls_Right_JoyConController_Button_R_X (String) + Controls_Right_JoyConController_Button_ZR_X (String) ``` The "X" is the Controller Configuration Number, to add more configurations, copy the first configuration, then increment the Number "X" @@ -156,5 +156,10 @@ - Valid Joystick Mappings - LJoystick = The Left Analog Stick - RJoystick = The Right Analog Stick + +On more obscure / weird controllers this can vary, so if this list doesn't work, trial and error will. - On more obscure / weird controllers this can vary, so if this list doesn't work, trial and error will. \ No newline at end of file +### How to configure Co-Op +To configure Co-Op you need to first have your Controller Configurations set up, mutliple of them if you're using multiple controllers. Make sure to have the `GamePad_Index_X` variable correct for each one, this variable corresponds to each physical controller hooked up to your system, you can also use a Controller and a Keyboard as separate emulated players, this is entirely up to you. Once you have chosen what you want to do, you then need to configure in the Configuration file. +Change the `Handheld_Device` to `None`, this is done as, multiple players do not work with the Handheld Device. +Change `Player1_Device` to either `Keyboard` or `GamePad_X`, the X being which Controller configuration you want to apply to this player, then go through all the players you want and do the same, changing them to the Input Device for your selected Player. That's it, have fun! \ No newline at end of file diff --git a/Ryujinx.HLE/Hid/Hid.cs b/Ryujinx.HLE/Hid/Hid.cs index 460d4f1d1..94211f906 100644 --- a/Ryujinx.HLE/Hid/Hid.cs +++ b/Ryujinx.HLE/Hid/Hid.cs @@ -70,6 +70,8 @@ namespace Ryujinx.HLE.Input private readonly long HidPosition; + public static Dictionary Devices; + public Hid(Switch Device, long HidPosition) { this.Device = Device; @@ -80,13 +82,13 @@ namespace Ryujinx.HLE.Input public void InitializeJoycons() { - foreach (KeyValuePair entry in HidEmulatedDevices.Devices) + foreach (KeyValuePair Entry in Devices) { - if (entry.Value != HidEmulatedDevices.HostDevice.None) + if (Entry.Value != HidHostDevice.None) { InitializeJoyconPair( - entry.Key, - (entry.Key == HidControllerId.CONTROLLER_HANDHELD) ? HidControllerType.ControllerType_Handheld : HidControllerType.ControllerType_JoyconPair, + Entry.Key, + (Entry.Key == HidControllerId.CONTROLLER_HANDHELD) ? HidControllerType.ControllerType_Handheld : HidControllerType.ControllerType_JoyconPair, BodyColorLeft, ButtonColorLeft, BodyColorRight, diff --git a/Ryujinx.HLE/Hid/HidEmulatedDevices.cs b/Ryujinx.HLE/Hid/HidEmulatedDevices.cs deleted file mode 100644 index 594b6bfc8..000000000 --- a/Ryujinx.HLE/Hid/HidEmulatedDevices.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Ryujinx.HLE.Input -{ - public class HidEmulatedDevices - { - public enum HostDevice - { - None, - Keyboard, - GamePad_0, - GamePad_1, - GamePad_2, - GamePad_3, - GamePad_4, - GamePad_5, - GamePad_6, - GamePad_7, - GamePad_8, - }; - - public static Dictionary Devices; - } -} diff --git a/Ryujinx.HLE/Hid/HidHostDevice.cs b/Ryujinx.HLE/Hid/HidHostDevice.cs new file mode 100644 index 000000000..81889e048 --- /dev/null +++ b/Ryujinx.HLE/Hid/HidHostDevice.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Ryujinx.HLE.Input +{ + public enum HidHostDevice + { + None, + Keyboard, + GamePad0, + GamePad1, + GamePad2, + GamePad3, + GamePad4, + GamePad5, + GamePad6, + GamePad7, + GamePad8 + }; +} diff --git a/Ryujinx/Config.cs b/Ryujinx/Config.cs index 68c0b4ada..9251b6f13 100644 --- a/Ryujinx/Config.cs +++ b/Ryujinx/Config.cs @@ -1,7 +1,7 @@ using Ryujinx.HLE; -using Ryujinx.HLE.Logging; using Ryujinx.HLE.Input; using Ryujinx.UI.Input; +using Ryujinx.HLE.Logging; using System; using System.Globalization; using System.Collections.Generic; @@ -9,6 +9,7 @@ using System.IO; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; +using Ryujinx.Ui.Input; namespace Ryujinx { @@ -40,7 +41,7 @@ namespace Ryujinx GamePadEnable = Boolean.Parse(Parser.Value("GamePad_Enable")); - HidEmulatedDevices.Devices = new Dictionary + EmulatedDevices.Devices = new Dictionary { //Device Mappings { HidControllerId.CONTROLLER_HANDHELD, ToHostDevice(Parser.Value("Handheld_Device")) }, @@ -55,6 +56,8 @@ namespace Ryujinx { HidControllerId.CONTROLLER_UNKNOWN, ToHostDevice(Parser.Value("PlayerUnknown_Device")) } }; + Hid.Devices = EmulatedDevices.Devices; + //When the classes are specified on the list, we only //enable the classes that are on the list. //So, first disable everything, then enable @@ -81,79 +84,79 @@ namespace Ryujinx } } - JoyConKeyboard = new JoyConKeyboard( + JoyConKeyboardLeft LeftKeyboardJoycon = new JoyConKeyboardLeft + { + StickUp = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Up")), + StickDown = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Down")), + StickLeft = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Left")), + StickRight = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Right")), + StickButton = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Button")), + DPadUp = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Up")), + DPadDown = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Down")), + DPadLeft = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Left")), + DPadRight = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Right")), + ButtonMinus = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_Minus")), + ButtonL = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_L")), + ButtonZL = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_ZL")) + }; - new JoyConKeyboardLeft - { - StickUp = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Up")), - StickDown = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Down")), - StickLeft = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Left")), - StickRight = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Right")), - StickButton = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Button")), - DPadUp = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Up")), - DPadDown = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Down")), - DPadLeft = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Left")), - DPadRight = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Right")), - ButtonMinus = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_Minus")), - ButtonL = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_L")), - ButtonZL = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_ZL")) - }, - - new JoyConKeyboardRight - { - StickUp = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Up")), - StickDown = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Down")), - StickLeft = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Left")), - StickRight = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Right")), - StickButton = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Button")), - ButtonA = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_A")), - ButtonB = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_B")), - ButtonX = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_X")), - ButtonY = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Y")), - ButtonPlus = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Plus")), - ButtonR = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_R")), - ButtonZR = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_ZR")) - }); + JoyConKeyboardRight RightKeyboardJoycon = new JoyConKeyboardRight + { + StickUp = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Up")), + StickDown = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Down")), + StickLeft = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Left")), + StickRight = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Right")), + StickButton = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Button")), + ButtonA = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_A")), + ButtonB = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_B")), + ButtonX = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_X")), + ButtonY = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Y")), + ButtonPlus = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Plus")), + ButtonR = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_R")), + ButtonZR = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_ZR")) + }; + JoyConKeyboard = new JoyConKeyboard(LeftKeyboardJoycon, RightKeyboardJoycon); List JoyConControllerList = new List(); //Populate the Controller List for (int i = 0; i < 9; ++i) { - if (Parser.Value(i + "_GamePad_Index") == null) break; + if (Parser.Value("GamePad_Index_" + i) == null) break; + + JoyConControllerLeft LeftJoycon = new JoyConControllerLeft + { + Stick = ToID(Parser.Value("Controls_Left_JoyConController_Stick_" + i)), + StickButton = ToID(Parser.Value("Controls_Left_JoyConController_Stick_Button_" + i)), + DPadUp = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Up_" + i)), + DPadDown = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Down_" + i)), + DPadLeft = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Left_" + i)), + DPadRight = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Right_" + i)), + ButtonMinus = ToID(Parser.Value("Controls_Left_JoyConController_Button_Minus_" + i)), + ButtonL = ToID(Parser.Value("Controls_Left_JoyConController_Button_L_" + i)), + ButtonZL = ToID(Parser.Value("Controls_Left_JoyConController_Button_ZL_" + i)) + }; + + JoyConControllerRight RightJoycon = new JoyConControllerRight + { + Stick = ToID(Parser.Value("Controls_Right_JoyConController_Stick_" + i)), + StickButton = ToID(Parser.Value("Controls_Right_JoyConController_Stick_Button_" + i)), + ButtonA = ToID(Parser.Value("Controls_Right_JoyConController_Button_A_" + i)), + ButtonB = ToID(Parser.Value("Controls_Right_JoyConController_Button_B_" + i)), + ButtonX = ToID(Parser.Value("Controls_Right_JoyConController_Button_X_" + i)), + ButtonY = ToID(Parser.Value("Controls_Right_JoyConController_Button_Y_" + i)), + ButtonPlus = ToID(Parser.Value("Controls_Right_JoyConController_Button_Plus_" + i)), + ButtonR = ToID(Parser.Value("Controls_Right_JoyConController_Button_R_" + i)), + ButtonZR = ToID(Parser.Value("Controls_Right_JoyConController_Button_ZR_" + i)) + }; JoyConController Controller = new JoyConController( - Convert.ToBoolean(GamePadEnable), - Convert.ToInt32 (Parser.Value(i + "_GamePad_Index")), - (float)Convert.ToDouble (Parser.Value(i + "_GamePad_Deadzone"), CultureInfo.InvariantCulture), - (float)Convert.ToDouble (Parser.Value(i + "_GamePad_Trigger_Threshold"), CultureInfo.InvariantCulture), - - new JoyConControllerLeft - { - Stick = ToID(Parser.Value(i + "_Controls_Left_JoyConController_Stick")), - StickButton = ToID(Parser.Value(i + "_Controls_Left_JoyConController_Stick_Button")), - DPadUp = ToID(Parser.Value(i + "_Controls_Left_JoyConController_DPad_Up")), - DPadDown = ToID(Parser.Value(i + "_Controls_Left_JoyConController_DPad_Down")), - DPadLeft = ToID(Parser.Value(i + "_Controls_Left_JoyConController_DPad_Left")), - DPadRight = ToID(Parser.Value(i + "_Controls_Left_JoyConController_DPad_Right")), - ButtonMinus = ToID(Parser.Value(i + "_Controls_Left_JoyConController_Button_Minus")), - ButtonL = ToID(Parser.Value(i + "_Controls_Left_JoyConController_Button_L")), - ButtonZL = ToID(Parser.Value(i + "_Controls_Left_JoyConController_Button_ZL")) - }, - - new JoyConControllerRight - { - Stick = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Stick")), - StickButton = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Stick_Button")), - ButtonA = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Button_A")), - ButtonB = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Button_B")), - ButtonX = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Button_X")), - ButtonY = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Button_Y")), - ButtonPlus = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Button_Plus")), - ButtonR = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Button_R")), - ButtonZR = ToID(Parser.Value(i + "_Controls_Right_JoyConController_Button_ZR")) - }); + Convert.ToBoolean(GamePadEnable), + Convert.ToInt32 (Parser.Value("GamePad_Index_" + i)), + (float)Convert.ToDouble (Parser.Value("GamePad_Deadzone_" + i), CultureInfo.InvariantCulture), + (float)Convert.ToDouble (Parser.Value("GamePad_Trigger_Threshold_" + i), CultureInfo.InvariantCulture), + LeftJoycon, RightJoycon); JoyConControllerList.Add(Controller); } @@ -191,31 +194,31 @@ namespace Ryujinx } } - private static HidEmulatedDevices.HostDevice ToHostDevice(string Key) + private static HidHostDevice ToHostDevice(string Key) { switch (Key.ToUpper()) { - case "NONE": return HidEmulatedDevices.HostDevice.None; - case "KEYBOARD": return HidEmulatedDevices.HostDevice.Keyboard; + case "NONE": return HidHostDevice.None; + case "KEYBOARD": return HidHostDevice.Keyboard; } - if (Key.Split("GAMEPAD_").Length > 0 && Regex.IsMatch(""+Key[Key.Length-1], @"^\d+$")) + if (Key.ToUpper().Contains("GAMEPAD_") && Char.IsDigit(Key[Key.Length-1])) { 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; + case '0': return HidHostDevice.GamePad0; + case '1': return HidHostDevice.GamePad1; + case '2': return HidHostDevice.GamePad2; + case '3': return HidHostDevice.GamePad3; + case '4': return HidHostDevice.GamePad4; + case '5': return HidHostDevice.GamePad5; + case '6': return HidHostDevice.GamePad6; + case '7': return HidHostDevice.GamePad7; + case '8': return HidHostDevice.GamePad8; } } - return HidEmulatedDevices.HostDevice.None; + throw new ArgumentException("Not a valid Input Device"); } } diff --git a/Ryujinx/Ryujinx.conf b/Ryujinx/Ryujinx.conf index 878d58f61..fb97cb317 100644 --- a/Ryujinx/Ryujinx.conf +++ b/Ryujinx/Ryujinx.conf @@ -35,14 +35,8 @@ GamePad_Enable = true #Keyboard = Keyboard Input #GamePad_X = X Game Pad Configuration (eg. GamePad_0 is the zeroth Controller Configuration) -#Handheld Devices can not be mixed with any other players (Player 1, Player 2, etc.) -#Set this to GamePad_0 if you want to use a Controller Handheld_Device = Keyboard -#The Player Devices don't work in all games (eg. Super Mario Odyssey) but do in some (eg. Sonic Mania) -#If you want to use these, set Handheld_Device to none, then configure Player1_Device to be one of the Valid Mappings -#(eg. GamePad_0 if you have a Controller, or Keyboard) -#Then configure any of the other players to be a Valid Mapping aswell if you want to play Co-Op Player1_Device = None Player2_Device = None Player3_Device = None @@ -85,36 +79,36 @@ Controls_Right_JoyConKeyboard_Button_ZR = 97 #Controller Mappings -#The left most Number ("0"_blah_blahblahblah) is which Controller Configuration the setting applies to. +#The right most Number is which Controller Configuration the setting applies to. #Controller Configuration 0 #Controller Device Index -0_GamePad_Index = 0 +GamePad_Index_0 = 0 #Controller Analog Stick Deadzone -0_GamePad_Deadzone = 0.05 +GamePad_Deadzone_0 = 0.05 #The value of how pressed down each trigger has to be in order to register a button press -0_GamePad_Trigger_Threshold = 0.5 +GamePad_Trigger_Threshold_0 = 0.5 -0_Controls_Left_JoyConController_Stick_Button = LStick -0_Controls_Left_JoyConController_DPad_Up = DPadUp -0_Controls_Left_JoyConController_DPad_Down = DPadDown -0_Controls_Left_JoyConController_DPad_Left = DPadLeft -0_Controls_Left_JoyConController_DPad_Right = DPadRight -0_Controls_Left_JoyConController_Button_Minus = Back -0_Controls_Left_JoyConController_Button_L = LShoulder -0_Controls_Left_JoyConController_Button_ZL = LTrigger +Controls_Left_JoyConController_Stick_Button_0 = LStick +Controls_Left_JoyConController_DPad_Up_0 = DPadUp +Controls_Left_JoyConController_DPad_Down_0 = DPadDown +Controls_Left_JoyConController_DPad_Left_0 = DPadLeft +Controls_Left_JoyConController_DPad_Right_0 = DPadRight +Controls_Left_JoyConController_Button_Minus_0 = Back +Controls_Left_JoyConController_Button_L_0 = LShoulder +Controls_Left_JoyConController_Button_ZL_0 = LTrigger -0_Controls_Right_JoyConController_Stick_Button = RStick -0_Controls_Right_JoyConController_Button_A = B -0_Controls_Right_JoyConController_Button_B = A -0_Controls_Right_JoyConController_Button_X = Y -0_Controls_Right_JoyConController_Button_Y = X -0_Controls_Right_JoyConController_Button_Plus = Start -0_Controls_Right_JoyConController_Button_R = RShoulder -0_Controls_Right_JoyConController_Button_ZR = RTrigger +Controls_Right_JoyConController_Stick_Button_0 = RStick +Controls_Right_JoyConController_Button_A_0 = B +Controls_Right_JoyConController_Button_B_0 = A +Controls_Right_JoyConController_Button_X_0 = Y +Controls_Right_JoyConController_Button_Y_0 = X +Controls_Right_JoyConController_Button_Plus_0 = Start +Controls_Right_JoyConController_Button_R_0 = RShoulder +Controls_Right_JoyConController_Button_ZR_0 = RTrigger -0_Controls_Left_JoyConController_Stick = LJoystick -0_Controls_Right_JoyConController_Stick = RJoystick +Controls_Left_JoyConController_Stick_0 = LJoystick +Controls_Right_JoyConController_Stick_0 = RJoystick diff --git a/Ryujinx/Ui/EmulatedDevices.cs b/Ryujinx/Ui/EmulatedDevices.cs new file mode 100644 index 000000000..cc0052232 --- /dev/null +++ b/Ryujinx/Ui/EmulatedDevices.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Ryujinx.HLE.Input; + +namespace Ryujinx.Ui.Input +{ + class EmulatedDevices + { + public static Dictionary Devices; + } +} diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index 1664f8010..13fe64f0e 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -4,6 +4,7 @@ using OpenTK.Input; using Ryujinx.Graphics.Gal; using Ryujinx.HLE; using Ryujinx.HLE.Input; +using Ryujinx.Ui.Input; using System; using System.Collections.Generic; using System.Threading; @@ -252,11 +253,11 @@ namespace Ryujinx Device.Hid.SetTouchPoints(); } - foreach (KeyValuePair Entry in HidEmulatedDevices.Devices) + foreach (KeyValuePair Entry in EmulatedDevices.Devices) { - if (Entry.Value != HidEmulatedDevices.HostDevice.None) + if (Entry.Value != HidHostDevice.None) { - bool IsKeyboard = Entry.Value == HidEmulatedDevices.HostDevice.Keyboard; + bool IsKeyboard = (Entry.Value == HidHostDevice.Keyboard); Device.Hid.SetJoyconButton( Entry.Key, (Entry.Key == HidControllerId.CONTROLLER_HANDHELD) ? HidControllerLayouts.Handheld_Joined : HidControllerLayouts.Joined, @@ -274,19 +275,19 @@ namespace Ryujinx } } - private int GetGamePadIndexFromHostDevice(HidEmulatedDevices.HostDevice HostDevice) + private int GetGamePadIndexFromHostDevice(HidHostDevice HostDevice) { switch (HostDevice) { - case HidEmulatedDevices.HostDevice.GamePad_0: return 0; - case HidEmulatedDevices.HostDevice.GamePad_1: return 1; - case HidEmulatedDevices.HostDevice.GamePad_2: return 2; - case HidEmulatedDevices.HostDevice.GamePad_3: return 3; - case HidEmulatedDevices.HostDevice.GamePad_4: return 4; - case HidEmulatedDevices.HostDevice.GamePad_5: return 5; - case HidEmulatedDevices.HostDevice.GamePad_6: return 6; - case HidEmulatedDevices.HostDevice.GamePad_7: return 7; - case HidEmulatedDevices.HostDevice.GamePad_8: return 8; + case HidHostDevice.GamePad0: return 0; + case HidHostDevice.GamePad1: return 1; + case HidHostDevice.GamePad2: return 2; + case HidHostDevice.GamePad3: return 3; + case HidHostDevice.GamePad4: return 4; + case HidHostDevice.GamePad5: return 5; + case HidHostDevice.GamePad6: return 6; + case HidHostDevice.GamePad7: return 7; + case HidHostDevice.GamePad8: return 8; } throw new ArgumentException("Not a valid GamePad Device");