From bd6e346b88bf11250405d8c3100b1eb12b35073d Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Sat, 27 Oct 2018 16:30:29 -0500 Subject: [PATCH] Change naming convention for Ryujinx project --- Ryujinx/Config.cs | 190 ++++++++++++++-------------- Ryujinx/Ui/ConsoleLog.cs | 44 +++---- Ryujinx/Ui/GLScreen.cs | 222 ++++++++++++++++----------------- Ryujinx/Ui/JoyConController.cs | 176 +++++++++++++------------- Ryujinx/Ui/JoyConKeyboard.cs | 82 ++++++------ Ryujinx/Ui/Program.cs | 36 +++--- 6 files changed, 375 insertions(+), 375 deletions(-) diff --git a/Ryujinx/Config.cs b/Ryujinx/Config.cs index 3e4d4dd3f4..2e73985250 100644 --- a/Ryujinx/Config.cs +++ b/Ryujinx/Config.cs @@ -15,29 +15,29 @@ namespace Ryujinx public static JoyConKeyboard JoyConKeyboard { get; private set; } public static JoyConController JoyConController { get; private set; } - public static void Read(Switch Device) + public static void Read(Switch device) { - string IniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + string iniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); - string IniPath = Path.Combine(IniFolder, "Ryujinx.conf"); + string iniPath = Path.Combine(iniFolder, "Ryujinx.conf"); - IniParser Parser = new IniParser(IniPath); + IniParser parser = new IniParser(iniPath); - GraphicsConfig.ShadersDumpPath = Parser.Value("Graphics_Shaders_Dump_Path"); + GraphicsConfig.ShadersDumpPath = parser.Value("Graphics_Shaders_Dump_Path"); - Logger.SetEnable(LogLevel.Debug, Convert.ToBoolean(Parser.Value("Logging_Enable_Debug"))); - Logger.SetEnable(LogLevel.Stub, Convert.ToBoolean(Parser.Value("Logging_Enable_Stub"))); - Logger.SetEnable(LogLevel.Info, Convert.ToBoolean(Parser.Value("Logging_Enable_Info"))); - Logger.SetEnable(LogLevel.Warning, Convert.ToBoolean(Parser.Value("Logging_Enable_Warn"))); - Logger.SetEnable(LogLevel.Error, Convert.ToBoolean(Parser.Value("Logging_Enable_Error"))); + Logger.SetEnable(LogLevel.Debug, Convert.ToBoolean(parser.Value("Logging_Enable_Debug"))); + Logger.SetEnable(LogLevel.Stub, Convert.ToBoolean(parser.Value("Logging_Enable_Stub"))); + Logger.SetEnable(LogLevel.Info, Convert.ToBoolean(parser.Value("Logging_Enable_Info"))); + Logger.SetEnable(LogLevel.Warning, Convert.ToBoolean(parser.Value("Logging_Enable_Warn"))); + Logger.SetEnable(LogLevel.Error, Convert.ToBoolean(parser.Value("Logging_Enable_Error"))); - string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries); + string[] filteredLogClasses = parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries); //When the classes are specified on the list, we only //enable the classes that are on the list. //So, first disable everything, then enable //the classes that the user added to the list. - if (FilteredLogClasses.Length > 0) + if (filteredLogClasses.Length > 0) { foreach (LogClass Class in Enum.GetValues(typeof(LogClass))) { @@ -45,13 +45,13 @@ namespace Ryujinx } } - foreach (string LogClass in FilteredLogClasses) + foreach (string logClass in filteredLogClasses) { - if (!string.IsNullOrEmpty(LogClass.Trim())) + if (!string.IsNullOrEmpty(logClass.Trim())) { foreach (LogClass Class in Enum.GetValues(typeof(LogClass))) { - if (Class.ToString().ToLower().Contains(LogClass.Trim().ToLower())) + if (Class.ToString().ToLower().Contains(logClass.Trim().ToLower())) { Logger.SetEnable(Class, true); } @@ -59,111 +59,111 @@ namespace Ryujinx } } - Device.System.State.DockedMode = Convert.ToBoolean(Parser.Value("Docked_Mode")); + device.System.State.DockedMode = Convert.ToBoolean(parser.Value("Docked_Mode")); - Device.EnableDeviceVsync = Convert.ToBoolean(Parser.Value("Enable_Vsync")); + device.EnableDeviceVsync = Convert.ToBoolean(parser.Value("Enable_Vsync")); - if (Convert.ToBoolean(Parser.Value("Enable_MultiCore_Scheduling"))) + if (Convert.ToBoolean(parser.Value("Enable_MultiCore_Scheduling"))) { - Device.System.EnableMultiCoreScheduling(); + device.System.EnableMultiCoreScheduling(); } - Device.System.EnableFsIntegrityChecks = Convert.ToBoolean(Parser.Value("Enable_FS_Integrity_Checks")); + device.System.EnableFsIntegrityChecks = Convert.ToBoolean(parser.Value("Enable_FS_Integrity_Checks")); JoyConKeyboard = new JoyConKeyboard( 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")) + 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")) + 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")) }); JoyConController = new JoyConController( - Convert.ToBoolean(Parser.Value("GamePad_Enable")), - Convert.ToInt32 (Parser.Value("GamePad_Index")), - (float)Convert.ToDouble (Parser.Value("GamePad_Deadzone"), CultureInfo.InvariantCulture), - (float)Convert.ToDouble (Parser.Value("GamePad_Trigger_Threshold"), CultureInfo.InvariantCulture), + Convert.ToBoolean(parser.Value("GamePad_Enable")), + Convert.ToInt32 (parser.Value("GamePad_Index")), + (float)Convert.ToDouble (parser.Value("GamePad_Deadzone"), CultureInfo.InvariantCulture), + (float)Convert.ToDouble (parser.Value("GamePad_Trigger_Threshold"), CultureInfo.InvariantCulture), new JoyConControllerLeft { - Stick = ToID(Parser.Value("Controls_Left_JoyConController_Stick")), - StickButton = ToID(Parser.Value("Controls_Left_JoyConController_Stick_Button")), - DPadUp = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Up")), - DPadDown = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Down")), - DPadLeft = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Left")), - DPadRight = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Right")), - ButtonMinus = ToID(Parser.Value("Controls_Left_JoyConController_Button_Minus")), - ButtonL = ToID(Parser.Value("Controls_Left_JoyConController_Button_L")), - ButtonZL = ToID(Parser.Value("Controls_Left_JoyConController_Button_ZL")) + Stick = ToId(parser.Value("Controls_Left_JoyConController_Stick")), + StickButton = ToId(parser.Value("Controls_Left_JoyConController_Stick_Button")), + DPadUp = ToId(parser.Value("Controls_Left_JoyConController_DPad_Up")), + DPadDown = ToId(parser.Value("Controls_Left_JoyConController_DPad_Down")), + DPadLeft = ToId(parser.Value("Controls_Left_JoyConController_DPad_Left")), + DPadRight = ToId(parser.Value("Controls_Left_JoyConController_DPad_Right")), + ButtonMinus = ToId(parser.Value("Controls_Left_JoyConController_Button_Minus")), + ButtonL = ToId(parser.Value("Controls_Left_JoyConController_Button_L")), + ButtonZl = ToId(parser.Value("Controls_Left_JoyConController_Button_ZL")) }, new JoyConControllerRight { - Stick = ToID(Parser.Value("Controls_Right_JoyConController_Stick")), - StickButton = ToID(Parser.Value("Controls_Right_JoyConController_Stick_Button")), - ButtonA = ToID(Parser.Value("Controls_Right_JoyConController_Button_A")), - ButtonB = ToID(Parser.Value("Controls_Right_JoyConController_Button_B")), - ButtonX = ToID(Parser.Value("Controls_Right_JoyConController_Button_X")), - ButtonY = ToID(Parser.Value("Controls_Right_JoyConController_Button_Y")), - ButtonPlus = ToID(Parser.Value("Controls_Right_JoyConController_Button_Plus")), - ButtonR = ToID(Parser.Value("Controls_Right_JoyConController_Button_R")), - ButtonZR = ToID(Parser.Value("Controls_Right_JoyConController_Button_ZR")) + Stick = ToId(parser.Value("Controls_Right_JoyConController_Stick")), + StickButton = ToId(parser.Value("Controls_Right_JoyConController_Stick_Button")), + ButtonA = ToId(parser.Value("Controls_Right_JoyConController_Button_A")), + ButtonB = ToId(parser.Value("Controls_Right_JoyConController_Button_B")), + ButtonX = ToId(parser.Value("Controls_Right_JoyConController_Button_X")), + ButtonY = ToId(parser.Value("Controls_Right_JoyConController_Button_Y")), + ButtonPlus = ToId(parser.Value("Controls_Right_JoyConController_Button_Plus")), + ButtonR = ToId(parser.Value("Controls_Right_JoyConController_Button_R")), + ButtonZr = ToId(parser.Value("Controls_Right_JoyConController_Button_ZR")) }); } - private static ControllerInputID ToID(string Key) + private static ControllerInputId ToId(string key) { - switch (Key.ToUpper()) + switch (key.ToUpper()) { - case "LSTICK": return ControllerInputID.LStick; - case "DPADUP": return ControllerInputID.DPadUp; - case "DPADDOWN": return ControllerInputID.DPadDown; - case "DPADLEFT": return ControllerInputID.DPadLeft; - case "DPADRIGHT": return ControllerInputID.DPadRight; - case "BACK": return ControllerInputID.Back; - case "LSHOULDER": return ControllerInputID.LShoulder; - case "LTRIGGER": return ControllerInputID.LTrigger; + case "LSTICK": return ControllerInputId.LStick; + case "DPADUP": return ControllerInputId.DPadUp; + case "DPADDOWN": return ControllerInputId.DPadDown; + case "DPADLEFT": return ControllerInputId.DPadLeft; + case "DPADRIGHT": return ControllerInputId.DPadRight; + case "BACK": return ControllerInputId.Back; + case "LSHOULDER": return ControllerInputId.LShoulder; + case "LTRIGGER": return ControllerInputId.LTrigger; - case "RSTICK": return ControllerInputID.RStick; - case "A": return ControllerInputID.A; - case "B": return ControllerInputID.B; - case "X": return ControllerInputID.X; - case "Y": return ControllerInputID.Y; - case "START": return ControllerInputID.Start; - case "RSHOULDER": return ControllerInputID.RShoulder; - case "RTRIGGER": return ControllerInputID.RTrigger; + case "RSTICK": return ControllerInputId.RStick; + case "A": return ControllerInputId.A; + case "B": return ControllerInputId.B; + case "X": return ControllerInputId.X; + case "Y": return ControllerInputId.Y; + case "START": return ControllerInputId.Start; + case "RSHOULDER": return ControllerInputId.RShoulder; + case "RTRIGGER": return ControllerInputId.RTrigger; - case "LJOYSTICK": return ControllerInputID.LJoystick; - case "RJOYSTICK": return ControllerInputID.RJoystick; + case "LJOYSTICK": return ControllerInputId.LJoystick; + case "RJOYSTICK": return ControllerInputId.RJoystick; - default: return ControllerInputID.Invalid; + default: return ControllerInputId.Invalid; } } } @@ -171,19 +171,19 @@ namespace Ryujinx //https://stackoverflow.com/a/37772571 public class IniParser { - private readonly Dictionary Values; + private readonly Dictionary _values; - public IniParser(string Path) + public IniParser(string path) { - Values = File.ReadLines(Path) - .Where(Line => !string.IsNullOrWhiteSpace(Line) && !Line.StartsWith('#')) - .Select(Line => Line.Split('=', 2)) - .ToDictionary(Parts => Parts[0].Trim(), Parts => Parts.Length > 1 ? Parts[1].Trim() : null); + _values = File.ReadLines(path) + .Where(line => !string.IsNullOrWhiteSpace(line) && !line.StartsWith('#')) + .Select(line => line.Split('=', 2)) + .ToDictionary(parts => parts[0].Trim(), parts => parts.Length > 1 ? parts[1].Trim() : null); } - public string Value(string Name) + public string Value(string name) { - return Values.TryGetValue(Name, out string Value) ? Value : null; + return _values.TryGetValue(name, out string value) ? value : null; } } } \ No newline at end of file diff --git a/Ryujinx/Ui/ConsoleLog.cs b/Ryujinx/Ui/ConsoleLog.cs index 5ae13817e4..1ecd4cde44 100644 --- a/Ryujinx/Ui/ConsoleLog.cs +++ b/Ryujinx/Ui/ConsoleLog.cs @@ -8,17 +8,17 @@ namespace Ryujinx { static class ConsoleLog { - private static Thread MessageThread; + private static Thread _messageThread; - private static BlockingCollection MessageQueue; + private static BlockingCollection _messageQueue; - private static Dictionary LogColors; + private static Dictionary _logColors; - private static object ConsoleLock; + private static object _consoleLock; static ConsoleLog() { - LogColors = new Dictionary() + _logColors = new Dictionary() { { LogLevel.Stub, ConsoleColor.DarkGray }, { LogLevel.Info, ConsoleColor.White }, @@ -26,17 +26,17 @@ namespace Ryujinx { LogLevel.Error, ConsoleColor.Red } }; - MessageQueue = new BlockingCollection(); + _messageQueue = new BlockingCollection(); - ConsoleLock = new object(); + _consoleLock = new object(); - MessageThread = new Thread(() => + _messageThread = new Thread(() => { - while (!MessageQueue.IsCompleted) + while (!_messageQueue.IsCompleted) { try { - PrintLog(MessageQueue.Take()); + PrintLog(_messageQueue.Take()); } catch (InvalidOperationException) { @@ -49,39 +49,39 @@ namespace Ryujinx } }); - MessageThread.IsBackground = true; - MessageThread.Start(); + _messageThread.IsBackground = true; + _messageThread.Start(); } private static void PrintLog(LogEventArgs e) { - string FormattedTime = e.Time.ToString(@"hh\:mm\:ss\.fff"); + string formattedTime = e.Time.ToString(@"hh\:mm\:ss\.fff"); - string CurrentThread = Thread.CurrentThread.ManagedThreadId.ToString("d4"); + string currentThread = Thread.CurrentThread.ManagedThreadId.ToString("d4"); - string Message = FormattedTime + " | " + CurrentThread + " " + e.Message; + string message = formattedTime + " | " + currentThread + " " + e.Message; - if (LogColors.TryGetValue(e.Level, out ConsoleColor Color)) + if (_logColors.TryGetValue(e.Level, out ConsoleColor color)) { - lock (ConsoleLock) + lock (_consoleLock) { - Console.ForegroundColor = Color; + Console.ForegroundColor = color; - Console.WriteLine(Message); + Console.WriteLine(message); Console.ResetColor(); } } else { - Console.WriteLine(Message); + Console.WriteLine(message); } } public static void Log(object sender, LogEventArgs e) { - if (!MessageQueue.IsAddingCompleted) + if (!_messageQueue.IsAddingCompleted) { - MessageQueue.Add(e); + _messageQueue.Add(e); } } } diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index 27f3f08b56..08335dc0d3 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -11,37 +11,37 @@ using Stopwatch = System.Diagnostics.Stopwatch; namespace Ryujinx { - public class GLScreen : GameWindow + public class GlScreen : GameWindow { private const int TouchScreenWidth = 1280; private const int TouchScreenHeight = 720; - private const int TargetFPS = 60; + private const int TargetFps = 60; - private Switch Device; + private Switch _device; - private IGalRenderer Renderer; + private IGalRenderer _renderer; - private KeyboardState? Keyboard = null; + private KeyboardState? _keyboard = null; - private MouseState? Mouse = null; + private MouseState? _mouse = null; - private Thread RenderThread; + private Thread _renderThread; - private bool ResizeEvent; + private bool _resizeEvent; - private bool TitleEvent; + private bool _titleEvent; - private string NewTitle; + private string _newTitle; - public GLScreen(Switch Device, IGalRenderer Renderer) + public GlScreen(Switch device, IGalRenderer renderer) : base(1280, 720, new GraphicsMode(), "Ryujinx", 0, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible) { - this.Device = Device; - this.Renderer = Renderer; + this._device = device; + this._renderer = renderer; Location = new Point( (DisplayDevice.Default.Width / 2) - (Width / 2), @@ -52,40 +52,40 @@ namespace Ryujinx { MakeCurrent(); - Stopwatch Chrono = new Stopwatch(); + Stopwatch chrono = new Stopwatch(); - Chrono.Start(); + chrono.Start(); - long TicksPerFrame = Stopwatch.Frequency / TargetFPS; + long ticksPerFrame = Stopwatch.Frequency / TargetFps; - long Ticks = 0; + long ticks = 0; while (Exists && !IsExiting) { - if (Device.WaitFifo()) + if (_device.WaitFifo()) { - Device.ProcessFrame(); + _device.ProcessFrame(); } - Renderer.RunActions(); + _renderer.RunActions(); - if (ResizeEvent) + if (_resizeEvent) { - ResizeEvent = false; + _resizeEvent = false; - Renderer.RenderTarget.SetWindowSize(Width, Height); + _renderer.RenderTarget.SetWindowSize(Width, Height); } - Ticks += Chrono.ElapsedTicks; + ticks += chrono.ElapsedTicks; - Chrono.Restart(); + chrono.Restart(); - if (Ticks >= TicksPerFrame) + if (ticks >= ticksPerFrame) { RenderFrame(); //Queue max. 1 vsync - Ticks = Math.Min(Ticks - TicksPerFrame, TicksPerFrame); + ticks = Math.Min(ticks - ticksPerFrame, ticksPerFrame); } } } @@ -96,14 +96,14 @@ namespace Ryujinx Visible = true; - Renderer.RenderTarget.SetWindowSize(Width, Height); + _renderer.RenderTarget.SetWindowSize(Width, Height); Context.MakeCurrent(null); //OpenTK doesn't like sleeps in its thread, to avoid this a renderer thread is created - RenderThread = new Thread(RenderLoop); + _renderThread = new Thread(RenderLoop); - RenderThread.Start(); + _renderThread.Start(); while (Exists && !IsExiting) { @@ -113,11 +113,11 @@ namespace Ryujinx { UpdateFrame(); - if (TitleEvent) + if (_titleEvent) { - TitleEvent = false; + _titleEvent = false; - Title = NewTitle; + Title = _newTitle; } } @@ -128,94 +128,94 @@ namespace Ryujinx private new void UpdateFrame() { - HidControllerButtons CurrentButton = 0; - HidJoystickPosition LeftJoystick; - HidJoystickPosition RightJoystick; + HidControllerButtons currentButton = 0; + HidJoystickPosition leftJoystick; + HidJoystickPosition rightJoystick; - int LeftJoystickDX = 0; - int LeftJoystickDY = 0; - int RightJoystickDX = 0; - int RightJoystickDY = 0; + int leftJoystickDx = 0; + int leftJoystickDy = 0; + int rightJoystickDx = 0; + int rightJoystickDy = 0; //Keyboard Input - if (Keyboard.HasValue) + if (_keyboard.HasValue) { - KeyboardState Keyboard = this.Keyboard.Value; + KeyboardState keyboard = this._keyboard.Value; - CurrentButton = Config.JoyConKeyboard.GetButtons(Keyboard); + currentButton = Config.JoyConKeyboard.GetButtons(keyboard); - (LeftJoystickDX, LeftJoystickDY) = Config.JoyConKeyboard.GetLeftStick(Keyboard); + (leftJoystickDx, leftJoystickDy) = Config.JoyConKeyboard.GetLeftStick(keyboard); - (RightJoystickDX, RightJoystickDY) = Config.JoyConKeyboard.GetRightStick(Keyboard); + (rightJoystickDx, rightJoystickDy) = Config.JoyConKeyboard.GetRightStick(keyboard); } //Controller Input - CurrentButton |= Config.JoyConController.GetButtons(); + currentButton |= Config.JoyConController.GetButtons(); //Keyboard has priority stick-wise - if (LeftJoystickDX == 0 && LeftJoystickDY == 0) + if (leftJoystickDx == 0 && leftJoystickDy == 0) { - (LeftJoystickDX, LeftJoystickDY) = Config.JoyConController.GetLeftStick(); + (leftJoystickDx, leftJoystickDy) = Config.JoyConController.GetLeftStick(); } - if (RightJoystickDX == 0 && RightJoystickDY == 0) + if (rightJoystickDx == 0 && rightJoystickDy == 0) { - (RightJoystickDX, RightJoystickDY) = Config.JoyConController.GetRightStick(); + (rightJoystickDx, rightJoystickDy) = Config.JoyConController.GetRightStick(); } - LeftJoystick = new HidJoystickPosition + leftJoystick = new HidJoystickPosition { - DX = LeftJoystickDX, - DY = LeftJoystickDY + DX = leftJoystickDx, + DY = leftJoystickDy }; - RightJoystick = new HidJoystickPosition + rightJoystick = new HidJoystickPosition { - DX = RightJoystickDX, - DY = RightJoystickDY + DX = rightJoystickDx, + DY = rightJoystickDy }; - bool HasTouch = false; + bool hasTouch = false; //Get screen touch position from left mouse click //OpenTK always captures mouse events, even if out of focus, so check if window is focused. - if (Focused && Mouse?.LeftButton == ButtonState.Pressed) + if (Focused && _mouse?.LeftButton == ButtonState.Pressed) { - MouseState Mouse = this.Mouse.Value; + MouseState mouse = this._mouse.Value; - int ScrnWidth = Width; - int ScrnHeight = Height; + int scrnWidth = Width; + int scrnHeight = Height; if (Width > (Height * TouchScreenWidth) / TouchScreenHeight) { - ScrnWidth = (Height * TouchScreenWidth) / TouchScreenHeight; + scrnWidth = (Height * TouchScreenWidth) / TouchScreenHeight; } else { - ScrnHeight = (Width * TouchScreenHeight) / TouchScreenWidth; + scrnHeight = (Width * TouchScreenHeight) / TouchScreenWidth; } - int StartX = (Width - ScrnWidth) >> 1; - int StartY = (Height - ScrnHeight) >> 1; + int startX = (Width - scrnWidth) >> 1; + int startY = (Height - scrnHeight) >> 1; - int EndX = StartX + ScrnWidth; - int EndY = StartY + ScrnHeight; + int endX = startX + scrnWidth; + int endY = startY + scrnHeight; - if (Mouse.X >= StartX && - Mouse.Y >= StartY && - Mouse.X < EndX && - Mouse.Y < EndY) + if (mouse.X >= startX && + mouse.Y >= startY && + mouse.X < endX && + mouse.Y < endY) { - int ScrnMouseX = Mouse.X - StartX; - int ScrnMouseY = Mouse.Y - StartY; + int scrnMouseX = mouse.X - startX; + int scrnMouseY = mouse.Y - startY; - int MX = (ScrnMouseX * TouchScreenWidth) / ScrnWidth; - int MY = (ScrnMouseY * TouchScreenHeight) / ScrnHeight; + int mx = (scrnMouseX * TouchScreenWidth) / scrnWidth; + int my = (scrnMouseY * TouchScreenHeight) / scrnHeight; - HidTouchPoint CurrentPoint = new HidTouchPoint + HidTouchPoint currentPoint = new HidTouchPoint { - X = MX, - Y = MY, + X = mx, + Y = my, //Placeholder values till more data is acquired DiameterX = 10, @@ -223,76 +223,76 @@ namespace Ryujinx Angle = 90 }; - HasTouch = true; + hasTouch = true; - Device.Hid.SetTouchPoints(CurrentPoint); + _device.Hid.SetTouchPoints(currentPoint); } } - if (!HasTouch) + if (!hasTouch) { - Device.Hid.SetTouchPoints(); + _device.Hid.SetTouchPoints(); } - Device.Hid.SetJoyconButton( + _device.Hid.SetJoyconButton( HidControllerId.CONTROLLER_HANDHELD, HidControllerLayouts.Handheld_Joined, - CurrentButton, - LeftJoystick, - RightJoystick); + currentButton, + leftJoystick, + rightJoystick); - Device.Hid.SetJoyconButton( + _device.Hid.SetJoyconButton( HidControllerId.CONTROLLER_HANDHELD, HidControllerLayouts.Main, - CurrentButton, - LeftJoystick, - RightJoystick); + currentButton, + leftJoystick, + rightJoystick); } private new void RenderFrame() { - Renderer.RenderTarget.Render(); + _renderer.RenderTarget.Render(); - Device.Statistics.RecordSystemFrameTime(); + _device.Statistics.RecordSystemFrameTime(); - double HostFps = Device.Statistics.GetSystemFrameRate(); - double GameFps = Device.Statistics.GetGameFrameRate(); + double hostFps = _device.Statistics.GetSystemFrameRate(); + double gameFps = _device.Statistics.GetGameFrameRate(); - string TitleSection = string.IsNullOrWhiteSpace(Device.System.CurrentTitle) ? string.Empty - : " | " + Device.System.CurrentTitle; + string titleSection = string.IsNullOrWhiteSpace(_device.System.CurrentTitle) ? string.Empty + : " | " + _device.System.CurrentTitle; - NewTitle = $"Ryujinx{TitleSection} | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0} | " + - $"Game Vsync: {(Device.EnableDeviceVsync ? "On" : "Off")}"; + _newTitle = $"Ryujinx{titleSection} | Host FPS: {hostFps:0.0} | Game FPS: {gameFps:0.0} | " + + $"Game Vsync: {(_device.EnableDeviceVsync ? "On" : "Off")}"; - TitleEvent = true; + _titleEvent = true; SwapBuffers(); - Device.System.SignalVsync(); + _device.System.SignalVsync(); - Device.VsyncEvent.Set(); + _device.VsyncEvent.Set(); } protected override void OnUnload(EventArgs e) { - RenderThread.Join(); + _renderThread.Join(); base.OnUnload(e); } protected override void OnResize(EventArgs e) { - ResizeEvent = true; + _resizeEvent = true; } protected override void OnKeyDown(KeyboardKeyEventArgs e) { - bool ToggleFullscreen = e.Key == Key.F11 || + bool toggleFullscreen = e.Key == Key.F11 || (e.Modifiers.HasFlag(KeyModifiers.Alt) && e.Key == Key.Enter); if (WindowState == WindowState.Fullscreen) { - if (e.Key == Key.Escape || ToggleFullscreen) + if (e.Key == Key.Escape || toggleFullscreen) { WindowState = WindowState.Normal; } @@ -304,33 +304,33 @@ namespace Ryujinx Exit(); } - if (ToggleFullscreen) + if (toggleFullscreen) { WindowState = WindowState.Fullscreen; } } - Keyboard = e.Keyboard; + _keyboard = e.Keyboard; } protected override void OnKeyUp(KeyboardKeyEventArgs e) { - Keyboard = e.Keyboard; + _keyboard = e.Keyboard; } protected override void OnMouseDown(MouseButtonEventArgs e) { - Mouse = e.Mouse; + _mouse = e.Mouse; } protected override void OnMouseUp(MouseButtonEventArgs e) { - Mouse = e.Mouse; + _mouse = e.Mouse; } protected override void OnMouseMove(MouseMoveEventArgs e) { - Mouse = e.Mouse; + _mouse = e.Mouse; } } } \ No newline at end of file diff --git a/Ryujinx/Ui/JoyConController.cs b/Ryujinx/Ui/JoyConController.cs index aac8efd7c4..faeac9d91c 100644 --- a/Ryujinx/Ui/JoyConController.cs +++ b/Ryujinx/Ui/JoyConController.cs @@ -5,7 +5,7 @@ using System; namespace Ryujinx.UI.Input { - public enum ControllerInputID + public enum ControllerInputId { Invalid, @@ -34,28 +34,28 @@ namespace Ryujinx.UI.Input public struct JoyConControllerLeft { - public ControllerInputID Stick; - public ControllerInputID StickButton; - public ControllerInputID DPadUp; - public ControllerInputID DPadDown; - public ControllerInputID DPadLeft; - public ControllerInputID DPadRight; - public ControllerInputID ButtonMinus; - public ControllerInputID ButtonL; - public ControllerInputID ButtonZL; + public ControllerInputId Stick; + public ControllerInputId StickButton; + public ControllerInputId DPadUp; + public ControllerInputId DPadDown; + public ControllerInputId DPadLeft; + public ControllerInputId DPadRight; + public ControllerInputId ButtonMinus; + public ControllerInputId ButtonL; + public ControllerInputId ButtonZl; } public struct JoyConControllerRight { - public ControllerInputID Stick; - public ControllerInputID StickButton; - public ControllerInputID ButtonA; - public ControllerInputID ButtonB; - public ControllerInputID ButtonX; - public ControllerInputID ButtonY; - public ControllerInputID ButtonPlus; - public ControllerInputID ButtonR; - public ControllerInputID ButtonZR; + public ControllerInputId Stick; + public ControllerInputId StickButton; + public ControllerInputId ButtonA; + public ControllerInputId ButtonB; + public ControllerInputId ButtonX; + public ControllerInputId ButtonY; + public ControllerInputId ButtonPlus; + public ControllerInputId ButtonR; + public ControllerInputId ButtonZr; } public class JoyConController @@ -69,22 +69,22 @@ namespace Ryujinx.UI.Input public JoyConControllerRight Right { private set; get; } public JoyConController( - bool Enabled, - int Index, - float Deadzone, - float TriggerThreshold, - JoyConControllerLeft Left, - JoyConControllerRight Right) + bool enabled, + int index, + float deadzone, + float triggerThreshold, + JoyConControllerLeft left, + JoyConControllerRight right) { - this.Enabled = Enabled; - this.Index = Index; - this.Deadzone = Deadzone; - this.TriggerThreshold = TriggerThreshold; - this.Left = Left; - this.Right = Right; + this.Enabled = enabled; + this.Index = index; + this.Deadzone = deadzone; + this.TriggerThreshold = triggerThreshold; + this.Left = left; + this.Right = right; //Unmapped controllers are problematic, skip them - if (GamePad.GetName(Index) == "Unmapped Controller") + if (GamePad.GetName(index) == "Unmapped Controller") { this.Enabled = false; } @@ -97,29 +97,29 @@ namespace Ryujinx.UI.Input return 0; } - GamePadState GpState = GamePad.GetState(Index); + GamePadState gpState = GamePad.GetState(Index); - HidControllerButtons Buttons = 0; + HidControllerButtons buttons = 0; - if (IsPressed(GpState, Left.DPadUp)) Buttons |= HidControllerButtons.KEY_DUP; - if (IsPressed(GpState, Left.DPadDown)) Buttons |= HidControllerButtons.KEY_DDOWN; - if (IsPressed(GpState, Left.DPadLeft)) Buttons |= HidControllerButtons.KEY_DLEFT; - if (IsPressed(GpState, Left.DPadRight)) Buttons |= HidControllerButtons.KEY_DRIGHT; - if (IsPressed(GpState, Left.StickButton)) Buttons |= HidControllerButtons.KEY_LSTICK; - if (IsPressed(GpState, Left.ButtonMinus)) Buttons |= HidControllerButtons.KEY_MINUS; - if (IsPressed(GpState, Left.ButtonL)) Buttons |= HidControllerButtons.KEY_L; - if (IsPressed(GpState, Left.ButtonZL)) Buttons |= HidControllerButtons.KEY_ZL; + if (IsPressed(gpState, Left.DPadUp)) buttons |= HidControllerButtons.KEY_DUP; + if (IsPressed(gpState, Left.DPadDown)) buttons |= HidControllerButtons.KEY_DDOWN; + if (IsPressed(gpState, Left.DPadLeft)) buttons |= HidControllerButtons.KEY_DLEFT; + if (IsPressed(gpState, Left.DPadRight)) buttons |= HidControllerButtons.KEY_DRIGHT; + if (IsPressed(gpState, Left.StickButton)) buttons |= HidControllerButtons.KEY_LSTICK; + if (IsPressed(gpState, Left.ButtonMinus)) buttons |= HidControllerButtons.KEY_MINUS; + if (IsPressed(gpState, Left.ButtonL)) buttons |= HidControllerButtons.KEY_L; + if (IsPressed(gpState, Left.ButtonZl)) buttons |= HidControllerButtons.KEY_ZL; - if (IsPressed(GpState, Right.ButtonA)) Buttons |= HidControllerButtons.KEY_A; - if (IsPressed(GpState, Right.ButtonB)) Buttons |= HidControllerButtons.KEY_B; - if (IsPressed(GpState, Right.ButtonX)) Buttons |= HidControllerButtons.KEY_X; - if (IsPressed(GpState, Right.ButtonY)) Buttons |= HidControllerButtons.KEY_Y; - if (IsPressed(GpState, Right.StickButton)) Buttons |= HidControllerButtons.KEY_RSTICK; - if (IsPressed(GpState, Right.ButtonPlus)) Buttons |= HidControllerButtons.KEY_PLUS; - if (IsPressed(GpState, Right.ButtonR)) Buttons |= HidControllerButtons.KEY_R; - if (IsPressed(GpState, Right.ButtonZR)) Buttons |= HidControllerButtons.KEY_ZR; + if (IsPressed(gpState, Right.ButtonA)) buttons |= HidControllerButtons.KEY_A; + if (IsPressed(gpState, Right.ButtonB)) buttons |= HidControllerButtons.KEY_B; + if (IsPressed(gpState, Right.ButtonX)) buttons |= HidControllerButtons.KEY_X; + if (IsPressed(gpState, Right.ButtonY)) buttons |= HidControllerButtons.KEY_Y; + if (IsPressed(gpState, Right.StickButton)) buttons |= HidControllerButtons.KEY_RSTICK; + if (IsPressed(gpState, Right.ButtonPlus)) buttons |= HidControllerButtons.KEY_PLUS; + if (IsPressed(gpState, Right.ButtonR)) buttons |= HidControllerButtons.KEY_R; + if (IsPressed(gpState, Right.ButtonZr)) buttons |= HidControllerButtons.KEY_ZR; - return Buttons; + return buttons; } public (short, short) GetLeftStick() @@ -142,71 +142,71 @@ namespace Ryujinx.UI.Input return GetStick(Right.Stick); } - private (short, short) GetStick(ControllerInputID Joystick) + private (short, short) GetStick(ControllerInputId joystick) { - GamePadState GpState = GamePad.GetState(Index); + GamePadState gpState = GamePad.GetState(Index); - switch (Joystick) + switch (joystick) { - case ControllerInputID.LJoystick: - return ApplyDeadzone(GpState.ThumbSticks.Left); + case ControllerInputId.LJoystick: + return ApplyDeadzone(gpState.ThumbSticks.Left); - case ControllerInputID.RJoystick: - return ApplyDeadzone(GpState.ThumbSticks.Right); + case ControllerInputId.RJoystick: + return ApplyDeadzone(gpState.ThumbSticks.Right); default: return (0, 0); } } - private (short, short) ApplyDeadzone(Vector2 Axis) + private (short, short) ApplyDeadzone(Vector2 axis) { - return (ClampAxis(MathF.Abs(Axis.X) > Deadzone ? Axis.X : 0f), - ClampAxis(MathF.Abs(Axis.Y) > Deadzone ? Axis.Y : 0f)); + return (ClampAxis(MathF.Abs(axis.X) > Deadzone ? axis.X : 0f), + ClampAxis(MathF.Abs(axis.Y) > Deadzone ? axis.Y : 0f)); } - private static short ClampAxis(float Value) + private static short ClampAxis(float value) { - if (Value <= -short.MaxValue) + if (value <= -short.MaxValue) { return -short.MaxValue; } else { - return (short)(Value * short.MaxValue); + return (short)(value * short.MaxValue); } } - private bool IsPressed(GamePadState GpState, ControllerInputID Button) + private bool IsPressed(GamePadState gpState, ControllerInputId button) { - switch (Button) + switch (button) { - case ControllerInputID.A: return GpState.Buttons.A == ButtonState.Pressed; - case ControllerInputID.B: return GpState.Buttons.B == ButtonState.Pressed; - case ControllerInputID.X: return GpState.Buttons.X == ButtonState.Pressed; - case ControllerInputID.Y: return GpState.Buttons.Y == ButtonState.Pressed; - case ControllerInputID.LStick: return GpState.Buttons.LeftStick == ButtonState.Pressed; - case ControllerInputID.RStick: return GpState.Buttons.RightStick == ButtonState.Pressed; - case ControllerInputID.LShoulder: return GpState.Buttons.LeftShoulder == ButtonState.Pressed; - case ControllerInputID.RShoulder: return GpState.Buttons.RightShoulder == ButtonState.Pressed; - case ControllerInputID.DPadUp: return GpState.DPad.Up == ButtonState.Pressed; - case ControllerInputID.DPadDown: return GpState.DPad.Down == ButtonState.Pressed; - case ControllerInputID.DPadLeft: return GpState.DPad.Left == ButtonState.Pressed; - case ControllerInputID.DPadRight: return GpState.DPad.Right == ButtonState.Pressed; - case ControllerInputID.Start: return GpState.Buttons.Start == ButtonState.Pressed; - case ControllerInputID.Back: return GpState.Buttons.Back == ButtonState.Pressed; + case ControllerInputId.A: return gpState.Buttons.A == ButtonState.Pressed; + case ControllerInputId.B: return gpState.Buttons.B == ButtonState.Pressed; + case ControllerInputId.X: return gpState.Buttons.X == ButtonState.Pressed; + case ControllerInputId.Y: return gpState.Buttons.Y == ButtonState.Pressed; + case ControllerInputId.LStick: return gpState.Buttons.LeftStick == ButtonState.Pressed; + case ControllerInputId.RStick: return gpState.Buttons.RightStick == ButtonState.Pressed; + case ControllerInputId.LShoulder: return gpState.Buttons.LeftShoulder == ButtonState.Pressed; + case ControllerInputId.RShoulder: return gpState.Buttons.RightShoulder == ButtonState.Pressed; + case ControllerInputId.DPadUp: return gpState.DPad.Up == ButtonState.Pressed; + case ControllerInputId.DPadDown: return gpState.DPad.Down == ButtonState.Pressed; + case ControllerInputId.DPadLeft: return gpState.DPad.Left == ButtonState.Pressed; + case ControllerInputId.DPadRight: return gpState.DPad.Right == ButtonState.Pressed; + case ControllerInputId.Start: return gpState.Buttons.Start == ButtonState.Pressed; + case ControllerInputId.Back: return gpState.Buttons.Back == ButtonState.Pressed; - case ControllerInputID.LTrigger: return GpState.Triggers.Left >= TriggerThreshold; - case ControllerInputID.RTrigger: return GpState.Triggers.Right >= TriggerThreshold; + case ControllerInputId.LTrigger: return gpState.Triggers.Left >= TriggerThreshold; + case ControllerInputId.RTrigger: return gpState.Triggers.Right >= TriggerThreshold; //Using thumbsticks as buttons is not common, but it would be nice not to ignore them - case ControllerInputID.LJoystick: - return GpState.ThumbSticks.Left.X >= Deadzone || - GpState.ThumbSticks.Left.Y >= Deadzone; + case ControllerInputId.LJoystick: + return gpState.ThumbSticks.Left.X >= Deadzone || + gpState.ThumbSticks.Left.Y >= Deadzone; - case ControllerInputID.RJoystick: - return GpState.ThumbSticks.Right.X >= Deadzone || - GpState.ThumbSticks.Right.Y >= Deadzone; + case ControllerInputId.RJoystick: + return gpState.ThumbSticks.Right.X >= Deadzone || + gpState.ThumbSticks.Right.Y >= Deadzone; default: return false; diff --git a/Ryujinx/Ui/JoyConKeyboard.cs b/Ryujinx/Ui/JoyConKeyboard.cs index ea9645539a..65def55429 100644 --- a/Ryujinx/Ui/JoyConKeyboard.cs +++ b/Ryujinx/Ui/JoyConKeyboard.cs @@ -16,7 +16,7 @@ namespace Ryujinx.UI.Input public int DPadRight; public int ButtonMinus; public int ButtonL; - public int ButtonZL; + public int ButtonZl; } public struct JoyConKeyboardRight @@ -32,7 +32,7 @@ namespace Ryujinx.UI.Input public int ButtonY; public int ButtonPlus; public int ButtonR; - public int ButtonZR; + public int ButtonZr; } public class JoyConKeyboard @@ -41,62 +41,62 @@ namespace Ryujinx.UI.Input public JoyConKeyboardRight Right; public JoyConKeyboard( - JoyConKeyboardLeft Left, - JoyConKeyboardRight Right) + JoyConKeyboardLeft left, + JoyConKeyboardRight right) { - this.Left = Left; - this.Right = Right; + this.Left = left; + this.Right = right; } - public HidControllerButtons GetButtons(KeyboardState Keyboard) + public HidControllerButtons GetButtons(KeyboardState keyboard) { - HidControllerButtons Buttons = 0; + HidControllerButtons buttons = 0; - if (Keyboard[(Key)Left.StickButton]) Buttons |= HidControllerButtons.KEY_LSTICK; - if (Keyboard[(Key)Left.DPadUp]) Buttons |= HidControllerButtons.KEY_DUP; - if (Keyboard[(Key)Left.DPadDown]) Buttons |= HidControllerButtons.KEY_DDOWN; - if (Keyboard[(Key)Left.DPadLeft]) Buttons |= HidControllerButtons.KEY_DLEFT; - if (Keyboard[(Key)Left.DPadRight]) Buttons |= HidControllerButtons.KEY_DRIGHT; - if (Keyboard[(Key)Left.ButtonMinus]) Buttons |= HidControllerButtons.KEY_MINUS; - if (Keyboard[(Key)Left.ButtonL]) Buttons |= HidControllerButtons.KEY_L; - if (Keyboard[(Key)Left.ButtonZL]) Buttons |= HidControllerButtons.KEY_ZL; + if (keyboard[(Key)Left.StickButton]) buttons |= HidControllerButtons.KEY_LSTICK; + if (keyboard[(Key)Left.DPadUp]) buttons |= HidControllerButtons.KEY_DUP; + if (keyboard[(Key)Left.DPadDown]) buttons |= HidControllerButtons.KEY_DDOWN; + if (keyboard[(Key)Left.DPadLeft]) buttons |= HidControllerButtons.KEY_DLEFT; + if (keyboard[(Key)Left.DPadRight]) buttons |= HidControllerButtons.KEY_DRIGHT; + if (keyboard[(Key)Left.ButtonMinus]) buttons |= HidControllerButtons.KEY_MINUS; + if (keyboard[(Key)Left.ButtonL]) buttons |= HidControllerButtons.KEY_L; + if (keyboard[(Key)Left.ButtonZl]) buttons |= HidControllerButtons.KEY_ZL; - if (Keyboard[(Key)Right.StickButton]) Buttons |= HidControllerButtons.KEY_RSTICK; - if (Keyboard[(Key)Right.ButtonA]) Buttons |= HidControllerButtons.KEY_A; - if (Keyboard[(Key)Right.ButtonB]) Buttons |= HidControllerButtons.KEY_B; - if (Keyboard[(Key)Right.ButtonX]) Buttons |= HidControllerButtons.KEY_X; - if (Keyboard[(Key)Right.ButtonY]) Buttons |= HidControllerButtons.KEY_Y; - if (Keyboard[(Key)Right.ButtonPlus]) Buttons |= HidControllerButtons.KEY_PLUS; - if (Keyboard[(Key)Right.ButtonR]) Buttons |= HidControllerButtons.KEY_R; - if (Keyboard[(Key)Right.ButtonZR]) Buttons |= HidControllerButtons.KEY_ZR; + if (keyboard[(Key)Right.StickButton]) buttons |= HidControllerButtons.KEY_RSTICK; + if (keyboard[(Key)Right.ButtonA]) buttons |= HidControllerButtons.KEY_A; + if (keyboard[(Key)Right.ButtonB]) buttons |= HidControllerButtons.KEY_B; + if (keyboard[(Key)Right.ButtonX]) buttons |= HidControllerButtons.KEY_X; + if (keyboard[(Key)Right.ButtonY]) buttons |= HidControllerButtons.KEY_Y; + if (keyboard[(Key)Right.ButtonPlus]) buttons |= HidControllerButtons.KEY_PLUS; + if (keyboard[(Key)Right.ButtonR]) buttons |= HidControllerButtons.KEY_R; + if (keyboard[(Key)Right.ButtonZr]) buttons |= HidControllerButtons.KEY_ZR; - return Buttons; + return buttons; } - public (short, short) GetLeftStick(KeyboardState Keyboard) + public (short, short) GetLeftStick(KeyboardState keyboard) { - short DX = 0; - short DY = 0; + short dx = 0; + short dy = 0; - if (Keyboard[(Key)Left.StickUp]) DY = short.MaxValue; - if (Keyboard[(Key)Left.StickDown]) DY = -short.MaxValue; - if (Keyboard[(Key)Left.StickLeft]) DX = -short.MaxValue; - if (Keyboard[(Key)Left.StickRight]) DX = short.MaxValue; + if (keyboard[(Key)Left.StickUp]) dy = short.MaxValue; + if (keyboard[(Key)Left.StickDown]) dy = -short.MaxValue; + if (keyboard[(Key)Left.StickLeft]) dx = -short.MaxValue; + if (keyboard[(Key)Left.StickRight]) dx = short.MaxValue; - return (DX, DY); + return (dx, dy); } - public (short, short) GetRightStick(KeyboardState Keyboard) + public (short, short) GetRightStick(KeyboardState keyboard) { - short DX = 0; - short DY = 0; + short dx = 0; + short dy = 0; - if (Keyboard[(Key)Right.StickUp]) DY = short.MaxValue; - if (Keyboard[(Key)Right.StickDown]) DY = -short.MaxValue; - if (Keyboard[(Key)Right.StickLeft]) DX = -short.MaxValue; - if (Keyboard[(Key)Right.StickRight]) DX = short.MaxValue; + if (keyboard[(Key)Right.StickUp]) dy = short.MaxValue; + if (keyboard[(Key)Right.StickDown]) dy = -short.MaxValue; + if (keyboard[(Key)Right.StickLeft]) dx = -short.MaxValue; + if (keyboard[(Key)Right.StickRight]) dx = short.MaxValue; - return (DX, DY); + return (dx, dy); } } } diff --git a/Ryujinx/Ui/Program.cs b/Ryujinx/Ui/Program.cs index 145ff33fd8..4edf6e4714 100644 --- a/Ryujinx/Ui/Program.cs +++ b/Ryujinx/Ui/Program.cs @@ -15,13 +15,13 @@ namespace Ryujinx { Console.Title = "Ryujinx Console"; - IGalRenderer Renderer = new OGLRenderer(); + IGalRenderer renderer = new OGLRenderer(); - IAalOutput AudioOut = new OpenALAudioOut(); + IAalOutput audioOut = new OpenALAudioOut(); - Switch Device = new Switch(Renderer, AudioOut); + Switch device = new Switch(renderer, audioOut); - Config.Read(Device); + Config.Read(device); Logger.Updated += ConsoleLog.Log; @@ -29,24 +29,24 @@ namespace Ryujinx { if (Directory.Exists(args[0])) { - string[] RomFsFiles = Directory.GetFiles(args[0], "*.istorage"); + string[] romFsFiles = Directory.GetFiles(args[0], "*.istorage"); - if (RomFsFiles.Length == 0) + if (romFsFiles.Length == 0) { - RomFsFiles = Directory.GetFiles(args[0], "*.romfs"); + romFsFiles = Directory.GetFiles(args[0], "*.romfs"); } - if (RomFsFiles.Length > 0) + if (romFsFiles.Length > 0) { Console.WriteLine("Loading as cart with RomFS."); - Device.LoadCart(args[0], RomFsFiles[0]); + device.LoadCart(args[0], romFsFiles[0]); } else { Console.WriteLine("Loading as cart WITHOUT RomFS."); - Device.LoadCart(args[0]); + device.LoadCart(args[0]); } } else if (File.Exists(args[0])) @@ -55,19 +55,19 @@ namespace Ryujinx { case ".xci": Console.WriteLine("Loading as XCI."); - Device.LoadXci(args[0]); + device.LoadXci(args[0]); break; case ".nca": Console.WriteLine("Loading as NCA."); - Device.LoadNca(args[0]); + device.LoadNca(args[0]); break; case ".nsp": Console.WriteLine("Loading as NSP."); - Device.LoadNsp(args[0]); + device.LoadNsp(args[0]); break; default: Console.WriteLine("Loading as homebrew."); - Device.LoadProgram(args[0]); + device.LoadProgram(args[0]); break; } } @@ -77,14 +77,14 @@ namespace Ryujinx Console.WriteLine("Please specify the folder with the NSOs/IStorage or a NSO/NRO."); } - using (GLScreen Screen = new GLScreen(Device, Renderer)) + using (GlScreen screen = new GlScreen(device, renderer)) { - Screen.MainLoop(); + screen.MainLoop(); - Device.Dispose(); + device.Dispose(); } - AudioOut.Dispose(); + audioOut.Dispose(); } } }