requested changes and cleanup
still need to fix the gtk seizure
This commit is contained in:
parent
51939321e6
commit
9e2fc45cb6
10 changed files with 289 additions and 238 deletions
|
@ -107,7 +107,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
public string TitleName { get; private set; }
|
public string TitleName { get; private set; }
|
||||||
|
|
||||||
public string TitleID { get; private set; }
|
public string TitleId { get; private set; }
|
||||||
|
|
||||||
public IntegrityCheckLevel FsIntegrityCheckLevel { get; set; }
|
public IntegrityCheckLevel FsIntegrityCheckLevel { get; set; }
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
Nacp controlData = new Nacp(controlFile.AsStream());
|
Nacp controlData = new Nacp(controlFile.AsStream());
|
||||||
|
|
||||||
TitleName = controlData.Descriptions[(int)State.DesiredTitleLanguage].Title;
|
TitleName = controlData.Descriptions[(int)State.DesiredTitleLanguage].Title;
|
||||||
TitleID = metaData.Aci0.TitleId.ToString("x16");
|
TitleId = metaData.Aci0.TitleId.ToString("x16");
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(TitleName))
|
if (string.IsNullOrWhiteSpace(TitleName))
|
||||||
{
|
{
|
||||||
|
@ -515,7 +515,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TitleID = metaData.Aci0.TitleId.ToString("x16");
|
TitleId = metaData.Aci0.TitleId.ToString("x16");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TitleID = metaData.Aci0.TitleId.ToString("x16");
|
TitleId = metaData.Aci0.TitleId.ToString("x16");
|
||||||
|
|
||||||
LoadNso("rtld");
|
LoadNso("rtld");
|
||||||
LoadNso("main");
|
LoadNso("main");
|
||||||
|
@ -658,7 +658,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
ContentManager.LoadEntries();
|
ContentManager.LoadEntries();
|
||||||
|
|
||||||
TitleName = metaData.TitleName;
|
TitleName = metaData.TitleName;
|
||||||
TitleID = metaData.Aci0.TitleId.ToString("x16");
|
TitleId = metaData.Aci0.TitleId.ToString("x16");
|
||||||
|
|
||||||
ProgramLoader.LoadStaticObjects(this, metaData, new IExecutable[] { staticObject });
|
ProgramLoader.LoadStaticObjects(this, metaData, new IExecutable[] { staticObject });
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Arp
|
||||||
|
|
||||||
return new ApplicationLaunchProperty
|
return new ApplicationLaunchProperty
|
||||||
{
|
{
|
||||||
TitleId = BitConverter.ToInt64(StringUtils.HexToBytes(context.Device.System.TitleID), 0),
|
TitleId = BitConverter.ToInt64(StringUtils.HexToBytes(context.Device.System.TitleId), 0),
|
||||||
Version = 0x00,
|
Version = 0x00,
|
||||||
BaseGameStorageId = (byte)StorageId.NandSystem,
|
BaseGameStorageId = (byte)StorageId.NandSystem,
|
||||||
UpdateGameStorageId = (byte)StorageId.None
|
UpdateGameStorageId = (byte)StorageId.None
|
||||||
|
|
|
@ -4,9 +4,15 @@
|
||||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseExplicitType</s:String>
|
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseExplicitType</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String>
|
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=TypesAndNamespaces/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="I" Suffix="" Style="AaBb" /></Policy></s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=TypesAndNamespaces/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="I" Suffix="" Style="AaBb" /></Policy></s:String>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=ASET/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Astc/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Astc/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Luma/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Luma/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=mins/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=nacp/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Npad/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=patreon/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Probs/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Probs/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ryujinx/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sint/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sint/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Snorm/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Snorm/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Srgb/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Srgb/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|
|
@ -23,19 +23,20 @@ namespace Ryujinx
|
||||||
|
|
||||||
Application.Init();
|
Application.Init();
|
||||||
|
|
||||||
|
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs", "system", "prod.keys");
|
||||||
|
string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys");
|
||||||
|
if (!File.Exists(appDataPath) && !File.Exists(userProfilePath))
|
||||||
|
{
|
||||||
|
MainWindow.CreateErrorDialog($"Key file was not found. Please refer to `KEYS.md` for more info");
|
||||||
|
}
|
||||||
|
|
||||||
Application gtkApplication = new Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None);
|
Application gtkApplication = new Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None);
|
||||||
MainWindow mainWindow = new MainWindow(args, gtkApplication);
|
MainWindow mainWindow = new MainWindow(gtkApplication);
|
||||||
|
|
||||||
gtkApplication.Register(GLib.Cancellable.Current);
|
gtkApplication.Register(GLib.Cancellable.Current);
|
||||||
gtkApplication.AddWindow(mainWindow);
|
gtkApplication.AddWindow(mainWindow);
|
||||||
mainWindow.Show();
|
mainWindow.Show();
|
||||||
|
|
||||||
if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs", "system", "prod.keys")))
|
|
||||||
{
|
|
||||||
Logger.PrintWarning(LogClass.Application, "Key file was not found");
|
|
||||||
MainWindow.CreateErrorDialog($"Key file was not found. Please refer to `KEYS.md` for more info");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.Length == 1)
|
if (args.Length == 1)
|
||||||
{
|
{
|
||||||
mainWindow.LoadApplication(args[0]);
|
mainWindow.LoadApplication(args[0]);
|
||||||
|
@ -51,7 +52,7 @@ namespace Ryujinx
|
||||||
|
|
||||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
var exception = e.ExceptionObject as Exception;
|
Exception exception = e.ExceptionObject as Exception;
|
||||||
|
|
||||||
Logger.PrintError(LogClass.Emulation, $"Unhandled exception caught: {exception}");
|
Logger.PrintError(LogClass.Emulation, $"Unhandled exception caught: {exception}");
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace Ryujinx.UI
|
||||||
private static Info Information { get; set; }
|
private static Info Information { get; set; }
|
||||||
|
|
||||||
#pragma warning disable CS0649
|
#pragma warning disable CS0649
|
||||||
|
#pragma warning disable IDE0044
|
||||||
[GUI] Window _aboutWin;
|
[GUI] Window _aboutWin;
|
||||||
[GUI] Label _versionText;
|
[GUI] Label _versionText;
|
||||||
[GUI] Image _ryujinxLogo;
|
[GUI] Image _ryujinxLogo;
|
||||||
|
@ -30,6 +31,7 @@ namespace Ryujinx.UI
|
||||||
[GUI] Image _discordLogo;
|
[GUI] Image _discordLogo;
|
||||||
[GUI] Image _twitterLogo;
|
[GUI] Image _twitterLogo;
|
||||||
#pragma warning restore CS0649
|
#pragma warning restore CS0649
|
||||||
|
#pragma warning restore IDE0044
|
||||||
|
|
||||||
public AboutWindow() : this(new Builder("Ryujinx.Ui.AboutWindow.glade")) { }
|
public AboutWindow() : this(new Builder("Ryujinx.Ui.AboutWindow.glade")) { }
|
||||||
|
|
||||||
|
@ -103,7 +105,7 @@ namespace Ryujinx.UI
|
||||||
OpenUrl("https://twitter.com/RyujinxEmu");
|
OpenUrl("https://twitter.com/RyujinxEmu");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ContributersButton_Pressed(object sender, ButtonPressEventArgs args)
|
private void ContributorsButton_Pressed(object sender, ButtonPressEventArgs args)
|
||||||
{
|
{
|
||||||
OpenUrl("https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a");
|
OpenUrl("https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a");
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,11 +523,11 @@ Andy A (BaronKiko)</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEventBox" id="ContributersButton">
|
<object class="GtkEventBox" id="ContributorsButton">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="valign">start</property>
|
<property name="valign">start</property>
|
||||||
<signal name="button-press-event" handler="ContributersButton_Pressed" swapped="no"/>
|
<signal name="button-press-event" handler="ContributorsButton_Pressed" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -14,8 +14,8 @@ using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Utf8Json;
|
using Utf8Json;
|
||||||
using Utf8Json.Resolvers;
|
using Utf8Json.Resolvers;
|
||||||
using SystemState = Ryujinx.HLE.HOS.SystemState;
|
|
||||||
using ApplicationData = Ryujinx.UI.ApplicationLibrary.ApplicationData;
|
using ApplicationData = Ryujinx.UI.ApplicationLibrary.ApplicationData;
|
||||||
|
using SystemState = Ryujinx.HLE.HOS.SystemState;
|
||||||
|
|
||||||
namespace Ryujinx.UI
|
namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
|
@ -38,18 +38,14 @@ namespace Ryujinx.UI
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] RyujinxNspIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSPIcon.png");
|
private static readonly byte[] _ryujinxNspIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSPIcon.png");
|
||||||
private static byte[] RyujinxXciIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxXCIIcon.png");
|
private static readonly byte[] _ryujinxXciIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxXCIIcon.png");
|
||||||
private static byte[] RyujinxNcaIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNCAIcon.png");
|
private static readonly byte[] _ryujinxNcaIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNCAIcon.png");
|
||||||
private static byte[] RyujinxNroIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNROIcon.png");
|
private static readonly byte[] _ryujinxNroIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNROIcon.png");
|
||||||
private static byte[] RyujinxNsoIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSOIcon.png");
|
private static readonly byte[] _ryujinxNsoIcon = GetResourceBytes("Ryujinx.Ui.assets.ryujinxNSOIcon.png");
|
||||||
|
|
||||||
private static Keyset KeySet;
|
private static Keyset _keySet;
|
||||||
private static SystemState.TitleLanguage DesiredTitleLanguage;
|
private static SystemState.TitleLanguage _desiredTitleLanguage;
|
||||||
|
|
||||||
private const double SecondsPerMinute = 60.0;
|
|
||||||
private const double SecondsPerHour = SecondsPerMinute * 60;
|
|
||||||
private const double SecondsPerDay = SecondsPerHour * 24;
|
|
||||||
|
|
||||||
private struct ApplicationMetadata
|
private struct ApplicationMetadata
|
||||||
{
|
{
|
||||||
|
@ -58,19 +54,19 @@ namespace Ryujinx.UI
|
||||||
public string LastPlayed { get; set; }
|
public string LastPlayed { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ApplicationMetadata AppMetadata;
|
private static ApplicationMetadata _appMetadata;
|
||||||
|
|
||||||
public static void LoadApplications(List<string> AppDirs, Keyset keySet, SystemState.TitleLanguage desiredTitleLanguage)
|
public static void LoadApplications(List<string> appDirs, Keyset keySet, SystemState.TitleLanguage desiredTitleLanguage)
|
||||||
{
|
{
|
||||||
float numApplicationsFound = 0;
|
int numApplicationsFound = 0;
|
||||||
float numApplicationsLoaded = 0;
|
int numApplicationsLoaded = 0;
|
||||||
|
|
||||||
KeySet = keySet;
|
_keySet = keySet;
|
||||||
DesiredTitleLanguage = desiredTitleLanguage;
|
_desiredTitleLanguage = desiredTitleLanguage;
|
||||||
|
|
||||||
// Builds the applications list with paths to found applications
|
// Builds the applications list with paths to found applications
|
||||||
List<string> applications = new List<string>();
|
List<string> applications = new List<string>();
|
||||||
foreach (string appDir in AppDirs)
|
foreach (string appDir in appDirs)
|
||||||
{
|
{
|
||||||
if (Directory.Exists(appDir) == false)
|
if (Directory.Exists(appDir) == false)
|
||||||
{
|
{
|
||||||
|
@ -83,21 +79,57 @@ namespace Ryujinx.UI
|
||||||
foreach (string app in apps)
|
foreach (string app in apps)
|
||||||
{
|
{
|
||||||
if ((Path.GetExtension(app) == ".xci") ||
|
if ((Path.GetExtension(app) == ".xci") ||
|
||||||
(Path.GetExtension(app) == ".nsp") ||
|
|
||||||
(Path.GetExtension(app) == ".pfs0")||
|
|
||||||
(Path.GetExtension(app) == ".nro") ||
|
(Path.GetExtension(app) == ".nro") ||
|
||||||
(Path.GetExtension(app) == ".nso"))
|
(Path.GetExtension(app) == ".nso"))
|
||||||
{
|
{
|
||||||
applications.Add(app);
|
applications.Add(app);
|
||||||
numApplicationsFound++;
|
numApplicationsFound++;
|
||||||
}
|
}
|
||||||
|
else if ((Path.GetExtension(app) == ".nsp") || (Path.GetExtension(app) == ".pfs0"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool hasMainNca = false;
|
||||||
|
|
||||||
|
PartitionFileSystem nsp = new PartitionFileSystem(new FileStream(app, FileMode.Open, FileAccess.Read).AsStorage());
|
||||||
|
foreach (DirectoryEntryEx fileEntry in nsp.EnumerateEntries("/", "*.nca"))
|
||||||
|
{
|
||||||
|
nsp.OpenFile(out IFile ncaFile, fileEntry.FullPath, OpenMode.Read).ThrowIfFailure();
|
||||||
|
Nca nca = new Nca(_keySet, ncaFile.AsStorage());
|
||||||
|
int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, NcaContentType.Program);
|
||||||
|
|
||||||
|
if (nca.Header.ContentType == NcaContentType.Program && !nca.Header.GetFsHeader(dataIndex).IsPatchSection())
|
||||||
|
{
|
||||||
|
hasMainNca = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasMainNca) continue;
|
||||||
|
}
|
||||||
|
catch (InvalidDataException)
|
||||||
|
{
|
||||||
|
Logger.PrintWarning(LogClass.Application, "The header key is incorrect or missing and therefore the NCA header content type check has failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
applications.Add(app);
|
||||||
|
numApplicationsFound++;
|
||||||
|
}
|
||||||
else if (Path.GetExtension(app) == ".nca")
|
else if (Path.GetExtension(app) == ".nca")
|
||||||
{
|
{
|
||||||
Nca nca = new Nca(KeySet, new FileStream(app, FileMode.Open, FileAccess.Read).AsStorage());
|
try
|
||||||
if (nca.Header.ContentType != NcaContentType.Program)
|
{
|
||||||
|
Nca nca = new Nca(_keySet, new FileStream(app, FileMode.Open, FileAccess.Read).AsStorage());
|
||||||
|
int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, NcaContentType.Program);
|
||||||
|
|
||||||
|
if (nca.Header.ContentType != NcaContentType.Program || nca.Header.GetFsHeader(dataIndex).IsPatchSection())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (InvalidDataException)
|
||||||
|
{
|
||||||
|
Logger.PrintWarning(LogClass.Application, "The header key is incorrect or missing and therefore the NCA header content type check has failed.");
|
||||||
|
}
|
||||||
|
|
||||||
applications.Add(app);
|
applications.Add(app);
|
||||||
numApplicationsFound++;
|
numApplicationsFound++;
|
||||||
|
@ -108,7 +140,7 @@ namespace Ryujinx.UI
|
||||||
// Loops through applications list, creating a struct and then firing an event containing the struct for each application
|
// Loops through applications list, creating a struct and then firing an event containing the struct for each application
|
||||||
foreach (string applicationPath in applications)
|
foreach (string applicationPath in applications)
|
||||||
{
|
{
|
||||||
double filesize = new FileInfo(applicationPath).Length * 0.000000000931;
|
double fileSize = new FileInfo(applicationPath).Length * 0.000000000931;
|
||||||
string titleName = null;
|
string titleName = null;
|
||||||
string titleId = null;
|
string titleId = null;
|
||||||
string developer = null;
|
string developer = null;
|
||||||
|
@ -123,12 +155,12 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IFileSystem controlFs = null;
|
IFileSystem controlFs;
|
||||||
|
|
||||||
// Store the ControlFS in variable called controlFs
|
// Store the ControlFS in variable called controlFs
|
||||||
if (Path.GetExtension(applicationPath) == ".xci")
|
if (Path.GetExtension(applicationPath) == ".xci")
|
||||||
{
|
{
|
||||||
Xci xci = new Xci(KeySet, file.AsStorage());
|
Xci xci = new Xci(_keySet, file.AsStorage());
|
||||||
|
|
||||||
controlFs = GetControlFs(xci.OpenPartition(XciPartitionType.Secure));
|
controlFs = GetControlFs(xci.OpenPartition(XciPartitionType.Secure));
|
||||||
}
|
}
|
||||||
|
@ -145,7 +177,7 @@ namespace Ryujinx.UI
|
||||||
// Get the title name, title ID, developer name and version number from the NACP
|
// Get the title name, title ID, developer name and version number from the NACP
|
||||||
version = controlData.DisplayVersion;
|
version = controlData.DisplayVersion;
|
||||||
|
|
||||||
titleName = controlData.Descriptions[(int)DesiredTitleLanguage].Title;
|
titleName = controlData.Descriptions[(int)_desiredTitleLanguage].Title;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(titleName))
|
if (string.IsNullOrWhiteSpace(titleName))
|
||||||
{
|
{
|
||||||
|
@ -164,7 +196,7 @@ namespace Ryujinx.UI
|
||||||
titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("x16");
|
titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("x16");
|
||||||
}
|
}
|
||||||
|
|
||||||
developer = controlData.Descriptions[(int)DesiredTitleLanguage].Developer;
|
developer = controlData.Descriptions[(int)_desiredTitleLanguage].Developer;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(developer))
|
if (string.IsNullOrWhiteSpace(developer))
|
||||||
{
|
{
|
||||||
|
@ -174,14 +206,12 @@ namespace Ryujinx.UI
|
||||||
// Read the icon from the ControlFS and store it as a byte array
|
// Read the icon from the ControlFS and store it as a byte array
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
controlFs.OpenFile(out IFile icon, $"/icon_{DesiredTitleLanguage}.dat", OpenMode.Read).ThrowIfFailure();
|
controlFs.OpenFile(out IFile icon, $"/icon_{_desiredTitleLanguage}.dat", OpenMode.Read).ThrowIfFailure();
|
||||||
|
|
||||||
using (MemoryStream stream = new MemoryStream())
|
using MemoryStream stream = new MemoryStream();
|
||||||
{
|
|
||||||
icon.AsStream().CopyTo(stream);
|
icon.AsStream().CopyTo(stream);
|
||||||
applicationIcon = stream.ToArray();
|
applicationIcon = stream.ToArray();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (HorizonResultException)
|
catch (HorizonResultException)
|
||||||
{
|
{
|
||||||
foreach (DirectoryEntryEx entry in controlFs.EnumerateEntries("/", "*"))
|
foreach (DirectoryEntryEx entry in controlFs.EnumerateEntries("/", "*"))
|
||||||
|
@ -229,52 +259,45 @@ namespace Ryujinx.UI
|
||||||
version = "?";
|
version = "?";
|
||||||
applicationIcon = NspOrXciIcon(applicationPath);
|
applicationIcon = NspOrXciIcon(applicationPath);
|
||||||
|
|
||||||
Logger.PrintWarning(LogClass.Application, $"The file is not an NCA file or the header key is incorrect. Errored File: {applicationPath}");
|
Logger.PrintWarning(LogClass.Application, $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {applicationPath}");
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
|
||||||
Logger.PrintWarning(LogClass.Application, $"This warning usualy means that you have a DLC in one of you game directories\n{exception}");
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Path.GetExtension(applicationPath) == ".nro")
|
else if (Path.GetExtension(applicationPath) == ".nro")
|
||||||
{
|
{
|
||||||
BinaryReader reader = new BinaryReader(file);
|
BinaryReader reader = new BinaryReader(file);
|
||||||
|
|
||||||
byte[] Read(long Position, int Size)
|
byte[] Read(long position, int size)
|
||||||
{
|
{
|
||||||
file.Seek(Position, SeekOrigin.Begin);
|
file.Seek(position, SeekOrigin.Begin);
|
||||||
|
|
||||||
return reader.ReadBytes(Size);
|
return reader.ReadBytes(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
file.Seek(24, SeekOrigin.Begin);
|
file.Seek(24, SeekOrigin.Begin);
|
||||||
int AssetOffset = reader.ReadInt32();
|
int assetOffset = reader.ReadInt32();
|
||||||
|
|
||||||
if (Encoding.ASCII.GetString(Read(AssetOffset, 4)) == "ASET")
|
if (Encoding.ASCII.GetString(Read(assetOffset, 4)) == "ASET")
|
||||||
{
|
{
|
||||||
byte[] IconSectionInfo = Read(AssetOffset + 8, 0x10);
|
byte[] iconSectionInfo = Read(assetOffset + 8, 0x10);
|
||||||
|
|
||||||
long iconOffset = BitConverter.ToInt64(IconSectionInfo, 0);
|
long iconOffset = BitConverter.ToInt64(iconSectionInfo, 0);
|
||||||
long iconSize = BitConverter.ToInt64(IconSectionInfo, 8);
|
long iconSize = BitConverter.ToInt64(iconSectionInfo, 8);
|
||||||
|
|
||||||
ulong nacpOffset = reader.ReadUInt64();
|
ulong nacpOffset = reader.ReadUInt64();
|
||||||
ulong nacpSize = reader.ReadUInt64();
|
ulong nacpSize = reader.ReadUInt64();
|
||||||
|
|
||||||
// Reads and stores game icon as byte array
|
// Reads and stores game icon as byte array
|
||||||
applicationIcon = Read(AssetOffset + iconOffset, (int)iconSize);
|
applicationIcon = Read(assetOffset + iconOffset, (int)iconSize);
|
||||||
|
|
||||||
// Creates memory stream out of byte array which is the NACP
|
// Creates memory stream out of byte array which is the NACP
|
||||||
using (MemoryStream stream = new MemoryStream(Read(AssetOffset + (int)nacpOffset, (int)nacpSize)))
|
using MemoryStream stream = new MemoryStream(Read(assetOffset + (int)nacpOffset, (int)nacpSize));
|
||||||
{
|
|
||||||
// Creates NACP class from the memory stream
|
// Creates NACP class from the memory stream
|
||||||
Nacp controlData = new Nacp(stream);
|
Nacp controlData = new Nacp(stream);
|
||||||
|
|
||||||
// Get the title name, title ID, developer name and version number from the NACP
|
// Get the title name, title ID, developer name and version number from the NACP
|
||||||
version = controlData.DisplayVersion;
|
version = controlData.DisplayVersion;
|
||||||
|
|
||||||
titleName = controlData.Descriptions[(int)DesiredTitleLanguage].Title;
|
titleName = controlData.Descriptions[(int)_desiredTitleLanguage].Title;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(titleName))
|
if (string.IsNullOrWhiteSpace(titleName))
|
||||||
{
|
{
|
||||||
|
@ -293,17 +316,16 @@ namespace Ryujinx.UI
|
||||||
titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("x16");
|
titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("x16");
|
||||||
}
|
}
|
||||||
|
|
||||||
developer = controlData.Descriptions[(int)DesiredTitleLanguage].Developer;
|
developer = controlData.Descriptions[(int)_desiredTitleLanguage].Developer;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(developer))
|
if (string.IsNullOrWhiteSpace(developer))
|
||||||
{
|
{
|
||||||
developer = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Developer)).Developer;
|
developer = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Developer)).Developer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
applicationIcon = RyujinxNroIcon;
|
applicationIcon = _ryujinxNroIcon;
|
||||||
titleName = "Application";
|
titleName = "Application";
|
||||||
titleId = "0000000000000000";
|
titleId = "0000000000000000";
|
||||||
developer = "Unknown";
|
developer = "Unknown";
|
||||||
|
@ -315,11 +337,11 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
if (Path.GetExtension(applicationPath) == ".nca")
|
if (Path.GetExtension(applicationPath) == ".nca")
|
||||||
{
|
{
|
||||||
applicationIcon = RyujinxNcaIcon;
|
applicationIcon = _ryujinxNcaIcon;
|
||||||
}
|
}
|
||||||
else if (Path.GetExtension(applicationPath) == ".nso")
|
else if (Path.GetExtension(applicationPath) == ".nso")
|
||||||
{
|
{
|
||||||
applicationIcon = RyujinxNsoIcon;
|
applicationIcon = _ryujinxNsoIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
string fileName = Path.GetFileName(applicationPath);
|
string fileName = Path.GetFileName(applicationPath);
|
||||||
|
@ -336,20 +358,20 @@ namespace Ryujinx.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(bool, string, string) metaData = GetMetadata(titleId);
|
(bool fav, string timePlayed, string lastPlayed) metaData = GetMetadata(titleId);
|
||||||
|
|
||||||
ApplicationData data = new ApplicationData()
|
ApplicationData data = new ApplicationData()
|
||||||
{
|
{
|
||||||
Favorite = metaData.Item1,
|
Favorite = metaData.fav,
|
||||||
Icon = applicationIcon,
|
Icon = applicationIcon,
|
||||||
TitleName = titleName,
|
TitleName = titleName,
|
||||||
TitleId = titleId,
|
TitleId = titleId,
|
||||||
Developer = developer,
|
Developer = developer,
|
||||||
Version = version,
|
Version = version,
|
||||||
TimePlayed = metaData.Item2,
|
TimePlayed = metaData.timePlayed,
|
||||||
LastPlayed = metaData.Item3,
|
LastPlayed = metaData.lastPlayed,
|
||||||
FileExtension = Path.GetExtension(applicationPath).ToUpper().Remove(0 ,1),
|
FileExtension = Path.GetExtension(applicationPath).ToUpper().Remove(0 ,1),
|
||||||
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
|
FileSize = (fileSize < 1) ? (fileSize * 1024).ToString("0.##") + "MB" : fileSize.ToString("0.##") + "GB",
|
||||||
Path = applicationPath,
|
Path = applicationPath,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -379,29 +401,29 @@ namespace Ryujinx.UI
|
||||||
return resourceByteArray;
|
return resourceByteArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IFileSystem GetControlFs(PartitionFileSystem Pfs)
|
private static IFileSystem GetControlFs(PartitionFileSystem pfs)
|
||||||
{
|
{
|
||||||
Nca controlNca = null;
|
Nca controlNca = null;
|
||||||
|
|
||||||
// Add keys to key set if needed
|
// Add keys to key set if needed
|
||||||
foreach (DirectoryEntryEx ticketEntry in Pfs.EnumerateEntries("/", "*.tik"))
|
foreach (DirectoryEntryEx ticketEntry in pfs.EnumerateEntries("/", "*.tik"))
|
||||||
{
|
{
|
||||||
Result result = Pfs.OpenFile(out IFile ticketFile, ticketEntry.FullPath, OpenMode.Read);
|
Result result = pfs.OpenFile(out IFile ticketFile, ticketEntry.FullPath, OpenMode.Read);
|
||||||
|
|
||||||
if (result.IsSuccess())
|
if (result.IsSuccess())
|
||||||
{
|
{
|
||||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||||
|
|
||||||
KeySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(KeySet)));
|
_keySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(_keySet)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the Control NCA and store it in variable called controlNca
|
// Find the Control NCA and store it in variable called controlNca
|
||||||
foreach (DirectoryEntryEx fileEntry in Pfs.EnumerateEntries("/", "*.nca"))
|
foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
|
||||||
{
|
{
|
||||||
Pfs.OpenFile(out IFile ncaFile, fileEntry.FullPath, OpenMode.Read).ThrowIfFailure();
|
pfs.OpenFile(out IFile ncaFile, fileEntry.FullPath, OpenMode.Read).ThrowIfFailure();
|
||||||
|
|
||||||
Nca nca = new Nca(KeySet, ncaFile.AsStorage());
|
Nca nca = new Nca(_keySet, ncaFile.AsStorage());
|
||||||
|
|
||||||
if (nca.Header.ContentType == NcaContentType.Control)
|
if (nca.Header.ContentType == NcaContentType.Control)
|
||||||
{
|
{
|
||||||
|
@ -413,72 +435,80 @@ namespace Ryujinx.UI
|
||||||
return controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
|
return controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static (bool, string, string) GetMetadata(string TitleId)
|
private static (bool fav, string timePlayed, string lastPlayed) GetMetadata(string titleId)
|
||||||
{
|
{
|
||||||
string metadataFolder = Path.Combine(new VirtualFileSystem().GetBasePath(), "games", TitleId, "gui");
|
string metadataFolder = Path.Combine(new VirtualFileSystem().GetBasePath(), "games", titleId, "gui");
|
||||||
string metadataFile = Path.Combine(metadataFolder, "metadata.json");
|
string metadataFile = Path.Combine(metadataFolder, "metadata.json");
|
||||||
|
|
||||||
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
|
IJsonFormatterResolver resolver = CompositeResolver.Create(StandardResolver.AllowPrivateSnakeCase);
|
||||||
|
|
||||||
if (!File.Exists(metadataFile))
|
if (!File.Exists(metadataFile))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(metadataFolder);
|
Directory.CreateDirectory(metadataFolder);
|
||||||
|
|
||||||
AppMetadata = new ApplicationMetadata
|
_appMetadata = new ApplicationMetadata
|
||||||
{
|
{
|
||||||
Favorite = false,
|
Favorite = false,
|
||||||
TimePlayed = 0,
|
TimePlayed = 0,
|
||||||
LastPlayed = "Never"
|
LastPlayed = "Never"
|
||||||
};
|
};
|
||||||
|
|
||||||
byte[] saveData = JsonSerializer.Serialize(AppMetadata, resolver);
|
byte[] saveData = JsonSerializer.Serialize(_appMetadata, resolver);
|
||||||
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
|
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
using (Stream stream = File.OpenRead(metadataFile))
|
using (Stream stream = File.OpenRead(metadataFile))
|
||||||
{
|
{
|
||||||
AppMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
|
_appMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
string timePlayed;
|
return (_appMetadata.Favorite, ConvertSecondsToReadableString(_appMetadata.TimePlayed), _appMetadata.LastPlayed);
|
||||||
|
|
||||||
if (AppMetadata.TimePlayed < SecondsPerMinute)
|
|
||||||
{
|
|
||||||
timePlayed = $"{AppMetadata.TimePlayed}s";
|
|
||||||
}
|
|
||||||
else if (AppMetadata.TimePlayed < SecondsPerHour)
|
|
||||||
{
|
|
||||||
timePlayed = $"{Math.Round(AppMetadata.TimePlayed / SecondsPerMinute, 2, MidpointRounding.AwayFromZero)} mins";
|
|
||||||
}
|
|
||||||
else if (AppMetadata.TimePlayed < SecondsPerDay)
|
|
||||||
{
|
|
||||||
timePlayed = $"{Math.Round(AppMetadata.TimePlayed / SecondsPerHour, 2, MidpointRounding.AwayFromZero)} hrs";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
timePlayed = $"{Math.Round(AppMetadata.TimePlayed / SecondsPerDay, 2, MidpointRounding.AwayFromZero)} days";
|
|
||||||
}
|
|
||||||
|
|
||||||
return (AppMetadata.Favorite, timePlayed, AppMetadata.LastPlayed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] NspOrXciIcon(string applicationPath)
|
private static byte[] NspOrXciIcon(string applicationPath)
|
||||||
{
|
{
|
||||||
if (Path.GetExtension(applicationPath) == ".xci")
|
if (Path.GetExtension(applicationPath) == ".xci")
|
||||||
{
|
{
|
||||||
return RyujinxXciIcon;
|
return _ryujinxXciIcon;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return RyujinxNspIcon;
|
return _ryujinxNspIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string ConvertSecondsToReadableString(double seconds)
|
||||||
|
{
|
||||||
|
const int secondsPerMinute = 60;
|
||||||
|
const int secondsPerHour = secondsPerMinute * 60;
|
||||||
|
const int secondsPerDay = secondsPerHour * 24;
|
||||||
|
string readableString;
|
||||||
|
|
||||||
|
if (seconds < secondsPerMinute)
|
||||||
|
{
|
||||||
|
readableString = $"{seconds}s";
|
||||||
|
}
|
||||||
|
else if (seconds < secondsPerHour)
|
||||||
|
{
|
||||||
|
readableString = $"{Math.Round(seconds / secondsPerMinute, 2, MidpointRounding.AwayFromZero)} mins";
|
||||||
|
}
|
||||||
|
else if (seconds < secondsPerDay)
|
||||||
|
{
|
||||||
|
readableString = $"{Math.Round(seconds / secondsPerHour, 2, MidpointRounding.AwayFromZero)} hrs";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
readableString = $"{Math.Round(seconds / secondsPerDay, 2, MidpointRounding.AwayFromZero)} days";
|
||||||
|
}
|
||||||
|
|
||||||
|
return readableString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ApplicationAddedEventArgs : EventArgs
|
public class ApplicationAddedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
public ApplicationData AppData { get; set; }
|
public ApplicationData AppData { get; set; }
|
||||||
public float NumAppsFound { get; set; }
|
public int NumAppsFound { get; set; }
|
||||||
public float NumAppsLoaded { get; set; }
|
public int NumAppsLoaded { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,8 +300,8 @@ namespace Ryujinx.UI
|
||||||
string titleNameSection = string.IsNullOrWhiteSpace(_device.System.TitleName) ? string.Empty
|
string titleNameSection = string.IsNullOrWhiteSpace(_device.System.TitleName) ? string.Empty
|
||||||
: " | " + _device.System.TitleName;
|
: " | " + _device.System.TitleName;
|
||||||
|
|
||||||
string titleIDSection = string.IsNullOrWhiteSpace(_device.System.TitleID) ? string.Empty
|
string titleIDSection = string.IsNullOrWhiteSpace(_device.System.TitleId) ? string.Empty
|
||||||
: " | " + _device.System.TitleID.ToUpper();
|
: " | " + _device.System.TitleId.ToUpper();
|
||||||
|
|
||||||
_newTitle = $"Ryujinx{titleNameSection}{titleIDSection} | Host FPS: {hostFps:0.0} | Game FPS: {gameFps:0.0} | " +
|
_newTitle = $"Ryujinx{titleNameSection}{titleIDSection} | Host FPS: {hostFps:0.0} | Game FPS: {gameFps:0.0} | " +
|
||||||
$"Game Vsync: {(_device.EnableDeviceVsync ? "On" : "Off")}";
|
$"Game Vsync: {(_device.EnableDeviceVsync ? "On" : "Off")}";
|
||||||
|
|
|
@ -49,20 +49,22 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
private static ListStore _tableStore;
|
private static ListStore _tableStore;
|
||||||
|
|
||||||
private static Task UpdateGameTableTask;
|
private static Task _updateGameTableTask;
|
||||||
|
|
||||||
private static bool _gameLoaded = false;
|
private static bool _gameLoaded;
|
||||||
private static bool _ending = false;
|
private static bool _ending;
|
||||||
|
|
||||||
private static TreeViewColumn favColumn;
|
private static TreeViewColumn _favColumn;
|
||||||
private static TreeViewColumn appColumn;
|
private static TreeViewColumn _appColumn;
|
||||||
private static TreeViewColumn devColumn;
|
private static TreeViewColumn _devColumn;
|
||||||
private static TreeViewColumn versionColumn;
|
private static TreeViewColumn _versionColumn;
|
||||||
private static TreeViewColumn timePlayedColumn;
|
private static TreeViewColumn _timePlayedColumn;
|
||||||
private static TreeViewColumn lastPlayedColumn;
|
private static TreeViewColumn _lastPlayedColumn;
|
||||||
private static TreeViewColumn fileExtColumn;
|
private static TreeViewColumn _fileExtColumn;
|
||||||
private static TreeViewColumn fileSizeColumn;
|
private static TreeViewColumn _fileSizeColumn;
|
||||||
private static TreeViewColumn pathColumn;
|
private static TreeViewColumn _pathColumn;
|
||||||
|
|
||||||
|
private static TreeView _treeView;
|
||||||
|
|
||||||
private struct ApplicationMetadata
|
private struct ApplicationMetadata
|
||||||
{
|
{
|
||||||
|
@ -78,6 +80,7 @@ namespace Ryujinx.UI
|
||||||
public static RichPresence DiscordPresence;
|
public static RichPresence DiscordPresence;
|
||||||
|
|
||||||
#pragma warning disable CS0649
|
#pragma warning disable CS0649
|
||||||
|
#pragma warning disable IDE0044
|
||||||
[GUI] Window _mainWin;
|
[GUI] Window _mainWin;
|
||||||
[GUI] CheckMenuItem _fullScreen;
|
[GUI] CheckMenuItem _fullScreen;
|
||||||
[GUI] MenuItem _stopEmulation;
|
[GUI] MenuItem _stopEmulation;
|
||||||
|
@ -95,10 +98,11 @@ namespace Ryujinx.UI
|
||||||
[GUI] Label _progressLabel;
|
[GUI] Label _progressLabel;
|
||||||
[GUI] LevelBar _progressBar;
|
[GUI] LevelBar _progressBar;
|
||||||
#pragma warning restore CS0649
|
#pragma warning restore CS0649
|
||||||
|
#pragma warning restore IDE0044
|
||||||
|
|
||||||
public MainWindow(string[] args, Application gtkApplication) : this(new Builder("Ryujinx.Ui.MainWindow.glade"), args, gtkApplication) { }
|
public MainWindow(Application gtkApplication) : this(new Builder("Ryujinx.Ui.MainWindow.glade"), gtkApplication) { }
|
||||||
|
|
||||||
private MainWindow(Builder builder, string[] args, Application gtkApplication) : base(builder.GetObject("_mainWin").Handle)
|
private MainWindow(Builder builder, Application gtkApplication) : base(builder.GetObject("_mainWin").Handle)
|
||||||
{
|
{
|
||||||
builder.Autoconnect(this);
|
builder.Autoconnect(this);
|
||||||
|
|
||||||
|
@ -114,6 +118,8 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
_gtkApplication = gtkApplication;
|
_gtkApplication = gtkApplication;
|
||||||
|
|
||||||
|
_treeView = _gameTable;
|
||||||
|
|
||||||
Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||||
Configuration.InitialConfigure(_device);
|
Configuration.InitialConfigure(_device);
|
||||||
|
|
||||||
|
@ -181,10 +187,10 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
internal static void ApplyTheme()
|
internal static void ApplyTheme()
|
||||||
{
|
{
|
||||||
CssProvider cssProvider = new CssProvider();
|
|
||||||
|
|
||||||
if (SwitchSettings.SwitchConfig.EnableCustomTheme)
|
if (SwitchSettings.SwitchConfig.EnableCustomTheme)
|
||||||
{
|
{
|
||||||
|
CssProvider cssProvider = new CssProvider();
|
||||||
|
|
||||||
if (File.Exists(SwitchSettings.SwitchConfig.CustomThemePath) && (System.IO.Path.GetExtension(SwitchSettings.SwitchConfig.CustomThemePath) == ".css"))
|
if (File.Exists(SwitchSettings.SwitchConfig.CustomThemePath) && (System.IO.Path.GetExtension(SwitchSettings.SwitchConfig.CustomThemePath) == ".css"))
|
||||||
{
|
{
|
||||||
cssProvider.LoadFromPath(SwitchSettings.SwitchConfig.CustomThemePath);
|
cssProvider.LoadFromPath(SwitchSettings.SwitchConfig.CustomThemePath);
|
||||||
|
@ -193,10 +199,10 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
Logger.PrintWarning(LogClass.Application, $"The \"custom_theme_path\" section in \"Config.json\" contains an invalid path: \"{SwitchSettings.SwitchConfig.CustomThemePath}\"");
|
Logger.PrintWarning(LogClass.Application, $"The \"custom_theme_path\" section in \"Config.json\" contains an invalid path: \"{SwitchSettings.SwitchConfig.CustomThemePath}\"");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, 800);
|
StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, 800);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateColumns()
|
private void UpdateColumns()
|
||||||
{
|
{
|
||||||
|
@ -221,36 +227,39 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
foreach (TreeViewColumn column in _gameTable.Columns)
|
foreach (TreeViewColumn column in _gameTable.Columns)
|
||||||
{
|
{
|
||||||
if (column.Title == "Fav") { favColumn = column; }
|
if (column.Title == "Fav") { _favColumn = column; }
|
||||||
else if (column.Title == "Application") { appColumn = column; }
|
else if (column.Title == "Application") { _appColumn = column; }
|
||||||
else if (column.Title == "Developer") { devColumn = column; }
|
else if (column.Title == "Developer") { _devColumn = column; }
|
||||||
else if (column.Title == "Version") { versionColumn = column; }
|
else if (column.Title == "Version") { _versionColumn = column; }
|
||||||
else if (column.Title == "Time Played") { timePlayedColumn = column; }
|
else if (column.Title == "Time Played") { _timePlayedColumn = column; }
|
||||||
else if (column.Title == "Last Played") { lastPlayedColumn = column; }
|
else if (column.Title == "Last Played") { _lastPlayedColumn = column; }
|
||||||
else if (column.Title == "File Ext") { fileExtColumn = column; }
|
else if (column.Title == "File Ext") { _fileExtColumn = column; }
|
||||||
else if (column.Title == "File Size") { fileSizeColumn = column; }
|
else if (column.Title == "File Size") { _fileSizeColumn = column; }
|
||||||
else if (column.Title == "Path") { pathColumn = column; }
|
else if (column.Title == "Path") { _pathColumn = column; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.FavColumn) { favColumn.SortColumnId = 0; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.FavColumn) { _favColumn.SortColumnId = 0; }
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.IconColumn) { appColumn.SortColumnId = 2; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.IconColumn) { _appColumn.SortColumnId = 2; }
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.AppColumn) { devColumn.SortColumnId = 3; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.AppColumn) { _devColumn.SortColumnId = 3; }
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.DevColumn) { versionColumn.SortColumnId = 4; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.DevColumn) { _versionColumn.SortColumnId = 4; }
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.TimePlayedColumn) { timePlayedColumn.SortColumnId = 5; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.TimePlayedColumn) { _timePlayedColumn.SortColumnId = 5; }
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.LastPlayedColumn) { lastPlayedColumn.SortColumnId = 6; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.LastPlayedColumn) { _lastPlayedColumn.SortColumnId = 6; }
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.FileExtColumn) { fileExtColumn.SortColumnId = 7; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.FileExtColumn) { _fileExtColumn.SortColumnId = 7; }
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.FileSizeColumn) { fileSizeColumn.SortColumnId = 8; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.FileSizeColumn) { _fileSizeColumn.SortColumnId = 8; }
|
||||||
if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { pathColumn.SortColumnId = 9; }
|
if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { _pathColumn.SortColumnId = 9; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static async Task UpdateGameTable()
|
internal static async Task UpdateGameTable()
|
||||||
{
|
{
|
||||||
if (UpdateGameTableTask != null && !UpdateGameTableTask.IsCompleted) return;
|
if (_updateGameTableTask != null && !_updateGameTableTask.IsCompleted) return;
|
||||||
|
|
||||||
_tableStore.Clear();
|
_tableStore.Clear();
|
||||||
|
_treeView.HeadersClickable = false;
|
||||||
|
|
||||||
UpdateGameTableTask = Task.Run(() => ApplicationLibrary.LoadApplications(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage));
|
_updateGameTableTask = Task.Run(() => ApplicationLibrary.LoadApplications(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage));
|
||||||
await UpdateGameTableTask;
|
await _updateGameTableTask;
|
||||||
|
|
||||||
|
_treeView.HeadersClickable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void LoadApplication(string path)
|
internal void LoadApplication(string path)
|
||||||
|
@ -322,7 +331,7 @@ namespace Ryujinx.UI
|
||||||
#if MACOS_BUILD
|
#if MACOS_BUILD
|
||||||
CreateGameWindow();
|
CreateGameWindow();
|
||||||
#else
|
#else
|
||||||
new Thread(new ThreadStart(CreateGameWindow)).Start();
|
new Thread(CreateGameWindow).Start();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_gameLoaded = true;
|
_gameLoaded = true;
|
||||||
|
@ -330,12 +339,12 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
if (DiscordIntegrationEnabled)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
string state = _device.System.TitleID;
|
string state = _device.System.TitleId;
|
||||||
|
|
||||||
if (state == null)
|
if (state == null)
|
||||||
{
|
{
|
||||||
|
@ -363,35 +372,35 @@ namespace Ryujinx.UI
|
||||||
DiscordClient.SetPresence(DiscordPresence);
|
DiscordClient.SetPresence(DiscordPresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
string metadataFolder = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", _device.System.TitleID, "gui");
|
string metadataFolder = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", _device.System.TitleId, "gui");
|
||||||
string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json");
|
string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json");
|
||||||
|
|
||||||
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
|
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
|
||||||
ApplicationMetadata AppMetadata = new ApplicationMetadata();
|
ApplicationMetadata appMetadata;
|
||||||
|
|
||||||
if (!File.Exists(metadataFile))
|
if (!File.Exists(metadataFile))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(metadataFolder);
|
Directory.CreateDirectory(metadataFolder);
|
||||||
|
|
||||||
AppMetadata = new ApplicationMetadata
|
appMetadata = new ApplicationMetadata
|
||||||
{
|
{
|
||||||
Favorite = false,
|
Favorite = false,
|
||||||
TimePlayed = 0,
|
TimePlayed = 0,
|
||||||
LastPlayed = "Never"
|
LastPlayed = "Never"
|
||||||
};
|
};
|
||||||
|
|
||||||
byte[] data = JsonSerializer.Serialize(AppMetadata, resolver);
|
byte[] data = JsonSerializer.Serialize(appMetadata, resolver);
|
||||||
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(data, 0, data.Length).PrettyPrintJson());
|
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(data, 0, data.Length).PrettyPrintJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
using (Stream stream = File.OpenRead(metadataFile))
|
using (Stream stream = File.OpenRead(metadataFile))
|
||||||
{
|
{
|
||||||
AppMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
|
appMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
AppMetadata.LastPlayed = DateTime.UtcNow.ToString();
|
appMetadata.LastPlayed = DateTime.UtcNow.ToString();
|
||||||
|
|
||||||
byte[] saveData = JsonSerializer.Serialize(AppMetadata, resolver);
|
byte[] saveData = JsonSerializer.Serialize(appMetadata, resolver);
|
||||||
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
|
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,35 +425,35 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
if (_gameLoaded)
|
if (_gameLoaded)
|
||||||
{
|
{
|
||||||
string metadataFolder = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", _device.System.TitleID, "gui");
|
string metadataFolder = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", _device.System.TitleId, "gui");
|
||||||
string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json");
|
string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json");
|
||||||
|
|
||||||
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
|
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
|
||||||
ApplicationMetadata AppMetadata = new ApplicationMetadata();
|
ApplicationMetadata appMetadata;
|
||||||
|
|
||||||
if (!File.Exists(metadataFile))
|
if (!File.Exists(metadataFile))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(metadataFolder);
|
Directory.CreateDirectory(metadataFolder);
|
||||||
|
|
||||||
AppMetadata = new ApplicationMetadata
|
appMetadata = new ApplicationMetadata
|
||||||
{
|
{
|
||||||
Favorite = false,
|
Favorite = false,
|
||||||
TimePlayed = 0,
|
TimePlayed = 0,
|
||||||
LastPlayed = "Never"
|
LastPlayed = "Never"
|
||||||
};
|
};
|
||||||
|
|
||||||
byte[] data = JsonSerializer.Serialize(AppMetadata, resolver);
|
byte[] data = JsonSerializer.Serialize(appMetadata, resolver);
|
||||||
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(data, 0, data.Length).PrettyPrintJson());
|
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(data, 0, data.Length).PrettyPrintJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
using (Stream stream = File.OpenRead(metadataFile))
|
using (Stream stream = File.OpenRead(metadataFile))
|
||||||
{
|
{
|
||||||
AppMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
|
appMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
AppMetadata.TimePlayed += Math.Round(DateTime.UtcNow.Subtract(DateTime.Parse(AppMetadata.LastPlayed)).TotalSeconds, MidpointRounding.AwayFromZero);
|
appMetadata.TimePlayed += Math.Round(DateTime.UtcNow.Subtract(DateTime.Parse(appMetadata.LastPlayed)).TotalSeconds, MidpointRounding.AwayFromZero);
|
||||||
|
|
||||||
byte[] saveData = JsonSerializer.Serialize(AppMetadata, resolver);
|
byte[] saveData = JsonSerializer.Serialize(appMetadata, resolver);
|
||||||
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
|
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +491,7 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
_tableStore.AppendValues(e.AppData.Favorite, new Gdk.Pixbuf(e.AppData.Icon, 75, 75), $"{e.AppData.TitleName}\n{e.AppData.TitleId.ToUpper()}", e.AppData.Developer, e.AppData.Version, e.AppData.TimePlayed, e.AppData.LastPlayed, e.AppData.FileExtension, e.AppData.FileSize, e.AppData.Path);
|
_tableStore.AppendValues(e.AppData.Favorite, new Gdk.Pixbuf(e.AppData.Icon, 75, 75), $"{e.AppData.TitleName}\n{e.AppData.TitleId.ToUpper()}", e.AppData.Developer, e.AppData.Version, e.AppData.TimePlayed, e.AppData.LastPlayed, e.AppData.FileExtension, e.AppData.FileSize, e.AppData.Path);
|
||||||
_progressLabel.Text = $"{e.NumAppsLoaded}/{e.NumAppsFound} Games Loaded";
|
_progressLabel.Text = $"{e.NumAppsLoaded}/{e.NumAppsFound} Games Loaded";
|
||||||
_progressBar.Value = e.NumAppsLoaded / e.NumAppsFound;
|
_progressBar.Value = (float)e.NumAppsLoaded / e.NumAppsFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FavToggle_Toggled(object sender, ToggledArgs args)
|
private void FavToggle_Toggled(object sender, ToggledArgs args)
|
||||||
|
@ -492,27 +501,27 @@ namespace Ryujinx.UI
|
||||||
string metadataPath = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", titleid, "gui", "metadata.json");
|
string metadataPath = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", titleid, "gui", "metadata.json");
|
||||||
|
|
||||||
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
|
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
|
||||||
ApplicationMetadata AppMetadata = new ApplicationMetadata();
|
ApplicationMetadata appMetadata;
|
||||||
|
|
||||||
using (Stream stream = File.OpenRead(metadataPath))
|
using (Stream stream = File.OpenRead(metadataPath))
|
||||||
{
|
{
|
||||||
AppMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
|
appMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bool)_tableStore.GetValue(treeIter, 0))
|
if ((bool)_tableStore.GetValue(treeIter, 0))
|
||||||
{
|
{
|
||||||
_tableStore.SetValue(treeIter, 0, false);
|
_tableStore.SetValue(treeIter, 0, false);
|
||||||
|
|
||||||
AppMetadata.Favorite = false;
|
appMetadata.Favorite = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_tableStore.SetValue(treeIter, 0, true);
|
_tableStore.SetValue(treeIter, 0, true);
|
||||||
|
|
||||||
AppMetadata.Favorite = true;
|
appMetadata.Favorite = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] saveData = JsonSerializer.Serialize(AppMetadata, resolver);
|
byte[] saveData = JsonSerializer.Serialize(appMetadata, resolver);
|
||||||
File.WriteAllText(metadataPath, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
|
File.WriteAllText(metadataPath, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,12 +606,12 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
private void Settings_Pressed(object sender, EventArgs args)
|
private void Settings_Pressed(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
SwitchSettings SettingsWin = new SwitchSettings(_device);
|
SwitchSettings settingsWin = new SwitchSettings(_device);
|
||||||
|
|
||||||
_gtkApplication.Register(GLib.Cancellable.Current);
|
_gtkApplication.Register(GLib.Cancellable.Current);
|
||||||
_gtkApplication.AddWindow(SettingsWin);
|
_gtkApplication.AddWindow(settingsWin);
|
||||||
|
|
||||||
SettingsWin.Show();
|
settingsWin.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update_Pressed(object sender, EventArgs args)
|
private void Update_Pressed(object sender, EventArgs args)
|
||||||
|
@ -621,12 +630,12 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
private void About_Pressed(object sender, EventArgs args)
|
private void About_Pressed(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
AboutWindow AboutWin = new AboutWindow();
|
AboutWindow aboutWin = new AboutWindow();
|
||||||
|
|
||||||
_gtkApplication.Register(GLib.Cancellable.Current);
|
_gtkApplication.Register(GLib.Cancellable.Current);
|
||||||
_gtkApplication.AddWindow(AboutWin);
|
_gtkApplication.AddWindow(aboutWin);
|
||||||
|
|
||||||
AboutWin.Show();
|
aboutWin.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Fav_Toggled(object sender, EventArgs args)
|
private void Fav_Toggled(object sender, EventArgs args)
|
||||||
|
@ -808,15 +817,15 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
if (aValue.Substring(aValue.Length - 2) == "GB")
|
if (aValue.Substring(aValue.Length - 2) == "GB")
|
||||||
{
|
{
|
||||||
aValue = (float.Parse(aValue.Substring(0, aValue.Length - 2)) * 1024).ToString();
|
aValue = (float.Parse(aValue[0..^2]) * 1024).ToString();
|
||||||
}
|
}
|
||||||
else aValue = aValue.Substring(0, aValue.Length - 2);
|
else aValue = aValue[0..^2];
|
||||||
|
|
||||||
if (bValue.Substring(bValue.Length - 2) == "GB")
|
if (bValue.Substring(bValue.Length - 2) == "GB")
|
||||||
{
|
{
|
||||||
bValue = (float.Parse(bValue.Substring(0, bValue.Length - 2)) * 1024).ToString();
|
bValue = (float.Parse(bValue[0..^2]) * 1024).ToString();
|
||||||
}
|
}
|
||||||
else bValue = bValue.Substring(0, bValue.Length - 2);
|
else bValue = bValue[0..^2];
|
||||||
|
|
||||||
if (float.Parse(aValue) > float.Parse(bValue)) return -1;
|
if (float.Parse(aValue) > float.Parse(bValue)) return -1;
|
||||||
else if (float.Parse(bValue) > float.Parse(aValue)) return 1;
|
else if (float.Parse(bValue) > float.Parse(aValue)) return 1;
|
||||||
|
|
|
@ -15,13 +15,14 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
internal static Configuration SwitchConfig { get; set; }
|
internal static Configuration SwitchConfig { get; set; }
|
||||||
|
|
||||||
private HLE.Switch _device;
|
private readonly HLE.Switch _device;
|
||||||
|
|
||||||
private static ListStore _gameDirsBoxStore;
|
private static ListStore _gameDirsBoxStore;
|
||||||
|
|
||||||
private static bool _listeningForKeypress;
|
private static bool _listeningForKeypress;
|
||||||
|
|
||||||
#pragma warning disable CS0649
|
#pragma warning disable CS0649
|
||||||
|
#pragma warning disable IDE0044
|
||||||
[GUI] Window _settingsWin;
|
[GUI] Window _settingsWin;
|
||||||
[GUI] CheckButton _errorLogToggle;
|
[GUI] CheckButton _errorLogToggle;
|
||||||
[GUI] CheckButton _warningLogToggle;
|
[GUI] CheckButton _warningLogToggle;
|
||||||
|
@ -79,8 +80,9 @@ namespace Ryujinx.UI
|
||||||
[GUI] ToggleButton _r1;
|
[GUI] ToggleButton _r1;
|
||||||
[GUI] ToggleButton _zR1;
|
[GUI] ToggleButton _zR1;
|
||||||
#pragma warning restore CS0649
|
#pragma warning restore CS0649
|
||||||
|
#pragma warning restore IDE0044
|
||||||
|
|
||||||
public static void ConfigureSettings(Configuration Instance) { SwitchConfig = Instance; }
|
public static void ConfigureSettings(Configuration instance) { SwitchConfig = instance; }
|
||||||
|
|
||||||
public SwitchSettings(HLE.Switch device) : this(new Builder("Ryujinx.Ui.SwitchSettings.glade"), device) { }
|
public SwitchSettings(HLE.Switch device) : this(new Builder("Ryujinx.Ui.SwitchSettings.glade"), device) { }
|
||||||
|
|
||||||
|
@ -200,18 +202,18 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
_listeningForKeypress = true;
|
_listeningForKeypress = true;
|
||||||
|
|
||||||
void On_KeyPress(object Sender, KeyPressEventArgs KeyPressed)
|
void On_KeyPress(object o, KeyPressEventArgs keyPressed)
|
||||||
{
|
{
|
||||||
string key = KeyPressed.Event.Key.ToString();
|
string key = keyPressed.Event.Key.ToString();
|
||||||
string capKey = key.First().ToString().ToUpper() + key.Substring(1);
|
string capKey = key.First().ToString().ToUpper() + key.Substring(1);
|
||||||
|
|
||||||
if (Enum.IsDefined(typeof(OpenTK.Input.Key), capKey))
|
if (Enum.IsDefined(typeof(OpenTK.Input.Key), capKey))
|
||||||
{
|
{
|
||||||
button.Label = capKey;
|
button.Label = capKey;
|
||||||
}
|
}
|
||||||
else if (GdkToOpenTKInput.ContainsKey(key))
|
else if (GdkToOpenTkInput.ContainsKey(key))
|
||||||
{
|
{
|
||||||
button.Label = GdkToOpenTKInput[key];
|
button.Label = GdkToOpenTkInput[key];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -233,21 +235,20 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
private void Controller_Changed(object sender, EventArgs args, string controllerType, Image controllerImage)
|
private void Controller_Changed(object sender, EventArgs args, string controllerType, Image controllerImage)
|
||||||
{
|
{
|
||||||
if (controllerType == "ProController")
|
switch (controllerType)
|
||||||
{
|
{
|
||||||
|
case "ProController":
|
||||||
controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ProCon.png", 500, 500);
|
controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ProCon.png", 500, 500);
|
||||||
}
|
break;
|
||||||
else if (controllerType == "NpadLeft")
|
case "NpadLeft":
|
||||||
{
|
|
||||||
controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.BlueCon.png", 500, 500);
|
controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.BlueCon.png", 500, 500);
|
||||||
}
|
break;
|
||||||
else if (controllerType == "NpadRight")
|
case "NpadRight":
|
||||||
{
|
|
||||||
controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.RedCon.png", 500, 500);
|
controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.RedCon.png", 500, 500);
|
||||||
}
|
break;
|
||||||
else
|
default:
|
||||||
{
|
|
||||||
controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500);
|
controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +384,9 @@ namespace Ryujinx.UI
|
||||||
Configuration.Configure(_device, SwitchConfig);
|
Configuration.Configure(_device, SwitchConfig);
|
||||||
|
|
||||||
MainWindow.ApplyTheme();
|
MainWindow.ApplyTheme();
|
||||||
|
#pragma warning disable CS4014
|
||||||
MainWindow.UpdateGameTable();
|
MainWindow.UpdateGameTable();
|
||||||
|
#pragma warning restore CS4014
|
||||||
Dispose();
|
Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +395,7 @@ namespace Ryujinx.UI
|
||||||
Dispose();
|
Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly Dictionary<string, string> GdkToOpenTKInput = new Dictionary<string, string>()
|
public readonly Dictionary<string, string> GdkToOpenTkInput = new Dictionary<string, string>()
|
||||||
{
|
{
|
||||||
{ "Key_0", "Number0" },
|
{ "Key_0", "Number0" },
|
||||||
{ "Key_1", "Number1" },
|
{ "Key_1", "Number1" },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue