added input page

This commit is contained in:
emmaus 2018-07-08 09:38:51 +00:00
commit 941bc58063
14 changed files with 1413 additions and 705 deletions

View file

@ -0,0 +1,28 @@
namespace Ryujinx.Common.Input
{
public enum GamePadButton
{
A,
B,
X,
Y,
LStick,
RStick,
LShoulder,
RShoulder,
DPadUp,
DPadDown,
DPadLeft,
DPadRight,
Start,
Back,
LTrigger,
RTrigger,
}
public enum GamePadStick
{
LJoystick,
RJoystick
}
}

View file

@ -2,28 +2,28 @@
{ {
public struct JoyConControllerLeft public struct JoyConControllerLeft
{ {
public string Stick; public GamePadStick Stick;
public string StickButton; public GamePadButton StickButton;
public string DPadUp; public GamePadButton DPadUp;
public string DPadDown; public GamePadButton DPadDown;
public string DPadLeft; public GamePadButton DPadLeft;
public string DPadRight; public GamePadButton DPadRight;
public string ButtonMinus; public GamePadButton ButtonMinus;
public string ButtonL; public GamePadButton ButtonL;
public string ButtonZL; public GamePadButton ButtonZL;
} }
public struct JoyConControllerRight public struct JoyConControllerRight
{ {
public string Stick; public GamePadStick Stick;
public string StickButton; public GamePadButton StickButton;
public string ButtonA; public GamePadButton ButtonA;
public string ButtonB; public GamePadButton ButtonB;
public string ButtonX; public GamePadButton ButtonX;
public string ButtonY; public GamePadButton ButtonY;
public string ButtonPlus; public GamePadButton ButtonPlus;
public string ButtonR; public GamePadButton ButtonR;
public string ButtonZR; public GamePadButton ButtonZR;
} }
public struct JoyConController public struct JoyConController

View file

@ -15,10 +15,10 @@ namespace Ryujinx
public static JoyConKeyboard JoyConKeyboard { get; set; } public static JoyConKeyboard JoyConKeyboard { get; set; }
public static JoyConController JoyConController { get; set; } public static JoyConController JoyConController { get; set; }
public static float GamePadDeadzone { get; private set; } public static float GamePadDeadzone { get; set; }
public static bool GamePadEnable { get; private set; } public static bool GamePadEnable { get; set; }
public static int GamePadIndex { get; private set; } public static int GamePadIndex { get; set; }
public static float GamePadTriggerThreshold { get; private set; } public static float GamePadTriggerThreshold { get; set; }
public static string IniPath { get; set; } public static string IniPath { get; set; }
@ -112,28 +112,28 @@ namespace Ryujinx
{ {
Left = new JoyConControllerLeft Left = new JoyConControllerLeft
{ {
Stick = Parser.GetValue("Controls_Left_JoyConController_Stick"), Stick = Enum.Parse<GamePadStick>(Parser.GetValue("Controls_Left_JoyConController_Stick")),
StickButton = Parser.GetValue("Controls_Left_JoyConController_Stick_Button"), StickButton = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Left_JoyConController_Stick_Button")),
DPadUp = Parser.GetValue("Controls_Left_JoyConController_DPad_Up"), DPadUp = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Left_JoyConController_DPad_Up")),
DPadDown = Parser.GetValue("Controls_Left_JoyConController_DPad_Down"), DPadDown = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Left_JoyConController_DPad_Down")),
DPadLeft = Parser.GetValue("Controls_Left_JoyConController_DPad_Left"), DPadLeft = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Left_JoyConController_DPad_Left")),
DPadRight = Parser.GetValue("Controls_Left_JoyConController_DPad_Right"), DPadRight = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Left_JoyConController_DPad_Right")),
ButtonMinus = Parser.GetValue("Controls_Left_JoyConController_Button_Minus"), ButtonMinus = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Left_JoyConController_Button_Minus")),
ButtonL = Parser.GetValue("Controls_Left_JoyConController_Button_L"), ButtonL = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Left_JoyConController_Button_L")),
ButtonZL = Parser.GetValue("Controls_Left_JoyConController_Button_ZL") ButtonZL = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Left_JoyConController_Button_ZL"))
}, },
Right = new JoyConControllerRight Right = new JoyConControllerRight
{ {
Stick = Parser.GetValue("Controls_Right_JoyConController_Stick"), Stick = Enum.Parse<GamePadStick>(Parser.GetValue("Controls_Right_JoyConController_Stick")),
StickButton = Parser.GetValue("Controls_Right_JoyConController_Stick_Button"), StickButton = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Right_JoyConController_Stick_Button")),
ButtonA = Parser.GetValue("Controls_Right_JoyConController_Button_A"), ButtonA = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Right_JoyConController_Button_A")),
ButtonB = Parser.GetValue("Controls_Right_JoyConController_Button_B"), ButtonB = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Right_JoyConController_Button_B")),
ButtonX = Parser.GetValue("Controls_Right_JoyConController_Button_X"), ButtonX = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Right_JoyConController_Button_X")),
ButtonY = Parser.GetValue("Controls_Right_JoyConController_Button_Y"), ButtonY = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Right_JoyConController_Button_Y")),
ButtonPlus = Parser.GetValue("Controls_Right_JoyConController_Button_Plus"), ButtonPlus = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Right_JoyConController_Button_Plus")),
ButtonR = Parser.GetValue("Controls_Right_JoyConController_Button_R"), ButtonR = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Right_JoyConController_Button_R")),
ButtonZR = Parser.GetValue("Controls_Right_JoyConController_Button_ZR") ButtonZR = Enum.Parse<GamePadButton>(Parser.GetValue("Controls_Right_JoyConController_Button_ZR"))
} }
}; };

View file

@ -1,17 +1,15 @@
using System; using System.IO;
using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO;
namespace Ryujinx.UI namespace Ryujinx.UI
{ {
public class ControlArchive public class ControlArchive
{ {
public LanguageEntry[] LanguageEntries { get; set; } public LanguageEntry[] LanguageEntries { get; set; }
public long ApplicationTitleID { get; set; } public long ApplicationTitleID { get; set; }
public long BaseTitleID { get; set; } public long BaseTitleID { get; set; }
public long ProductCode { get; set; } public long ProductCode { get; set; }
public string ApplicationVersion { get; set; } public string ApplicationVersion { get; set; }
public ControlArchive(Stream Input) public ControlArchive(Stream Input)
{ {
@ -22,7 +20,7 @@ namespace Ryujinx.UI
Input.Seek(0x3060, SeekOrigin.Begin); Input.Seek(0x3060, SeekOrigin.Begin);
ApplicationVersion = Encoding.ASCII.GetString(Reader.ReadBytes(0x10)); ApplicationVersion = Encoding.ASCII.GetString(Reader.ReadBytes(0x10));
BaseTitleID = Reader.ReadInt64(); BaseTitleID = Reader.ReadInt64();
ApplicationTitleID = Reader.ReadInt64(); ApplicationTitleID = Reader.ReadInt64();
Input.Seek(0x30a8, SeekOrigin.Begin); Input.Seek(0x30a8, SeekOrigin.Begin);
@ -38,7 +36,7 @@ namespace Ryujinx.UI
LanguageEntries[index] = new LanguageEntry() LanguageEntries[index] = new LanguageEntry()
{ {
AplicationName = Encoding.ASCII.GetString(LanguageReader.ReadBytes(0x200)).Trim('\0'), AplicationName = Encoding.ASCII.GetString(LanguageReader.ReadBytes(0x200)).Trim('\0'),
DeveloperName = Encoding.ASCII.GetString(LanguageReader.ReadBytes(0x100)).Trim('\0') DeveloperName = Encoding.ASCII.GetString(LanguageReader.ReadBytes(0x100)).Trim('\0')
}; };
} }
} }

View file

@ -1,8 +1,4 @@
using System; public enum DialogResult
using System.Collections.Generic;
using System.Text;
public enum DialogResult
{ {
OK, OK,
Cancel, Cancel,

View file

@ -1,17 +1,15 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using Ryujinx.HLE.Loaders; using System.Text;
namespace Ryujinx.UI namespace Ryujinx.UI
{ {
class Nro : HLE.Loaders.Executables.Nro class Nro : HLE.Loaders.Executables.Nro
{ {
public byte[] AssetRomfData { get; set; } public byte[] AssetRomfData { get; set; }
public byte[] IconData { get; set; } public byte[] IconData { get; set; }
private byte[] NACPData { get; set; } private byte[] NACPData { get; set; }
public int AssetOffset { get; set; } public int AssetOffset { get; set; }
public ControlArchive ControlArchive { get; set; } public ControlArchive ControlArchive { get; set; }
@ -36,18 +34,18 @@ namespace Ryujinx.UI
{ {
Input.Seek(AssetOffset, SeekOrigin.Begin); Input.Seek(AssetOffset, SeekOrigin.Begin);
int AssetMagic0 = Reader.ReadInt32(); int AssetMagic0 = Reader.ReadInt32();
int AssetFormat = Reader.ReadInt32(); int AssetFormat = Reader.ReadInt32();
byte[] IconSectionInfo = Reader.ReadBytes(0x10); byte[] IconSectionInfo = Reader.ReadBytes(0x10);
byte[] NACPSectionInfo = Reader.ReadBytes(0x10); byte[] NACPSectionInfo = Reader.ReadBytes(0x10);
byte[] AssetRomfSectionInfo = Reader.ReadBytes(0x10); byte[] AssetRomfSectionInfo = Reader.ReadBytes(0x10);
long IconOffset = BitConverter.ToInt64(IconSectionInfo, 0); long IconOffset = BitConverter.ToInt64(IconSectionInfo, 0);
long IconSize = BitConverter.ToInt64(IconSectionInfo, 8); long IconSize = BitConverter.ToInt64(IconSectionInfo, 8);
long NACPOffset = BitConverter.ToInt64(NACPSectionInfo, 0); long NACPOffset = BitConverter.ToInt64(NACPSectionInfo, 0);
long NACPSize = BitConverter.ToInt64(NACPSectionInfo, 8); long NACPSize = BitConverter.ToInt64(NACPSectionInfo, 8);
long RomfOffset = BitConverter.ToInt64(AssetRomfSectionInfo, 0); long RomfOffset = BitConverter.ToInt64(AssetRomfSectionInfo, 0);
long RomfSize = BitConverter.ToInt64(AssetRomfSectionInfo, 8); long RomfSize = BitConverter.ToInt64(AssetRomfSectionInfo, 8);
Input.Seek(AssetOffset + IconOffset, SeekOrigin.Begin); Input.Seek(AssetOffset + IconOffset, SeekOrigin.Begin);
IconData = Reader.ReadBytes((int)IconSize); IconData = Reader.ReadBytes((int)IconSize);

View file

@ -153,7 +153,7 @@ namespace Ryujinx.UI
protected override void OnUpdateFrame(FrameEventArgs e) protected override void OnUpdateFrame(FrameEventArgs e)
{ {
KeyboardState Keyboard = this.Keyboard.HasValue ? this.Keyboard.Value : new KeyboardState(); KeyboardState Keyboard = this.Keyboard ?? new KeyboardState();
if (!UIActive) if (!UIActive)
{ {
@ -181,42 +181,86 @@ namespace Ryujinx.UI
HidJoystickPosition LeftJoystick; HidJoystickPosition LeftJoystick;
HidJoystickPosition RightJoystick; HidJoystickPosition RightJoystick;
int LeftJoystickDX = 0; int LeftJoystickDX = 0;
int LeftJoystickDY = 0; int LeftJoystickDY = 0;
int RightJoystickDX = 0; int RightJoystickDX = 0;
int RightJoystickDY = 0; int RightJoystickDY = 0;
float AnalogStickDeadzone = Config.GamePadDeadzone;
//RightJoystick //LeftJoystick
if (Keyboard[(Key)Config.FakeJoyCon.Left.StickUp]) LeftJoystickDY = short.MaxValue; if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickUp]) LeftJoystickDY = short.MaxValue;
if (Keyboard[(Key)Config.FakeJoyCon.Left.StickDown]) LeftJoystickDY = -short.MaxValue; if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickDown]) LeftJoystickDY = -short.MaxValue;
if (Keyboard[(Key)Config.FakeJoyCon.Left.StickLeft]) LeftJoystickDX = -short.MaxValue; if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickLeft]) LeftJoystickDX = -short.MaxValue;
if (Keyboard[(Key)Config.FakeJoyCon.Left.StickRight]) LeftJoystickDX = short.MaxValue; if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickRight]) LeftJoystickDX = short.MaxValue;
//LeftButtons //LeftButtons
if (Keyboard[(Key)Config.FakeJoyCon.Left.StickButton]) CurrentButton |= HidControllerButtons.KEY_LSTICK; if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickButton]) CurrentButton |= HidControllerButtons.KEY_LSTICK;
if (Keyboard[(Key)Config.FakeJoyCon.Left.DPadUp]) CurrentButton |= HidControllerButtons.KEY_DUP; if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadUp]) CurrentButton |= HidControllerButtons.KEY_DUP;
if (Keyboard[(Key)Config.FakeJoyCon.Left.DPadDown]) CurrentButton |= HidControllerButtons.KEY_DDOWN; if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadDown]) CurrentButton |= HidControllerButtons.KEY_DDOWN;
if (Keyboard[(Key)Config.FakeJoyCon.Left.DPadLeft]) CurrentButton |= HidControllerButtons.KEY_DLEFT; if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadLeft]) CurrentButton |= HidControllerButtons.KEY_DLEFT;
if (Keyboard[(Key)Config.FakeJoyCon.Left.DPadRight]) CurrentButton |= HidControllerButtons.KEY_DRIGHT; if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadRight]) CurrentButton |= HidControllerButtons.KEY_DRIGHT;
if (Keyboard[(Key)Config.FakeJoyCon.Left.ButtonMinus]) CurrentButton |= HidControllerButtons.KEY_MINUS; if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonMinus]) CurrentButton |= HidControllerButtons.KEY_MINUS;
if (Keyboard[(Key)Config.FakeJoyCon.Left.ButtonL]) CurrentButton |= HidControllerButtons.KEY_L; if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonL]) CurrentButton |= HidControllerButtons.KEY_L;
if (Keyboard[(Key)Config.FakeJoyCon.Left.ButtonZL]) CurrentButton |= HidControllerButtons.KEY_ZL; if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonZL]) CurrentButton |= HidControllerButtons.KEY_ZL;
//RightJoystick //RightJoystick
if (Keyboard[(Key)Config.FakeJoyCon.Right.StickUp]) RightJoystickDY = short.MaxValue; if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickUp]) RightJoystickDY = short.MaxValue;
if (Keyboard[(Key)Config.FakeJoyCon.Right.StickDown]) RightJoystickDY = -short.MaxValue; if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickDown]) RightJoystickDY = -short.MaxValue;
if (Keyboard[(Key)Config.FakeJoyCon.Right.StickLeft]) RightJoystickDX = -short.MaxValue; if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickLeft]) RightJoystickDX = -short.MaxValue;
if (Keyboard[(Key)Config.FakeJoyCon.Right.StickRight]) RightJoystickDX = short.MaxValue; if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickRight]) RightJoystickDX = short.MaxValue;
//RightButtons //RightButtons
if (Keyboard[(Key)Config.FakeJoyCon.Right.StickButton]) CurrentButton |= HidControllerButtons.KEY_RSTICK; if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickButton]) CurrentButton |= HidControllerButtons.KEY_RSTICK;
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonA]) CurrentButton |= HidControllerButtons.KEY_A; if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonA]) CurrentButton |= HidControllerButtons.KEY_A;
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonB]) CurrentButton |= HidControllerButtons.KEY_B; if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonB]) CurrentButton |= HidControllerButtons.KEY_B;
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonX]) CurrentButton |= HidControllerButtons.KEY_X; if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonX]) CurrentButton |= HidControllerButtons.KEY_X;
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonY]) CurrentButton |= HidControllerButtons.KEY_Y; if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonY]) CurrentButton |= HidControllerButtons.KEY_Y;
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonPlus]) CurrentButton |= HidControllerButtons.KEY_PLUS; if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonPlus]) CurrentButton |= HidControllerButtons.KEY_PLUS;
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonR]) CurrentButton |= HidControllerButtons.KEY_R; if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonR]) CurrentButton |= HidControllerButtons.KEY_R;
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonZR]) CurrentButton |= HidControllerButtons.KEY_ZR; if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonZR]) CurrentButton |= HidControllerButtons.KEY_ZR;
//Controller Input
if (Config.GamePadEnable)
{
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
//LeftButtons
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.DPadUp)) CurrentButton |= HidControllerButtons.KEY_DUP;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.DPadDown)) CurrentButton |= HidControllerButtons.KEY_DDOWN;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.DPadLeft)) CurrentButton |= HidControllerButtons.KEY_DLEFT;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.DPadRight)) CurrentButton |= HidControllerButtons.KEY_DRIGHT;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.StickButton)) CurrentButton |= HidControllerButtons.KEY_LSTICK;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.ButtonMinus)) CurrentButton |= HidControllerButtons.KEY_MINUS;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.ButtonL)) CurrentButton |= HidControllerButtons.KEY_L;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.ButtonZL)) CurrentButton |= HidControllerButtons.KEY_ZL;
//RightButtons
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonA)) CurrentButton |= HidControllerButtons.KEY_A;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonB)) CurrentButton |= HidControllerButtons.KEY_B;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonX)) CurrentButton |= HidControllerButtons.KEY_X;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonY)) CurrentButton |= HidControllerButtons.KEY_Y;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.StickButton)) CurrentButton |= HidControllerButtons.KEY_RSTICK;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonPlus)) CurrentButton |= HidControllerButtons.KEY_PLUS;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonR)) CurrentButton |= HidControllerButtons.KEY_R;
if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonZR)) CurrentButton |= HidControllerButtons.KEY_ZR;
//LeftJoystick
if (GetJoystickAxis(GamePad, Config.JoyConController.Left.Stick).X >= AnalogStickDeadzone
|| GetJoystickAxis(GamePad, Config.JoyConController.Left.Stick).X <= -AnalogStickDeadzone)
LeftJoystickDX = (int)(GetJoystickAxis(GamePad, Config.JoyConController.Left.Stick).X * short.MaxValue);
if (GetJoystickAxis(GamePad, Config.JoyConController.Left.Stick).Y >= AnalogStickDeadzone
|| GetJoystickAxis(GamePad, Config.JoyConController.Left.Stick).Y <= -AnalogStickDeadzone)
LeftJoystickDY = (int)(GetJoystickAxis(GamePad, Config.JoyConController.Left.Stick).Y * short.MaxValue);
//RightJoystick
if (GetJoystickAxis(GamePad, Config.JoyConController.Right.Stick).X >= AnalogStickDeadzone
|| GetJoystickAxis(GamePad, Config.JoyConController.Right.Stick).X <= -AnalogStickDeadzone)
RightJoystickDX = (int)(GetJoystickAxis(GamePad, Config.JoyConController.Right.Stick).X * short.MaxValue);
if (GetJoystickAxis(GamePad, Config.JoyConController.Right.Stick).Y >= AnalogStickDeadzone
|| GetJoystickAxis(GamePad, Config.JoyConController.Right.Stick).Y <= -AnalogStickDeadzone)
RightJoystickDY = (int)(GetJoystickAxis(GamePad, Config.JoyConController.Right.Stick).Y * short.MaxValue);
}
LeftJoystick = new HidJoystickPosition LeftJoystick = new HidJoystickPosition
{ {

View file

@ -9,12 +9,16 @@ namespace Ryujinx.UI.Widgets
static bool ConfigIntialized = false; static bool ConfigIntialized = false;
static bool OpenFolderPicker; static bool OpenFolderPicker;
static string CurrentPath; static string CurrentPath;
static float CurrentGamePadDeadzone;
static bool CurrentGamePadEnable;
static int CurrentGamePadIndex;
static float CurrentGamePadTriggerThreshold;
static IniParser IniParser; static IniParser IniParser;
static FilePicker FolderPicker; static FilePicker FolderPicker;
static JoyConKeyboard KeyboardInputLayout; static JoyConKeyboard KeyboardInputLayout;
static JoyConController ControllerInputLayout; static JoyConController ControllerInputLayout;
static Page CurrentPage = Page.General; static Page CurrentPage = Page.General;
static ConfigurationWidget() static ConfigurationWidget()
{ {
@ -23,11 +27,32 @@ namespace Ryujinx.UI.Widgets
CurrentPath = Config.DefaultGameDirectory.ToString(); CurrentPath = Config.DefaultGameDirectory.ToString();
} }
static void Reset()
{
KeyboardInputLayout = Config.JoyConKeyboard;
ControllerInputLayout = Config.JoyConController;
CurrentGamePadTriggerThreshold = Config.GamePadTriggerThreshold;
CurrentGamePadIndex = Config.GamePadIndex;
CurrentGamePadEnable = Config.GamePadEnable;
CurrentGamePadDeadzone = Config.GamePadDeadzone;
}
static void Apply()
{
Config.JoyConKeyboard = KeyboardInputLayout;
Config.JoyConController = ControllerInputLayout;
Config.GamePadDeadzone = CurrentGamePadDeadzone;
Config.GamePadEnable = CurrentGamePadEnable;
Config.GamePadIndex = CurrentGamePadIndex;
Config.GamePadTriggerThreshold = CurrentGamePadTriggerThreshold;
}
public static void Draw() public static void Draw()
{ {
if(!ConfigIntialized) if(!ConfigIntialized)
{ {
KeyboardInputLayout = Config.JoyConKeyboard; Reset();
ConfigIntialized = true; ConfigIntialized = true;
} }
@ -104,12 +129,14 @@ namespace Ryujinx.UI.Widgets
{ {
if (ImGui.Button("Apply", new Vector2(Values.ButtonWidth, Values.ButtonHeight))) if (ImGui.Button("Apply", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
{ {
Config.JoyConKeyboard = KeyboardInputLayout; Apply();
} }
ImGui.SameLine(); ImGui.SameLine();
} }
if (ImGui.Button("Save", new Vector2(Values.ButtonWidth, Values.ButtonHeight))) if (ImGui.Button("Save", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
{ {
Apply();
Config.Save(EmulationWindow.Ns.Log); Config.Save(EmulationWindow.Ns.Log);
} }
ImGui.SameLine(); ImGui.SameLine();

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@ using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL; using OpenTK.Graphics.OpenGL;
using OpenTK.Input; using OpenTK.Input;
using System; using System;
using Ryujinx.Common.Input;
namespace Ryujinx.UI namespace Ryujinx.UI
{ {
@ -22,6 +23,8 @@ namespace Ryujinx.UI
protected MouseState? Mouse = null; protected MouseState? Mouse = null;
protected GamePadState? GamePad = null;
public WindowHelper(string Title) : base(1280, 720, GraphicsMode.Default, Title, GameWindowFlags.Default public WindowHelper(string Title) : base(1280, 720, GraphicsMode.Default, Title, GameWindowFlags.Default
, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible) , DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible)
{ {
@ -261,6 +264,60 @@ namespace Ryujinx.UI
SwapBuffers(); SwapBuffers();
} }
internal static bool IsGamePadButtonPressed(GamePadState GamePad, GamePadButton Button)
{
if (Button == GamePadButton.LTrigger || Button == GamePadButton.RTrigger)
{
return GetGamePadTrigger(GamePad, Button) >= Config.GamePadTriggerThreshold;
}
else
{
return (GetGamePadButton(GamePad, Button) == ButtonState.Pressed);
}
}
internal static ButtonState GetGamePadButton(GamePadState GamePad, GamePadButton Button)
{
switch (Button)
{
case GamePadButton.A: return GamePad.Buttons.A;
case GamePadButton.B: return GamePad.Buttons.B;
case GamePadButton.X: return GamePad.Buttons.X;
case GamePadButton.Y: return GamePad.Buttons.Y;
case GamePadButton.LStick: return GamePad.Buttons.LeftStick;
case GamePadButton.RStick: return GamePad.Buttons.RightStick;
case GamePadButton.LShoulder: return GamePad.Buttons.LeftShoulder;
case GamePadButton.RShoulder: return GamePad.Buttons.RightShoulder;
case GamePadButton.DPadUp: return GamePad.DPad.Up;
case GamePadButton.DPadDown: return GamePad.DPad.Down;
case GamePadButton.DPadLeft: return GamePad.DPad.Left;
case GamePadButton.DPadRight: return GamePad.DPad.Right;
case GamePadButton.Start: return GamePad.Buttons.Start;
case GamePadButton.Back: return GamePad.Buttons.Back;
default: throw new ArgumentException();
}
}
internal static float GetGamePadTrigger(GamePadState GamePad, GamePadButton Trigger)
{
switch (Trigger)
{
case GamePadButton.LTrigger: return GamePad.Triggers.Left;
case GamePadButton.RTrigger: return GamePad.Triggers.Right;
default: throw new ArgumentException();
}
}
internal static Vector2 GetJoystickAxis(GamePadState GamePad, GamePadStick Joystick)
{
switch (Joystick)
{
case GamePadStick.LJoystick: return GamePad.ThumbSticks.Left;
case GamePadStick.RJoystick: return new Vector2(-GamePad.ThumbSticks.Right.Y, -GamePad.ThumbSticks.Right.X);
default: throw new ArgumentException();
}
}
protected override void OnKeyDown(KeyboardKeyEventArgs e) protected override void OnKeyDown(KeyboardKeyEventArgs e)
{ {
Keyboard = e.Keyboard; Keyboard = e.Keyboard;

21
Ryujinx.UI/InputDevice.cs Normal file
View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Input;
namespace Ryujinx.UI
{
public struct InputDevice
{
public int Index;
public IInputDevice Device;
public DeviceType DeviceType;
public string Name;
}
public enum DeviceType
{
GamePad,
Keyboard
}
}

View file

@ -19,29 +19,64 @@ Logging_Enable_Error = true
#Filtered log classes, seperated by ", ", eg. `Logging_Filtered_Classes = Loader, ServiceFS` #Filtered log classes, seperated by ", ", eg. `Logging_Filtered_Classes = Loader, ServiceFS`
Logging_Filtered_Classes = Logging_Filtered_Classes =
#https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs #Controller Device Index
Controls_Left_FakeJoycon_Stick_Up = 105 GamePad_Index = 0
Controls_Left_FakeJoycon_Stick_Down = 101
Controls_Left_FakeJoycon_Stick_Left = 83
Controls_Left_FakeJoycon_Stick_Right = 86
Controls_Left_FakeJoycon_Stick_Button = 88
Controls_Left_FakeJoycon_DPad_Up = 45
Controls_Left_FakeJoycon_DPad_Down = 46
Controls_Left_FakeJoycon_DPad_Left = 47
Controls_Left_FakeJoycon_DPad_Right = 48
Controls_Left_FakeJoycon_Button_Minus = 120
Controls_Left_FakeJoycon_Button_L = 87
Controls_Left_FakeJoycon_Button_ZL = 99
Controls_Right_FakeJoycon_Stick_Up = 91 #Controller Analog Stick Deadzone
Controls_Right_FakeJoycon_Stick_Down = 93 GamePad_Deadzone = 0.05
Controls_Right_FakeJoycon_Stick_Left = 92
Controls_Right_FakeJoycon_Stick_Right = 94 #The value of how pressed down each trigger has to be in order to register a button press
Controls_Right_FakeJoycon_Stick_Button = 90 GamePad_Trigger_Threshold = 0.5
Controls_Right_FakeJoycon_Button_A = 108
Controls_Right_FakeJoycon_Button_B = 106 #Whether or not to enable Controller support
Controls_Right_FakeJoycon_Button_X = 85 GamePad_Enable = true
Controls_Right_FakeJoycon_Button_Y = 104
Controls_Right_FakeJoycon_Button_Plus = 121 #https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs
Controls_Right_FakeJoycon_Button_R = 103 Controls_Left_JoyConKeyboard_Stick_Up = 105
Controls_Right_FakeJoycon_Button_ZR = 97 Controls_Left_JoyConKeyboard_Stick_Down = 101
Controls_Left_JoyConKeyboard_Stick_Left = 83
Controls_Left_JoyConKeyboard_Stick_Right = 86
Controls_Left_JoyConKeyboard_Stick_Button = 88
Controls_Left_JoyConKeyboard_DPad_Up = 45
Controls_Left_JoyConKeyboard_DPad_Down = 46
Controls_Left_JoyConKeyboard_DPad_Left = 47
Controls_Left_JoyConKeyboard_DPad_Right = 48
Controls_Left_JoyConKeyboard_Button_Minus = 120
Controls_Left_JoyConKeyboard_Button_L = 87
Controls_Left_JoyConKeyboard_Button_ZL = 99
Controls_Right_JoyConKeyboard_Stick_Up = 91
Controls_Right_JoyConKeyboard_Stick_Down = 93
Controls_Right_JoyConKeyboard_Stick_Left = 92
Controls_Right_JoyConKeyboard_Stick_Right = 94
Controls_Right_JoyConKeyboard_Stick_Button = 90
Controls_Right_JoyConKeyboard_Button_A = 108
Controls_Right_JoyConKeyboard_Button_B = 106
Controls_Right_JoyConKeyboard_Button_X = 85
Controls_Right_JoyConKeyboard_Button_Y = 104
Controls_Right_JoyConKeyboard_Button_Plus = 121
Controls_Right_JoyConKeyboard_Button_R = 103
Controls_Right_JoyConKeyboard_Button_ZR = 97
#Controller Controls
Controls_Left_JoyConController_Stick_Button = LStick
Controls_Left_JoyConController_DPad_Up = DPadUp
Controls_Left_JoyConController_DPad_Down = DPadDown
Controls_Left_JoyConController_DPad_Left = DPadLeft
Controls_Left_JoyConController_DPad_Right = DPadRight
Controls_Left_JoyConController_Button_Minus = Back
Controls_Left_JoyConController_Button_L = LShoulder
Controls_Left_JoyConController_Button_ZL = LTrigger
Controls_Right_JoyConController_Stick_Button = RStick
Controls_Right_JoyConController_Button_A = B
Controls_Right_JoyConController_Button_B = A
Controls_Right_JoyConController_Button_X = Y
Controls_Right_JoyConController_Button_Y = X
Controls_Right_JoyConController_Button_Plus = Start
Controls_Right_JoyConController_Button_R = RShoulder
Controls_Right_JoyConController_Button_ZR = RTrigger
Controls_Left_JoyConController_Stick = LJoystick
Controls_Right_JoyConController_Stick = RJoystick

View file

@ -109,28 +109,28 @@ namespace Ryujinx
{ {
Left = new JoyConControllerLeft Left = new JoyConControllerLeft
{ {
Stick = Parser.Value("Controls_Left_JoyConController_Stick"), Stick = Enum.Parse<GamePadStick>(Parser.Value("Controls_Left_JoyConController_Stick")),
StickButton = Parser.Value("Controls_Left_JoyConController_Stick_Button"), StickButton = Enum.Parse<GamePadButton>(Parser.Value("Controls_Left_JoyConController_Stick_Button")),
DPadUp = Parser.Value("Controls_Left_JoyConController_DPad_Up"), DPadUp = Enum.Parse<GamePadButton>(Parser.Value("Controls_Left_JoyConController_DPad_Up")),
DPadDown = Parser.Value("Controls_Left_JoyConController_DPad_Down"), DPadDown = Enum.Parse<GamePadButton>(Parser.Value("Controls_Left_JoyConController_DPad_Down")),
DPadLeft = Parser.Value("Controls_Left_JoyConController_DPad_Left"), DPadLeft = Enum.Parse<GamePadButton>(Parser.Value("Controls_Left_JoyConController_DPad_Left")),
DPadRight = Parser.Value("Controls_Left_JoyConController_DPad_Right"), DPadRight = Enum.Parse<GamePadButton>(Parser.Value("Controls_Left_JoyConController_DPad_Right")),
ButtonMinus = Parser.Value("Controls_Left_JoyConController_Button_Minus"), ButtonMinus = Enum.Parse<GamePadButton>(Parser.Value("Controls_Left_JoyConController_Button_Minus")),
ButtonL = Parser.Value("Controls_Left_JoyConController_Button_L"), ButtonL = Enum.Parse<GamePadButton>(Parser.Value("Controls_Left_JoyConController_Button_L")),
ButtonZL = Parser.Value("Controls_Left_JoyConController_Button_ZL") ButtonZL = Enum.Parse<GamePadButton>(Parser.Value("Controls_Left_JoyConController_Button_ZL"))
}, },
Right = new JoyConControllerRight Right = new JoyConControllerRight
{ {
Stick = Parser.Value("Controls_Right_JoyConController_Stick"), Stick = Enum.Parse<GamePadStick>(Parser.Value("Controls_Right_JoyConController_Stick")),
StickButton = Parser.Value("Controls_Right_JoyConController_Stick_Button"), StickButton = Enum.Parse<GamePadButton>(Parser.Value("Controls_Right_JoyConController_Stick_Button")),
ButtonA = Parser.Value("Controls_Right_JoyConController_Button_A"), ButtonA = Enum.Parse<GamePadButton>(Parser.Value("Controls_Right_JoyConController_Button_A")),
ButtonB = Parser.Value("Controls_Right_JoyConController_Button_B"), ButtonB = Enum.Parse<GamePadButton>(Parser.Value("Controls_Right_JoyConController_Button_B")),
ButtonX = Parser.Value("Controls_Right_JoyConController_Button_X"), ButtonX = Enum.Parse<GamePadButton>(Parser.Value("Controls_Right_JoyConController_Button_X")),
ButtonY = Parser.Value("Controls_Right_JoyConController_Button_Y"), ButtonY = Enum.Parse<GamePadButton>(Parser.Value("Controls_Right_JoyConController_Button_Y")),
ButtonPlus = Parser.Value("Controls_Right_JoyConController_Button_Plus"), ButtonPlus = Enum.Parse<GamePadButton>(Parser.Value("Controls_Right_JoyConController_Button_Plus")),
ButtonR = Parser.Value("Controls_Right_JoyConController_Button_R"), ButtonR = Enum.Parse<GamePadButton>(Parser.Value("Controls_Right_JoyConController_Button_R")),
ButtonZR = Parser.Value("Controls_Right_JoyConController_Button_ZR") ButtonZR = Enum.Parse<GamePadButton>(Parser.Value("Controls_Right_JoyConController_Button_ZR"))
} }
}; };
} }

View file

@ -4,6 +4,7 @@ using OpenTK.Input;
using Ryujinx.Graphics.Gal; using Ryujinx.Graphics.Gal;
using Ryujinx.HLE; using Ryujinx.HLE;
using Ryujinx.HLE.Input; using Ryujinx.HLE.Input;
using Ryujinx.Common.Input;
using System; using System;
using System.Threading; using System.Threading;
@ -130,57 +131,57 @@ namespace Ryujinx
} }
} }
private bool IsGamePadButtonPressedFromString(GamePadState GamePad, string Button) private bool IsGamePadButtonPressed(GamePadState GamePad, GamePadButton Button)
{ {
if (Button.ToUpper() == "LTRIGGER" || Button.ToUpper() == "RTRIGGER") if (Button == GamePadButton.LTrigger || Button == GamePadButton.RTrigger)
{ {
return GetGamePadTriggerFromString(GamePad, Button) >= Config.GamePadTriggerThreshold; return GetGamePadTrigger(GamePad, Button) >= Config.GamePadTriggerThreshold;
} }
else else
{ {
return (GetGamePadButtonFromString(GamePad, Button) == ButtonState.Pressed); return (GetGamePadButton(GamePad, Button) == ButtonState.Pressed);
} }
} }
private ButtonState GetGamePadButtonFromString(GamePadState GamePad, string Button) private ButtonState GetGamePadButton(GamePadState GamePad, GamePadButton Button)
{ {
switch (Button.ToUpper()) switch (Button)
{ {
case "A": return GamePad.Buttons.A; case GamePadButton.A: return GamePad.Buttons.A;
case "B": return GamePad.Buttons.B; case GamePadButton.B: return GamePad.Buttons.B;
case "X": return GamePad.Buttons.X; case GamePadButton.X: return GamePad.Buttons.X;
case "Y": return GamePad.Buttons.Y; case GamePadButton.Y: return GamePad.Buttons.Y;
case "LSTICK": return GamePad.Buttons.LeftStick; case GamePadButton.LStick: return GamePad.Buttons.LeftStick;
case "RSTICK": return GamePad.Buttons.RightStick; case GamePadButton.RStick: return GamePad.Buttons.RightStick;
case "LSHOULDER": return GamePad.Buttons.LeftShoulder; case GamePadButton.LShoulder: return GamePad.Buttons.LeftShoulder;
case "RSHOULDER": return GamePad.Buttons.RightShoulder; case GamePadButton.RShoulder: return GamePad.Buttons.RightShoulder;
case "DPADUP": return GamePad.DPad.Up; case GamePadButton.DPadUp: return GamePad.DPad.Up;
case "DPADDOWN": return GamePad.DPad.Down; case GamePadButton.DPadDown: return GamePad.DPad.Down;
case "DPADLEFT": return GamePad.DPad.Left; case GamePadButton.DPadLeft: return GamePad.DPad.Left;
case "DPADRIGHT": return GamePad.DPad.Right; case GamePadButton.DPadRight: return GamePad.DPad.Right;
case "START": return GamePad.Buttons.Start; case GamePadButton.Start: return GamePad.Buttons.Start;
case "BACK": return GamePad.Buttons.Back; case GamePadButton.Back: return GamePad.Buttons.Back;
default: throw new ArgumentException(); default: throw new ArgumentException();
} }
} }
private float GetGamePadTriggerFromString(GamePadState GamePad, string Trigger) private float GetGamePadTrigger(GamePadState GamePad, GamePadButton Trigger)
{ {
switch (Trigger.ToUpper()) switch (Trigger)
{ {
case "LTRIGGER": return GamePad.Triggers.Left; case GamePadButton.LTrigger: return GamePad.Triggers.Left;
case "RTRIGGER": return GamePad.Triggers.Right; case GamePadButton.RTrigger: return GamePad.Triggers.Right;
default: throw new ArgumentException(); default: throw new ArgumentException();
} }
} }
private Vector2 GetJoystickAxisFromString(GamePadState GamePad, string Joystick) private Vector2 GetJoystickAxisFromString(GamePadState GamePad, GamePadStick Joystick)
{ {
switch (Joystick.ToUpper()) switch (Joystick)
{ {
case "LJOYSTICK": return GamePad.ThumbSticks.Left; case GamePadStick.LJoystick: return GamePad.ThumbSticks.Left;
case "RJOYSTICK": return new Vector2(-GamePad.ThumbSticks.Right.Y, -GamePad.ThumbSticks.Right.X); case GamePadStick.RJoystick: return new Vector2(-GamePad.ThumbSticks.Right.Y, -GamePad.ThumbSticks.Right.X);
default: throw new ArgumentException(); default: throw new ArgumentException();
} }
} }
@ -241,24 +242,24 @@ namespace Ryujinx
{ {
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex); GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
//LeftButtons //LeftButtons
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.DPadUp)) CurrentButton |= HidControllerButtons.KEY_DUP; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.DPadUp)) CurrentButton |= HidControllerButtons.KEY_DUP;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.DPadDown)) CurrentButton |= HidControllerButtons.KEY_DDOWN; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.DPadDown)) CurrentButton |= HidControllerButtons.KEY_DDOWN;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.DPadLeft)) CurrentButton |= HidControllerButtons.KEY_DLEFT; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.DPadLeft)) CurrentButton |= HidControllerButtons.KEY_DLEFT;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.DPadRight)) CurrentButton |= HidControllerButtons.KEY_DRIGHT; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.DPadRight)) CurrentButton |= HidControllerButtons.KEY_DRIGHT;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.StickButton)) CurrentButton |= HidControllerButtons.KEY_LSTICK; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.StickButton)) CurrentButton |= HidControllerButtons.KEY_LSTICK;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.ButtonMinus)) CurrentButton |= HidControllerButtons.KEY_MINUS; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.ButtonMinus)) CurrentButton |= HidControllerButtons.KEY_MINUS;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.ButtonL)) CurrentButton |= HidControllerButtons.KEY_L; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.ButtonL)) CurrentButton |= HidControllerButtons.KEY_L;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.ButtonZL)) CurrentButton |= HidControllerButtons.KEY_ZL; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Left.ButtonZL)) CurrentButton |= HidControllerButtons.KEY_ZL;
//RightButtons //RightButtons
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonA)) CurrentButton |= HidControllerButtons.KEY_A; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonA)) CurrentButton |= HidControllerButtons.KEY_A;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonB)) CurrentButton |= HidControllerButtons.KEY_B; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonB)) CurrentButton |= HidControllerButtons.KEY_B;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonX)) CurrentButton |= HidControllerButtons.KEY_X; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonX)) CurrentButton |= HidControllerButtons.KEY_X;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonY)) CurrentButton |= HidControllerButtons.KEY_Y; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonY)) CurrentButton |= HidControllerButtons.KEY_Y;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.StickButton)) CurrentButton |= HidControllerButtons.KEY_RSTICK; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.StickButton)) CurrentButton |= HidControllerButtons.KEY_RSTICK;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonPlus)) CurrentButton |= HidControllerButtons.KEY_PLUS; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonPlus)) CurrentButton |= HidControllerButtons.KEY_PLUS;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonR)) CurrentButton |= HidControllerButtons.KEY_R; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonR)) CurrentButton |= HidControllerButtons.KEY_R;
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonZR)) CurrentButton |= HidControllerButtons.KEY_ZR; if (IsGamePadButtonPressed(GamePad, Config.JoyConController.Right.ButtonZR)) CurrentButton |= HidControllerButtons.KEY_ZR;
//LeftJoystick //LeftJoystick
if (GetJoystickAxisFromString(GamePad, Config.JoyConController.Left.Stick).X >= AnalogStickDeadzone if (GetJoystickAxisFromString(GamePad, Config.JoyConController.Left.Stick).X >= AnalogStickDeadzone