requested changes have been changed
This commit is contained in:
parent
da3d3f040e
commit
982215c66f
9 changed files with 170 additions and 164 deletions
|
@ -13,43 +13,52 @@ namespace Ryujinx
|
|||
{
|
||||
public class ApplicationLibrary
|
||||
{
|
||||
public static Gdk.Pixbuf RyujinxNSPIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxXCIIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxNCAIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxNROIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxNSOIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxROMIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxNspIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxXciIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxNcaIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxNroIcon { get; private set; }
|
||||
public static Gdk.Pixbuf RyujinxNsoIcon { get; private set; }
|
||||
|
||||
public static List<ApplicationData> ApplicationLibraryData { get; private set; }
|
||||
|
||||
public struct ApplicationData
|
||||
{
|
||||
public Gdk.Pixbuf Icon;
|
||||
public string Game;
|
||||
public string TP;
|
||||
public string LP;
|
||||
public string GameName;
|
||||
public string TimePlayed;
|
||||
public string LastPlayed;
|
||||
public string FileSize;
|
||||
public string Path;
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
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);
|
||||
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);
|
||||
RyujinxNSOIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNSOIcon.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);
|
||||
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);
|
||||
RyujinxNsoIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNSOIcon.png", 75, 75);
|
||||
|
||||
List<string> Games = new List<string>();
|
||||
|
||||
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);
|
||||
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());
|
||||
}
|
||||
|
@ -64,96 +73,96 @@ namespace Ryujinx
|
|||
using (FileStream file = new FileStream(GamePath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
Nca controlNca = null;
|
||||
PartitionFileSystem PFS = null;
|
||||
IFileSystem ControlFs = null;
|
||||
PartitionFileSystem pfs = null;
|
||||
IFileSystem controlFs = null;
|
||||
string TitleName = null;
|
||||
Gdk.Pixbuf GameIcon = null;
|
||||
|
||||
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")
|
||||
{
|
||||
Xci xci = new Xci(MainMenu.device.System.KeySet, file.AsStorage());
|
||||
PFS = xci.OpenPartition(XciPartitionType.Secure);
|
||||
Xci xci = new Xci(MainWindow._device.System.KeySet, file.AsStorage());
|
||||
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)
|
||||
{
|
||||
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); }
|
||||
else
|
||||
{
|
||||
IFile controlFile = ControlFs.OpenFile("/control.nacp", OpenMode.Read);
|
||||
Nacp ControlData = new Nacp(controlFile.AsStream());
|
||||
IFile controlFile = controlFs.OpenFile("/control.nacp", OpenMode.Read);
|
||||
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))
|
||||
{
|
||||
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"))
|
||||
{
|
||||
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);
|
||||
}
|
||||
catch(FileNotFoundException)
|
||||
{
|
||||
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);
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
if (Path.GetExtension(GamePath) == ".xci") { GameIcon = RyujinxXCIIcon; }
|
||||
else { GameIcon = RyujinxNSPIcon; }
|
||||
if (Path.GetExtension(GamePath) == ".xci") { GameIcon = RyujinxXciIcon; }
|
||||
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")
|
||||
{
|
||||
BinaryReader Reader = new BinaryReader(file);
|
||||
BinaryReader reader = new BinaryReader(file);
|
||||
|
||||
file.Seek(24, SeekOrigin.Begin);
|
||||
int AssetOffset = Reader.ReadInt32();
|
||||
int AssetOffset = reader.ReadInt32();
|
||||
|
||||
byte[] Read(long Position, int Size)
|
||||
{
|
||||
file.Seek(Position, SeekOrigin.Begin);
|
||||
return Reader.ReadBytes(Size);
|
||||
return reader.ReadBytes(Size);
|
||||
}
|
||||
|
||||
if (Encoding.ASCII.GetString(Read(AssetOffset, 4)) == "ASET")
|
||||
|
@ -167,17 +176,17 @@ namespace Ryujinx
|
|||
|
||||
GameIcon = new Gdk.Pixbuf(IconData, 75, 75);
|
||||
}
|
||||
else { GameIcon = RyujinxNROIcon; }
|
||||
else { GameIcon = RyujinxNroIcon; }
|
||||
}
|
||||
|
||||
ApplicationData data = new ApplicationData()
|
||||
{
|
||||
Icon = GameIcon,
|
||||
Game = TitleName,
|
||||
TP = "",
|
||||
LP = "",
|
||||
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
|
||||
Path = GamePath,
|
||||
Icon = GameIcon,
|
||||
GameName = TitleName,
|
||||
TimePlayed = "",
|
||||
LastPlayed = "",
|
||||
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
|
||||
Path = GamePath,
|
||||
};
|
||||
|
||||
ApplicationLibraryData.Add(data);
|
||||
|
|
|
@ -259,7 +259,7 @@ namespace Ryujinx
|
|||
}
|
||||
}
|
||||
|
||||
MainMenu.DiscordIntegrationEnabled = SwitchConfig.EnableDiscordIntegration;
|
||||
MainWindow.DiscordIntegrationEnabled = SwitchConfig.EnableDiscordIntegration;
|
||||
|
||||
device.EnableDeviceVsync = SwitchConfig.EnableVsync;
|
||||
|
||||
|
|
|
@ -9,12 +9,14 @@ namespace Ryujinx
|
|||
{
|
||||
public class AboutWindow : Window
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[GUI] Window AboutWin;
|
||||
[GUI] Image RyujinxLogo;
|
||||
[GUI] Image PatreonLogo;
|
||||
[GUI] Image GitHubLogo;
|
||||
[GUI] Image DiscordLogo;
|
||||
[GUI] Image TwitterLogo;
|
||||
#pragma warning restore 649
|
||||
|
||||
public AboutWindow() : this(new Builder("Ryujinx.GUI.AboutWindow.glade")) { }
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ using System.Reflection;
|
|||
|
||||
namespace Ryujinx
|
||||
{
|
||||
public class MainMenu : Window
|
||||
public class MainWindow : Window
|
||||
{
|
||||
public static bool DiscordIntegrationEnabled { get; set; }
|
||||
|
||||
|
@ -21,39 +21,42 @@ namespace Ryujinx
|
|||
|
||||
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] CheckMenuItem FullScreen;
|
||||
[GUI] MenuItem NFC;
|
||||
[GUI] TreeView GameTable;
|
||||
[GUI] MenuItem Nfc;
|
||||
[GUI] Box Box;
|
||||
[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.InitialConfigure(device);
|
||||
Configuration.InitialConfigure(_device);
|
||||
|
||||
ApplicationLibrary.Init();
|
||||
|
||||
gtkapp = _gtkapp;
|
||||
_gtkapp = gtkapp;
|
||||
|
||||
ApplyTheme();
|
||||
|
||||
|
@ -83,26 +86,24 @@ namespace Ryujinx
|
|||
|
||||
if (args.Length == 1)
|
||||
{
|
||||
GameTableWindow.Hide();
|
||||
GLScreen.Show();
|
||||
Box.Remove(GameTableWindow);
|
||||
|
||||
LoadApplication(args[0]);
|
||||
|
||||
using (GlScreen screen = new GlScreen(device, renderer))
|
||||
using (GlScreen screen = new GlScreen(_device, _renderer))
|
||||
{
|
||||
screen.MainLoop();
|
||||
|
||||
Profile.FinishProfiling();
|
||||
|
||||
device.Dispose();
|
||||
_device.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GameTableWindow.Show();
|
||||
GLScreen.Hide();
|
||||
Box.Remove(GlScreen);
|
||||
|
||||
NFC.Sensitive = false;
|
||||
Nfc.Sensitive = false;
|
||||
|
||||
GameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0);
|
||||
GameTable.AppendColumn("Game", new CellRendererText(), "text", 1);
|
||||
|
@ -111,8 +112,8 @@ namespace Ryujinx
|
|||
GameTable.AppendColumn("File Size", new CellRendererText(), "text", 4);
|
||||
GameTable.AppendColumn("Path", new CellRendererText(), "text", 5);
|
||||
|
||||
TableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
|
||||
GameTable.Model = TableStore;
|
||||
_TableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
|
||||
GameTable.Model = _TableStore;
|
||||
|
||||
UpdateGameTable();
|
||||
}
|
||||
|
@ -120,12 +121,12 @@ namespace Ryujinx
|
|||
|
||||
public static void UpdateGameTable()
|
||||
{
|
||||
TableStore.Clear();
|
||||
_TableStore.Clear();
|
||||
ApplicationLibrary.Init();
|
||||
|
||||
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.XftHintstyle = "hintfull";
|
||||
|
||||
CssProvider css_provider = new CssProvider();
|
||||
CssProvider cssProvider = new CssProvider();
|
||||
|
||||
if (SwitchSettings.SwitchConfig.EnableCustomTheme)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -152,10 +153,10 @@ namespace Ryujinx
|
|||
}
|
||||
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)
|
||||
|
@ -172,12 +173,12 @@ namespace Ryujinx
|
|||
if (romFsFiles.Length > 0)
|
||||
{
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as cart with RomFS.");
|
||||
device.LoadCart(path, romFsFiles[0]);
|
||||
_device.LoadCart(path, romFsFiles[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS.");
|
||||
device.LoadCart(path);
|
||||
_device.LoadCart(path);
|
||||
}
|
||||
}
|
||||
else if (File.Exists(path))
|
||||
|
@ -186,20 +187,20 @@ namespace Ryujinx
|
|||
{
|
||||
case ".xci":
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as XCI.");
|
||||
device.LoadXci(path);
|
||||
_device.LoadXci(path);
|
||||
break;
|
||||
case ".nca":
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as NCA.");
|
||||
device.LoadNca(path);
|
||||
_device.LoadNca(path);
|
||||
break;
|
||||
case ".nsp":
|
||||
case ".pfs0":
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as NSP.");
|
||||
device.LoadNsp(path);
|
||||
_device.LoadNsp(path);
|
||||
break;
|
||||
default:
|
||||
Logger.PrintInfo(LogClass.Application, "Loading as homebrew.");
|
||||
device.LoadProgram(path);
|
||||
_device.LoadProgram(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -210,14 +211,14 @@ namespace Ryujinx
|
|||
|
||||
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.State = string.IsNullOrWhiteSpace(device.System.TitleID) ? string.Empty : device.System.TitleID.ToUpper();
|
||||
DiscordPresence.Assets.LargeImageText = device.System.TitleName;
|
||||
DiscordPresence.Details = $"Playing {_device.System.TitleName}";
|
||||
DiscordPresence.State = string.IsNullOrWhiteSpace(_device.System.TitleID) ? string.Empty : _device.System.TitleID.ToUpper();
|
||||
DiscordPresence.Assets.LargeImageText = _device.System.TitleName;
|
||||
DiscordPresence.Assets.SmallImageKey = "ryujinx";
|
||||
DiscordPresence.Assets.SmallImageText = "Ryujinx is an emulator for the Nintendo Switch";
|
||||
DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow);
|
||||
|
@ -229,26 +230,26 @@ namespace Ryujinx
|
|||
//Events
|
||||
private void Row_Activated(object obj, RowActivatedArgs args)
|
||||
{
|
||||
TableStore.GetIter(out TreeIter treeiter, new TreePath(args.Path.ToString()));
|
||||
string path = (string)TableStore.GetValue(treeiter, 5);
|
||||
_TableStore.GetIter(out TreeIter treeiter, new TreePath(args.Path.ToString()));
|
||||
string path = (string)_TableStore.GetValue(treeiter, 5);
|
||||
|
||||
LoadApplication(path);
|
||||
|
||||
GameTableWindow.Hide();
|
||||
GLScreen.Show();
|
||||
Box.Remove(GameTableWindow);
|
||||
Box.Add(GlScreen);
|
||||
|
||||
Destroy();
|
||||
|
||||
using (GlScreen screen = new GlScreen(device, renderer))
|
||||
using (GlScreen screen = new GlScreen(_device, _renderer))
|
||||
{
|
||||
screen.MainLoop();
|
||||
|
||||
Profile.FinishProfiling();
|
||||
|
||||
device.Dispose();
|
||||
_device.Dispose();
|
||||
}
|
||||
|
||||
audioOut.Dispose();
|
||||
_audioOut.Dispose();
|
||||
Logger.Shutdown();
|
||||
}
|
||||
|
||||
|
@ -266,21 +267,21 @@ namespace Ryujinx
|
|||
{
|
||||
LoadApplication(fc.Filename);
|
||||
|
||||
GameTableWindow.Hide();
|
||||
GLScreen.Show();
|
||||
Box.Remove(GameTableWindow);
|
||||
Box.Add(GlScreen);
|
||||
|
||||
Destroy();
|
||||
|
||||
using (GlScreen screen = new GlScreen(device, renderer))
|
||||
using (GlScreen screen = new GlScreen(_device, _renderer))
|
||||
{
|
||||
screen.MainLoop();
|
||||
|
||||
Profile.FinishProfiling();
|
||||
|
||||
device.Dispose();
|
||||
_device.Dispose();
|
||||
}
|
||||
|
||||
audioOut.Dispose();
|
||||
_audioOut.Dispose();
|
||||
Logger.Shutdown();
|
||||
}
|
||||
|
||||
|
@ -295,21 +296,21 @@ namespace Ryujinx
|
|||
{
|
||||
LoadApplication(fc.Filename);
|
||||
|
||||
GameTableWindow.Hide();
|
||||
GLScreen.Show();
|
||||
Box.Remove(GameTableWindow);
|
||||
Box.Add(GlScreen);
|
||||
|
||||
Destroy();
|
||||
|
||||
using (GlScreen screen = new GlScreen(device, renderer))
|
||||
using (GlScreen screen = new GlScreen(_device, _renderer))
|
||||
{
|
||||
screen.MainLoop();
|
||||
|
||||
Profile.FinishProfiling();
|
||||
|
||||
device.Dispose();
|
||||
_device.Dispose();
|
||||
}
|
||||
|
||||
audioOut.Dispose();
|
||||
_audioOut.Dispose();
|
||||
Logger.Shutdown();
|
||||
}
|
||||
|
||||
|
@ -318,7 +319,7 @@ namespace Ryujinx
|
|||
|
||||
private void Exit_Pressed(object o, EventArgs args)
|
||||
{
|
||||
audioOut.Dispose();
|
||||
_audioOut.Dispose();
|
||||
DiscordClient.Dispose();
|
||||
Logger.Shutdown();
|
||||
Environment.Exit(0);
|
||||
|
@ -326,7 +327,7 @@ namespace Ryujinx
|
|||
|
||||
private void Window_Close(object obj, DeleteEventArgs args)
|
||||
{
|
||||
audioOut.Dispose();
|
||||
_audioOut.Dispose();
|
||||
DiscordClient.Dispose();
|
||||
Logger.Shutdown();
|
||||
Environment.Exit(0);
|
||||
|
@ -334,8 +335,8 @@ namespace Ryujinx
|
|||
|
||||
private void ReturnMain_Pressed(object o, EventArgs args)
|
||||
{
|
||||
GameTableWindow.Show();
|
||||
GLScreen.Hide();
|
||||
Box.Remove(GlScreen);
|
||||
Box.Add(GameTableWindow);
|
||||
//will also have to write logic to kill running game
|
||||
}
|
||||
|
||||
|
@ -347,18 +348,13 @@ namespace Ryujinx
|
|||
|
||||
private void Settings_Pressed(object o, EventArgs args)
|
||||
{
|
||||
SwitchSettings SettingsWin = new SwitchSettings(device);
|
||||
gtkapp.Register(GLib.Cancellable.Current);
|
||||
gtkapp.AddWindow(SettingsWin);
|
||||
SwitchSettings SettingsWin = new SwitchSettings(_device);
|
||||
_gtkapp.Register(GLib.Cancellable.Current);
|
||||
_gtkapp.AddWindow(SettingsWin);
|
||||
SettingsWin.Show();
|
||||
}
|
||||
|
||||
private void Profiler_Pressed(object o, EventArgs args)
|
||||
{
|
||||
//Soon™
|
||||
}
|
||||
|
||||
private void NFC_Pressed(object o, EventArgs args)
|
||||
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);
|
||||
fc.Filter = new FileFilter();
|
||||
|
@ -374,8 +370,8 @@ namespace Ryujinx
|
|||
private void About_Pressed(object o, EventArgs args)
|
||||
{
|
||||
AboutWindow AboutWin = new AboutWindow();
|
||||
gtkapp.Register(GLib.Cancellable.Current);
|
||||
gtkapp.AddWindow(AboutWin);
|
||||
_gtkapp.Register(GLib.Cancellable.Current);
|
||||
_gtkapp.AddWindow(AboutWin);
|
||||
AboutWin.Show();
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box">
|
||||
<object class="GtkBox" id="Box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
|
@ -124,21 +124,12 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="Profiler">
|
||||
<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">
|
||||
<object class="GtkMenuItem" id="Nfc">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Scan NFC Tag from File</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="NFC_Pressed" swapped="no"/>
|
||||
<signal name="activate" handler="Nfc_Pressed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -177,6 +168,8 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="GameTableWindow">
|
||||
<property name="width_request">1280</property>
|
||||
<property name="height_request">720</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
|
@ -199,7 +192,9 @@
|
|||
</packing>
|
||||
</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="app_paintable">True</property>
|
||||
<property name="can_focus">False</property>
|
|
@ -15,12 +15,13 @@ namespace Ryujinx
|
|||
{
|
||||
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] CheckButton ErrorLogToggle;
|
||||
[GUI] CheckButton WarningLogToggle;
|
||||
|
@ -77,14 +78,15 @@ namespace Ryujinx
|
|||
[GUI] ToggleButton Plus1;
|
||||
[GUI] ToggleButton R1;
|
||||
[GUI] ToggleButton ZR1;
|
||||
#pragma warning restore 649
|
||||
|
||||
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);
|
||||
|
||||
|
@ -166,27 +168,27 @@ namespace Ryujinx
|
|||
FGALMSpinAdjustment.Value = SwitchConfig.FsGlobalAccessLogMode;
|
||||
|
||||
GameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
|
||||
GameDirsBoxStore = new ListStore(typeof(string));
|
||||
GameDirsBox.Model = GameDirsBoxStore;
|
||||
_GameDirsBoxStore = new ListStore(typeof(string));
|
||||
GameDirsBox.Model = _GameDirsBoxStore;
|
||||
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; }
|
||||
|
||||
LogPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log");
|
||||
|
||||
ListeningForKeypress = false;
|
||||
_ListeningForKeypress = false;
|
||||
}
|
||||
|
||||
//Events
|
||||
private void Button_Pressed(object obj, EventArgs args, ToggleButton Button)
|
||||
{
|
||||
if (ListeningForKeypress == false)
|
||||
if (_ListeningForKeypress == false)
|
||||
{
|
||||
KeyPressEvent += On_KeyPress;
|
||||
ListeningForKeypress = true;
|
||||
_ListeningForKeypress = true;
|
||||
|
||||
void On_KeyPress(object Obj, KeyPressEventArgs KeyPressed)
|
||||
{
|
||||
|
@ -198,7 +200,7 @@ namespace Ryujinx
|
|||
|
||||
Button.SetStateFlags(0, true);
|
||||
KeyPressEvent -= On_KeyPress;
|
||||
ListeningForKeypress = false;
|
||||
_ListeningForKeypress = false;
|
||||
}
|
||||
}
|
||||
else { Button.SetStateFlags(0, true); }
|
||||
|
@ -206,7 +208,7 @@ namespace Ryujinx
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -217,7 +219,7 @@ namespace Ryujinx
|
|||
|
||||
if (fc.Run() == (int)ResponseType.Accept)
|
||||
{
|
||||
GameDirsBoxStore.AppendValues(fc.Filename);
|
||||
_GameDirsBoxStore.AppendValues(fc.Filename);
|
||||
}
|
||||
|
||||
fc.Destroy();
|
||||
|
@ -230,7 +232,7 @@ namespace Ryujinx
|
|||
TreeSelection selection = GameDirsBox.Selection;
|
||||
|
||||
selection.GetSelected(out TreeIter treeiter);
|
||||
GameDirsBoxStore.Remove(ref treeiter);
|
||||
_GameDirsBoxStore.Remove(ref treeiter);
|
||||
|
||||
RemoveDir.SetStateFlags(0, true);
|
||||
}
|
||||
|
@ -260,14 +262,14 @@ namespace Ryujinx
|
|||
{
|
||||
List<string> gameDirs = new List<string>();
|
||||
|
||||
GameDirsBoxStore.GetIterFirst(out TreeIter iter);
|
||||
for (int i = 0; i < GameDirsBoxStore.IterNChildren(); i++)
|
||||
_GameDirsBoxStore.GetIterFirst(out TreeIter iter);
|
||||
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; }
|
||||
|
@ -347,9 +349,9 @@ namespace Ryujinx
|
|||
|
||||
|
||||
Configuration.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
Configuration.Configure(device, SwitchConfig);
|
||||
MainMenu.ApplyTheme();
|
||||
MainMenu.UpdateGameTable();
|
||||
Configuration.Configure(Device, SwitchConfig);
|
||||
MainWindow.ApplyTheme();
|
||||
MainWindow.UpdateGameTable();
|
||||
|
||||
Destroy();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Ryujinx
|
|||
Application.Init();
|
||||
|
||||
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.AddWindow(win);
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
01000d700be88000
|
||||
01000dc007e90000
|
||||
01000e2003fa0000
|
||||
01002fc00c6d0000
|
||||
0100225000fee000
|
||||
010028d0045ce000
|
||||
01002b30028f6000
|
||||
01002fc00c6d0000
|
||||
010034e005c9c000
|
||||
01004f8006a78000
|
||||
010051f00ac5e000
|
||||
|
@ -21,6 +21,7 @@
|
|||
010080b00ad66000
|
||||
010094e00b52e000
|
||||
01009aa000faa000
|
||||
01009b90006dc000
|
||||
0100a4200a284000
|
||||
0100a5c00d162000
|
||||
0100ae000aebc000
|
||||
|
@ -31,6 +32,7 @@
|
|||
0100d6b00cd88000
|
||||
0100d870045b6000
|
||||
0100e0c00adac000
|
||||
0100e46006708000
|
||||
0100e7200b272000
|
||||
0100e9f00b882000
|
||||
0100eab00605c000
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<EmbeddedResource Include="GUI\assets\ryujinxNSPIcon.png" />
|
||||
<EmbeddedResource Include="GUI\assets\ryujinxXCIIcon.png" />
|
||||
<EmbeddedResource Include="GUI\assets\TwitterLogo.png" />
|
||||
<EmbeddedResource Include="GUI\MainMenu.glade" />
|
||||
<EmbeddedResource Include="GUI\MainWindow.glade" />
|
||||
<EmbeddedResource Include="GUI\SwitchSettings.glade" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue