Added General Settings Menu (read-only for now) and moved some functionality from MainMenu.cs to ApplicationLibrary.cs
This commit is contained in:
parent
cf3a6cd993
commit
a0fe3401df
9 changed files with 566 additions and 136 deletions
108
Ryujinx/ApplicationLibrary.cs
Normal file
108
Ryujinx/ApplicationLibrary.cs
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Ryujinx
|
||||||
|
{
|
||||||
|
public class ApplicationLibrary
|
||||||
|
{
|
||||||
|
public static Gdk.Pixbuf RyujinxROMIcon { get; private set; }
|
||||||
|
|
||||||
|
public static List<ApplicationData> ApplicationLibraryData { get; private set; }
|
||||||
|
|
||||||
|
public struct ApplicationData
|
||||||
|
{
|
||||||
|
public Gdk.Pixbuf Icon;
|
||||||
|
public string Game;
|
||||||
|
public string Version;
|
||||||
|
public string DLC;
|
||||||
|
public string TP;
|
||||||
|
public string LP;
|
||||||
|
public string Path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
using (Stream iconstream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.ryujinxROMIcon.png"))
|
||||||
|
using (StreamReader reader = new StreamReader(iconstream))
|
||||||
|
{
|
||||||
|
RyujinxROMIcon = new Gdk.Pixbuf(iconstream);
|
||||||
|
}
|
||||||
|
|
||||||
|
string dat = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "GameDirs.dat");
|
||||||
|
if (File.Exists(dat) == false) { File.Create(dat).Close(); }
|
||||||
|
string[] GameDirs = File.ReadAllLines(dat);
|
||||||
|
List<string> Games = new List<string>();
|
||||||
|
|
||||||
|
foreach (string GameDir in GameDirs)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(GameDir) == false) { Logger.PrintError(LogClass.Application, "There is an invalid game directory in \"GameDirs.dat\""); }
|
||||||
|
|
||||||
|
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"))
|
||||||
|
{
|
||||||
|
Games.Add(Game.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationLibraryData = new List<ApplicationData>();
|
||||||
|
foreach (string GamePath in Games)
|
||||||
|
{
|
||||||
|
ApplicationData data = new ApplicationData()
|
||||||
|
{
|
||||||
|
Icon = GetGameIcon(GamePath),
|
||||||
|
Game = (Path.GetExtension(GamePath) == ".nro") ? "Application" : "",
|
||||||
|
Version = "",
|
||||||
|
DLC = "",
|
||||||
|
TP = "",
|
||||||
|
LP = "",
|
||||||
|
Path = GamePath
|
||||||
|
};
|
||||||
|
ApplicationLibraryData.Add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static Gdk.Pixbuf GetGameIcon(string filePath)
|
||||||
|
{
|
||||||
|
using (FileStream Input = File.Open(filePath, FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
|
BinaryReader Reader = new BinaryReader(Input);
|
||||||
|
|
||||||
|
if (Path.GetExtension(filePath) == ".nro")
|
||||||
|
{
|
||||||
|
Input.Seek(24, SeekOrigin.Begin);
|
||||||
|
int AssetOffset = Reader.ReadInt32();
|
||||||
|
|
||||||
|
byte[] Read(long Position, int Size)
|
||||||
|
{
|
||||||
|
Input.Seek(Position, SeekOrigin.Begin);
|
||||||
|
return Reader.ReadBytes(Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Encoding.ASCII.GetString(Read(AssetOffset, 4)) == "ASET")
|
||||||
|
{
|
||||||
|
byte[] IconSectionInfo = Read(AssetOffset + 8, 0x10);
|
||||||
|
|
||||||
|
long IconOffset = BitConverter.ToInt64(IconSectionInfo, 0);
|
||||||
|
long IconSize = BitConverter.ToInt64(IconSectionInfo, 8);
|
||||||
|
|
||||||
|
byte[] IconData = Read(AssetOffset + IconOffset, (int)IconSize);
|
||||||
|
|
||||||
|
return new Gdk.Pixbuf(IconData, 50, 50);
|
||||||
|
}
|
||||||
|
else { return RyujinxROMIcon; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return RyujinxROMIcon; //temp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -183,6 +183,8 @@ namespace Ryujinx
|
||||||
throw new InvalidOperationException("Configuration has not been loaded yet.");
|
throw new InvalidOperationException("Configuration has not been loaded yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GeneralSettings.ConfigureSettings(Instance);
|
||||||
|
|
||||||
GraphicsConfig.ShadersDumpPath = Instance.GraphicsShadersDumpPath;
|
GraphicsConfig.ShadersDumpPath = Instance.GraphicsShadersDumpPath;
|
||||||
|
|
||||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||||
|
|
|
@ -1,62 +1,79 @@
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
using GUI = Gtk.Builder.ObjectAttribute;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace Ryujinx
|
namespace Ryujinx
|
||||||
{
|
{
|
||||||
public class GeneralSettings
|
public class GeneralSettings : Window
|
||||||
{
|
{
|
||||||
public static void GeneralSettingsMenu()
|
internal HLE.Switch device { get; private set; }
|
||||||
{
|
|
||||||
Window GSWin = new Window(WindowType.Toplevel);
|
|
||||||
GSWin.Title = "General Settings";
|
|
||||||
GSWin.Resizable = false;
|
|
||||||
GSWin.WindowPosition = WindowPosition.Center;
|
|
||||||
GSWin.SetDefaultSize(854, 360);
|
|
||||||
|
|
||||||
VBox box = new VBox(false, 2);
|
internal static Configuration SwitchConfig { get; private set; }
|
||||||
|
|
||||||
//Load Icon
|
//UI Controls
|
||||||
using (Stream iconstream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.ryujinxIcon.png"))
|
[GUI] CheckButton ErrorLogToggle;
|
||||||
using (StreamReader reader = new StreamReader(iconstream))
|
[GUI] CheckButton WarningLogToggle;
|
||||||
|
[GUI] CheckButton InfoLogToggle;
|
||||||
|
[GUI] CheckButton StubLogToggle;
|
||||||
|
[GUI] CheckButton DebugLogToggle;
|
||||||
|
[GUI] CheckButton FileLogToggle;
|
||||||
|
[GUI] CheckButton DockedModeToggle;
|
||||||
|
[GUI] CheckButton DiscordToggle;
|
||||||
|
[GUI] CheckButton VSyncToggle;
|
||||||
|
[GUI] CheckButton MultiSchedToggle;
|
||||||
|
[GUI] CheckButton FSICToggle;
|
||||||
|
[GUI] CheckButton AggrToggle;
|
||||||
|
[GUI] CheckButton IgnoreToggle;
|
||||||
|
[GUI] ComboBoxText SystemLanguageSelect;
|
||||||
|
[GUI] TextView GameDirsBox;
|
||||||
|
[GUI] Button SaveButton;
|
||||||
|
[GUI] Button CancelButton;
|
||||||
|
|
||||||
|
public GeneralSettings(HLE.Switch _device) : this(new Builder("Ryujinx.GeneralSettings.glade"), _device) { }
|
||||||
|
|
||||||
|
private GeneralSettings(Builder builder, HLE.Switch _device) : base(builder.GetObject("GSWin").Handle)
|
||||||
{
|
{
|
||||||
Gdk.Pixbuf RyujinxIcon = new Gdk.Pixbuf(iconstream);
|
device = _device;
|
||||||
GSWin.Icon = RyujinxIcon;
|
|
||||||
|
builder.Autoconnect(this);
|
||||||
|
|
||||||
|
SaveButton.Activated += Save_Activated;
|
||||||
|
CancelButton.Activated += Cancel_Activated;
|
||||||
|
|
||||||
|
if (SwitchConfig.LoggingEnableError == true) { ErrorLogToggle.Click(); }
|
||||||
|
if (SwitchConfig.LoggingEnableWarn == true) { WarningLogToggle.Click(); }
|
||||||
|
if (SwitchConfig.LoggingEnableInfo == true) { InfoLogToggle.Click(); }
|
||||||
|
if (SwitchConfig.LoggingEnableStub == true) { StubLogToggle.Click(); }
|
||||||
|
if (SwitchConfig.LoggingEnableDebug == true) { DebugLogToggle.Click(); }
|
||||||
|
if (SwitchConfig.EnableFileLog == true) { FileLogToggle.Click(); }
|
||||||
|
if (SwitchConfig.DockedMode == true) { DockedModeToggle.Click(); }
|
||||||
|
if (SwitchConfig.EnableDiscordIntergration == true) { DiscordToggle.Click(); }
|
||||||
|
if (SwitchConfig.EnableVsync == true) { VSyncToggle.Click(); }
|
||||||
|
if (SwitchConfig.EnableMulticoreScheduling == true) { MultiSchedToggle.Click(); }
|
||||||
|
if (SwitchConfig.EnableFsIntegrityChecks == true) { FSICToggle.Click(); }
|
||||||
|
if (SwitchConfig.EnableAggressiveCpuOpts == true) { AggrToggle.Click(); }
|
||||||
|
if (SwitchConfig.IgnoreMissingServices == true) { IgnoreToggle.Click(); }
|
||||||
|
SystemLanguageSelect.SetActiveId(SwitchConfig.SystemLanguage.ToString());
|
||||||
|
|
||||||
|
GameDirsBox.Buffer.Text = File.ReadAllText("./GameDirs.dat");
|
||||||
}
|
}
|
||||||
|
|
||||||
//settings stuff will replace this block
|
public static void ConfigureSettings(Configuration Instance) { SwitchConfig = Instance; }
|
||||||
Label myLabel = new Label { Text = "General Settings" };
|
|
||||||
box.PackStart(myLabel, true, true, 3);
|
|
||||||
|
|
||||||
HBox ButtonBox = new HBox(true, 3);
|
//Events
|
||||||
Alignment BoxAlign = new Alignment(1, 0, 0, 0);
|
private void Save_Activated(object obj, EventArgs args)
|
||||||
|
{
|
||||||
|
//Saving code is about to make this a BIG boi
|
||||||
|
|
||||||
Button Save = new Button("Save");
|
File.WriteAllText("./GameDirs.dat", GameDirsBox.Buffer.Text);
|
||||||
Save.Pressed += (o, args) => Save_Pressed(o, args, GSWin);
|
|
||||||
ButtonBox.Add(Save);
|
|
||||||
|
|
||||||
Button Cancel = new Button("Cancel");
|
Destroy();
|
||||||
Cancel.Pressed += (o, args) => Cancel_Pressed(o, args, GSWin);
|
|
||||||
ButtonBox.Add(Cancel);
|
|
||||||
|
|
||||||
BoxAlign.SetPadding(0, 5, 0, 7);
|
|
||||||
BoxAlign.Add(ButtonBox);
|
|
||||||
box.PackStart(BoxAlign, false, false, 3);
|
|
||||||
|
|
||||||
GSWin.Add(box);
|
|
||||||
GSWin.ShowAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Save_Pressed(object o, EventArgs args, Window window)
|
private void Cancel_Activated(object obj, EventArgs args)
|
||||||
{
|
{
|
||||||
//save settings stuff will go here
|
Destroy();
|
||||||
window.Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Cancel_Pressed(object o, EventArgs args, Window window)
|
|
||||||
{
|
|
||||||
window.Destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
366
Ryujinx/GeneralSettings.glade
Normal file
366
Ryujinx/GeneralSettings.glade
Normal file
|
@ -0,0 +1,366 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.22.1 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.20"/>
|
||||||
|
<object class="GtkWindow" id="GSWin">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="default_height">500</property>
|
||||||
|
<property name="icon">ryujinxIcon.png</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Settings - Read Only</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="ErrorLogToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Error Logs</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="FileLogToggle">
|
||||||
|
<property name="label" translatable="yes">Enable File Log</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="FSICToggle">
|
||||||
|
<property name="label" translatable="yes">Enable FS Integrity Checks</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="AggrToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Aggressive CPU Options</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="DockedModeToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Docked Mode</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="WarningLogToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Warning Logs</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="InfoLogToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Info Logs</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">2</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="DiscordToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Discord Integration</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">2</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="IgnoreToggle">
|
||||||
|
<property name="label" translatable="yes">Ignore Missing Services</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">2</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="VSyncToggle">
|
||||||
|
<property name="label" translatable="yes">Enable VSync</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">3</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="StubLogToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Stub Logs</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">3</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="DebugLogToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Debug Logs</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">4</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="MultiSchedToggle">
|
||||||
|
<property name="label" translatable="yes">Enable Multicore Scheduling</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">4</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="SystemLanguageSelect">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<items>
|
||||||
|
<item id="AmericanEnglish" translatable="yes">American English</item>
|
||||||
|
<item id="BritishEnglish" translatable="yes">British English</item>
|
||||||
|
<item id="CanadianFrench" translatable="yes">Canadian French</item>
|
||||||
|
<item id="Chinese" translatable="yes">Chinese</item>
|
||||||
|
<item id="Dutch" translatable="yes">Dutch</item>
|
||||||
|
<item id="French" translatable="yes">French</item>
|
||||||
|
<item id="German" translatable="yes">German</item>
|
||||||
|
<item id="Italian" translatable="yes">Italian</item>
|
||||||
|
<item id="Japanese" translatable="yes">Japanese</item>
|
||||||
|
<item id="Korean" translatable="yes">Korean</item>
|
||||||
|
<item id="LatinAmericanSpanish" translatable="yes">Latin American Spanish</item>
|
||||||
|
<item id="Portuguese" translatable="yes">Portuguese</item>
|
||||||
|
<item id="Russian" translatable="yes">Russian</item>
|
||||||
|
<item id="SimplifiedChinese" translatable="yes">Simplified Chinese</item>
|
||||||
|
<item id="Spanish" translatable="yes">Spanish</item>
|
||||||
|
<item id="Taiwanese" translatable="yes">Taiwanese</item>
|
||||||
|
<item id="TraditionalChinese" translatable="yes">Traditional Chinese</item>
|
||||||
|
</items>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">4</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">System Language:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">3</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Game Directories</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTextView" id="GameDirsBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="stock">gtk-discard</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="SaveButton">
|
||||||
|
<property name="label" translatable="yes">Save</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="CancelButton">
|
||||||
|
<property name="label" translatable="yes">Cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
|
@ -4,7 +4,6 @@ using Ryujinx.Common.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Ryujinx
|
namespace Ryujinx
|
||||||
{
|
{
|
||||||
|
@ -12,28 +11,22 @@ namespace Ryujinx
|
||||||
{
|
{
|
||||||
internal HLE.Switch device { get; private set; }
|
internal HLE.Switch device { get; private set; }
|
||||||
|
|
||||||
internal ListStore TableStore { get; private set; }
|
internal Application gtkapp { get; private set; }
|
||||||
|
|
||||||
internal static Gdk.Pixbuf RyujinxIcon { get; private set; }
|
internal ListStore TableStore { get; private set; }
|
||||||
|
|
||||||
//UI Controls
|
//UI Controls
|
||||||
[GUI] Window MainWin;
|
[GUI] Window MainWin;
|
||||||
[GUI] MenuBar MenuBar;
|
|
||||||
[GUI] MenuItem LoadApplicationFile;
|
|
||||||
[GUI] MenuItem LoadApplicationFolder;
|
|
||||||
[GUI] MenuItem Exit;
|
|
||||||
[GUI] MenuItem GeneralSettingsMenu;
|
|
||||||
[GUI] MenuItem ControlSettingsMenu;
|
|
||||||
[GUI] MenuItem NFC;
|
[GUI] MenuItem NFC;
|
||||||
[GUI] MenuItem Debugger;
|
[GUI] MenuItem Debugger;
|
||||||
[GUI] MenuItem About;
|
|
||||||
[GUI] TreeView GameTable;
|
[GUI] TreeView GameTable;
|
||||||
|
|
||||||
public MainMenu(HLE.Switch _device) : this(new Builder("Ryujinx.MainMenu.glade"), _device) { }
|
public MainMenu(HLE.Switch _device, Application _gtkapp) : this(new Builder("Ryujinx.MainMenu.glade"), _device, _gtkapp) { }
|
||||||
|
|
||||||
private MainMenu(Builder builder, HLE.Switch _device) : base(builder.GetObject("MainWin").Handle)
|
private MainMenu(Builder builder, HLE.Switch _device, Application _gtkapp) : base(builder.GetObject("MainWin").Handle)
|
||||||
{
|
{
|
||||||
device = _device;
|
device = _device;
|
||||||
|
gtkapp = _gtkapp;
|
||||||
|
|
||||||
if (device.System.State.DiscordIntergrationEnabled == true)
|
if (device.System.State.DiscordIntergrationEnabled == true)
|
||||||
{
|
{
|
||||||
|
@ -47,14 +40,6 @@ namespace Ryujinx
|
||||||
builder.Autoconnect(this);
|
builder.Autoconnect(this);
|
||||||
ApplyTheme();
|
ApplyTheme();
|
||||||
|
|
||||||
//Load Icon
|
|
||||||
using (Stream iconstream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.ryujinxIcon.png"))
|
|
||||||
using (StreamReader reader = new StreamReader(iconstream))
|
|
||||||
{
|
|
||||||
RyujinxIcon = new Gdk.Pixbuf(iconstream);
|
|
||||||
MainWin.Icon = RyujinxIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteEvent += Window_Close;
|
DeleteEvent += Window_Close;
|
||||||
|
|
||||||
//disable some buttons
|
//disable some buttons
|
||||||
|
@ -63,41 +48,18 @@ namespace Ryujinx
|
||||||
|
|
||||||
//Games grid thing
|
//Games grid thing
|
||||||
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);
|
||||||
GameTable.AppendColumn("Version", new CellRendererText(), "text" , 2);
|
GameTable.AppendColumn("Version", new CellRendererText(), "text", 2);
|
||||||
GameTable.AppendColumn("DLC", new CellRendererText(), "text" , 3);
|
GameTable.AppendColumn("DLC", new CellRendererText(), "text", 3);
|
||||||
GameTable.AppendColumn("Time Played", new CellRendererText(), "text" , 4);
|
GameTable.AppendColumn("Time Played", new CellRendererText(), "text", 4);
|
||||||
GameTable.AppendColumn("Last Played", new CellRendererText(), "text" , 5);
|
GameTable.AppendColumn("Last Played", new CellRendererText(), "text", 5);
|
||||||
GameTable.AppendColumn("Path", new CellRendererText(), "text" , 6);
|
GameTable.AppendColumn("Path", new CellRendererText(), "text", 6);
|
||||||
|
|
||||||
string dat = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "GameDirs.dat");
|
|
||||||
|
|
||||||
if (File.Exists(dat) == false) { File.Create(dat).Close(); }
|
|
||||||
|
|
||||||
string[] GameDirs = File.ReadAllLines(dat);
|
|
||||||
string[] Games = new string[] { };
|
|
||||||
|
|
||||||
foreach (string GameDir in GameDirs)
|
|
||||||
{
|
|
||||||
if (Directory.Exists(GameDir) == false) { Logger.PrintError(LogClass.Application, "There is an invalid game directory in \"GameDirs.dat\""); return; }
|
|
||||||
|
|
||||||
DirectoryInfo GameDirInfo = new DirectoryInfo(GameDir);
|
|
||||||
foreach (var Game in GameDirInfo.GetFiles())
|
|
||||||
{
|
|
||||||
if ((System.IO.Path.GetExtension(Game.ToString()) == ".xci") || (System.IO.Path.GetExtension(Game.ToString()) == ".nca") || (System.IO.Path.GetExtension(Game.ToString()) == ".nsp") || (System.IO.Path.GetExtension(Game.ToString()) == ".pfs0") || (System.IO.Path.GetExtension(Game.ToString()) == ".nro") || (System.IO.Path.GetExtension(Game.ToString()) == ".nso"))
|
|
||||||
{
|
|
||||||
Array.Resize(ref Games, Games.Length + 1);
|
|
||||||
Games[Games.Length - 1] = Game.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), 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), typeof(string));
|
||||||
|
|
||||||
foreach (string GamePath in Games)
|
foreach (ApplicationLibrary.ApplicationData AppData in ApplicationLibrary.ApplicationLibraryData)
|
||||||
{
|
{
|
||||||
Gdk.Pixbuf GameIcon = GetIconData(GamePath);
|
TableStore.AppendValues(AppData.Icon, AppData.Game, AppData.Version, AppData.DLC, AppData.TP, AppData.LP, AppData.Path);
|
||||||
TableStore.AppendValues(GameIcon, "", "", "", "", "", GamePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GameTable.Model = TableStore;
|
GameTable.Model = TableStore;
|
||||||
|
@ -115,43 +77,6 @@ namespace Ryujinx
|
||||||
StyleContext.AddProviderForScreen(Gdk.Screen.Default, css_provider, 800);
|
StyleContext.AddProviderForScreen(Gdk.Screen.Default, css_provider, 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Gdk.Pixbuf GetIconData(string filePath)
|
|
||||||
{
|
|
||||||
using (FileStream Input = File.Open(filePath, FileMode.Open, FileAccess.Read))
|
|
||||||
{
|
|
||||||
BinaryReader Reader = new BinaryReader(Input);
|
|
||||||
|
|
||||||
if (System.IO.Path.GetExtension(filePath) == ".nro")
|
|
||||||
{
|
|
||||||
Input.Seek(24, SeekOrigin.Begin);
|
|
||||||
int AssetOffset = Reader.ReadInt32();
|
|
||||||
|
|
||||||
byte[] Read(long Position, int Size)
|
|
||||||
{
|
|
||||||
Input.Seek(Position, SeekOrigin.Begin);
|
|
||||||
return Reader.ReadBytes(Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Encoding.ASCII.GetString(Read(AssetOffset, 4)) == "ASET")
|
|
||||||
{
|
|
||||||
byte[] IconSectionInfo = Read(AssetOffset + 8, 0x10);
|
|
||||||
|
|
||||||
long IconOffset = BitConverter.ToInt64(IconSectionInfo, 0);
|
|
||||||
long IconSize = BitConverter.ToInt64(IconSectionInfo, 8);
|
|
||||||
|
|
||||||
byte[] IconData = Read(AssetOffset + IconOffset, (int)IconSize);
|
|
||||||
|
|
||||||
return new Gdk.Pixbuf(IconData, 50, 50);
|
|
||||||
}
|
|
||||||
else { return RyujinxIcon; }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return RyujinxIcon; //temp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Events
|
//Events
|
||||||
private void Row_Activated(object obj, RowActivatedArgs args)
|
private void Row_Activated(object obj, RowActivatedArgs args)
|
||||||
{
|
{
|
||||||
|
@ -269,7 +194,12 @@ namespace Ryujinx
|
||||||
|
|
||||||
private void General_Settings_Pressed(object o, EventArgs args)
|
private void General_Settings_Pressed(object o, EventArgs args)
|
||||||
{
|
{
|
||||||
GeneralSettings.GeneralSettingsMenu();
|
var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||||
|
var GSWin = new GeneralSettings(device);
|
||||||
|
|
||||||
|
gtkapp.Register(GLib.Cancellable.Current);
|
||||||
|
gtkapp.AddWindow(GSWin);
|
||||||
|
GSWin.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Control_Settings_Pressed(object o, EventArgs args)
|
private void Control_Settings_Pressed(object o, EventArgs args)
|
||||||
|
@ -299,7 +229,7 @@ namespace Ryujinx
|
||||||
{
|
{
|
||||||
AboutDialog about = new AboutDialog();
|
AboutDialog about = new AboutDialog();
|
||||||
about.ProgramName = "Ryujinx";
|
about.ProgramName = "Ryujinx";
|
||||||
about.Icon = RyujinxIcon;
|
about.Icon = new Gdk.Pixbuf("./ryujinxIcon");
|
||||||
about.Version = "Version x.x.x";
|
about.Version = "Version x.x.x";
|
||||||
about.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)" };
|
about.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)" };
|
||||||
about.Copyright = "Unlicense";
|
about.Copyright = "Unlicense";
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<property name="window_position">center</property>
|
<property name="window_position">center</property>
|
||||||
<property name="default_width">1280</property>
|
<property name="default_width">1280</property>
|
||||||
<property name="default_height">745</property>
|
<property name="default_height">745</property>
|
||||||
|
<property name="icon">ryujinxIcon.png</property>
|
||||||
<property name="gravity">center</property>
|
<property name="gravity">center</property>
|
||||||
<child type="titlebar">
|
<child type="titlebar">
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace Ryujinx
|
||||||
|
|
||||||
Profile.Initialize();
|
Profile.Initialize();
|
||||||
|
|
||||||
|
ApplicationLibrary.Init();
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
|
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
|
||||||
|
|
||||||
|
@ -59,11 +61,11 @@ namespace Ryujinx
|
||||||
Gtk.Application.Init();
|
Gtk.Application.Init();
|
||||||
|
|
||||||
var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||||
var app = new Gtk.Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None);
|
var gtkapp = new Gtk.Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None);
|
||||||
var win = new MainMenu(device);
|
var win = new MainMenu(device, gtkapp);
|
||||||
|
|
||||||
app.Register(GLib.Cancellable.Current);
|
gtkapp.Register(GLib.Cancellable.Current);
|
||||||
app.AddWindow(win);
|
gtkapp.AddWindow(win);
|
||||||
win.Show();
|
win.Show();
|
||||||
|
|
||||||
Gtk.Application.Run();
|
Gtk.Application.Run();
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="GeneralSettings.glade" />
|
||||||
<EmbeddedResource Include="MainMenu.glade" />
|
<EmbeddedResource Include="MainMenu.glade" />
|
||||||
<EmbeddedResource Include="ryujinxIcon.png" />
|
<EmbeddedResource Include="ryujinxROMIcon.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -45,6 +46,9 @@
|
||||||
<None Update="RPsupported.dat">
|
<None Update="RPsupported.dat">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="ryujinxIcon.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Update="Theme.css">
|
<None Update="Theme.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|
BIN
Ryujinx/ryujinxROMIcon.png
Normal file
BIN
Ryujinx/ryujinxROMIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue