From e3aab599e5ee3a7cbf08ae6005ecc4380b1ffdad Mon Sep 17 00:00:00 2001 From: Xpl0itR Date: Sat, 2 Nov 2019 18:22:40 +0000 Subject: [PATCH] bugfix and cleanup --- Ryujinx/Config.json | 6 +-- Ryujinx/Ui/AboutWindow.cs | 32 ++++++------ Ryujinx/Ui/ApplicationLibrary.cs | 39 ++++++-------- Ryujinx/Ui/MainWindow.cs | 88 ++++++++++++++++++-------------- Ryujinx/Ui/MainWindow.glade | 36 ++++++++++--- Ryujinx/Ui/SwitchSettings.cs | 87 ++++++++++++++++--------------- 6 files changed, 159 insertions(+), 129 deletions(-) diff --git a/Ryujinx/Config.json b/Ryujinx/Config.json index 81a9dcc52c..177b698c4d 100644 --- a/Ryujinx/Config.json +++ b/Ryujinx/Config.json @@ -18,7 +18,6 @@ "enable_multicore_scheduling": true, "enable_fs_integrity_checks": true, "fs_global_access_log_mode": 0, - "enable_legacy_jit": false, "ignore_missing_services": false, "controller_type": "Handheld", "gui_columns": { @@ -72,7 +71,7 @@ "toggle_vsync": "Tab" } }, - "joystick_controls": { + "joystick_controls": { "enabled": true, "index": 0, "deadzone": 0.05, @@ -90,6 +89,7 @@ }, "right_joycon": { "stick": "Axis3", + "stick_y": "Button0", "stick_button": "Button9", "button_a": "Button1", "button_b": "Button0", @@ -100,4 +100,4 @@ "button_zr": "Axis5" } } -} +} \ No newline at end of file diff --git a/Ryujinx/Ui/AboutWindow.cs b/Ryujinx/Ui/AboutWindow.cs index 981a881b8e..66d8b05849 100644 --- a/Ryujinx/Ui/AboutWindow.cs +++ b/Ryujinx/Ui/AboutWindow.cs @@ -10,16 +10,16 @@ using System.IO; namespace Ryujinx.UI { - public struct Info - { - public string InstallVersion; - public string InstallCommit; - public string InstallBranch; - } - public class AboutWindow : Window { - public static Info Information { get; private set; } + private struct Info + { + public string InstallVersion; + public string InstallCommit; + public string InstallBranch; + } + + private static Info Information { get; set; } #pragma warning disable CS0649 [GUI] Window _aboutWin; @@ -61,7 +61,7 @@ namespace Ryujinx.UI } } - public void OpenUrl(string url) + private void OpenUrl(string url) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { @@ -78,37 +78,37 @@ namespace Ryujinx.UI } //Events - private void RyujinxButton_Pressed(object obj, ButtonPressEventArgs args) + private void RyujinxButton_Pressed(object sender, ButtonPressEventArgs args) { OpenUrl("https://ryujinx.org"); } - private void PatreonButton_Pressed(object obj, ButtonPressEventArgs args) + private void PatreonButton_Pressed(object sender, ButtonPressEventArgs args) { OpenUrl("https://www.patreon.com/ryujinx"); } - private void GitHubButton_Pressed(object obj, ButtonPressEventArgs args) + private void GitHubButton_Pressed(object sender, ButtonPressEventArgs args) { OpenUrl("https://github.com/Ryujinx/Ryujinx"); } - private void DiscordButton_Pressed(object obj, ButtonPressEventArgs args) + private void DiscordButton_Pressed(object sender, ButtonPressEventArgs args) { OpenUrl("https://discordapp.com/invite/N2FmfVc"); } - private void TwitterButton_Pressed(object obj, ButtonPressEventArgs args) + private void TwitterButton_Pressed(object sender, ButtonPressEventArgs args) { OpenUrl("https://twitter.com/RyujinxEmu"); } - private void ContributersButton_Pressed(object obj, ButtonPressEventArgs args) + private void ContributersButton_Pressed(object sender, ButtonPressEventArgs args) { OpenUrl("https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a"); } - private void CloseToggle_Activated(object obj, EventArgs args) + private void CloseToggle_Activated(object sender, EventArgs args) { Dispose(); } diff --git a/Ryujinx/Ui/ApplicationLibrary.cs b/Ryujinx/Ui/ApplicationLibrary.cs index b641e3b787..13da5da60e 100644 --- a/Ryujinx/Ui/ApplicationLibrary.cs +++ b/Ryujinx/Ui/ApplicationLibrary.cs @@ -22,12 +22,6 @@ namespace Ryujinx.UI { public static event EventHandler ApplicationAdded; - public static byte[] RyujinxNspIcon { get; private set; } - public static byte[] RyujinxXciIcon { get; private set; } - public static byte[] RyujinxNcaIcon { get; private set; } - public static byte[] RyujinxNroIcon { get; private set; } - public static byte[] RyujinxNsoIcon { get; private set; } - public struct ApplicationData { public bool Favorite { get; set; } @@ -43,8 +37,11 @@ namespace Ryujinx.UI public string Path { get; set; } } - public static float NumApplicationsFound { get; set; } - public static float NumApplicationsLoaded { get; set; } + private static byte[] RyujinxNspIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSPIcon.png"); + private static byte[] RyujinxXciIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxXCIIcon.png"); + private static byte[] RyujinxNcaIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNCAIcon.png"); + private static byte[] RyujinxNroIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNROIcon.png"); + private static byte[] RyujinxNsoIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSOIcon.png"); private static Keyset KeySet; private static SystemState.TitleLanguage DesiredTitleLanguage; @@ -64,15 +61,11 @@ namespace Ryujinx.UI public static void LoadApplications(List AppDirs, Keyset keySet, SystemState.TitleLanguage desiredTitleLanguage) { - KeySet = keySet; - DesiredTitleLanguage = desiredTitleLanguage; + float numApplicationsFound = 0; + float numApplicationsLoaded = 0; - // Loads the default application Icons - RyujinxNspIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSPIcon.png"); - RyujinxXciIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxXCIIcon.png"); - RyujinxNcaIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNCAIcon.png"); - RyujinxNroIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNROIcon.png"); - RyujinxNsoIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSOIcon.png"); + KeySet = keySet; + DesiredTitleLanguage = desiredTitleLanguage; // Builds the applications list with paths to found applications List applications = new List(); @@ -95,7 +88,7 @@ namespace Ryujinx.UI (Path.GetExtension(app) == ".nso")) { applications.Add(app); - NumApplicationsFound++; + numApplicationsFound++; } else if (Path.GetExtension(app) == ".nca") { @@ -106,7 +99,7 @@ namespace Ryujinx.UI } applications.Add(app); - NumApplicationsFound++; + numApplicationsFound++; } } } @@ -359,12 +352,13 @@ namespace Ryujinx.UI Path = applicationPath, }; - NumApplicationsLoaded++; + numApplicationsLoaded++; OnApplicationAdded(new ApplicationAddedEventArgs() { - AppData = data, - AppsLoaded = NumApplicationsLoaded + AppData = data, + NumAppsFound = numApplicationsFound, + NumAppsLoaded = numApplicationsLoaded }); } } @@ -483,6 +477,7 @@ namespace Ryujinx.UI public class ApplicationAddedEventArgs : EventArgs { public ApplicationLibrary.ApplicationData AppData { get; set; } - public float AppsLoaded { get; set; } + public float NumAppsFound { get; set; } + public float NumAppsLoaded { get; set; } } } diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index 1b8ebf5b0d..39f2266a5d 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -18,7 +18,6 @@ using System.Threading; using Utf8Json; using Utf8Json.Resolvers; using System.Threading.Tasks; -using System.Collections.Generic; namespace Ryujinx.UI { @@ -38,7 +37,7 @@ namespace Ryujinx.UI public class MainWindow : Window { - internal static HLE.Switch _device; + private static HLE.Switch _device; private static IGalRenderer _renderer; @@ -50,6 +49,8 @@ namespace Ryujinx.UI private static ListStore _tableStore; + private static Task UpdateGameTableTask; + private static bool _gameLoaded = false; private static bool _ending = false; @@ -152,6 +153,10 @@ namespace Ryujinx.UI if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { _pathToggle.Active = true; } _gameTable.Model = _tableStore = new ListStore(typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); + + _tableStore.SetSortFunc(5, TimePlayedSort); + _tableStore.SetSortFunc(6, LastPlayedSort); + _tableStore.SetSortFunc(8, FileSizeSort); UpdateColumns(); #pragma warning disable CS4014 @@ -159,12 +164,14 @@ namespace Ryujinx.UI #pragma warning restore CS4014 } - public static void CreateErrorDialog(string errorMessage) + internal static void CreateErrorDialog(string errorMessage) { - MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, errorMessage) + MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, null) { Title = "Ryujinx - Error", Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png"), + Text = "Ryujinx has encountered an Error", + SecondaryText = errorMessage, WindowPosition = WindowPosition.Center }; errorDialog.SetSizeRequest(100, 20); @@ -172,7 +179,7 @@ namespace Ryujinx.UI errorDialog.Dispose(); } - public static void ApplyTheme() + internal static void ApplyTheme() { CssProvider cssProvider = new CssProvider(); @@ -236,16 +243,14 @@ namespace Ryujinx.UI if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { pathColumn.SortColumnId = 9; } } - public static async Task UpdateGameTable() + internal static async Task UpdateGameTable() { - _tableStore.Clear(); - _tableStore.SetSortFunc(5, TimePlayedSort); - _tableStore.SetSortFunc(6, LastPlayedSort); - _tableStore.SetSortFunc(8, FileSizeSort); - ApplicationLibrary.NumApplicationsLoaded = 0; - ApplicationLibrary.NumApplicationsFound = 0; + if (UpdateGameTableTask != null && !UpdateGameTableTask.IsCompleted) return; - await Task.Run(() => { ApplicationLibrary.LoadApplications(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage); }); + _tableStore.Clear(); + + UpdateGameTableTask = Task.Run(() => ApplicationLibrary.LoadApplications(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage)); + await UpdateGameTableTask; } internal void LoadApplication(string path) @@ -476,11 +481,11 @@ namespace Ryujinx.UI private void Application_Added(object sender, ApplicationAddedEventArgs e) { _tableStore.AppendValues(e.AppData.Favorite, new Gdk.Pixbuf(e.AppData.Icon, 75, 75), $"{e.AppData.TitleName}\n{e.AppData.TitleId.ToUpper()}", e.AppData.Developer, e.AppData.Version, e.AppData.TimePlayed, e.AppData.LastPlayed, e.AppData.FileExtension, e.AppData.FileSize, e.AppData.Path); - _progressLabel.Text = $"{e.AppsLoaded}/{ApplicationLibrary.NumApplicationsFound} Games Loaded"; - _progressBar.Value = e.AppsLoaded / ApplicationLibrary.NumApplicationsFound; + _progressLabel.Text = $"{e.NumAppsLoaded}/{e.NumAppsFound} Games Loaded"; + _progressBar.Value = e.NumAppsLoaded / e.NumAppsFound; } - private void FavToggle_Toggled(object o, ToggledArgs args) + private void FavToggle_Toggled(object sender, ToggledArgs args) { _tableStore.GetIter(out TreeIter treeIter, new TreePath(args.Path)); string titleid = _tableStore.GetValue(treeIter, 2).ToString().Split("\n")[1].ToLower(); @@ -511,7 +516,7 @@ namespace Ryujinx.UI File.WriteAllText(metadataPath, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson()); } - private void Row_Activated(object o, RowActivatedArgs args) + private void Row_Activated(object sender, RowActivatedArgs args) { _tableStore.GetIter(out TreeIter treeIter, new TreePath(args.Path.ToString())); string path = (string)_tableStore.GetValue(treeIter, 9); @@ -519,7 +524,7 @@ namespace Ryujinx.UI LoadApplication(path); } - private void Load_Application_File(object o, EventArgs args) + private void Load_Application_File(object sender, EventArgs args) { FileChooserDialog fileChooser = new FileChooserDialog("Choose the file to open", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); @@ -539,7 +544,7 @@ namespace Ryujinx.UI fileChooser.Dispose(); } - private void Load_Application_Folder(object o, EventArgs args) + private void Load_Application_Folder(object sender, EventArgs args) { FileChooserDialog fileChooser = new FileChooserDialog("Choose the folder to open", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); @@ -551,7 +556,7 @@ namespace Ryujinx.UI fileChooser.Dispose(); } - private void Open_Ryu_Folder(object o, EventArgs args) + private void Open_Ryu_Folder(object sender, EventArgs args) { Process.Start(new ProcessStartInfo() { @@ -561,24 +566,24 @@ namespace Ryujinx.UI }); } - private void Exit_Pressed(object o, EventArgs args) + private void Exit_Pressed(object sender, EventArgs args) { _screen?.Exit(); End(); } - private void Window_Close(object o, DeleteEventArgs args) + private void Window_Close(object sender, DeleteEventArgs args) { _screen?.Exit(); End(); } - private void StopEmulation_Pressed(object o, EventArgs args) + private void StopEmulation_Pressed(object sender, EventArgs args) { // TODO: Write logic to kill running game } - private void FullScreen_Toggled(object o, EventArgs args) + private void FullScreen_Toggled(object sender, EventArgs args) { if (_fullScreen.Active) { @@ -590,7 +595,7 @@ namespace Ryujinx.UI } } - private void Settings_Pressed(object o, EventArgs args) + private void Settings_Pressed(object sender, EventArgs args) { SwitchSettings SettingsWin = new SwitchSettings(_device); @@ -600,7 +605,7 @@ namespace Ryujinx.UI SettingsWin.Show(); } - private void Update_Pressed(object o, EventArgs args) + private void Update_Pressed(object sender, EventArgs args) { string ryuUpdater = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "RyuUpdater.exe"); @@ -614,7 +619,7 @@ namespace Ryujinx.UI } } - private void About_Pressed(object o, EventArgs args) + private void About_Pressed(object sender, EventArgs args) { AboutWindow AboutWin = new AboutWindow(); @@ -624,7 +629,7 @@ namespace Ryujinx.UI AboutWin.Show(); } - private void Fav_Toggled(object o, EventArgs args) + private void Fav_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.FavColumn = _favToggle.Active; @@ -635,7 +640,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void Icon_Toggled(object o, EventArgs args) + private void Icon_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.IconColumn = _iconToggle.Active; @@ -646,7 +651,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void Title_Toggled(object o, EventArgs args) + private void Title_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.AppColumn = _appToggle.Active; @@ -657,7 +662,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void Developer_Toggled(object o, EventArgs args) + private void Developer_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.DevColumn = _developerToggle.Active; @@ -668,7 +673,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void Version_Toggled(object o, EventArgs args) + private void Version_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.VersionColumn = _versionToggle.Active; @@ -679,7 +684,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void TimePlayed_Toggled(object o, EventArgs args) + private void TimePlayed_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.TimePlayedColumn = _timePlayedToggle.Active; @@ -690,7 +695,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void LastPlayed_Toggled(object o, EventArgs args) + private void LastPlayed_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.LastPlayedColumn = _lastPlayedToggle.Active; @@ -701,7 +706,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void FileExt_Toggled(object o, EventArgs args) + private void FileExt_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.FileExtColumn = _fileExtToggle.Active; @@ -712,7 +717,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void FileSize_Toggled(object o, EventArgs args) + private void FileSize_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.FileSizeColumn = _fileSizeToggle.Active; @@ -723,7 +728,7 @@ namespace Ryujinx.UI UpdateColumns(); } - private void Path_Toggled(object o, EventArgs args) + private void Path_Toggled(object sender, EventArgs args) { GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; updatedColumns.PathColumn = _pathToggle.Active; @@ -733,7 +738,14 @@ namespace Ryujinx.UI UpdateColumns(); } - + + private void RefreshList_Pressed(object sender, ButtonReleaseEventArgs args) + { +#pragma warning disable CS4014 + UpdateGameTable(); +#pragma warning restore CS4014 + } + private static int TimePlayedSort(ITreeModel model, TreeIter a, TreeIter b) { string aValue = model.GetValue(a, 5).ToString(); diff --git a/Ryujinx/Ui/MainWindow.glade b/Ryujinx/Ui/MainWindow.glade index dc715546a2..6d66dc2007 100644 --- a/Ryujinx/Ui/MainWindow.glade +++ b/Ryujinx/Ui/MainWindow.glade @@ -342,17 +342,23 @@ - + True False - + True False 5 - 5 - 2 - 2 + + + + RefreshList + True + False + gtk-refresh + + False @@ -360,17 +366,35 @@ 0 + + + True + False + 5 + 5 + 2 + 2 + 0/0 Games Loaded + + + False + True + 1 + + 200 True False start + 5 + 5 True True - 1 + 2 diff --git a/Ryujinx/Ui/SwitchSettings.cs b/Ryujinx/Ui/SwitchSettings.cs index eb71eafc30..2431e34cf5 100644 --- a/Ryujinx/Ui/SwitchSettings.cs +++ b/Ryujinx/Ui/SwitchSettings.cs @@ -15,7 +15,7 @@ namespace Ryujinx.UI { internal static Configuration SwitchConfig { get; set; } - internal HLE.Switch Device { get; set; } + private HLE.Switch _device; private static ListStore _gameDirsBoxStore; @@ -88,37 +88,37 @@ namespace Ryujinx.UI { builder.Autoconnect(this); - Device = device; + _device = device; _settingsWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png"); _controller1Image.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500); //Bind Events - _lStickUp1.Clicked += (o, args) => Button_Pressed(o, args, _lStickUp1); - _lStickDown1.Clicked += (o, args) => Button_Pressed(o, args, _lStickDown1); - _lStickLeft1.Clicked += (o, args) => Button_Pressed(o, args, _lStickLeft1); - _lStickRight1.Clicked += (o, args) => Button_Pressed(o, args, _lStickRight1); - _lStickButton1.Clicked += (o, args) => Button_Pressed(o, args, _lStickButton1); - _dpadUp1.Clicked += (o, args) => Button_Pressed(o, args, _dpadUp1); - _dpadDown1.Clicked += (o, args) => Button_Pressed(o, args, _dpadDown1); - _dpadLeft1.Clicked += (o, args) => Button_Pressed(o, args, _dpadLeft1); - _dpadRight1.Clicked += (o, args) => Button_Pressed(o, args, _dpadRight1); - _minus1.Clicked += (o, args) => Button_Pressed(o, args, _minus1); - _l1.Clicked += (o, args) => Button_Pressed(o, args, _l1); - _zL1.Clicked += (o, args) => Button_Pressed(o, args, _zL1); - _rStickUp1.Clicked += (o, args) => Button_Pressed(o, args, _rStickUp1); - _rStickDown1.Clicked += (o, args) => Button_Pressed(o, args, _rStickDown1); - _rStickLeft1.Clicked += (o, args) => Button_Pressed(o, args, _rStickLeft1); - _rStickRight1.Clicked += (o, args) => Button_Pressed(o, args, _rStickRight1); - _rStickButton1.Clicked += (o, args) => Button_Pressed(o, args, _rStickButton1); - _a1.Clicked += (o, args) => Button_Pressed(o, args, _a1); - _b1.Clicked += (o, args) => Button_Pressed(o, args, _b1); - _x1.Clicked += (o, args) => Button_Pressed(o, args, _x1); - _y1.Clicked += (o, args) => Button_Pressed(o, args, _y1); - _plus1.Clicked += (o, args) => Button_Pressed(o, args, _plus1); - _r1.Clicked += (o, args) => Button_Pressed(o, args, _r1); - _zR1.Clicked += (o, args) => Button_Pressed(o, args, _zR1); - _controller1Type.Changed += (o, args) => Controller_Changed(o, args, _controller1Type.ActiveId, _controller1Image); + _lStickUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickUp1); + _lStickDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickDown1); + _lStickLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickLeft1); + _lStickRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickRight1); + _lStickButton1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickButton1); + _dpadUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadUp1); + _dpadDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadDown1); + _dpadLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadLeft1); + _dpadRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadRight1); + _minus1.Clicked += (sender, args) => Button_Pressed(sender, args, _minus1); + _l1.Clicked += (sender, args) => Button_Pressed(sender, args, _l1); + _zL1.Clicked += (sender, args) => Button_Pressed(sender, args, _zL1); + _rStickUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickUp1); + _rStickDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickDown1); + _rStickLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickLeft1); + _rStickRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickRight1); + _rStickButton1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickButton1); + _a1.Clicked += (sender, args) => Button_Pressed(sender, args, _a1); + _b1.Clicked += (sender, args) => Button_Pressed(sender, args, _b1); + _x1.Clicked += (sender, args) => Button_Pressed(sender, args, _x1); + _y1.Clicked += (sender, args) => Button_Pressed(sender, args, _y1); + _plus1.Clicked += (sender, args) => Button_Pressed(sender, args, _plus1); + _r1.Clicked += (sender, args) => Button_Pressed(sender, args, _r1); + _zR1.Clicked += (sender, args) => Button_Pressed(sender, args, _zR1); + _controller1Type.Changed += (sender, args) => Controller_Changed(sender, args, _controller1Type.ActiveId, _controller1Image); //Setup Currents if (SwitchConfig.EnableFileLog) { _fileLogToggle.Click(); } @@ -192,7 +192,7 @@ namespace Ryujinx.UI } //Events - private void Button_Pressed(object obj, EventArgs args, ToggleButton Button) + private void Button_Pressed(object sender, EventArgs args, ToggleButton button) { if (_listeningForKeypress == false) { @@ -200,25 +200,25 @@ namespace Ryujinx.UI _listeningForKeypress = true; - void On_KeyPress(object Obj, KeyPressEventArgs KeyPressed) + void On_KeyPress(object Sender, KeyPressEventArgs KeyPressed) { string key = KeyPressed.Event.Key.ToString(); string capKey = key.First().ToString().ToUpper() + key.Substring(1); if (Enum.IsDefined(typeof(OpenTK.Input.Key), capKey)) { - Button.Label = capKey; + button.Label = capKey; } else if (GdkToOpenTKInput.ContainsKey(key)) { - Button.Label = GdkToOpenTKInput[key]; + button.Label = GdkToOpenTKInput[key]; } else { - Button.Label = "Space"; + button.Label = "Space"; } - Button.SetStateFlags(0, true); + button.SetStateFlags(0, true); KeyPressEvent -= On_KeyPress; @@ -227,11 +227,11 @@ namespace Ryujinx.UI } else { - Button.SetStateFlags(0, true); + button.SetStateFlags(0, true); } } - private void Controller_Changed(object obj, EventArgs args, string controllerType, Image controllerImage) + private void Controller_Changed(object sender, EventArgs args, string controllerType, Image controllerImage) { if (controllerType == "ProController") { @@ -251,7 +251,7 @@ namespace Ryujinx.UI } } - private void AddDir_Pressed(object obj, EventArgs args) + private void AddDir_Pressed(object sender, EventArgs args) { if (Directory.Exists(_addGameDirBox.Buffer.Text)) { @@ -261,7 +261,7 @@ namespace Ryujinx.UI _addDir.SetStateFlags(0, true); } - private void BrowseDir_Pressed(object obj, EventArgs args) + private void BrowseDir_Pressed(object sender, EventArgs args) { FileChooserDialog fileChooser = new FileChooserDialog("Choose the game directory to add to the list", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Add", ResponseType.Accept); @@ -275,7 +275,7 @@ namespace Ryujinx.UI _browseDir.SetStateFlags(0, true); } - private void RemoveDir_Pressed(object obj, EventArgs args) + private void RemoveDir_Pressed(object sender, EventArgs args) { TreeSelection selection = _gameDirsBox.Selection; @@ -285,14 +285,14 @@ namespace Ryujinx.UI _removeDir.SetStateFlags(0, true); } - private void CustThemeToggle_Activated(object obj, EventArgs args) + private void CustThemeToggle_Activated(object sender, EventArgs args) { _custThemePath.Sensitive = _custThemeToggle.Active; _custThemePathLabel.Sensitive = _custThemeToggle.Active; _browseThemePath.Sensitive = _custThemeToggle.Active; } - private void BrowseThemeDir_Pressed(object obj, EventArgs args) + private void BrowseThemeDir_Pressed(object sender, EventArgs args) { FileChooserDialog fileChooser = new FileChooserDialog("Choose the theme to load", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Select", ResponseType.Accept); @@ -309,7 +309,7 @@ namespace Ryujinx.UI _browseThemePath.SetStateFlags(0, true); } - private void SaveToggle_Activated(object obj, EventArgs args) + private void SaveToggle_Activated(object sender, EventArgs args) { List gameDirs = new List(); @@ -380,15 +380,14 @@ namespace Ryujinx.UI SwitchConfig.FsGlobalAccessLogMode = (int)_fsLogSpinAdjustment.Value; Configuration.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json")); - Configuration.Configure(Device, SwitchConfig); + Configuration.Configure(_device, SwitchConfig); MainWindow.ApplyTheme(); MainWindow.UpdateGameTable(); - Dispose(); } - private void CloseToggle_Activated(object obj, EventArgs args) + private void CloseToggle_Activated(object sender, EventArgs args) { Dispose(); }