2nd wave of changes

This commit is contained in:
Xpl0itR 2019-06-13 15:14:27 +01:00
parent 8b2781c578
commit 86191d78bb
No known key found for this signature in database
GPG key ID: 91798184109676AD
10 changed files with 175 additions and 41 deletions

View file

@ -39,12 +39,9 @@ namespace Ryujinx
RyujinxNSOIcon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxNSOIcon.png", 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(); }
string[] GameDirs = File.ReadAllLines(dat);
List<string> Games = new List<string>();
foreach (string GameDir in GameDirs)
foreach (string GameDir in SwitchSettings.SwitchConfig.GameDirs)
{
if (Directory.Exists(GameDir) == false) { Logger.PrintError(LogClass.Application, $"\"GameDirs.dat\" contains an invalid directory: \"{GameDir}\""); continue; }

View file

@ -18,6 +18,7 @@
"enable_legacy_jit": false,
"ignore_missing_services": false,
"controller_type": "Handheld",
"game_dirs": [],
"enable_custom_theme": false,
"custom_theme_path": "",
"keyboard_controls": {

View file

@ -1,4 +1,5 @@
using ARMeilleure;
using JsonPrettyPrinterPlus;
using LibHac.Fs;
using OpenTK.Input;
using Ryujinx.Common;
@ -9,12 +10,12 @@ using Ryujinx.HLE.HOS.Services;
using Ryujinx.HLE.Input;
using Ryujinx.UI.Input;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Utf8Json;
using Utf8Json.Resolvers;
using JsonPrettyPrinterPlus;
namespace Ryujinx
{
@ -125,6 +126,11 @@ namespace Ryujinx
/// </summary>
public ControllerStatus ControllerType { get; private set; }
/// <summary>
/// A list of directories containing games to be used to load games into the games list
/// </summary>
public List<string> GameDirs { get; set; }
/// <summary>
/// Enable or disable custom themes in the GUI
/// </summary>

View file

@ -32,6 +32,7 @@ namespace Ryujinx
private static ListStore TableStore { get; set; }
[GUI] Window MainWin;
[GUI] CheckMenuItem FullScreen;
[GUI] MenuItem NFC;
[GUI] TreeView GameTable;
[GUI] ScrolledWindow GameTableWindow;
@ -50,6 +51,8 @@ namespace Ryujinx
Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
Configuration.InitialConfigure(device);
ApplicationLibrary.Init();
gtkapp = _gtkapp;
ApplyTheme();
@ -111,13 +114,20 @@ namespace Ryujinx
GameTable.AppendColumn("Path", new CellRendererText(), "text", 7);
TableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
foreach (ApplicationLibrary.ApplicationData AppData in ApplicationLibrary.ApplicationLibraryData)
{
TableStore.AppendValues(AppData.Icon, AppData.Game, AppData.Version, AppData.DLC, AppData.TP, AppData.LP, AppData.FileSize, AppData.Path);
}
GameTable.Model = TableStore;
UpdateGameTable();
}
}
public static void UpdateGameTable()
{
TableStore.Clear();
ApplicationLibrary.Init();
foreach (ApplicationLibrary.ApplicationData AppData in ApplicationLibrary.ApplicationLibraryData)
{
TableStore.AppendValues(AppData.Icon, AppData.Game, AppData.Version, AppData.DLC, AppData.TP, AppData.LP, AppData.FileSize, AppData.Path);
}
}
@ -317,6 +327,19 @@ namespace Ryujinx
Environment.Exit(0);
}
private void ReturnMain_Pressed(object o, EventArgs args)
{
GameTableWindow.Show();
GLScreen.Hide();
//will also have to write logic to kill running game
}
private void FullScreen_Toggled(object o, EventArgs args)
{
if (FullScreen.Active == true) { Fullscreen(); }
else { Unfullscreen(); }
}
private void Settings_Pressed(object o, EventArgs args)
{
var SettingsWin = new SwitchSettings(device);
@ -325,6 +348,11 @@ namespace Ryujinx
SettingsWin.Show();
}
private void Profiler_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);
@ -333,7 +361,7 @@ namespace Ryujinx
if (fc.Run() == (int)ResponseType.Accept)
{
Console.WriteLine(fc.Filename); //temp
//Soon™
}
fc.Destroy();
}

View file

@ -48,7 +48,7 @@
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="sep">
<object class="GtkSeparatorMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@ -76,6 +76,30 @@
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckMenuItem" id="FullScreen">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Fullscreen</property>
<property name="use_underline">True</property>
<signal name="toggled" handler="FullScreen_Toggled" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="ReturnMain">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Return to Main Menu</property>
<property name="use_underline">True</property>
<signal name="activate" handler="ReturnMain_Pressed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="SettingsMenu">
<property name="visible">True</property>
@ -99,6 +123,15 @@
<object class="GtkMenu">
<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">
<property name="visible">True</property>

View file

@ -5,7 +5,6 @@ using Ryujinx.HLE.Input;
using Ryujinx.UI.Input;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
@ -37,9 +36,9 @@ namespace Ryujinx
[GUI] Entry CustThemeDir;
[GUI] Label CustThemeDirLabel;
[GUI] TextView GameDirsBox;
[GUI] Entry LogPath;
[GUI] Image ControllerImage;
[GUI] ComboBoxText Controller1Type;
[GUI] ToggleButton LStickUp1;
[GUI] ToggleButton LStickDown1;
@ -68,7 +67,7 @@ namespace Ryujinx
public static void ConfigureSettings(Configuration Instance) { SwitchConfig = Instance; }
public SwitchSettings(HLE.Switch _device) : this(new Builder("Ryujinx.GUI.Settings.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)
{
@ -151,9 +150,11 @@ namespace Ryujinx
ZR1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonZr.ToString();
CustThemeDir.Buffer.Text = SwitchConfig.CustomThemePath;
GameDirsBox.Buffer.Text = File.ReadAllText("./GameDirs.dat");
GameDirsBox.Buffer.Text = String.Join("\r\n", SwitchConfig.GameDirs);
if (CustThemeToggle.Active == false) { CustThemeDir.Sensitive = false; CustThemeDirLabel.Sensitive = false; }
LogPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log");
}
//Events
@ -181,6 +182,12 @@ namespace Ryujinx
private void SaveToggle_Activated(object obj, EventArgs args)
{
List<string> gameDirs = new List<string>();
foreach (string line in GameDirsBox.Buffer.Text.Split("\n"))
{
gameDirs.Add(line);
}
if (ErrorLogToggle.Active) { SwitchConfig.LoggingEnableError = true; }
if (WarningLogToggle.Active) { SwitchConfig.LoggingEnableWarn = true; }
if (InfoLogToggle.Active) { SwitchConfig.LoggingEnableInfo = true; }
@ -199,45 +206,47 @@ namespace Ryujinx
SwitchConfig.KeyboardControls.LeftJoycon = new NpadKeyboardLeft()
{
StickUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickUp1.Label),
StickDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickDown1.Label),
StickLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickLeft1.Label),
StickRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickRight1.Label),
StickUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickUp1.Label),
StickDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickDown1.Label),
StickLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickLeft1.Label),
StickRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickRight1.Label),
StickButton = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickButton1.Label),
DPadUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadUp1.Label),
DPadDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadDown1.Label),
DPadLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadLeft1.Label),
DPadRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadRight1.Label),
DPadUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadUp1.Label),
DPadDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadDown1.Label),
DPadLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadLeft1.Label),
DPadRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadRight1.Label),
ButtonMinus = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), Minus1.Label),
ButtonL = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), L1.Label),
ButtonZl = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), ZL1.Label),
ButtonL = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), L1.Label),
ButtonZl = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), ZL1.Label),
};
SwitchConfig.KeyboardControls.RightJoycon = new NpadKeyboardRight()
{
StickUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickUp1.Label),
StickDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickDown1.Label),
StickLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickLeft1.Label),
StickRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickRight1.Label),
StickUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickUp1.Label),
StickDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickDown1.Label),
StickLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickLeft1.Label),
StickRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickRight1.Label),
StickButton = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickButton1.Label),
ButtonA = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), A1.Label),
ButtonB = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), B1.Label),
ButtonX = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), X1.Label),
ButtonY = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), Y1.Label),
ButtonPlus = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), Plus1.Label),
ButtonR = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), R1.Label),
ButtonZr = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), ZR1.Label),
ButtonA = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), A1.Label),
ButtonB = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), B1.Label),
ButtonX = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), X1.Label),
ButtonY = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), Y1.Label),
ButtonPlus = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), Plus1.Label),
ButtonR = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), R1.Label),
ButtonZr = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), ZR1.Label),
};
SwitchConfig.SystemLanguage = (SystemLanguage)Enum.Parse(typeof(SystemLanguage), SystemLanguageSelect.ActiveId);
SwitchConfig.ControllerType = (HidControllerType)Enum.Parse(typeof(HidControllerType), Controller1Type.ActiveId);
SwitchConfig.CustomThemePath = CustThemeDir.Buffer.Text;
SwitchConfig.GameDirs = gameDirs;
Configuration.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
File.WriteAllText("./GameDirs.dat", GameDirsBox.Buffer.Text);
Configuration.Configure(device, SwitchConfig);
MainMenu.UpdateGameTable();
Destroy();
}

View file

@ -128,6 +128,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="draw_indicator">True</property>
</object>
@ -251,6 +252,56 @@
<property name="position">7</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">8</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">2</property>
<property name="margin_right">8</property>
<property name="label" translatable="yes">Log File Location:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="LogPath">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">9</property>
</packing>
</child>
</object>
</child>
<child type="tab">

View file

@ -22,6 +22,8 @@ namespace Ryujinx
ApplicationLibrary.Init();
Gtk.Application.Init();
var gtkapp = new Gtk.Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None);
var win = new MainMenu(args, gtkapp);

View file

@ -28,7 +28,7 @@
<EmbeddedResource Include="GUI\assets\ryujinxROMIcon.png" />
<EmbeddedResource Include="GUI\assets\ryujinxXCIIcon.png" />
<EmbeddedResource Include="GUI\MainMenu.glade" />
<EmbeddedResource Include="GUI\Settings.glade" />
<EmbeddedResource Include="GUI\SwitchSettings.glade" />
</ItemGroup>
<ItemGroup>

View file

@ -494,6 +494,13 @@
false
]
},
"game_dirs": {
"$id": "#/properties/game_dirs",
"type": "string list",
"title": "List of Game Directories",
"description": "A list of directories containing games to be used to load games into the games list",
"default": []
},
"enable_custom_theme": {
"$id": "#/properties/enable_custom_theme",
"type": "boolean",