Moved Files

moved ApplicationLibrary.cs to Ryujinx.HLE as that is a better place for it. Moved contents of GUI folder to Ui folder and changed the namespaces of the gui files from Ryujinx to Ryujinx.Ui
This commit is contained in:
Xpl0itR 2019-07-07 19:29:02 +01:00
parent bf82c5f5d5
commit a42993d11d
No known key found for this signature in database
GPG key ID: 91798184109676AD
26 changed files with 76 additions and 65 deletions

View file

@ -14,6 +14,7 @@ namespace Ryujinx
public class ApplicationLibrary
{
private static Keyset KeySet;
private static HLE.HOS.SystemState.TitleLanguage DesiredTitleLanguage;
public static byte[] RyujinxNspIcon { get; private set; }
public static byte[] RyujinxXciIcon { get; private set; }
@ -36,55 +37,56 @@ namespace Ryujinx
public string Path;
}
public static void Init(Keyset keySet, HLE.HOS.SystemState.TitleLanguage DesiredTitleLanguage)
public static void Init(List<string> AppDirs, Keyset keySet, HLE.HOS.SystemState.TitleLanguage desiredTitleLanguage)
{
// Load keyset
KeySet = keySet;
// Load Variables
KeySet = keySet;
DesiredTitleLanguage = desiredTitleLanguage;
// Loads the default application Icons
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.GUI.assets.ryujinxNSPIcon.png"))
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNSPIcon.png"))
{
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNspIcon = ms.ToArray(); }
}
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.GUI.assets.ryujinxXCIIcon.png"))
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxXCIIcon.png"))
{
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxXciIcon = ms.ToArray(); }
}
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.GUI.assets.ryujinxNCAIcon.png"))
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNCAIcon.png"))
{
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNcaIcon = ms.ToArray(); }
}
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.GUI.assets.ryujinxNROIcon.png"))
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNROIcon.png"))
{
using(MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNroIcon = ms.ToArray(); }
}
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.GUI.assets.ryujinxNSOIcon.png"))
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNSOIcon.png"))
{
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNsoIcon = ms.ToArray(); }
}
// Builds the applications list with paths to found applications
List<string> applications = new List<string>();
foreach (string gameDir in SwitchSettings.SwitchConfig.GameDirs)
foreach (string appDir in AppDirs)
{
if (Directory.Exists(gameDir) == false)
if (Directory.Exists(appDir) == false)
{
Logger.PrintError(LogClass.Application, $"The \"game_dirs\" section in \"Config.json\" contains an invalid directory: \"{gameDir}\"");
Logger.PrintError(LogClass.Application, $"The \"game_dirs\" section in \"Config.json\" contains an invalid directory: \"{appDir}\"");
continue;
}
DirectoryInfo GameDirInfo = new DirectoryInfo(gameDir);
foreach (var Game in GameDirInfo.GetFiles())
DirectoryInfo AppDirInfo = new DirectoryInfo(appDir);
foreach (var App in AppDirInfo.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(App.ToString()) == ".xci") ||
(Path.GetExtension(App.ToString()) == ".nca") ||
(Path.GetExtension(App.ToString()) == ".nsp") ||
(Path.GetExtension(App.ToString()) == ".pfs0") ||
(Path.GetExtension(App.ToString()) == ".nro") ||
(Path.GetExtension(App.ToString()) == ".nso"))
{
applications.Add(Game.ToString());
applications.Add(App.ToString());
}
}
}
@ -109,7 +111,7 @@ namespace Ryujinx
// Store the ControlFS in variable called controlFs
if (Path.GetExtension(applicationPath) == ".xci")
{
Xci xci = new Xci(MainWindow._device.System.KeySet, file.AsStorage());
Xci xci = new Xci(KeySet, file.AsStorage());
controlFs = GetControlFs(xci.OpenPartition(XciPartitionType.Secure));
}
else { controlFs = GetControlFs(new PartitionFileSystem(file.AsStorage())); }
@ -121,7 +123,7 @@ namespace Ryujinx
// Get the title name, title ID, developer name and version number from the NACP
version = controlData.DisplayVersion;
titleName = controlData.Descriptions[(int)MainWindow._device.System.State.DesiredTitleLanguage].Title;
titleName = controlData.Descriptions[(int)DesiredTitleLanguage].Title;
if (string.IsNullOrWhiteSpace(titleName))
{
titleName = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Title)).Title;
@ -131,7 +133,7 @@ namespace Ryujinx
if (string.IsNullOrWhiteSpace(titleId)) { titleId = controlData.SaveDataOwnerId.ToString("X16"); }
if (string.IsNullOrWhiteSpace(titleId)) { titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("X16"); }
developer = controlData.Descriptions[(int)MainWindow._device.System.State.DesiredTitleLanguage].Developer;
developer = controlData.Descriptions[(int)DesiredTitleLanguage].Developer;
if (string.IsNullOrWhiteSpace(developer))
{
developer = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Developer)).Developer;
@ -140,10 +142,10 @@ namespace Ryujinx
// Read the icon from the ControlFS and store it as a byte array
try
{
IFile logo = controlFs.OpenFile($"/icon_{DesiredTitleLanguage}.dat", OpenMode.Read);
IFile icon = controlFs.OpenFile($"/icon_{DesiredTitleLanguage}.dat", OpenMode.Read);
using (MemoryStream ms = new MemoryStream())
{
logo.AsStream().CopyTo(ms);
icon.AsStream().CopyTo(ms);
applicationIcon = ms.ToArray();
}
}
@ -151,10 +153,10 @@ namespace Ryujinx
{
try
{
IFile logo = controlFs.OpenFile($"/icon_AmericanEnglish.dat", OpenMode.Read);
IFile icon = controlFs.OpenFile($"/icon_AmericanEnglish.dat", OpenMode.Read);
using (MemoryStream ms = new MemoryStream())
{
logo.AsStream().CopyTo(ms);
icon.AsStream().CopyTo(ms);
applicationIcon = ms.ToArray();
}
}
@ -266,14 +268,14 @@ namespace Ryujinx
if (!KeySet.TitleKeys.ContainsKey(ticket.RightsId))
{
KeySet.TitleKeys.Add(ticket.RightsId, ticket.GetTitleKey(MainWindow._device.System.KeySet));
KeySet.TitleKeys.Add(ticket.RightsId, ticket.GetTitleKey(KeySet));
}
}
// Find the Control NCA and store it in variable called controlNca
foreach (DirectoryEntry fileEntry in Pfs.EnumerateEntries("*.nca"))
{
Nca nca = new Nca(MainWindow._device.System.KeySet, Pfs.OpenFile(fileEntry.FullPath, OpenMode.Read).AsStorage());
Nca nca = new Nca(KeySet, Pfs.OpenFile(fileEntry.FullPath, OpenMode.Read).AsStorage());
if (nca.Header.ContentType == ContentType.Control)
{
controlNca = nca;
@ -281,7 +283,7 @@ namespace Ryujinx
}
// Return the ControlFS
return controlNca.OpenFileSystem(NcaSectionType.Data, MainWindow._device.System.FsIntegrityCheckLevel);
return controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
}
private static string[] GetPlayedData(string TitleId)

View file

@ -29,11 +29,21 @@
<ItemGroup>
<None Remove="Homebrew.npdm" />
<None Remove="ryujinxNCAIcon.png" />
<None Remove="ryujinxNROIcon.png" />
<None Remove="ryujinxNSOIcon.png" />
<None Remove="ryujinxNSPIcon.png" />
<None Remove="ryujinxXCIIcon.png" />
<None Remove="RyujinxProfileImage.jpg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Homebrew.npdm" />
<EmbeddedResource Include="ryujinxNCAIcon.png" />
<EmbeddedResource Include="ryujinxNROIcon.png" />
<EmbeddedResource Include="ryujinxNSOIcon.png" />
<EmbeddedResource Include="ryujinxNSPIcon.png" />
<EmbeddedResource Include="ryujinxXCIIcon.png" />
<EmbeddedResource Include="RyujinxProfileImage.jpg" />
</ItemGroup>

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -8,6 +8,7 @@ using Ryujinx.HLE;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.HOS.Services;
using Ryujinx.HLE.Input;
using Ryujinx.UI;
using Ryujinx.UI.Input;
using System;
using System.Collections.Generic;

View file

@ -1,6 +1,7 @@
using Gtk;
using Ryujinx.Common.Logging;
using Ryujinx.Profiler;
using Ryujinx.UI;
using System;
using System.IO;

View file

@ -38,4 +38,5 @@
0100eab00605c000
0100efd00a4fa000
0100f6a00a684000
0100f9f00c696000
0100f9f00c696000
051337133769a000

View file

@ -6,6 +6,7 @@
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Configurations>Debug;Release;Profile Debug;Profile Release</Configurations>
<ApplicationIcon>ryujinx.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile Release|AnyCPU'">
@ -19,20 +20,15 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="GUI\AboutWindow.glade" />
<EmbeddedResource Include="GUI\assets\DiscordLogo.png" />
<EmbeddedResource Include="GUI\assets\GitHubLogo.png" />
<EmbeddedResource Include="GUI\assets\JoyCon.png" />
<EmbeddedResource Include="GUI\assets\PatreonLogo.png" />
<EmbeddedResource Include="GUI\assets\ryujinxIcon.png" />
<EmbeddedResource Include="GUI\assets\ryujinxNCAIcon.png" />
<EmbeddedResource Include="GUI\assets\ryujinxNROIcon.png" />
<EmbeddedResource Include="GUI\assets\ryujinxNSOIcon.png" />
<EmbeddedResource Include="GUI\assets\ryujinxNSPIcon.png" />
<EmbeddedResource Include="GUI\assets\ryujinxXCIIcon.png" />
<EmbeddedResource Include="GUI\assets\TwitterLogo.png" />
<EmbeddedResource Include="GUI\MainWindow.glade" />
<EmbeddedResource Include="GUI\SwitchSettings.glade" />
<EmbeddedResource Include="Ui\AboutWindow.glade" />
<EmbeddedResource Include="Ui\assets\DiscordLogo.png" />
<EmbeddedResource Include="Ui\assets\GitHubLogo.png" />
<EmbeddedResource Include="Ui\assets\JoyCon.png" />
<EmbeddedResource Include="Ui\assets\PatreonLogo.png" />
<EmbeddedResource Include="Ui\assets\ryujinxIcon.png" />
<EmbeddedResource Include="Ui\assets\TwitterLogo.png" />
<EmbeddedResource Include="Ui\MainWindow.glade" />
<EmbeddedResource Include="Ui\SwitchSettings.glade" />
</ItemGroup>
<ItemGroup>
@ -56,7 +52,7 @@
<None Update="Config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="GUI\assets\Theme.css">
<None Update="Theme.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="RPsupported.dat">

