diff --git a/Ryujinx/ApplicationLibrary.cs b/Ryujinx/ApplicationLibrary.cs
index d3ac824f33..d4f50c85de 100644
--- a/Ryujinx/ApplicationLibrary.cs
+++ b/Ryujinx/ApplicationLibrary.cs
@@ -26,10 +26,7 @@ namespace Ryujinx
public static void Init()
{
- using (Stream iconstream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.ryujinxROMIcon.png"))
- {
- RyujinxROMIcon = new Gdk.Pixbuf(iconstream, 75, 75);
- }
+ RyujinxROMIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxROMIcon.png", 75, 75);
string dat = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "GameDirs.dat");
if (File.Exists(dat) == false) { File.Create(dat).Close(); }
@@ -38,7 +35,7 @@ namespace Ryujinx
foreach (string GameDir in GameDirs)
{
- if (Directory.Exists(GameDir) == false) { Logger.PrintError(LogClass.Application, "There is an invalid game directory in \"GameDirs.dat\""); }
+ if (Directory.Exists(GameDir) == false) { Logger.PrintError(LogClass.Application, $"\"GameDirs.dat\" contains an invalid directory: \"{GameDir}\""); continue; }
DirectoryInfo GameDirInfo = new DirectoryInfo(GameDir);
foreach (var Game in GameDirInfo.GetFiles())
@@ -73,7 +70,13 @@ namespace Ryujinx
{
BinaryReader Reader = new BinaryReader(Input);
- if (Path.GetExtension(filePath) == ".nro")
+ if ((Path.GetExtension(filePath) == ".nsp") || (Path.GetExtension(filePath) == ".pfs0")) { return RyujinxROMIcon; }
+
+ else if (Path.GetExtension(filePath) == ".xci") { return RyujinxROMIcon; }
+
+ else if (Path.GetExtension(filePath) == ".nca") { return RyujinxROMIcon; }
+
+ else if (Path.GetExtension(filePath) == ".nro")
{
Input.Seek(24, SeekOrigin.Begin);
int AssetOffset = Reader.ReadInt32();
@@ -97,10 +100,8 @@ namespace Ryujinx
}
else { return RyujinxROMIcon; }
}
- else
- {
- return RyujinxROMIcon; //temp
- }
+
+ else { return RyujinxROMIcon; }
}
}
}
diff --git a/Ryujinx/Configuration.cs b/Ryujinx/Configuration.cs
index ff0b0f497b..4f7fbc9e0e 100644
--- a/Ryujinx/Configuration.cs
+++ b/Ryujinx/Configuration.cs
@@ -10,9 +10,11 @@ using Ryujinx.HLE.Input;
using Ryujinx.UI.Input;
using System;
using System.IO;
+using System.Text;
using System.Threading.Tasks;
using Utf8Json;
using Utf8Json.Resolvers;
+using JsonPrettyPrinterPlus;
namespace Ryujinx
{
@@ -182,6 +184,21 @@ namespace Ryujinx
}
}
+ ///
+ /// Save a configuration file to disk
+ ///
+ /// The path to the JSON configuration file
+ public static void SaveConfig(Configuration config, string path)
+ {
+ var resolver = CompositeResolver.Create(
+ new[] { new ConfigurationEnumFormatter() },
+ new[] { StandardResolver.AllowPrivateSnakeCase }
+ );
+
+ var data = JsonSerializer.Serialize(config, resolver);
+ File.WriteAllText(path, Encoding.UTF8.GetString(data, 0, data.Length).PrettyPrintJson());
+ }
+
///
/// Configures a instance
///
diff --git a/Ryujinx/GeneralSettings.cs b/Ryujinx/GUI/GeneralSettings.cs
similarity index 93%
rename from Ryujinx/GeneralSettings.cs
rename to Ryujinx/GUI/GeneralSettings.cs
index 1c440302b5..7c41016bbb 100644
--- a/Ryujinx/GeneralSettings.cs
+++ b/Ryujinx/GUI/GeneralSettings.cs
@@ -3,8 +3,7 @@ using GUI = Gtk.Builder.ObjectAttribute;
using Ryujinx.HLE.HOS.SystemState;
using System;
using System.IO;
-using Utf8Json;
-using Utf8Json.Resolvers;
+using System.Reflection;
namespace Ryujinx
{
@@ -15,6 +14,7 @@ namespace Ryujinx
internal static Configuration SwitchConfig { get; private set; }
//UI Controls
+ [GUI] Window GSWin;
[GUI] CheckButton ErrorLogToggle;
[GUI] CheckButton WarningLogToggle;
[GUI] CheckButton InfoLogToggle;
@@ -37,7 +37,7 @@ namespace Ryujinx
public static void ConfigureSettings(Configuration Instance) { SwitchConfig = Instance; }
- public GeneralSettings(HLE.Switch _device) : this(new Builder("Ryujinx.GeneralSettings.glade"), _device) { }
+ public GeneralSettings(HLE.Switch _device) : this(new Builder("Ryujinx.GUI.GeneralSettings.glade"), _device) { }
private GeneralSettings(Builder builder, HLE.Switch _device) : base(builder.GetObject("GSWin").Handle)
{
@@ -45,8 +45,8 @@ namespace Ryujinx
builder.Autoconnect(this);
- SaveToggle.Toggled += SaveToggle_Activated;
- CloseToggle.Toggled += CloseToggle_Activated;
+ GSWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png");
+
CustThemeToggle.Clicked += CustThemeToggle_Activated;
if (SwitchConfig.LoggingEnableError) { ErrorLogToggle.Click(); }
@@ -102,6 +102,7 @@ namespace Ryujinx
SwitchConfig.SystemLanguage = (SystemLanguage)Enum.Parse(typeof(SystemLanguage), SystemLanguageSelect.ActiveId);
SwitchConfig.CustomThemePath = CustThemeDir.Buffer.Text;
+ Configuration.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.jsonc"));
File.WriteAllText("./GameDirs.dat", GameDirsBox.Buffer.Text);
Configuration.Configure(device, SwitchConfig);
diff --git a/Ryujinx/GeneralSettings.glade b/Ryujinx/GUI/GeneralSettings.glade
similarity index 99%
rename from Ryujinx/GeneralSettings.glade
rename to Ryujinx/GUI/GeneralSettings.glade
index 00752c670f..45b1b7eabf 100644
--- a/Ryujinx/GeneralSettings.glade
+++ b/Ryujinx/GUI/GeneralSettings.glade
@@ -6,7 +6,6 @@
False
Ryujinx - General Settings (Read-Only)
500
- ryujinxIcon.png
@@ -409,6 +408,7 @@
True
True
True
+
False
@@ -422,6 +422,7 @@
True
True
True
+
False
diff --git a/Ryujinx/MainMenu.cs b/Ryujinx/GUI/MainMenu.cs
similarity index 95%
rename from Ryujinx/MainMenu.cs
rename to Ryujinx/GUI/MainMenu.cs
index c38fd8010c..39aa3ebcff 100644
--- a/Ryujinx/MainMenu.cs
+++ b/Ryujinx/GUI/MainMenu.cs
@@ -3,6 +3,7 @@ using GUI = Gtk.Builder.ObjectAttribute;
using Ryujinx.Common.Logging;
using System;
using System.IO;
+using System.Reflection;
namespace Ryujinx
{
@@ -15,13 +16,14 @@ namespace Ryujinx
internal ListStore TableStore { get; private set; }
//UI Controls
+ [GUI] Window MainWin;
[GUI] MenuItem NFC;
[GUI] MenuItem ControlSettingsMenu;
[GUI] TreeView GameTable;
[GUI] ScrolledWindow GameTableWindow;
[GUI] GLArea GLScreen;
- public MainMenu(HLE.Switch _device, Application _gtkapp) : this(new Builder("Ryujinx.MainMenu.glade"), _device, _gtkapp) { }
+ public MainMenu(HLE.Switch _device, Application _gtkapp) : this(new Builder("Ryujinx.GUI.MainMenu.glade"), _device, _gtkapp) { }
private MainMenu(Builder builder, HLE.Switch _device, Application _gtkapp) : base(builder.GetObject("MainWin").Handle)
{
@@ -38,6 +40,7 @@ namespace Ryujinx
}
builder.Autoconnect(this);
+ MainWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png");
GameTableWindow.Show();
GLScreen.Hide();
@@ -84,7 +87,7 @@ namespace Ryujinx
}
else
{
- css_provider.LoadFromPath("Theme.css");
+ css_provider.LoadFromPath("./GUI/assets/Theme.css");
}
StyleContext.AddProviderForScreen(Gdk.Screen.Default, css_provider, 800);
@@ -237,7 +240,7 @@ namespace Ryujinx
AboutDialog about = new AboutDialog
{
ProgramName = "Ryujinx",
- Icon = new Gdk.Pixbuf("./ryujinxIcon.png"),
+ Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png"),
Version = "Version x.x.x",
Authors = new string[] { "gdkchan", "Ac_K", "LDj3SNuD", "emmauss", "MerryMage", "MS-DOS1999", "Thog", "jD", "BaronKiko", "Dr.Hacknik", "Lordmau5", "(and Xpl0itR did a bit of work too :D)" },
Copyright = "Unlicense",
diff --git a/Ryujinx/MainMenu.glade b/Ryujinx/GUI/MainMenu.glade
similarity index 98%
rename from Ryujinx/MainMenu.glade
rename to Ryujinx/GUI/MainMenu.glade
index d17f102886..820a92743f 100644
--- a/Ryujinx/MainMenu.glade
+++ b/Ryujinx/GUI/MainMenu.glade
@@ -7,8 +7,7 @@
Ryujinx
center
1280
- 745
- ryujinxIcon.png
+ 750
center
diff --git a/Ryujinx/Theme.css b/Ryujinx/GUI/assets/Theme.css
similarity index 100%
rename from Ryujinx/Theme.css
rename to Ryujinx/GUI/assets/Theme.css
diff --git a/Ryujinx/ryujinxIcon.png b/Ryujinx/GUI/assets/ryujinxIcon.png
similarity index 100%
rename from Ryujinx/ryujinxIcon.png
rename to Ryujinx/GUI/assets/ryujinxIcon.png
diff --git a/Ryujinx/ryujinxROMIcon.png b/Ryujinx/GUI/assets/ryujinxROMIcon.png
similarity index 100%
rename from Ryujinx/ryujinxROMIcon.png
rename to Ryujinx/GUI/assets/ryujinxROMIcon.png
diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs
index 96a4173c35..3e9d1b5319 100644
--- a/Ryujinx/Program.cs
+++ b/Ryujinx/Program.cs
@@ -25,7 +25,7 @@ namespace Ryujinx
{
Console.Title = "Ryujinx Console";
- string parentDir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Parent.ToString();
+ string parentDir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).ToString();
string systemPATH = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
Environment.SetEnvironmentVariable("Path", $"{Path.Combine(parentDir, "bin")};{systemPATH}");
diff --git a/Ryujinx/Ryujinx.csproj b/Ryujinx/Ryujinx.csproj
index 3499a53c8b..24aacd50ff 100644
--- a/Ryujinx/Ryujinx.csproj
+++ b/Ryujinx/Ryujinx.csproj
@@ -19,14 +19,16 @@
-
-
-
+
+
+
+
+
@@ -43,15 +45,12 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
-
- PreserveNewest
-
-
- PreserveNewest
-