requested changes have been changed

This commit is contained in:
Xpl0itR 2019-06-30 20:43:28 +01:00
commit 982215c66f
No known key found for this signature in database
GPG key ID: 91798184109676AD
9 changed files with 170 additions and 164 deletions

View file

@ -13,43 +13,52 @@ namespace Ryujinx
{ {
public class ApplicationLibrary public class ApplicationLibrary
{ {
public static Gdk.Pixbuf RyujinxNSPIcon { get; private set; } public static Gdk.Pixbuf RyujinxNspIcon { get; private set; }
public static Gdk.Pixbuf RyujinxXCIIcon { get; private set; } public static Gdk.Pixbuf RyujinxXciIcon { get; private set; }
public static Gdk.Pixbuf RyujinxNCAIcon { get; private set; } public static Gdk.Pixbuf RyujinxNcaIcon { get; private set; }
public static Gdk.Pixbuf RyujinxNROIcon { get; private set; } public static Gdk.Pixbuf RyujinxNroIcon { get; private set; }
public static Gdk.Pixbuf RyujinxNSOIcon { get; private set; } public static Gdk.Pixbuf RyujinxNsoIcon { get; private set; }
public static Gdk.Pixbuf RyujinxROMIcon { get; private set; }
public static List<ApplicationData> ApplicationLibraryData { get; private set; } public static List<ApplicationData> ApplicationLibraryData { get; private set; }
public struct ApplicationData public struct ApplicationData
{ {
public Gdk.Pixbuf Icon; public Gdk.Pixbuf Icon;
public string Game; public string GameName;
public string TP; public string TimePlayed;
public string LP; public string LastPlayed;
public string FileSize; public string FileSize;
public string Path; public string Path;
} }
public static void Init() public static void Init()
{ {
RyujinxNSPIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNSPIcon.png", 75, 75); RyujinxNspIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNSPIcon.png", 75, 75);
RyujinxXCIIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxXCIIcon.png", 75, 75); RyujinxXciIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxXCIIcon.png", 75, 75);
RyujinxNCAIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNCAIcon.png", 75, 75); RyujinxNcaIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNCAIcon.png", 75, 75);
RyujinxNROIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNROIcon.png", 75, 75); RyujinxNroIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNROIcon.png", 75, 75);
RyujinxNSOIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNSOIcon.png", 75, 75); RyujinxNsoIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNSOIcon.png", 75, 75);
List<string> Games = new List<string>(); List<string> Games = new List<string>();
foreach (string GameDir in SwitchSettings.SwitchConfig.GameDirs) foreach (string GameDir in SwitchSettings.SwitchConfig.GameDirs)
{ {
if (Directory.Exists(GameDir) == false) { Logger.PrintError(LogClass.Application, $"The \"game_dirs\" section in \"Config.json\" contains an invalid directory: \"{GameDir}\""); continue; } if (Directory.Exists(GameDir) == false)
{
Logger.PrintError(LogClass.Application, $"The \"game_dirs\" section in \"Config.json\" contains an invalid directory: \"{GameDir}\"");
continue;
}
DirectoryInfo GameDirInfo = new DirectoryInfo(GameDir); DirectoryInfo GameDirInfo = new DirectoryInfo(GameDir);
foreach (var Game in GameDirInfo.GetFiles()) foreach (var Game in GameDirInfo.GetFiles())
{ {
if ((Path.GetExtension(Game.ToString()) == ".xci") || (Path.GetExtension(Game.ToString()) == ".nca") || (Path.GetExtension(Game.ToString()) == ".nsp") || (Path.GetExtension(Game.ToString()) == ".pfs0") || (Path.GetExtension(Game.ToString()) == ".nro") || (Path.GetExtension(Game.ToString()) == ".nso")) if ((Path.GetExtension(Game.ToString()) == ".xci") ||
(Path.GetExtension(Game.ToString()) == ".nca") ||
(Path.GetExtension(Game.ToString()) == ".nsp") ||
(Path.GetExtension(Game.ToString()) == ".pfs0") ||
(Path.GetExtension(Game.ToString()) == ".nro") ||
(Path.GetExtension(Game.ToString()) == ".nso"))
{ {
Games.Add(Game.ToString()); Games.Add(Game.ToString());
} }
@ -64,96 +73,96 @@ namespace Ryujinx
using (FileStream file = new FileStream(GamePath, FileMode.Open, FileAccess.Read)) using (FileStream file = new FileStream(GamePath, FileMode.Open, FileAccess.Read))
{ {
Nca controlNca = null; Nca controlNca = null;
PartitionFileSystem PFS = null; PartitionFileSystem pfs = null;
IFileSystem ControlFs = null; IFileSystem controlFs = null;
string TitleName = null; string TitleName = null;
Gdk.Pixbuf GameIcon = null; Gdk.Pixbuf GameIcon = null;
if ((Path.GetExtension(GamePath) == ".nsp") || (Path.GetExtension(GamePath) == ".pfs0")) if ((Path.GetExtension(GamePath) == ".nsp") || (Path.GetExtension(GamePath) == ".pfs0"))
{ {
PFS = new PartitionFileSystem(file.AsStorage()); pfs = new PartitionFileSystem(file.AsStorage());
} }
else if (Path.GetExtension(GamePath) == ".xci") else if (Path.GetExtension(GamePath) == ".xci")
{ {
Xci xci = new Xci(MainMenu.device.System.KeySet, file.AsStorage()); Xci xci = new Xci(MainWindow._device.System.KeySet, file.AsStorage());
PFS = xci.OpenPartition(XciPartitionType.Secure); pfs = xci.OpenPartition(XciPartitionType.Secure);
} }
if (PFS != null) if (pfs != null)
{ {
foreach (DirectoryEntry ticketEntry in PFS.EnumerateEntries("*.tik")) foreach (DirectoryEntry ticketEntry in pfs.EnumerateEntries("*.tik"))
{ {
Ticket ticket = new Ticket(PFS.OpenFile(ticketEntry.FullPath, OpenMode.Read).AsStream()); Ticket ticket = new Ticket(pfs.OpenFile(ticketEntry.FullPath, OpenMode.Read).AsStream());
if (!MainMenu.device.System.KeySet.TitleKeys.ContainsKey(ticket.RightsId)) if (!MainWindow._device.System.KeySet.TitleKeys.ContainsKey(ticket.RightsId))
{ {
MainMenu.device.System.KeySet.TitleKeys.Add(ticket.RightsId, ticket.GetTitleKey(MainMenu.device.System.KeySet)); MainWindow._device.System.KeySet.TitleKeys.Add(ticket.RightsId, ticket.GetTitleKey(MainWindow._device.System.KeySet));
} }
} }
foreach (DirectoryEntry fileEntry in PFS.EnumerateEntries("*.nca")) foreach (DirectoryEntry fileEntry in pfs.EnumerateEntries("*.nca"))
{ {
Nca nca = new Nca(MainMenu.device.System.KeySet, PFS.OpenFile(fileEntry.FullPath, OpenMode.Read).AsStorage()); Nca nca = new Nca(MainWindow._device.System.KeySet, pfs.OpenFile(fileEntry.FullPath, OpenMode.Read).AsStorage());
if (nca.Header.ContentType == ContentType.Control) if (nca.Header.ContentType == ContentType.Control)
{ {
controlNca = nca; controlNca = nca;
} }
} }
ControlFs = controlNca.OpenFileSystem(NcaSectionType.Data, MainMenu.device.System.FsIntegrityCheckLevel); controlFs = controlNca.OpenFileSystem(NcaSectionType.Data, MainWindow._device.System.FsIntegrityCheckLevel);
} }
if ((Path.GetExtension(GamePath) == ".nca") || (Path.GetExtension(GamePath) == ".nro") || (Path.GetExtension(GamePath) == ".nso")) { TitleName = Path.GetFileName(GamePath); } if ((Path.GetExtension(GamePath) == ".nca") || (Path.GetExtension(GamePath) == ".nro") || (Path.GetExtension(GamePath) == ".nso")) { TitleName = Path.GetFileName(GamePath); }
else else
{ {
IFile controlFile = ControlFs.OpenFile("/control.nacp", OpenMode.Read); IFile controlFile = controlFs.OpenFile("/control.nacp", OpenMode.Read);
Nacp ControlData = new Nacp(controlFile.AsStream()); Nacp controlData = new Nacp(controlFile.AsStream());
TitleName = ControlData.Descriptions[(int)MainMenu.device.System.State.DesiredTitleLanguage].Title; TitleName = controlData.Descriptions[(int)MainWindow._device.System.State.DesiredTitleLanguage].Title;
if (string.IsNullOrWhiteSpace(TitleName)) if (string.IsNullOrWhiteSpace(TitleName))
{ {
TitleName = ControlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Title)).Title; TitleName = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Title)).Title;
} }
} }
if (Path.GetExtension(GamePath) == ".nca") { GameIcon = RyujinxNCAIcon; } if (Path.GetExtension(GamePath) == ".nca") { GameIcon = RyujinxNcaIcon; }
else if ((Path.GetExtension(GamePath) == ".xci") || (Path.GetExtension(GamePath) == ".nsp") || (Path.GetExtension(GamePath) == ".pfs0")) else if ((Path.GetExtension(GamePath) == ".xci") || (Path.GetExtension(GamePath) == ".nsp") || (Path.GetExtension(GamePath) == ".pfs0"))
{ {
try try
{ {
IFile logo = ControlFs.OpenFile($"/icon_{MainMenu.device.System.State.DesiredTitleLanguage}.dat", OpenMode.Read); IFile logo = controlFs.OpenFile($"/icon_{MainWindow._device.System.State.DesiredTitleLanguage}.dat", OpenMode.Read);
GameIcon = new Gdk.Pixbuf(logo.AsStream(), 75, 75); GameIcon = new Gdk.Pixbuf(logo.AsStream(), 75, 75);
} }
catch(FileNotFoundException) catch(FileNotFoundException)
{ {
try try
{ {
IFile logo = ControlFs.OpenFile($"/icon_AmericanEnglish.dat", OpenMode.Read); IFile logo = controlFs.OpenFile($"/icon_AmericanEnglish.dat", OpenMode.Read);
GameIcon = new Gdk.Pixbuf(logo.AsStream(), 75, 75); GameIcon = new Gdk.Pixbuf(logo.AsStream(), 75, 75);
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
if (Path.GetExtension(GamePath) == ".xci") { GameIcon = RyujinxXCIIcon; } if (Path.GetExtension(GamePath) == ".xci") { GameIcon = RyujinxXciIcon; }
else { GameIcon = RyujinxNSPIcon; } else { GameIcon = RyujinxNspIcon; }
} }
} }
} }
else if (Path.GetExtension(GamePath) == ".nso") { GameIcon = RyujinxNSOIcon; } else if (Path.GetExtension(GamePath) == ".nso") { GameIcon = RyujinxNsoIcon; }
else if (Path.GetExtension(GamePath) == ".nro") else if (Path.GetExtension(GamePath) == ".nro")
{ {
BinaryReader Reader = new BinaryReader(file); BinaryReader reader = new BinaryReader(file);
file.Seek(24, SeekOrigin.Begin); file.Seek(24, SeekOrigin.Begin);
int AssetOffset = Reader.ReadInt32(); int AssetOffset = reader.ReadInt32();
byte[] Read(long Position, int Size) byte[] Read(long Position, int Size)
{ {
file.Seek(Position, SeekOrigin.Begin); file.Seek(Position, SeekOrigin.Begin);
return Reader.ReadBytes(Size); return reader.ReadBytes(Size);
} }
if (Encoding.ASCII.GetString(Read(AssetOffset, 4)) == "ASET") if (Encoding.ASCII.GetString(Read(AssetOffset, 4)) == "ASET")
@ -167,15 +176,15 @@ namespace Ryujinx
GameIcon = new Gdk.Pixbuf(IconData, 75, 75); GameIcon = new Gdk.Pixbuf(IconData, 75, 75);
} }
else { GameIcon = RyujinxNROIcon; } else { GameIcon = RyujinxNroIcon; }
} }
ApplicationData data = new ApplicationData() ApplicationData data = new ApplicationData()
{ {
Icon = GameIcon, Icon = GameIcon,
Game = TitleName, GameName = TitleName,
TP = "", TimePlayed = "",
LP = "", LastPlayed = "",
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB", FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
Path = GamePath, Path = GamePath,
}; };

View file

@ -259,7 +259,7 @@ namespace Ryujinx
} }
} }
MainMenu.DiscordIntegrationEnabled = SwitchConfig.EnableDiscordIntegration; MainWindow.DiscordIntegrationEnabled = SwitchConfig.EnableDiscordIntegration;
device.EnableDeviceVsync = SwitchConfig.EnableVsync; device.EnableDeviceVsync = SwitchConfig.EnableVsync;

View file

@ -9,12 +9,14 @@ namespace Ryujinx
{ {
public class AboutWindow : Window public class AboutWindow : Window
{ {
#pragma warning disable 649
[GUI] Window AboutWin; [GUI] Window AboutWin;
[GUI] Image RyujinxLogo; [GUI] Image RyujinxLogo;
[GUI] Image PatreonLogo; [GUI] Image PatreonLogo;
[GUI] Image GitHubLogo; [GUI] Image GitHubLogo;
[GUI] Image DiscordLogo; [GUI] Image DiscordLogo;
[GUI] Image TwitterLogo; [GUI] Image TwitterLogo;
#pragma warning restore 649
public AboutWindow() : this(new Builder("Ryujinx.GUI.AboutWindow.glade")) { } public AboutWindow() : this(new Builder("Ryujinx.GUI.AboutWindow.glade")) { }

View file

@ -13,7 +13,7 @@ using System.Reflection;
namespace Ryujinx namespace Ryujinx
{ {
public class MainMenu : Window public class MainWindow : Window
{ {
public static bool DiscordIntegrationEnabled { get; set; } public static bool DiscordIntegrationEnabled { get; set; }
@ -21,39 +21,42 @@ namespace Ryujinx
public static RichPresence DiscordPresence; public static RichPresence DiscordPresence;
private static IGalRenderer renderer; private static IGalRenderer _renderer;
private static IAalOutput audioOut; private static IAalOutput _audioOut;
internal static HLE.Switch device { get; set; } internal static HLE.Switch _device;
private static Application gtkapp { get; set; } private static Application _gtkapp;
private static ListStore TableStore { get; set; } private static ListStore _TableStore;
#pragma warning disable 649
[GUI] Window MainWin; [GUI] Window MainWin;
[GUI] CheckMenuItem FullScreen; [GUI] CheckMenuItem FullScreen;
[GUI] MenuItem NFC; [GUI] MenuItem Nfc;
[GUI] TreeView GameTable; [GUI] Box Box;
[GUI] ScrolledWindow GameTableWindow; [GUI] ScrolledWindow GameTableWindow;
[GUI] GLArea GLScreen; [GUI] TreeView GameTable;
[GUI] GLArea GlScreen;
#pragma warning restore 649
public MainMenu(string[] args, Application _gtkapp) : this(new Builder("Ryujinx.GUI.MainMenu.glade"), args, _gtkapp) { } public MainWindow(string[] args, Application gtkapp) : this(new Builder("Ryujinx.GUI.MainWindow.glade"), args, gtkapp) { }
private MainMenu(Builder builder, string[] args, Application _gtkapp) : base(builder.GetObject("MainWin").Handle) private MainWindow(Builder builder, string[] args, Application gtkapp) : base(builder.GetObject("MainWin").Handle)
{ {
renderer = new OglRenderer(); _renderer = new OglRenderer();
audioOut = InitializeAudioEngine(); _audioOut = InitializeAudioEngine();
device = new HLE.Switch(renderer, audioOut); _device = new HLE.Switch(_renderer, _audioOut);
Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json")); Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
Configuration.InitialConfigure(device); Configuration.InitialConfigure(_device);
ApplicationLibrary.Init(); ApplicationLibrary.Init();
gtkapp = _gtkapp; _gtkapp = gtkapp;
ApplyTheme(); ApplyTheme();
@ -83,26 +86,24 @@ namespace Ryujinx
if (args.Length == 1) if (args.Length == 1)
{ {
GameTableWindow.Hide(); Box.Remove(GameTableWindow);
GLScreen.Show();
LoadApplication(args[0]); LoadApplication(args[0]);
using (GlScreen screen = new GlScreen(device, renderer)) using (GlScreen screen = new GlScreen(_device, _renderer))
{ {
screen.MainLoop(); screen.MainLoop();
Profile.FinishProfiling(); Profile.FinishProfiling();
device.Dispose(); _device.Dispose();
} }
} }
else else
{ {
GameTableWindow.Show(); Box.Remove(GlScreen);
GLScreen.Hide();
NFC.Sensitive = false; Nfc.Sensitive = false;
GameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0); GameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0);
GameTable.AppendColumn("Game", new CellRendererText(), "text", 1); GameTable.AppendColumn("Game", new CellRendererText(), "text", 1);
@ -111,8 +112,8 @@ namespace Ryujinx
GameTable.AppendColumn("File Size", new CellRendererText(), "text", 4); GameTable.AppendColumn("File Size", new CellRendererText(), "text", 4);
GameTable.AppendColumn("Path", new CellRendererText(), "text", 5); GameTable.AppendColumn("Path", new CellRendererText(), "text", 5);
TableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); _TableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
GameTable.Model = TableStore; GameTable.Model = _TableStore;
UpdateGameTable(); UpdateGameTable();
} }
@ -120,12 +121,12 @@ namespace Ryujinx
public static void UpdateGameTable() public static void UpdateGameTable()
{ {
TableStore.Clear(); _TableStore.Clear();
ApplicationLibrary.Init(); ApplicationLibrary.Init();
foreach (ApplicationLibrary.ApplicationData AppData in ApplicationLibrary.ApplicationLibraryData) foreach (ApplicationLibrary.ApplicationData AppData in ApplicationLibrary.ApplicationLibraryData)
{ {
TableStore.AppendValues(AppData.Icon, AppData.Game, AppData.TP, AppData.LP, AppData.FileSize, AppData.Path); _TableStore.AppendValues(AppData.Icon, AppData.GameName, AppData.TimePlayed, AppData.LastPlayed, AppData.FileSize, AppData.Path);
} }
} }
@ -137,13 +138,13 @@ namespace Ryujinx
settings.XftHinting = 1; settings.XftHinting = 1;
settings.XftHintstyle = "hintfull"; settings.XftHintstyle = "hintfull";
CssProvider css_provider = new CssProvider(); CssProvider cssProvider = new CssProvider();
if (SwitchSettings.SwitchConfig.EnableCustomTheme) if (SwitchSettings.SwitchConfig.EnableCustomTheme)
{ {
if (File.Exists(SwitchSettings.SwitchConfig.CustomThemePath) && (System.IO.Path.GetExtension(SwitchSettings.SwitchConfig.CustomThemePath) == ".css")) if (File.Exists(SwitchSettings.SwitchConfig.CustomThemePath) && (System.IO.Path.GetExtension(SwitchSettings.SwitchConfig.CustomThemePath) == ".css"))
{ {
css_provider.LoadFromPath(SwitchSettings.SwitchConfig.CustomThemePath); cssProvider.LoadFromPath(SwitchSettings.SwitchConfig.CustomThemePath);
} }
else else
{ {
@ -152,10 +153,10 @@ namespace Ryujinx
} }
else else
{ {
css_provider.LoadFromPath("./GUI/assets/Theme.css"); cssProvider.LoadFromPath("./GUI/assets/Theme.css");
} }
StyleContext.AddProviderForScreen(Gdk.Screen.Default, css_provider, 800); StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, 800);
} }
private static void LoadApplication(string path) private static void LoadApplication(string path)
@ -172,12 +173,12 @@ namespace Ryujinx
if (romFsFiles.Length > 0) if (romFsFiles.Length > 0)
{ {
Logger.PrintInfo(LogClass.Application, "Loading as cart with RomFS."); Logger.PrintInfo(LogClass.Application, "Loading as cart with RomFS.");
device.LoadCart(path, romFsFiles[0]); _device.LoadCart(path, romFsFiles[0]);
} }
else else
{ {
Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS."); Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS.");
device.LoadCart(path); _device.LoadCart(path);
} }
} }
else if (File.Exists(path)) else if (File.Exists(path))
@ -186,20 +187,20 @@ namespace Ryujinx
{ {
case ".xci": case ".xci":
Logger.PrintInfo(LogClass.Application, "Loading as XCI."); Logger.PrintInfo(LogClass.Application, "Loading as XCI.");
device.LoadXci(path); _device.LoadXci(path);
break; break;
case ".nca": case ".nca":
Logger.PrintInfo(LogClass.Application, "Loading as NCA."); Logger.PrintInfo(LogClass.Application, "Loading as NCA.");
device.LoadNca(path); _device.LoadNca(path);
break; break;
case ".nsp": case ".nsp":
case ".pfs0": case ".pfs0":
Logger.PrintInfo(LogClass.Application, "Loading as NSP."); Logger.PrintInfo(LogClass.Application, "Loading as NSP.");
device.LoadNsp(path); _device.LoadNsp(path);
break; break;
default: default:
Logger.PrintInfo(LogClass.Application, "Loading as homebrew."); Logger.PrintInfo(LogClass.Application, "Loading as homebrew.");
device.LoadProgram(path); _device.LoadProgram(path);
break; break;
} }
} }
@ -210,14 +211,14 @@ namespace Ryujinx
if (DiscordIntegrationEnabled) if (DiscordIntegrationEnabled)
{ {
if (File.ReadAllLines(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RPsupported.dat")).Contains(device.System.TitleID)) if (File.ReadAllLines(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RPsupported.dat")).Contains(_device.System.TitleID))
{ {
DiscordPresence.Assets.LargeImageKey = device.System.TitleID; DiscordPresence.Assets.LargeImageKey = _device.System.TitleID;
} }
DiscordPresence.Details = $"Playing {device.System.TitleName}"; DiscordPresence.Details = $"Playing {_device.System.TitleName}";
DiscordPresence.State = string.IsNullOrWhiteSpace(device.System.TitleID) ? string.Empty : device.System.TitleID.ToUpper(); DiscordPresence.State = string.IsNullOrWhiteSpace(_device.System.TitleID) ? string.Empty : _device.System.TitleID.ToUpper();
DiscordPresence.Assets.LargeImageText = device.System.TitleName; DiscordPresence.Assets.LargeImageText = _device.System.TitleName;
DiscordPresence.Assets.SmallImageKey = "ryujinx"; DiscordPresence.Assets.SmallImageKey = "ryujinx";
DiscordPresence.Assets.SmallImageText = "Ryujinx is an emulator for the Nintendo Switch"; DiscordPresence.Assets.SmallImageText = "Ryujinx is an emulator for the Nintendo Switch";
DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow); DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow);
@ -229,26 +230,26 @@ namespace Ryujinx
//Events //Events
private void Row_Activated(object obj, RowActivatedArgs args) private void Row_Activated(object obj, 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, 5); string path = (string)_TableStore.GetValue(treeiter, 5);
LoadApplication(path); LoadApplication(path);
GameTableWindow.Hide(); Box.Remove(GameTableWindow);
GLScreen.Show(); Box.Add(GlScreen);
Destroy(); Destroy();
using (GlScreen screen = new GlScreen(device, renderer)) using (GlScreen screen = new GlScreen(_device, _renderer))
{ {
screen.MainLoop(); screen.MainLoop();
Profile.FinishProfiling(); Profile.FinishProfiling();
device.Dispose(); _device.Dispose();
} }
audioOut.Dispose(); _audioOut.Dispose();
Logger.Shutdown(); Logger.Shutdown();
} }
@ -266,21 +267,21 @@ namespace Ryujinx
{ {
LoadApplication(fc.Filename); LoadApplication(fc.Filename);
GameTableWindow.Hide(); Box.Remove(GameTableWindow);
GLScreen.Show(); Box.Add(GlScreen);
Destroy(); Destroy();
using (GlScreen screen = new GlScreen(device, renderer)) using (GlScreen screen = new GlScreen(_device, _renderer))
{ {
screen.MainLoop(); screen.MainLoop();
Profile.FinishProfiling(); Profile.FinishProfiling();
device.Dispose(); _device.Dispose();
} }
audioOut.Dispose(); _audioOut.Dispose();
Logger.Shutdown(); Logger.Shutdown();
} }
@ -295,21 +296,21 @@ namespace Ryujinx
{ {
LoadApplication(fc.Filename); LoadApplication(fc.Filename);
GameTableWindow.Hide(); Box.Remove(GameTableWindow);
GLScreen.Show(); Box.Add(GlScreen);
Destroy(); Destroy();
using (GlScreen screen = new GlScreen(device, renderer)) using (GlScreen screen = new GlScreen(_device, _renderer))
{ {
screen.MainLoop(); screen.MainLoop();
Profile.FinishProfiling(); Profile.FinishProfiling();
device.Dispose(); _device.Dispose();
} }
audioOut.Dispose(); _audioOut.Dispose();
Logger.Shutdown(); Logger.Shutdown();
} }
@ -318,7 +319,7 @@ namespace Ryujinx
private void Exit_Pressed(object o, EventArgs args) private void Exit_Pressed(object o, EventArgs args)
{ {
audioOut.Dispose(); _audioOut.Dispose();
DiscordClient.Dispose(); DiscordClient.Dispose();
Logger.Shutdown(); Logger.Shutdown();
Environment.Exit(0); Environment.Exit(0);
@ -326,7 +327,7 @@ namespace Ryujinx
private void Window_Close(object obj, DeleteEventArgs args) private void Window_Close(object obj, DeleteEventArgs args)
{ {
audioOut.Dispose(); _audioOut.Dispose();
DiscordClient.Dispose(); DiscordClient.Dispose();
Logger.Shutdown(); Logger.Shutdown();
Environment.Exit(0); Environment.Exit(0);
@ -334,8 +335,8 @@ namespace Ryujinx
private void ReturnMain_Pressed(object o, EventArgs args) private void ReturnMain_Pressed(object o, EventArgs args)
{ {
GameTableWindow.Show(); Box.Remove(GlScreen);
GLScreen.Hide(); Box.Add(GameTableWindow);
//will also have to write logic to kill running game //will also have to write logic to kill running game
} }
@ -347,18 +348,13 @@ namespace Ryujinx
private void Settings_Pressed(object o, EventArgs args) private void Settings_Pressed(object o, EventArgs args)
{ {
SwitchSettings SettingsWin = new SwitchSettings(device); SwitchSettings SettingsWin = new SwitchSettings(_device);
gtkapp.Register(GLib.Cancellable.Current); _gtkapp.Register(GLib.Cancellable.Current);
gtkapp.AddWindow(SettingsWin); _gtkapp.AddWindow(SettingsWin);
SettingsWin.Show(); SettingsWin.Show();
} }
private void Profiler_Pressed(object o, EventArgs args) private void Nfc_Pressed(object o, EventArgs args)
{
//Soon™
}
private void NFC_Pressed(object o, EventArgs args)
{ {
FileChooserDialog fc = new FileChooserDialog("Choose the file to open", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); FileChooserDialog fc = new FileChooserDialog("Choose the file to open", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
fc.Filter = new FileFilter(); fc.Filter = new FileFilter();
@ -374,8 +370,8 @@ namespace Ryujinx
private void About_Pressed(object o, EventArgs args) private void About_Pressed(object o, EventArgs args)
{ {
AboutWindow AboutWin = new AboutWindow(); AboutWindow AboutWin = new AboutWindow();
gtkapp.Register(GLib.Cancellable.Current); _gtkapp.Register(GLib.Cancellable.Current);
gtkapp.AddWindow(AboutWin); _gtkapp.AddWindow(AboutWin);
AboutWin.Show(); AboutWin.Show();
} }

View file

@ -11,7 +11,7 @@
<placeholder/> <placeholder/>
</child> </child>
<child> <child>
<object class="GtkBox" id="box"> <object class="GtkBox" id="Box">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
@ -124,21 +124,12 @@
<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="GtkMenuItem" id="Profiler"> <object class="GtkMenuItem" id="Nfc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Profiler</property>
<property name="use_underline">True</property>
<signal name="activate" handler="Profiler_Pressed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="NFC">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Scan NFC Tag from File</property> <property name="label" translatable="yes">Scan NFC Tag from File</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<signal name="activate" handler="NFC_Pressed" swapped="no"/> <signal name="activate" handler="Nfc_Pressed" swapped="no"/>
</object> </object>
</child> </child>
</object> </object>
@ -177,6 +168,8 @@
</child> </child>
<child> <child>
<object class="GtkScrolledWindow" id="GameTableWindow"> <object class="GtkScrolledWindow" id="GameTableWindow">
<property name="width_request">1280</property>
<property name="height_request">720</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="shadow_type">in</property> <property name="shadow_type">in</property>
@ -199,7 +192,9 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkGLArea" id="GLScreen"> <object class="GtkGLArea" id="GlScreen">
<property name="width_request">1280</property>
<property name="height_request">720</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="app_paintable">True</property> <property name="app_paintable">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>

View file

@ -15,12 +15,13 @@ namespace Ryujinx
{ {
internal static Configuration SwitchConfig { get; set; } internal static Configuration SwitchConfig { get; set; }
internal HLE.Switch device { get; set; } internal HLE.Switch Device { get; set; }
private static ListStore GameDirsBoxStore { get; set; } private static ListStore _GameDirsBoxStore;
private static bool ListeningForKeypress { get; set; } private static bool _ListeningForKeypress;
#pragma warning disable 649
[GUI] Window SettingsWin; [GUI] Window SettingsWin;
[GUI] CheckButton ErrorLogToggle; [GUI] CheckButton ErrorLogToggle;
[GUI] CheckButton WarningLogToggle; [GUI] CheckButton WarningLogToggle;
@ -77,14 +78,15 @@ namespace Ryujinx
[GUI] ToggleButton Plus1; [GUI] ToggleButton Plus1;
[GUI] ToggleButton R1; [GUI] ToggleButton R1;
[GUI] ToggleButton ZR1; [GUI] ToggleButton ZR1;
#pragma warning restore 649
public static void ConfigureSettings(Configuration Instance) { SwitchConfig = Instance; } public static void ConfigureSettings(Configuration Instance) { SwitchConfig = Instance; }
public SwitchSettings(HLE.Switch _device) : this(new Builder("Ryujinx.GUI.SwitchSettings.glade"), _device) { } public SwitchSettings(HLE.Switch device) : this(new Builder("Ryujinx.GUI.SwitchSettings.glade"), device) { }
private SwitchSettings(Builder builder, HLE.Switch _device) : base(builder.GetObject("SettingsWin").Handle) private SwitchSettings(Builder builder, HLE.Switch device) : base(builder.GetObject("SettingsWin").Handle)
{ {
device = _device; Device = device;
builder.Autoconnect(this); builder.Autoconnect(this);
@ -166,27 +168,27 @@ namespace Ryujinx
FGALMSpinAdjustment.Value = SwitchConfig.FsGlobalAccessLogMode; FGALMSpinAdjustment.Value = SwitchConfig.FsGlobalAccessLogMode;
GameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); GameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
GameDirsBoxStore = new ListStore(typeof(string)); _GameDirsBoxStore = new ListStore(typeof(string));
GameDirsBox.Model = GameDirsBoxStore; GameDirsBox.Model = _GameDirsBoxStore;
foreach (string GameDir in SwitchConfig.GameDirs) foreach (string GameDir in SwitchConfig.GameDirs)
{ {
GameDirsBoxStore.AppendValues(GameDir); _GameDirsBoxStore.AppendValues(GameDir);
} }
if (CustThemeToggle.Active == false) { CustThemeDir.Sensitive = false; CustThemeDirLabel.Sensitive = false; BrowseThemeDir.Sensitive = false; } if (CustThemeToggle.Active == false) { CustThemeDir.Sensitive = false; CustThemeDirLabel.Sensitive = false; BrowseThemeDir.Sensitive = false; }
LogPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log"); LogPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log");
ListeningForKeypress = false; _ListeningForKeypress = false;
} }
//Events //Events
private void Button_Pressed(object obj, EventArgs args, ToggleButton Button) private void Button_Pressed(object obj, EventArgs args, ToggleButton Button)
{ {
if (ListeningForKeypress == false) if (_ListeningForKeypress == false)
{ {
KeyPressEvent += On_KeyPress; KeyPressEvent += On_KeyPress;
ListeningForKeypress = true; _ListeningForKeypress = true;
void On_KeyPress(object Obj, KeyPressEventArgs KeyPressed) void On_KeyPress(object Obj, KeyPressEventArgs KeyPressed)
{ {
@ -198,7 +200,7 @@ namespace Ryujinx
Button.SetStateFlags(0, true); Button.SetStateFlags(0, true);
KeyPressEvent -= On_KeyPress; KeyPressEvent -= On_KeyPress;
ListeningForKeypress = false; _ListeningForKeypress = false;
} }
} }
else { Button.SetStateFlags(0, true); } else { Button.SetStateFlags(0, true); }
@ -206,7 +208,7 @@ namespace Ryujinx
private void AddDir_Pressed(object obj, EventArgs args) private void AddDir_Pressed(object obj, EventArgs args)
{ {
if (Directory.Exists(AddGameDirBox.Buffer.Text)) { GameDirsBoxStore.AppendValues(AddGameDirBox.Buffer.Text); } if (Directory.Exists(AddGameDirBox.Buffer.Text)) { _GameDirsBoxStore.AppendValues(AddGameDirBox.Buffer.Text); }
AddDir.SetStateFlags(0, true); AddDir.SetStateFlags(0, true);
} }
@ -217,7 +219,7 @@ namespace Ryujinx
if (fc.Run() == (int)ResponseType.Accept) if (fc.Run() == (int)ResponseType.Accept)
{ {
GameDirsBoxStore.AppendValues(fc.Filename); _GameDirsBoxStore.AppendValues(fc.Filename);
} }
fc.Destroy(); fc.Destroy();
@ -230,7 +232,7 @@ namespace Ryujinx
TreeSelection selection = GameDirsBox.Selection; TreeSelection selection = GameDirsBox.Selection;
selection.GetSelected(out TreeIter treeiter); selection.GetSelected(out TreeIter treeiter);
GameDirsBoxStore.Remove(ref treeiter); _GameDirsBoxStore.Remove(ref treeiter);
RemoveDir.SetStateFlags(0, true); RemoveDir.SetStateFlags(0, true);
} }
@ -260,14 +262,14 @@ namespace Ryujinx
{ {
List<string> gameDirs = new List<string>(); List<string> gameDirs = new List<string>();
GameDirsBoxStore.GetIterFirst(out TreeIter iter); _GameDirsBoxStore.GetIterFirst(out TreeIter iter);
for (int i = 0; i < GameDirsBoxStore.IterNChildren(); i++) for (int i = 0; i < _GameDirsBoxStore.IterNChildren(); i++)
{ {
GameDirsBoxStore.GetValue(iter, i ); _GameDirsBoxStore.GetValue(iter, i );
gameDirs.Add((string)GameDirsBoxStore.GetValue(iter, 0)); gameDirs.Add((string)_GameDirsBoxStore.GetValue(iter, 0));
GameDirsBoxStore.IterNext(ref iter); _GameDirsBoxStore.IterNext(ref iter);
} }
if (ErrorLogToggle.Active) { SwitchConfig.LoggingEnableError = true; } if (ErrorLogToggle.Active) { SwitchConfig.LoggingEnableError = true; }
@ -347,9 +349,9 @@ namespace Ryujinx
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);
MainMenu.ApplyTheme(); MainWindow.ApplyTheme();
MainMenu.UpdateGameTable(); MainWindow.UpdateGameTable();
Destroy(); Destroy();
} }

View file

@ -25,7 +25,7 @@ namespace Ryujinx
Application.Init(); Application.Init();
Application gtkapp = new Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None); Application gtkapp = new Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None);
MainMenu win = new MainMenu(args, gtkapp); MainWindow win = new MainWindow(args, gtkapp);
gtkapp.Register(GLib.Cancellable.Current); gtkapp.Register(GLib.Cancellable.Current);
gtkapp.AddWindow(win); gtkapp.AddWindow(win);

View file

@ -2,10 +2,10 @@
01000d700be88000 01000d700be88000
01000dc007e90000 01000dc007e90000
01000e2003fa0000 01000e2003fa0000
01002fc00c6d0000
0100225000fee000 0100225000fee000
010028d0045ce000 010028d0045ce000
01002b30028f6000 01002b30028f6000
01002fc00c6d0000
010034e005c9c000 010034e005c9c000
01004f8006a78000 01004f8006a78000
010051f00ac5e000 010051f00ac5e000
@ -21,6 +21,7 @@
010080b00ad66000 010080b00ad66000
010094e00b52e000 010094e00b52e000
01009aa000faa000 01009aa000faa000
01009b90006dc000
0100a4200a284000 0100a4200a284000
0100a5c00d162000 0100a5c00d162000
0100ae000aebc000 0100ae000aebc000
@ -31,6 +32,7 @@
0100d6b00cd88000 0100d6b00cd88000
0100d870045b6000 0100d870045b6000
0100e0c00adac000 0100e0c00adac000
0100e46006708000
0100e7200b272000 0100e7200b272000
0100e9f00b882000 0100e9f00b882000
0100eab00605c000 0100eab00605c000

View file

@ -31,7 +31,7 @@
<EmbeddedResource Include="GUI\assets\ryujinxNSPIcon.png" /> <EmbeddedResource Include="GUI\assets\ryujinxNSPIcon.png" />
<EmbeddedResource Include="GUI\assets\ryujinxXCIIcon.png" /> <EmbeddedResource Include="GUI\assets\ryujinxXCIIcon.png" />
<EmbeddedResource Include="GUI\assets\TwitterLogo.png" /> <EmbeddedResource Include="GUI\assets\TwitterLogo.png" />
<EmbeddedResource Include="GUI\MainMenu.glade" /> <EmbeddedResource Include="GUI\MainWindow.glade" />
<EmbeddedResource Include="GUI\SwitchSettings.glade" /> <EmbeddedResource Include="GUI\SwitchSettings.glade" />
</ItemGroup> </ItemGroup>