View file

@ -5,7 +5,7 @@ using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Ryujinx
namespace Ryujinx.UI
{
public class AboutWindow : Window
{
@ -18,17 +18,17 @@ namespace Ryujinx
[GUI] Image TwitterLogo;
#pragma warning restore 649
public AboutWindow() : this(new Builder("Ryujinx.GUI.AboutWindow.glade")) { }
public AboutWindow() : this(new Builder("Ryujinx.Ui.AboutWindow.glade")) { }
private AboutWindow(Builder builder) : base(builder.GetObject("AboutWin").Handle)
{
builder.Autoconnect(this);
AboutWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png");
RyujinxLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png", 220, 220);
PatreonLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.PatreonLogo.png", 30 , 30 );
GitHubLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.GitHubLogo.png" , 30 , 30 );
DiscordLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.DiscordLogo.png", 30 , 30 );
TwitterLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.TwitterLogo.png", 30 , 30 );
AboutWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png");
RyujinxLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png", 220, 220);
PatreonLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.PatreonLogo.png", 30 , 30 );
GitHubLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.GitHubLogo.png" , 30 , 30 );
DiscordLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.DiscordLogo.png", 30 , 30 );
TwitterLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.TwitterLogo.png", 30 , 30 );
}
public void OpenUrl(string url)

View file

@ -10,7 +10,7 @@ using System.Threading;
using Stopwatch = System.Diagnostics.Stopwatch;
namespace Ryujinx
namespace Ryujinx.UI
{
public class GlScreen : GameWindow
{

View file

@ -13,7 +13,7 @@ using System.Reflection;
using System.Text;
using System.Threading;
namespace Ryujinx
namespace Ryujinx.UI
{
public class MainWindow : Window
{
@ -46,7 +46,7 @@ namespace Ryujinx
[GUI] GLArea GlScreen;
#pragma warning restore 649
public MainWindow(string[] args, Application gtkapp) : this(new Builder("Ryujinx.GUI.MainWindow.glade"), args, gtkapp) { }
public MainWindow(string[] args, Application gtkapp) : this(new Builder("Ryujinx.Ui.MainWindow.glade"), args, gtkapp) { }
private MainWindow(Builder builder, string[] args, Application gtkapp) : base(builder.GetObject("MainWin").Handle)
{
@ -59,7 +59,7 @@ namespace Ryujinx
Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
Configuration.InitialConfigure(_device);
ApplicationLibrary.Init(_device.System.KeySet, _device.System.State.DesiredTitleLanguage);
ApplicationLibrary.Init(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage);
_gtkapp = gtkapp;
@ -87,7 +87,7 @@ namespace Ryujinx
}
builder.Autoconnect(this);
MainWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png");
MainWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png");
if (args.Length == 1)
{
@ -138,7 +138,7 @@ namespace Ryujinx
public static void UpdateGameTable()
{
_TableStore.Clear();
ApplicationLibrary.Init(_device.System.KeySet, _device.System.State.DesiredTitleLanguage);
ApplicationLibrary.Init(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage);
foreach (ApplicationLibrary.ApplicationData AppData in ApplicationLibrary.ApplicationLibraryData)
{
@ -169,7 +169,7 @@ namespace Ryujinx
}
else
{
cssProvider.LoadFromPath("./GUI/assets/Theme.css");
cssProvider.LoadFromPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Theme.css"));
}
StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, 800);

View file

@ -9,7 +9,7 @@ using System.IO;
using System.Linq;
using System.Reflection;
namespace Ryujinx
namespace Ryujinx.UI
{
public class SwitchSettings : Window
{
@ -82,7 +82,7 @@ namespace Ryujinx
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.Ui.SwitchSettings.glade"), device) { }
private SwitchSettings(Builder builder, HLE.Switch device) : base(builder.GetObject("SettingsWin").Handle)
{
@ -90,8 +90,8 @@ namespace Ryujinx
builder.Autoconnect(this);
SettingsWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png");
ControllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.JoyCon.png", 500, 500);
SettingsWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png");
ControllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500);
//Bind Events
LStickUp1.Clicked += (o, args) => Button_Pressed(o, args, LStickUp1);

View file

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 282 KiB

View file

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

BIN
Ryujinx/ryujinx.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB