bugfix and cleanup

This commit is contained in:
Xpl0itR 2019-11-02 18:22:40 +00:00 committed by unknown
commit e3aab599e5
No known key found for this signature in database
GPG key ID: 91798184109676AD
6 changed files with 159 additions and 129 deletions

View file

@ -18,7 +18,6 @@
"enable_multicore_scheduling": true, "enable_multicore_scheduling": true,
"enable_fs_integrity_checks": true, "enable_fs_integrity_checks": true,
"fs_global_access_log_mode": 0, "fs_global_access_log_mode": 0,
"enable_legacy_jit": false,
"ignore_missing_services": false, "ignore_missing_services": false,
"controller_type": "Handheld", "controller_type": "Handheld",
"gui_columns": { "gui_columns": {
@ -90,6 +89,7 @@
}, },
"right_joycon": { "right_joycon": {
"stick": "Axis3", "stick": "Axis3",
"stick_y": "Button0",
"stick_button": "Button9", "stick_button": "Button9",
"button_a": "Button1", "button_a": "Button1",
"button_b": "Button0", "button_b": "Button0",

View file

@ -10,16 +10,16 @@ using System.IO;
namespace Ryujinx.UI namespace Ryujinx.UI
{ {
public struct Info public class AboutWindow : Window
{
private struct Info
{ {
public string InstallVersion; public string InstallVersion;
public string InstallCommit; public string InstallCommit;
public string InstallBranch; public string InstallBranch;
} }
public class AboutWindow : Window private static Info Information { get; set; }
{
public static Info Information { get; private set; }
#pragma warning disable CS0649 #pragma warning disable CS0649
[GUI] Window _aboutWin; [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)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
@ -78,37 +78,37 @@ namespace Ryujinx.UI
} }
//Events //Events
private void RyujinxButton_Pressed(object obj, ButtonPressEventArgs args) private void RyujinxButton_Pressed(object sender, ButtonPressEventArgs args)
{ {
OpenUrl("https://ryujinx.org"); 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"); 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"); 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"); 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"); 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"); 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(); Dispose();
} }

View file

@ -22,12 +22,6 @@ namespace Ryujinx.UI
{ {
public static event EventHandler<ApplicationAddedEventArgs> ApplicationAdded; public static event EventHandler<ApplicationAddedEventArgs> 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 struct ApplicationData
{ {
public bool Favorite { get; set; } public bool Favorite { get; set; }
@ -43,8 +37,11 @@ namespace Ryujinx.UI
public string Path { get; set; } public string Path { get; set; }
} }
public static float NumApplicationsFound { get; set; } private static byte[] RyujinxNspIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSPIcon.png");
public static float NumApplicationsLoaded { get; set; } 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 Keyset KeySet;
private static SystemState.TitleLanguage DesiredTitleLanguage; private static SystemState.TitleLanguage DesiredTitleLanguage;
@ -64,16 +61,12 @@ namespace Ryujinx.UI
public static void LoadApplications(List<string> AppDirs, Keyset keySet, SystemState.TitleLanguage desiredTitleLanguage) public static void LoadApplications(List<string> AppDirs, Keyset keySet, SystemState.TitleLanguage desiredTitleLanguage)
{ {
float numApplicationsFound = 0;
float numApplicationsLoaded = 0;
KeySet = keySet; KeySet = keySet;
DesiredTitleLanguage = desiredTitleLanguage; DesiredTitleLanguage = desiredTitleLanguage;
// 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");
// Builds the applications list with paths to found applications // Builds the applications list with paths to found applications
List<string> applications = new List<string>(); List<string> applications = new List<string>();
foreach (string appDir in AppDirs) foreach (string appDir in AppDirs)
@ -95,7 +88,7 @@ namespace Ryujinx.UI
(Path.GetExtension(app) == ".nso")) (Path.GetExtension(app) == ".nso"))
{ {
applications.Add(app); applications.Add(app);
NumApplicationsFound++; numApplicationsFound++;
} }
else if (Path.GetExtension(app) == ".nca") else if (Path.GetExtension(app) == ".nca")
{ {
@ -106,7 +99,7 @@ namespace Ryujinx.UI
} }
applications.Add(app); applications.Add(app);
NumApplicationsFound++; numApplicationsFound++;
} }
} }
} }
@ -359,12 +352,13 @@ namespace Ryujinx.UI
Path = applicationPath, Path = applicationPath,
}; };
NumApplicationsLoaded++; numApplicationsLoaded++;
OnApplicationAdded(new ApplicationAddedEventArgs() OnApplicationAdded(new ApplicationAddedEventArgs()
{ {
AppData = data, AppData = data,
AppsLoaded = NumApplicationsLoaded NumAppsFound = numApplicationsFound,
NumAppsLoaded = numApplicationsLoaded
}); });
} }
} }
@ -483,6 +477,7 @@ namespace Ryujinx.UI
public class ApplicationAddedEventArgs : EventArgs public class ApplicationAddedEventArgs : EventArgs
{ {
public ApplicationLibrary.ApplicationData AppData { get; set; } public ApplicationLibrary.ApplicationData AppData { get; set; }
public float AppsLoaded { get; set; } public float NumAppsFound { get; set; }
public float NumAppsLoaded { get; set; }
} }
} }

View file

@ -18,7 +18,6 @@ using System.Threading;
using Utf8Json; using Utf8Json;
using Utf8Json.Resolvers; using Utf8Json.Resolvers;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic;
namespace Ryujinx.UI namespace Ryujinx.UI
{ {
@ -38,7 +37,7 @@ namespace Ryujinx.UI
public class MainWindow : Window public class MainWindow : Window
{ {
internal static HLE.Switch _device; private static HLE.Switch _device;
private static IGalRenderer _renderer; private static IGalRenderer _renderer;
@ -50,6 +49,8 @@ namespace Ryujinx.UI
private static ListStore _tableStore; private static ListStore _tableStore;
private static Task UpdateGameTableTask;
private static bool _gameLoaded = false; private static bool _gameLoaded = false;
private static bool _ending = false; private static bool _ending = false;
@ -153,18 +154,24 @@ namespace Ryujinx.UI
_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)); _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(); UpdateColumns();
#pragma warning disable CS4014 #pragma warning disable CS4014
UpdateGameTable(); UpdateGameTable();
#pragma warning restore CS4014 #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", Title = "Ryujinx - Error",
Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png"), Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png"),
Text = "Ryujinx has encountered an Error",
SecondaryText = errorMessage,
WindowPosition = WindowPosition.Center WindowPosition = WindowPosition.Center
}; };
errorDialog.SetSizeRequest(100, 20); errorDialog.SetSizeRequest(100, 20);
@ -172,7 +179,7 @@ namespace Ryujinx.UI
errorDialog.Dispose(); errorDialog.Dispose();
} }
public static void ApplyTheme() internal static void ApplyTheme()
{ {
CssProvider cssProvider = new CssProvider(); CssProvider cssProvider = new CssProvider();
@ -236,16 +243,14 @@ namespace Ryujinx.UI
if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { pathColumn.SortColumnId = 9; } if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { pathColumn.SortColumnId = 9; }
} }
public static async Task UpdateGameTable() internal static async Task UpdateGameTable()
{ {
_tableStore.Clear(); if (UpdateGameTableTask != null && !UpdateGameTableTask.IsCompleted) return;
_tableStore.SetSortFunc(5, TimePlayedSort);
_tableStore.SetSortFunc(6, LastPlayedSort);
_tableStore.SetSortFunc(8, FileSizeSort);
ApplicationLibrary.NumApplicationsLoaded = 0;
ApplicationLibrary.NumApplicationsFound = 0;
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) internal void LoadApplication(string path)
@ -476,11 +481,11 @@ namespace Ryujinx.UI
private void Application_Added(object sender, ApplicationAddedEventArgs e) 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); _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"; _progressLabel.Text = $"{e.NumAppsLoaded}/{e.NumAppsFound} Games Loaded";
_progressBar.Value = e.AppsLoaded / ApplicationLibrary.NumApplicationsFound; _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)); _tableStore.GetIter(out TreeIter treeIter, new TreePath(args.Path));
string titleid = _tableStore.GetValue(treeIter, 2).ToString().Split("\n")[1].ToLower(); 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()); 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())); _tableStore.GetIter(out TreeIter treeIter, new TreePath(args.Path.ToString()));
string path = (string)_tableStore.GetValue(treeIter, 9); string path = (string)_tableStore.GetValue(treeIter, 9);
@ -519,7 +524,7 @@ namespace Ryujinx.UI
LoadApplication(path); 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); 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(); 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); 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(); fileChooser.Dispose();
} }
private void Open_Ryu_Folder(object o, EventArgs args) private void Open_Ryu_Folder(object sender, EventArgs args)
{ {
Process.Start(new ProcessStartInfo() 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(); _screen?.Exit();
End(); End();
} }
private void Window_Close(object o, DeleteEventArgs args) private void Window_Close(object sender, DeleteEventArgs args)
{ {
_screen?.Exit(); _screen?.Exit();
End(); End();
} }
private void StopEmulation_Pressed(object o, EventArgs args) private void StopEmulation_Pressed(object sender, EventArgs args)
{ {
// TODO: Write logic to kill running game // 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) 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); SwitchSettings SettingsWin = new SwitchSettings(_device);
@ -600,7 +605,7 @@ namespace Ryujinx.UI
SettingsWin.Show(); 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"); 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(); AboutWindow AboutWin = new AboutWindow();
@ -624,7 +629,7 @@ namespace Ryujinx.UI
AboutWin.Show(); AboutWin.Show();
} }
private void Fav_Toggled(object o, EventArgs args) private void Fav_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.FavColumn = _favToggle.Active; updatedColumns.FavColumn = _favToggle.Active;
@ -635,7 +640,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void Icon_Toggled(object o, EventArgs args) private void Icon_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.IconColumn = _iconToggle.Active; updatedColumns.IconColumn = _iconToggle.Active;
@ -646,7 +651,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void Title_Toggled(object o, EventArgs args) private void Title_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.AppColumn = _appToggle.Active; updatedColumns.AppColumn = _appToggle.Active;
@ -657,7 +662,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void Developer_Toggled(object o, EventArgs args) private void Developer_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.DevColumn = _developerToggle.Active; updatedColumns.DevColumn = _developerToggle.Active;
@ -668,7 +673,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void Version_Toggled(object o, EventArgs args) private void Version_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.VersionColumn = _versionToggle.Active; updatedColumns.VersionColumn = _versionToggle.Active;
@ -679,7 +684,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void TimePlayed_Toggled(object o, EventArgs args) private void TimePlayed_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.TimePlayedColumn = _timePlayedToggle.Active; updatedColumns.TimePlayedColumn = _timePlayedToggle.Active;
@ -690,7 +695,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void LastPlayed_Toggled(object o, EventArgs args) private void LastPlayed_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.LastPlayedColumn = _lastPlayedToggle.Active; updatedColumns.LastPlayedColumn = _lastPlayedToggle.Active;
@ -701,7 +706,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void FileExt_Toggled(object o, EventArgs args) private void FileExt_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.FileExtColumn = _fileExtToggle.Active; updatedColumns.FileExtColumn = _fileExtToggle.Active;
@ -712,7 +717,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void FileSize_Toggled(object o, EventArgs args) private void FileSize_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.FileSizeColumn = _fileSizeToggle.Active; updatedColumns.FileSizeColumn = _fileSizeToggle.Active;
@ -723,7 +728,7 @@ namespace Ryujinx.UI
UpdateColumns(); UpdateColumns();
} }
private void Path_Toggled(object o, EventArgs args) private void Path_Toggled(object sender, EventArgs args)
{ {
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns; GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
updatedColumns.PathColumn = _pathToggle.Active; updatedColumns.PathColumn = _pathToggle.Active;
@ -734,6 +739,13 @@ namespace Ryujinx.UI
UpdateColumns(); 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) private static int TimePlayedSort(ITreeModel model, TreeIter a, TreeIter b)
{ {
string aValue = model.GetValue(a, 5).ToString(); string aValue = model.GetValue(a, 5).ToString();

View file

@ -342,17 +342,23 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="ProgressBox"> <object class="GtkBox" id="FooterBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<child> <child>
<object class="GtkLabel" id="_progressLabel"> <object class="GtkEventBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_left">5</property> <property name="margin_left">5</property>
<property name="margin_right">5</property> <signal name="button-release-event" handler="RefreshList_Pressed" swapped="no"/>
<property name="margin_top">2</property> <child>
<property name="margin_bottom">2</property> <object class="GtkImage">
<property name="name">RefreshList</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-refresh</property>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -360,17 +366,35 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="_progressLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="label" translatable="yes">0/0 Games Loaded</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkLevelBar" id="_progressBar"> <object class="GtkLevelBar" id="_progressBar">
<property name="width_request">200</property> <property name="width_request">200</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
</object> </object>

View file

@ -15,7 +15,7 @@ namespace Ryujinx.UI
{ {
internal static Configuration SwitchConfig { get; set; } internal static Configuration SwitchConfig { get; set; }
internal HLE.Switch Device { get; set; } private HLE.Switch _device;
private static ListStore _gameDirsBoxStore; private static ListStore _gameDirsBoxStore;
@ -88,37 +88,37 @@ namespace Ryujinx.UI
{ {
builder.Autoconnect(this); builder.Autoconnect(this);
Device = device; _device = device;
_settingsWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png"); _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); _controller1Image.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500);
//Bind Events //Bind Events
_lStickUp1.Clicked += (o, args) => Button_Pressed(o, args, _lStickUp1); _lStickUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickUp1);
_lStickDown1.Clicked += (o, args) => Button_Pressed(o, args, _lStickDown1); _lStickDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickDown1);
_lStickLeft1.Clicked += (o, args) => Button_Pressed(o, args, _lStickLeft1); _lStickLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickLeft1);
_lStickRight1.Clicked += (o, args) => Button_Pressed(o, args, _lStickRight1); _lStickRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickRight1);
_lStickButton1.Clicked += (o, args) => Button_Pressed(o, args, _lStickButton1); _lStickButton1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickButton1);
_dpadUp1.Clicked += (o, args) => Button_Pressed(o, args, _dpadUp1); _dpadUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadUp1);
_dpadDown1.Clicked += (o, args) => Button_Pressed(o, args, _dpadDown1); _dpadDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadDown1);
_dpadLeft1.Clicked += (o, args) => Button_Pressed(o, args, _dpadLeft1); _dpadLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadLeft1);
_dpadRight1.Clicked += (o, args) => Button_Pressed(o, args, _dpadRight1); _dpadRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadRight1);
_minus1.Clicked += (o, args) => Button_Pressed(o, args, _minus1); _minus1.Clicked += (sender, args) => Button_Pressed(sender, args, _minus1);
_l1.Clicked += (o, args) => Button_Pressed(o, args, _l1); _l1.Clicked += (sender, args) => Button_Pressed(sender, args, _l1);
_zL1.Clicked += (o, args) => Button_Pressed(o, args, _zL1); _zL1.Clicked += (sender, args) => Button_Pressed(sender, args, _zL1);
_rStickUp1.Clicked += (o, args) => Button_Pressed(o, args, _rStickUp1); _rStickUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickUp1);
_rStickDown1.Clicked += (o, args) => Button_Pressed(o, args, _rStickDown1); _rStickDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickDown1);
_rStickLeft1.Clicked += (o, args) => Button_Pressed(o, args, _rStickLeft1); _rStickLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickLeft1);
_rStickRight1.Clicked += (o, args) => Button_Pressed(o, args, _rStickRight1); _rStickRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickRight1);
_rStickButton1.Clicked += (o, args) => Button_Pressed(o, args, _rStickButton1); _rStickButton1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickButton1);
_a1.Clicked += (o, args) => Button_Pressed(o, args, _a1); _a1.Clicked += (sender, args) => Button_Pressed(sender, args, _a1);
_b1.Clicked += (o, args) => Button_Pressed(o, args, _b1); _b1.Clicked += (sender, args) => Button_Pressed(sender, args, _b1);
_x1.Clicked += (o, args) => Button_Pressed(o, args, _x1); _x1.Clicked += (sender, args) => Button_Pressed(sender, args, _x1);
_y1.Clicked += (o, args) => Button_Pressed(o, args, _y1); _y1.Clicked += (sender, args) => Button_Pressed(sender, args, _y1);
_plus1.Clicked += (o, args) => Button_Pressed(o, args, _plus1); _plus1.Clicked += (sender, args) => Button_Pressed(sender, args, _plus1);
_r1.Clicked += (o, args) => Button_Pressed(o, args, _r1); _r1.Clicked += (sender, args) => Button_Pressed(sender, args, _r1);
_zR1.Clicked += (o, args) => Button_Pressed(o, args, _zR1); _zR1.Clicked += (sender, args) => Button_Pressed(sender, args, _zR1);
_controller1Type.Changed += (o, args) => Controller_Changed(o, args, _controller1Type.ActiveId, _controller1Image); _controller1Type.Changed += (sender, args) => Controller_Changed(sender, args, _controller1Type.ActiveId, _controller1Image);
//Setup Currents //Setup Currents
if (SwitchConfig.EnableFileLog) { _fileLogToggle.Click(); } if (SwitchConfig.EnableFileLog) { _fileLogToggle.Click(); }
@ -192,7 +192,7 @@ namespace Ryujinx.UI
} }
//Events //Events
private void Button_Pressed(object obj, EventArgs args, ToggleButton Button) private void Button_Pressed(object sender, EventArgs args, ToggleButton button)
{ {
if (_listeningForKeypress == false) if (_listeningForKeypress == false)
{ {
@ -200,25 +200,25 @@ namespace Ryujinx.UI
_listeningForKeypress = true; _listeningForKeypress = true;
void On_KeyPress(object Obj, KeyPressEventArgs KeyPressed) void On_KeyPress(object Sender, KeyPressEventArgs KeyPressed)
{ {
string key = KeyPressed.Event.Key.ToString(); string key = KeyPressed.Event.Key.ToString();
string capKey = key.First().ToString().ToUpper() + key.Substring(1); string capKey = key.First().ToString().ToUpper() + key.Substring(1);
if (Enum.IsDefined(typeof(OpenTK.Input.Key), capKey)) if (Enum.IsDefined(typeof(OpenTK.Input.Key), capKey))
{ {
Button.Label = capKey; button.Label = capKey;
} }
else if (GdkToOpenTKInput.ContainsKey(key)) else if (GdkToOpenTKInput.ContainsKey(key))
{ {
Button.Label = GdkToOpenTKInput[key]; button.Label = GdkToOpenTKInput[key];
} }
else else
{ {
Button.Label = "Space"; button.Label = "Space";
} }
Button.SetStateFlags(0, true); button.SetStateFlags(0, true);
KeyPressEvent -= On_KeyPress; KeyPressEvent -= On_KeyPress;
@ -227,11 +227,11 @@ namespace Ryujinx.UI
} }
else 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") 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)) if (Directory.Exists(_addGameDirBox.Buffer.Text))
{ {
@ -261,7 +261,7 @@ namespace Ryujinx.UI
_addDir.SetStateFlags(0, true); _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); 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); _browseDir.SetStateFlags(0, true);
} }
private void RemoveDir_Pressed(object obj, EventArgs args) private void RemoveDir_Pressed(object sender, EventArgs args)
{ {
TreeSelection selection = _gameDirsBox.Selection; TreeSelection selection = _gameDirsBox.Selection;
@ -285,14 +285,14 @@ namespace Ryujinx.UI
_removeDir.SetStateFlags(0, true); _removeDir.SetStateFlags(0, true);
} }
private void CustThemeToggle_Activated(object obj, EventArgs args) private void CustThemeToggle_Activated(object sender, EventArgs args)
{ {
_custThemePath.Sensitive = _custThemeToggle.Active; _custThemePath.Sensitive = _custThemeToggle.Active;
_custThemePathLabel.Sensitive = _custThemeToggle.Active; _custThemePathLabel.Sensitive = _custThemeToggle.Active;
_browseThemePath.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); 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); _browseThemePath.SetStateFlags(0, true);
} }
private void SaveToggle_Activated(object obj, EventArgs args) private void SaveToggle_Activated(object sender, EventArgs args)
{ {
List<string> gameDirs = new List<string>(); List<string> gameDirs = new List<string>();
@ -380,15 +380,14 @@ namespace Ryujinx.UI
SwitchConfig.FsGlobalAccessLogMode = (int)_fsLogSpinAdjustment.Value; SwitchConfig.FsGlobalAccessLogMode = (int)_fsLogSpinAdjustment.Value;
Configuration.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json")); Configuration.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
Configuration.Configure(Device, SwitchConfig); Configuration.Configure(_device, SwitchConfig);
MainWindow.ApplyTheme(); MainWindow.ApplyTheme();
MainWindow.UpdateGameTable(); MainWindow.UpdateGameTable();
Dispose(); Dispose();
} }
private void CloseToggle_Activated(object obj, EventArgs args) private void CloseToggle_Activated(object sender, EventArgs args)
{ {
Dispose(); Dispose();
} }