mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-22 18:15:11 +00:00
[Ryujinx.Ui.Common] Address dotnet-format issues (#5392)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Silence dotnet format IDE0060 warnings * Address dotnet format CA1401 warnings * dotnet-format fixes after rebase * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Another rebase, another dotnet format run * Run dotnet format style after rebase * Add comments to disabled warnings * Remove a few unused parameters * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Address IDE0251 warnings * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * Small optimizations * Remove alignment * Apply formatting * Fix build issues * Final pass for dotnet format * Add trailing commas Co-authored-by: Ac_K <Acoustik666@gmail.com> * Add trailing commas --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
7c989f88bd
commit
6e28a4dd13
41 changed files with 761 additions and 696 deletions
|
@ -32,6 +32,7 @@ using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
using Ryujinx.HLE.HOS.SystemState;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
|
using Ryujinx.Ui.App.Common;
|
||||||
using Ryujinx.Ui.Common;
|
using Ryujinx.Ui.Common;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
using Ryujinx.Ui.Common.Helper;
|
using Ryujinx.Ui.Common.Helper;
|
||||||
|
@ -692,7 +693,7 @@ namespace Ryujinx.Ava
|
||||||
|
|
||||||
DiscordIntegrationModule.SwitchToPlayingState(Device.Processes.ActiveApplication.ProgramIdText, Device.Processes.ActiveApplication.Name);
|
DiscordIntegrationModule.SwitchToPlayingState(Device.Processes.ActiveApplication.ProgramIdText, Device.Processes.ActiveApplication.Name);
|
||||||
|
|
||||||
_viewModel.ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText, appMetadata =>
|
ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText, appMetadata =>
|
||||||
{
|
{
|
||||||
appMetadata.LastPlayed = DateTime.UtcNow;
|
appMetadata.LastPlayed = DateTime.UtcNow;
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace Ryujinx.Ava.UI.Controls
|
||||||
{
|
{
|
||||||
viewModel.SelectedApplication.Favorite = !viewModel.SelectedApplication.Favorite;
|
viewModel.SelectedApplication.Favorite = !viewModel.SelectedApplication.Favorite;
|
||||||
|
|
||||||
viewModel.ApplicationLibrary.LoadAndSaveMetaData(viewModel.SelectedApplication.TitleId, appMetadata =>
|
ApplicationLibrary.LoadAndSaveMetaData(viewModel.SelectedApplication.TitleId, appMetadata =>
|
||||||
{
|
{
|
||||||
appMetadata.Favorite = viewModel.SelectedApplication.Favorite;
|
appMetadata.Favorite = viewModel.SelectedApplication.Favorite;
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@ using LibHac.Ncm;
|
||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Ava.UI.Windows;
|
using Ryujinx.Ava.UI.Windows;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
|
using Ryujinx.Ui.App.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -74,7 +75,7 @@ namespace Ryujinx.Ava.UI.Models
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var appMetadata = MainWindow.MainWindowViewModel.ApplicationLibrary.LoadAndSaveMetaData(TitleIdString);
|
var appMetadata = ApplicationLibrary.LoadAndSaveMetaData(TitleIdString);
|
||||||
Title = appMetadata.Title ?? TitleIdString;
|
Title = appMetadata.Title ?? TitleIdString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -239,28 +239,28 @@ namespace Ryujinx.Ava.UI.Renderer
|
||||||
IPlatformHandle CreateMacOS()
|
IPlatformHandle CreateMacOS()
|
||||||
{
|
{
|
||||||
// Create a new CAMetalLayer.
|
// Create a new CAMetalLayer.
|
||||||
IntPtr layerClass = ObjectiveC.objc_getClass("CAMetalLayer");
|
ObjectiveC.Object layerObject = new("CAMetalLayer");
|
||||||
IntPtr metalLayer = ObjectiveC.IntPtr_objc_msgSend(layerClass, "alloc");
|
ObjectiveC.Object metalLayer = layerObject.GetFromMessage("alloc");
|
||||||
ObjectiveC.objc_msgSend(metalLayer, "init");
|
metalLayer.SendMessage("init");
|
||||||
|
|
||||||
// Create a child NSView to render into.
|
// Create a child NSView to render into.
|
||||||
IntPtr nsViewClass = ObjectiveC.objc_getClass("NSView");
|
ObjectiveC.Object nsViewObject = new("NSView");
|
||||||
IntPtr child = ObjectiveC.IntPtr_objc_msgSend(nsViewClass, "alloc");
|
ObjectiveC.Object child = nsViewObject.GetFromMessage("alloc");
|
||||||
ObjectiveC.objc_msgSend(child, "init", new ObjectiveC.NSRect(0, 0, 0, 0));
|
child.SendMessage("init", new ObjectiveC.NSRect(0, 0, 0, 0));
|
||||||
|
|
||||||
// Make its renderer our metal layer.
|
// Make its renderer our metal layer.
|
||||||
ObjectiveC.objc_msgSend(child, "setWantsLayer:", 1);
|
child.SendMessage("setWantsLayer:", 1);
|
||||||
ObjectiveC.objc_msgSend(child, "setLayer:", metalLayer);
|
child.SendMessage("setLayer:", metalLayer);
|
||||||
ObjectiveC.objc_msgSend(metalLayer, "setContentsScale:", Program.DesktopScaleFactor);
|
metalLayer.SendMessage("setContentsScale:", Program.DesktopScaleFactor);
|
||||||
|
|
||||||
// Ensure the scale factor is up to date.
|
// Ensure the scale factor is up to date.
|
||||||
_updateBoundsCallback = rect =>
|
_updateBoundsCallback = rect =>
|
||||||
{
|
{
|
||||||
ObjectiveC.objc_msgSend(metalLayer, "setContentsScale:", Program.DesktopScaleFactor);
|
metalLayer.SendMessage("setContentsScale:", Program.DesktopScaleFactor);
|
||||||
};
|
};
|
||||||
|
|
||||||
IntPtr nsView = child;
|
IntPtr nsView = child.ObjPtr;
|
||||||
MetalLayer = metalLayer;
|
MetalLayer = metalLayer.ObjPtr;
|
||||||
NsView = nsView;
|
NsView = nsView;
|
||||||
|
|
||||||
return new PlatformHandle(nsView, "NSView");
|
return new PlatformHandle(nsView, "NSView");
|
||||||
|
|
|
@ -6,4 +6,4 @@ namespace Ryujinx.Ui.App.Common
|
||||||
{
|
{
|
||||||
public ApplicationData AppData { get; set; }
|
public ApplicationData AppData { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
{
|
{
|
||||||
public class ApplicationCountUpdatedEventArgs : EventArgs
|
public class ApplicationCountUpdatedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
public int NumAppsFound { get; set; }
|
public int NumAppsFound { get; set; }
|
||||||
public int NumAppsLoaded { get; set; }
|
public int NumAppsLoaded { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,19 +18,19 @@ namespace Ryujinx.Ui.App.Common
|
||||||
{
|
{
|
||||||
public class ApplicationData
|
public class ApplicationData
|
||||||
{
|
{
|
||||||
public bool Favorite { get; set; }
|
public bool Favorite { get; set; }
|
||||||
public byte[] Icon { get; set; }
|
public byte[] Icon { get; set; }
|
||||||
public string TitleName { get; set; }
|
public string TitleName { get; set; }
|
||||||
public string TitleId { get; set; }
|
public string TitleId { get; set; }
|
||||||
public string Developer { get; set; }
|
public string Developer { get; set; }
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
public string TimePlayed { get; set; }
|
public string TimePlayed { get; set; }
|
||||||
public double TimePlayedNum { get; set; }
|
public double TimePlayedNum { get; set; }
|
||||||
public DateTime? LastPlayed { get; set; }
|
public DateTime? LastPlayed { get; set; }
|
||||||
public string FileExtension { get; set; }
|
public string FileExtension { get; set; }
|
||||||
public string FileSize { get; set; }
|
public string FileSize { get; set; }
|
||||||
public double FileSizeBytes { get; set; }
|
public double FileSizeBytes { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public BlitStruct<ApplicationControlProperty> ControlHolder { get; set; }
|
public BlitStruct<ApplicationControlProperty> ControlHolder { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
@ -159,7 +159,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
codeFs.OpenFile(ref nsoFile.Ref, $"/{MainExeFs}".ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
codeFs.OpenFile(ref nsoFile.Ref, $"/{MainExeFs}".ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||||
|
|
||||||
NsoReader reader = new NsoReader();
|
NsoReader reader = new();
|
||||||
reader.Initialize(nsoFile.Release().AsStorage().AsFile(OpenMode.Read)).ThrowIfFailure();
|
reader.Initialize(nsoFile.Release().AsStorage().AsFile(OpenMode.Read)).ThrowIfFailure();
|
||||||
|
|
||||||
return BitConverter.ToString(reader.Header.ModuleId.ItemsRo.ToArray()).Replace("-", "").ToUpper()[..16];
|
return BitConverter.ToString(reader.Header.ModuleId.ItemsRo.ToArray()).Replace("-", "").ToUpper()[..16];
|
||||||
|
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.Ui.App.Common
|
||||||
internal partial class ApplicationJsonSerializerContext : JsonSerializerContext
|
internal partial class ApplicationJsonSerializerContext : JsonSerializerContext
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,13 @@ using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Path = System.IO.Path;
|
using Path = System.IO.Path;
|
||||||
|
using TimeSpan = System.TimeSpan;
|
||||||
|
|
||||||
namespace Ryujinx.Ui.App.Common
|
namespace Ryujinx.Ui.App.Common
|
||||||
{
|
{
|
||||||
public class ApplicationLibrary
|
public class ApplicationLibrary
|
||||||
{
|
{
|
||||||
public event EventHandler<ApplicationAddedEventArgs> ApplicationAdded;
|
public event EventHandler<ApplicationAddedEventArgs> ApplicationAdded;
|
||||||
public event EventHandler<ApplicationCountUpdatedEventArgs> ApplicationCountUpdated;
|
public event EventHandler<ApplicationCountUpdatedEventArgs> ApplicationCountUpdated;
|
||||||
|
|
||||||
private readonly byte[] _nspIcon;
|
private readonly byte[] _nspIcon;
|
||||||
|
@ -41,11 +42,11 @@ namespace Ryujinx.Ui.App.Common
|
||||||
private readonly byte[] _nsoIcon;
|
private readonly byte[] _nsoIcon;
|
||||||
|
|
||||||
private readonly VirtualFileSystem _virtualFileSystem;
|
private readonly VirtualFileSystem _virtualFileSystem;
|
||||||
private Language _desiredTitleLanguage;
|
private Language _desiredTitleLanguage;
|
||||||
private CancellationTokenSource _cancellationToken;
|
private CancellationTokenSource _cancellationToken;
|
||||||
|
|
||||||
private static readonly ApplicationJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
private static readonly ApplicationJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||||
private static readonly TitleUpdateMetadataJsonSerializerContext TitleSerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
private static readonly TitleUpdateMetadataJsonSerializerContext _titleSerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||||
|
|
||||||
public ApplicationLibrary(VirtualFileSystem virtualFileSystem)
|
public ApplicationLibrary(VirtualFileSystem virtualFileSystem)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +61,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
private static byte[] GetResourceBytes(string resourceName)
|
private static byte[] GetResourceBytes(string resourceName)
|
||||||
{
|
{
|
||||||
Stream resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName);
|
Stream resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName);
|
||||||
byte[] resourceByteArray = new byte[resourceStream.Length];
|
byte[] resourceByteArray = new byte[resourceStream.Length];
|
||||||
|
|
||||||
resourceStream.Read(resourceByteArray);
|
resourceStream.Read(resourceByteArray);
|
||||||
|
@ -83,7 +84,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
public void LoadApplications(List<string> appDirs, Language desiredTitleLanguage)
|
public void LoadApplications(List<string> appDirs, Language desiredTitleLanguage)
|
||||||
{
|
{
|
||||||
int numApplicationsFound = 0;
|
int numApplicationsFound = 0;
|
||||||
int numApplicationsLoaded = 0;
|
int numApplicationsLoaded = 0;
|
||||||
|
|
||||||
_desiredTitleLanguage = desiredTitleLanguage;
|
_desiredTitleLanguage = desiredTitleLanguage;
|
||||||
|
@ -114,14 +115,14 @@ namespace Ryujinx.Ui.App.Common
|
||||||
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", SearchOption.AllDirectories).Where(file =>
|
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", SearchOption.AllDirectories).Where(file =>
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(Path.GetExtension(file).ToLower() is ".nsp" && ConfigurationState.Instance.Ui.ShownFileTypes.NSP.Value) ||
|
(Path.GetExtension(file).ToLower() is ".nsp" && ConfigurationState.Instance.Ui.ShownFileTypes.NSP.Value) ||
|
||||||
(Path.GetExtension(file).ToLower() is ".pfs0" && ConfigurationState.Instance.Ui.ShownFileTypes.PFS0.Value) ||
|
(Path.GetExtension(file).ToLower() is ".pfs0" && ConfigurationState.Instance.Ui.ShownFileTypes.PFS0.Value) ||
|
||||||
(Path.GetExtension(file).ToLower() is ".xci" && ConfigurationState.Instance.Ui.ShownFileTypes.XCI.Value) ||
|
(Path.GetExtension(file).ToLower() is ".xci" && ConfigurationState.Instance.Ui.ShownFileTypes.XCI.Value) ||
|
||||||
(Path.GetExtension(file).ToLower() is ".nca" && ConfigurationState.Instance.Ui.ShownFileTypes.NCA.Value) ||
|
(Path.GetExtension(file).ToLower() is ".nca" && ConfigurationState.Instance.Ui.ShownFileTypes.NCA.Value) ||
|
||||||
(Path.GetExtension(file).ToLower() is ".nro" && ConfigurationState.Instance.Ui.ShownFileTypes.NRO.Value) ||
|
(Path.GetExtension(file).ToLower() is ".nro" && ConfigurationState.Instance.Ui.ShownFileTypes.NRO.Value) ||
|
||||||
(Path.GetExtension(file).ToLower() is ".nso" && ConfigurationState.Instance.Ui.ShownFileTypes.NSO.Value);
|
(Path.GetExtension(file).ToLower() is ".nso" && ConfigurationState.Instance.Ui.ShownFileTypes.NSO.Value);
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (string app in files)
|
foreach (string app in files)
|
||||||
{
|
{
|
||||||
if (_cancellationToken.Token.IsCancellationRequested)
|
if (_cancellationToken.Token.IsCancellationRequested)
|
||||||
|
@ -459,27 +460,27 @@ namespace Ryujinx.Ui.App.Common
|
||||||
FileSize = (fileSize < 1) ? (fileSize * 1024).ToString("0.##") + " MiB" : fileSize.ToString("0.##") + " GiB",
|
FileSize = (fileSize < 1) ? (fileSize * 1024).ToString("0.##") + " MiB" : fileSize.ToString("0.##") + " GiB",
|
||||||
FileSizeBytes = fileSize,
|
FileSizeBytes = fileSize,
|
||||||
Path = applicationPath,
|
Path = applicationPath,
|
||||||
ControlHolder = controlHolder
|
ControlHolder = controlHolder,
|
||||||
};
|
};
|
||||||
|
|
||||||
numApplicationsLoaded++;
|
numApplicationsLoaded++;
|
||||||
|
|
||||||
OnApplicationAdded(new ApplicationAddedEventArgs()
|
OnApplicationAdded(new ApplicationAddedEventArgs
|
||||||
{
|
{
|
||||||
AppData = data
|
AppData = data,
|
||||||
});
|
});
|
||||||
|
|
||||||
OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs()
|
OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs
|
||||||
{
|
{
|
||||||
NumAppsFound = numApplicationsFound,
|
NumAppsFound = numApplicationsFound,
|
||||||
NumAppsLoaded = numApplicationsLoaded
|
NumAppsLoaded = numApplicationsLoaded,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs()
|
OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs
|
||||||
{
|
{
|
||||||
NumAppsFound = numApplicationsFound,
|
NumAppsFound = numApplicationsFound,
|
||||||
NumAppsLoaded = numApplicationsLoaded
|
NumAppsLoaded = numApplicationsLoaded,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -505,13 +506,13 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
// Return the ControlFS
|
// Return the ControlFS
|
||||||
controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
|
controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
|
||||||
titleId = controlNca?.Header.TitleId.ToString("x16");
|
titleId = controlNca?.Header.TitleId.ToString("x16");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationMetadata LoadAndSaveMetaData(string titleId, Action<ApplicationMetadata> modifyFunction = null)
|
public static ApplicationMetadata LoadAndSaveMetaData(string titleId, Action<ApplicationMetadata> modifyFunction = null)
|
||||||
{
|
{
|
||||||
string metadataFolder = Path.Combine(AppDataManager.GamesDirPath, titleId, "gui");
|
string metadataFolder = Path.Combine(AppDataManager.GamesDirPath, titleId, "gui");
|
||||||
string metadataFile = Path.Combine(metadataFolder, "metadata.json");
|
string metadataFile = Path.Combine(metadataFolder, "metadata.json");
|
||||||
|
|
||||||
ApplicationMetadata appMetadata;
|
ApplicationMetadata appMetadata;
|
||||||
|
|
||||||
|
@ -521,12 +522,12 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
appMetadata = new ApplicationMetadata();
|
appMetadata = new ApplicationMetadata();
|
||||||
|
|
||||||
JsonHelper.SerializeToFile(metadataFile, appMetadata, SerializerContext.ApplicationMetadata);
|
JsonHelper.SerializeToFile(metadataFile, appMetadata, _serializerContext.ApplicationMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
appMetadata = JsonHelper.DeserializeFromFile(metadataFile, SerializerContext.ApplicationMetadata);
|
appMetadata = JsonHelper.DeserializeFromFile(metadataFile, _serializerContext.ApplicationMetadata);
|
||||||
}
|
}
|
||||||
catch (JsonException)
|
catch (JsonException)
|
||||||
{
|
{
|
||||||
|
@ -539,7 +540,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
{
|
{
|
||||||
modifyFunction(appMetadata);
|
modifyFunction(appMetadata);
|
||||||
|
|
||||||
JsonHelper.SerializeToFile(metadataFile, appMetadata, SerializerContext.ApplicationMetadata);
|
JsonHelper.SerializeToFile(metadataFile, appMetadata, _serializerContext.ApplicationMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
return appMetadata;
|
return appMetadata;
|
||||||
|
@ -703,7 +704,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Logger.Warning?.Print(LogClass.Application, $"Could not retrieve a valid icon for the app. Default icon will be used. Errored File: {applicationPath}");
|
Logger.Warning?.Print(LogClass.Application, $"Could not retrieve a valid icon for the app. Default icon will be used. Errored File: {applicationPath}");
|
||||||
}
|
}
|
||||||
|
@ -713,7 +714,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
private static string ConvertSecondsToFormattedString(double seconds)
|
private static string ConvertSecondsToFormattedString(double seconds)
|
||||||
{
|
{
|
||||||
System.TimeSpan time = System.TimeSpan.FromSeconds(seconds);
|
TimeSpan time = TimeSpan.FromSeconds(seconds);
|
||||||
|
|
||||||
string timeString;
|
string timeString;
|
||||||
if (time.Days != 0)
|
if (time.Days != 0)
|
||||||
|
@ -840,7 +841,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||||
|
|
||||||
Nca nca = new Nca(fileSystem.KeySet, ncaFile.Release().AsStorage());
|
Nca nca = new(fileSystem.KeySet, ncaFile.Release().AsStorage());
|
||||||
|
|
||||||
int ncaProgramIndex = (int)(nca.Header.TitleId & 0xF);
|
int ncaProgramIndex = (int)(nca.Header.TitleId & 0xF);
|
||||||
|
|
||||||
|
@ -884,7 +885,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||||
|
|
||||||
Nca nca = new Nca(fileSystem.KeySet, ncaFile.Release().AsStorage());
|
Nca nca = new(fileSystem.KeySet, ncaFile.Release().AsStorage());
|
||||||
|
|
||||||
int ncaProgramIndex = (int)(nca.Header.TitleId & 0xF);
|
int ncaProgramIndex = (int)(nca.Header.TitleId & 0xF);
|
||||||
|
|
||||||
|
@ -925,12 +926,12 @@ namespace Ryujinx.Ui.App.Common
|
||||||
|
|
||||||
if (File.Exists(titleUpdateMetadataPath))
|
if (File.Exists(titleUpdateMetadataPath))
|
||||||
{
|
{
|
||||||
updatePath = JsonHelper.DeserializeFromFile(titleUpdateMetadataPath, TitleSerializerContext.TitleUpdateMetadata).Selected;
|
updatePath = JsonHelper.DeserializeFromFile(titleUpdateMetadataPath, _titleSerializerContext.TitleUpdateMetadata).Selected;
|
||||||
|
|
||||||
if (File.Exists(updatePath))
|
if (File.Exists(updatePath))
|
||||||
{
|
{
|
||||||
FileStream file = new FileStream(updatePath, FileMode.Open, FileAccess.Read);
|
FileStream file = new(updatePath, FileMode.Open, FileAccess.Read);
|
||||||
PartitionFileSystem nsp = new PartitionFileSystem(file.AsStorage());
|
PartitionFileSystem nsp = new(file.AsStorage());
|
||||||
|
|
||||||
return GetGameUpdateDataFromPartition(fileSystem, nsp, titleIdBase.ToString("x16"), programIndex);
|
return GetGameUpdateDataFromPartition(fileSystem, nsp, titleIdBase.ToString("x16"), programIndex);
|
||||||
}
|
}
|
||||||
|
@ -941,4 +942,3 @@ namespace Ryujinx.Ui.App.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Ryujinx.Ui.App.Common
|
||||||
public class ApplicationMetadata
|
public class ApplicationMetadata
|
||||||
{
|
{
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public bool Favorite { get; set; }
|
public bool Favorite { get; set; }
|
||||||
public double TimePlayed { get; set; }
|
public double TimePlayed { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("last_played_utc")]
|
[JsonPropertyName("last_played_utc")]
|
||||||
|
@ -16,4 +16,4 @@ namespace Ryujinx.Ui.App.Common
|
||||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||||
public string LastPlayedOld { get; set; }
|
public string LastPlayedOld { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,6 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
Dummy,
|
Dummy,
|
||||||
OpenAl,
|
OpenAl,
|
||||||
SoundIo,
|
SoundIo,
|
||||||
SDL2
|
SDL2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,4 +395,4 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
JsonHelper.SerializeToFile(path, this, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
JsonHelper.SerializeToFile(path, this, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,4 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
{
|
{
|
||||||
public static readonly ConfigurationJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
public static readonly ConfigurationJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
internal partial class ConfigurationJsonSerializerContext : JsonSerializerContext
|
internal partial class ConfigurationJsonSerializerContext : JsonSerializerContext
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,6 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
{
|
{
|
||||||
Success = 0,
|
Success = 0,
|
||||||
NotLoaded = 1,
|
NotLoaded = 1,
|
||||||
MigratedFromPreVulkan = 1 << 8
|
MigratedFromPreVulkan = 1 << 8,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -9,16 +9,16 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
{
|
{
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
ConfigurationState.Instance.Logger.EnableDebug.Event += ReloadEnableDebug;
|
ConfigurationState.Instance.Logger.EnableDebug.Event += ReloadEnableDebug;
|
||||||
ConfigurationState.Instance.Logger.EnableStub.Event += ReloadEnableStub;
|
ConfigurationState.Instance.Logger.EnableStub.Event += ReloadEnableStub;
|
||||||
ConfigurationState.Instance.Logger.EnableInfo.Event += ReloadEnableInfo;
|
ConfigurationState.Instance.Logger.EnableInfo.Event += ReloadEnableInfo;
|
||||||
ConfigurationState.Instance.Logger.EnableWarn.Event += ReloadEnableWarning;
|
ConfigurationState.Instance.Logger.EnableWarn.Event += ReloadEnableWarning;
|
||||||
ConfigurationState.Instance.Logger.EnableError.Event += ReloadEnableError;
|
ConfigurationState.Instance.Logger.EnableError.Event += ReloadEnableError;
|
||||||
ConfigurationState.Instance.Logger.EnableTrace.Event += ReloadEnableTrace;
|
ConfigurationState.Instance.Logger.EnableTrace.Event += ReloadEnableTrace;
|
||||||
ConfigurationState.Instance.Logger.EnableGuest.Event += ReloadEnableGuest;
|
ConfigurationState.Instance.Logger.EnableGuest.Event += ReloadEnableGuest;
|
||||||
ConfigurationState.Instance.Logger.EnableFsAccessLog.Event += ReloadEnableFsAccessLog;
|
ConfigurationState.Instance.Logger.EnableFsAccessLog.Event += ReloadEnableFsAccessLog;
|
||||||
ConfigurationState.Instance.Logger.FilteredClasses.Event += ReloadFilteredClasses;
|
ConfigurationState.Instance.Logger.FilteredClasses.Event += ReloadFilteredClasses;
|
||||||
ConfigurationState.Instance.Logger.EnableFileLog.Event += ReloadFileLogger;
|
ConfigurationState.Instance.Logger.EnableFileLog.Event += ReloadFileLogger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ReloadEnableDebug(object sender, ReactiveEventArgs<bool> e)
|
private static void ReloadEnableDebug(object sender, ReactiveEventArgs<bool> e)
|
||||||
|
|
|
@ -23,6 +23,6 @@ namespace Ryujinx.Ui.Common.Configuration.System
|
||||||
LatinAmericanSpanish,
|
LatinAmericanSpanish,
|
||||||
SimplifiedChinese,
|
SimplifiedChinese,
|
||||||
TraditionalChinese,
|
TraditionalChinese,
|
||||||
BrazilianPortuguese
|
BrazilianPortuguese,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,6 @@ namespace Ryujinx.Ui.Common.Configuration.System
|
||||||
Australia,
|
Australia,
|
||||||
China,
|
China,
|
||||||
Korea,
|
Korea,
|
||||||
Taiwan
|
Taiwan,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
public struct ColumnSort
|
public struct ColumnSort
|
||||||
{
|
{
|
||||||
public int SortColumnId { get; set; }
|
public int SortColumnId { get; set; }
|
||||||
public bool SortAscending { get; set; }
|
public bool SortAscending { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
{
|
{
|
||||||
public struct GuiColumns
|
public struct GuiColumns
|
||||||
{
|
{
|
||||||
public bool FavColumn { get; set; }
|
public bool FavColumn { get; set; }
|
||||||
public bool IconColumn { get; set; }
|
public bool IconColumn { get; set; }
|
||||||
public bool AppColumn { get; set; }
|
public bool AppColumn { get; set; }
|
||||||
public bool DevColumn { get; set; }
|
public bool DevColumn { get; set; }
|
||||||
public bool VersionColumn { get; set; }
|
public bool VersionColumn { get; set; }
|
||||||
public bool TimePlayedColumn { get; set; }
|
public bool TimePlayedColumn { get; set; }
|
||||||
public bool LastPlayedColumn { get; set; }
|
public bool LastPlayedColumn { get; set; }
|
||||||
public bool FileExtColumn { get; set; }
|
public bool FileExtColumn { get; set; }
|
||||||
public bool FileSizeColumn { get; set; }
|
public bool FileSizeColumn { get; set; }
|
||||||
public bool PathColumn { get; set; }
|
public bool PathColumn { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ namespace Ryujinx.Ui.Common.Configuration.Ui
|
||||||
{
|
{
|
||||||
public struct ShownFileTypes
|
public struct ShownFileTypes
|
||||||
{
|
{
|
||||||
public bool NSP { get; set; }
|
public bool NSP { get; set; }
|
||||||
public bool PFS0 { get; set; }
|
public bool PFS0 { get; set; }
|
||||||
public bool XCI { get; set; }
|
public bool XCI { get; set; }
|
||||||
public bool NCA { get; set; }
|
public bool NCA { get; set; }
|
||||||
public bool NRO { get; set; }
|
public bool NRO { get; set; }
|
||||||
public bool NSO { get; set; }
|
public bool NSO { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@ namespace Ryujinx.Ui.Common
|
||||||
public static class DiscordIntegrationModule
|
public static class DiscordIntegrationModule
|
||||||
{
|
{
|
||||||
private const string Description = "A simple, experimental Nintendo Switch emulator.";
|
private const string Description = "A simple, experimental Nintendo Switch emulator.";
|
||||||
private const string CliendId = "568815339807309834";
|
private const string CliendId = "568815339807309834";
|
||||||
|
|
||||||
private static DiscordRpcClient _discordClient;
|
private static DiscordRpcClient _discordClient;
|
||||||
private static RichPresence _discordPresenceMain;
|
private static RichPresence _discordPresenceMain;
|
||||||
|
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
|
@ -18,20 +18,20 @@ namespace Ryujinx.Ui.Common
|
||||||
{
|
{
|
||||||
Assets = new Assets
|
Assets = new Assets
|
||||||
{
|
{
|
||||||
LargeImageKey = "ryujinx",
|
LargeImageKey = "ryujinx",
|
||||||
LargeImageText = Description
|
LargeImageText = Description,
|
||||||
},
|
},
|
||||||
Details = "Main Menu",
|
Details = "Main Menu",
|
||||||
State = "Idling",
|
State = "Idling",
|
||||||
Timestamps = Timestamps.Now,
|
Timestamps = Timestamps.Now,
|
||||||
Buttons = new Button[]
|
Buttons = new[]
|
||||||
{
|
{
|
||||||
new Button()
|
new Button
|
||||||
{
|
{
|
||||||
Label = "Website",
|
Label = "Website",
|
||||||
Url = "https://ryujinx.org/"
|
Url = "https://ryujinx.org/",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
||||||
|
@ -66,22 +66,22 @@ namespace Ryujinx.Ui.Common
|
||||||
{
|
{
|
||||||
Assets = new Assets
|
Assets = new Assets
|
||||||
{
|
{
|
||||||
LargeImageKey = "game",
|
LargeImageKey = "game",
|
||||||
LargeImageText = titleName,
|
LargeImageText = titleName,
|
||||||
SmallImageKey = "ryujinx",
|
SmallImageKey = "ryujinx",
|
||||||
SmallImageText = Description,
|
SmallImageText = Description,
|
||||||
},
|
},
|
||||||
Details = $"Playing {titleName}",
|
Details = $"Playing {titleName}",
|
||||||
State = (titleId == "0000000000000000") ? "Homebrew" : titleId.ToUpper(),
|
State = (titleId == "0000000000000000") ? "Homebrew" : titleId.ToUpper(),
|
||||||
Timestamps = Timestamps.Now,
|
Timestamps = Timestamps.Now,
|
||||||
Buttons = new Button[]
|
Buttons = new[]
|
||||||
{
|
{
|
||||||
new Button()
|
new Button
|
||||||
{
|
{
|
||||||
Label = "Website",
|
Label = "Website",
|
||||||
Url = "https://ryujinx.org/"
|
Url = "https://ryujinx.org/",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,4 +95,4 @@ namespace Ryujinx.Ui.Common
|
||||||
_discordClient?.Dispose();
|
_discordClient?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Ryujinx.Ui.Common
|
||||||
FileTypes.NCA => config.NCA.Value,
|
FileTypes.NCA => config.NCA.Value,
|
||||||
FileTypes.NRO => config.NRO.Value,
|
FileTypes.NRO => config.NRO.Value,
|
||||||
FileTypes.NSO => config.NSO.Value,
|
FileTypes.NSO => config.NSO.Value,
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
|
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,13 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
{
|
{
|
||||||
public static string[] Arguments { get; private set; }
|
public static string[] Arguments { get; private set; }
|
||||||
|
|
||||||
public static bool? OverrideDockedMode { get; private set; }
|
public static bool? OverrideDockedMode { get; private set; }
|
||||||
public static string OverrideGraphicsBackend { get; private set; }
|
public static string OverrideGraphicsBackend { get; private set; }
|
||||||
public static string OverrideHideCursor { get; private set; }
|
public static string OverrideHideCursor { get; private set; }
|
||||||
public static string BaseDirPathArg { get; private set; }
|
public static string BaseDirPathArg { get; private set; }
|
||||||
public static string Profile { get; private set; }
|
public static string Profile { get; private set; }
|
||||||
public static string LaunchPathArg { get; private set; }
|
public static string LaunchPathArg { get; private set; }
|
||||||
public static bool StartFullscreenArg { get; private set; }
|
public static bool StartFullscreenArg { get; private set; }
|
||||||
|
|
||||||
public static void ParseArguments(string[] args)
|
public static void ParseArguments(string[] args)
|
||||||
{
|
{
|
||||||
|
@ -96,4 +96,4 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
Arguments = arguments.ToArray();
|
Arguments = arguments.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,4 +47,4 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
private static partial bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
private static partial bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
private static readonly string _mimeDbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share", "mime");
|
private static readonly string _mimeDbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share", "mime");
|
||||||
|
|
||||||
private const int SHCNE_ASSOCCHANGED = 0x8000000;
|
private const int SHCNE_ASSOCCHANGED = 0x8000000;
|
||||||
private const int SHCNF_FLUSH = 0x1000;
|
private const int SHCNF_FLUSH = 0x1000;
|
||||||
|
|
||||||
[LibraryImport("shell32.dll", SetLastError = true)]
|
[LibraryImport("shell32.dll", SetLastError = true)]
|
||||||
public static partial void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);
|
public static partial void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);
|
||||||
|
@ -199,4 +199,4 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
StartInfo =
|
StartInfo =
|
||||||
{
|
{
|
||||||
FileName = PkExecPath,
|
FileName = PkExecPath,
|
||||||
ArgumentList = { "sh", "-c", command }
|
ArgumentList = { "sh", "-c", command },
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
process.Start();
|
process.Start();
|
||||||
|
@ -59,4 +59,4 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
return process.ExitCode;
|
return process.ExitCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ui.Common.Helper
|
namespace Ryujinx.Ui.Common.Helper
|
||||||
{
|
{
|
||||||
|
@ -12,44 +10,109 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
private const string ObjCRuntime = "/usr/lib/libobjc.A.dylib";
|
private const string ObjCRuntime = "/usr/lib/libobjc.A.dylib";
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime, StringMarshalling = StringMarshalling.Utf8)]
|
[LibraryImport(ObjCRuntime, StringMarshalling = StringMarshalling.Utf8)]
|
||||||
private static unsafe partial IntPtr sel_getUid(string name);
|
private static partial IntPtr sel_getUid(string name);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime, StringMarshalling = StringMarshalling.Utf8)]
|
[LibraryImport(ObjCRuntime, StringMarshalling = StringMarshalling.Utf8)]
|
||||||
public static partial IntPtr objc_getClass(string name);
|
private static partial IntPtr objc_getClass(string name);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime)]
|
[LibraryImport(ObjCRuntime)]
|
||||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector);
|
private static partial void objc_msgSend(IntPtr receiver, Selector selector);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime)]
|
[LibraryImport(ObjCRuntime)]
|
||||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector, byte value);
|
private static partial void objc_msgSend(IntPtr receiver, Selector selector, byte value);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime)]
|
[LibraryImport(ObjCRuntime)]
|
||||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
|
private static partial void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime)]
|
[LibraryImport(ObjCRuntime)]
|
||||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
|
private static partial void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime)]
|
[LibraryImport(ObjCRuntime)]
|
||||||
public static partial void objc_msgSend(IntPtr receiver, Selector selector, double value);
|
private static partial void objc_msgSend(IntPtr receiver, Selector selector, double value);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
||||||
public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector);
|
private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
||||||
public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param);
|
private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend", StringMarshalling = StringMarshalling.Utf8)]
|
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend", StringMarshalling = StringMarshalling.Utf8)]
|
||||||
public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, string param);
|
private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, string param);
|
||||||
|
|
||||||
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
[LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")]
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
public static partial bool bool_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param);
|
private static partial bool bool_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param);
|
||||||
|
|
||||||
public struct Selector
|
public readonly struct Object
|
||||||
|
{
|
||||||
|
public readonly IntPtr ObjPtr;
|
||||||
|
|
||||||
|
private Object(IntPtr pointer)
|
||||||
|
{
|
||||||
|
ObjPtr = pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object(string name)
|
||||||
|
{
|
||||||
|
ObjPtr = objc_getClass(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendMessage(Selector selector)
|
||||||
|
{
|
||||||
|
objc_msgSend(ObjPtr, selector);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendMessage(Selector selector, byte value)
|
||||||
|
{
|
||||||
|
objc_msgSend(ObjPtr, selector, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendMessage(Selector selector, Object obj)
|
||||||
|
{
|
||||||
|
objc_msgSend(ObjPtr, selector, obj.ObjPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendMessage(Selector selector, NSRect point)
|
||||||
|
{
|
||||||
|
objc_msgSend(ObjPtr, selector, point);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendMessage(Selector selector, double value)
|
||||||
|
{
|
||||||
|
objc_msgSend(ObjPtr, selector, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object GetFromMessage(Selector selector)
|
||||||
|
{
|
||||||
|
return new Object(IntPtr_objc_msgSend(ObjPtr, selector));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object GetFromMessage(Selector selector, Object obj)
|
||||||
|
{
|
||||||
|
return new Object(IntPtr_objc_msgSend(ObjPtr, selector, obj.ObjPtr));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object GetFromMessage(Selector selector, NSString nsString)
|
||||||
|
{
|
||||||
|
return new Object(IntPtr_objc_msgSend(ObjPtr, selector, nsString.StrPtr));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object GetFromMessage(Selector selector, string param)
|
||||||
|
{
|
||||||
|
return new Object(IntPtr_objc_msgSend(ObjPtr, selector, param));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetBoolFromMessage(Selector selector, Object obj)
|
||||||
|
{
|
||||||
|
return bool_objc_msgSend(ObjPtr, selector, obj.ObjPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public readonly struct Selector
|
||||||
{
|
{
|
||||||
public readonly IntPtr SelPtr;
|
public readonly IntPtr SelPtr;
|
||||||
|
|
||||||
public unsafe Selector(string name)
|
private Selector(string name)
|
||||||
{
|
{
|
||||||
SelPtr = sel_getUid(name);
|
SelPtr = sel_getUid(name);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +120,7 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
public static implicit operator Selector(string value) => new(value);
|
public static implicit operator Selector(string value) => new(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct NSString
|
public readonly struct NSString
|
||||||
{
|
{
|
||||||
public readonly IntPtr StrPtr;
|
public readonly IntPtr StrPtr;
|
||||||
|
|
||||||
|
@ -94,4 +157,4 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,13 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
public static partial class OpenHelper
|
public static partial class OpenHelper
|
||||||
{
|
{
|
||||||
[LibraryImport("shell32.dll", SetLastError = true)]
|
[LibraryImport("shell32.dll", SetLastError = true)]
|
||||||
public static partial int SHOpenFolderAndSelectItems(IntPtr pidlFolder, uint cidl, IntPtr apidl, uint dwFlags);
|
private static partial int SHOpenFolderAndSelectItems(IntPtr pidlFolder, uint cidl, IntPtr apidl, uint dwFlags);
|
||||||
|
|
||||||
[LibraryImport("shell32.dll", SetLastError = true)]
|
[LibraryImport("shell32.dll", SetLastError = true)]
|
||||||
public static partial void ILFree(IntPtr pidlList);
|
private static partial void ILFree(IntPtr pidlList);
|
||||||
|
|
||||||
[LibraryImport("shell32.dll", SetLastError = true)]
|
[LibraryImport("shell32.dll", SetLastError = true)]
|
||||||
public static partial IntPtr ILCreateFromPathW([MarshalAs(UnmanagedType.LPWStr)] string pszPath);
|
private static partial IntPtr ILCreateFromPathW([MarshalAs(UnmanagedType.LPWStr)] string pszPath);
|
||||||
|
|
||||||
public static void OpenFolder(string path)
|
public static void OpenFolder(string path)
|
||||||
{
|
{
|
||||||
|
@ -23,9 +23,9 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo
|
Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = path,
|
FileName = path,
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
Verb = "open"
|
Verb = "open",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -56,16 +56,16 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
else if (OperatingSystem.IsMacOS())
|
else if (OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
ObjectiveC.NSString nsStringPath = new(path);
|
ObjectiveC.NSString nsStringPath = new(path);
|
||||||
IntPtr nsUrl = ObjectiveC.objc_getClass("NSURL");
|
ObjectiveC.Object nsUrl = new("NSURL");
|
||||||
var urlPtr = ObjectiveC.IntPtr_objc_msgSend(nsUrl, "fileURLWithPath:", nsStringPath);
|
var urlPtr = nsUrl.GetFromMessage("fileURLWithPath:", nsStringPath);
|
||||||
|
|
||||||
IntPtr nsArray = ObjectiveC.objc_getClass("NSArray");
|
ObjectiveC.Object nsArray = new("NSArray");
|
||||||
IntPtr urlArray = ObjectiveC.IntPtr_objc_msgSend(nsArray, "arrayWithObject:", urlPtr);
|
ObjectiveC.Object urlArray = nsArray.GetFromMessage("arrayWithObject:", urlPtr);
|
||||||
|
|
||||||
IntPtr nsWorkspace = ObjectiveC.objc_getClass("NSWorkspace");
|
ObjectiveC.Object nsWorkspace = new("NSWorkspace");
|
||||||
IntPtr sharedWorkspace = ObjectiveC.IntPtr_objc_msgSend(nsWorkspace, "sharedWorkspace");
|
ObjectiveC.Object sharedWorkspace = nsWorkspace.GetFromMessage("sharedWorkspace");
|
||||||
|
|
||||||
ObjectiveC.objc_msgSend(sharedWorkspace, "activateFileViewerSelectingURLs:", urlArray);
|
sharedWorkspace.SendMessage("activateFileViewerSelectingURLs:", urlArray);
|
||||||
}
|
}
|
||||||
else if (OperatingSystem.IsLinux())
|
else if (OperatingSystem.IsLinux())
|
||||||
{
|
{
|
||||||
|
@ -95,13 +95,13 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
else if (OperatingSystem.IsMacOS())
|
else if (OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
ObjectiveC.NSString nsStringPath = new(url);
|
ObjectiveC.NSString nsStringPath = new(url);
|
||||||
IntPtr nsUrl = ObjectiveC.objc_getClass("NSURL");
|
ObjectiveC.Object nsUrl = new("NSURL");
|
||||||
var urlPtr = ObjectiveC.IntPtr_objc_msgSend(nsUrl, "URLWithString:", nsStringPath);
|
var urlPtr = nsUrl.GetFromMessage("URLWithString:", nsStringPath);
|
||||||
|
|
||||||
IntPtr nsWorkspace = ObjectiveC.objc_getClass("NSWorkspace");
|
ObjectiveC.Object nsWorkspace = new("NSWorkspace");
|
||||||
IntPtr sharedWorkspace = ObjectiveC.IntPtr_objc_msgSend(nsWorkspace, "sharedWorkspace");
|
ObjectiveC.Object sharedWorkspace = nsWorkspace.GetFromMessage("sharedWorkspace");
|
||||||
|
|
||||||
ObjectiveC.bool_objc_msgSend(sharedWorkspace, "openURL:", urlPtr);
|
sharedWorkspace.GetBoolFromMessage("openURL:", urlPtr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -109,4 +109,4 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,10 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
error = UserError.NoFirmware;
|
|
||||||
|
|
||||||
return false;
|
error = UserError.NoFirmware;
|
||||||
}
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CanFixStartApplication(ContentManager contentManager, string baseApplicationPath, UserError error, out SystemVersion firmwareVersion)
|
public static bool CanFixStartApplication(ContentManager contentManager, string baseApplicationPath, UserError error, out SystemVersion firmwareVersion)
|
||||||
|
@ -107,12 +105,10 @@ namespace Ryujinx.Ui.Common.Helper
|
||||||
|
|
||||||
return IsFirmwareValid(contentManager, out error);
|
return IsFirmwareValid(contentManager, out error);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
error = UserError.ApplicationNotFound;
|
|
||||||
|
|
||||||
return false;
|
error = UserError.ApplicationNotFound;
|
||||||
}
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,29 +29,39 @@ namespace Ryujinx.Ui.Common.Models.Amiibo
|
||||||
[JsonPropertyName("gamesSwitch")]
|
[JsonPropertyName("gamesSwitch")]
|
||||||
public List<AmiiboApiGamesSwitch> GamesSwitch { get; set; }
|
public List<AmiiboApiGamesSwitch> GamesSwitch { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
public readonly override string ToString()
|
||||||
{
|
{
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetId()
|
public readonly string GetId()
|
||||||
{
|
{
|
||||||
return Head + Tail;
|
return Head + Tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(AmiiboApi other)
|
public readonly bool Equals(AmiiboApi other)
|
||||||
{
|
{
|
||||||
return Head + Tail == other.Head + other.Tail;
|
return Head + Tail == other.Head + other.Tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public readonly override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
return obj is AmiiboApi other && Equals(other);
|
return obj is AmiiboApi other && Equals(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public readonly override int GetHashCode()
|
||||||
{
|
{
|
||||||
return HashCode.Combine(Head, Tail);
|
return HashCode.Combine(Head, Tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool operator ==(AmiiboApi left, AmiiboApi right)
|
||||||
|
{
|
||||||
|
return left.Equals(right);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator !=(AmiiboApi left, AmiiboApi right)
|
||||||
|
{
|
||||||
|
return !(left == right);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,4 +12,4 @@ namespace Ryujinx.Ui.Common.Models.Amiibo
|
||||||
[JsonPropertyName("gameName")]
|
[JsonPropertyName("gameName")]
|
||||||
public string GameName { get; set; }
|
public string GameName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@ namespace Ryujinx.Ui.Common.Models.Amiibo
|
||||||
[JsonPropertyName("write")]
|
[JsonPropertyName("write")]
|
||||||
public bool Write { get; set; }
|
public bool Write { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,4 @@ namespace Ryujinx.Ui.Common.Models.Amiibo
|
||||||
[JsonPropertyName("lastUpdated")]
|
[JsonPropertyName("lastUpdated")]
|
||||||
public DateTime LastUpdated { get; set; }
|
public DateTime LastUpdated { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,4 @@ namespace Ryujinx.Ui.Common.Models.Amiibo
|
||||||
public partial class AmiiboJsonSerializerContext : JsonSerializerContext
|
public partial class AmiiboJsonSerializerContext : JsonSerializerContext
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
public string State { get; set; }
|
public string State { get; set; }
|
||||||
public string BrowserDownloadUrl { get; set; }
|
public string BrowserDownloadUrl { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.Ui.Common.Models.Github
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public List<GithubReleaseAssetJsonResponse> Assets { get; set; }
|
public List<GithubReleaseAssetJsonResponse> Assets { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,4 @@ namespace Ryujinx.Ui.Common.Models.Github
|
||||||
public partial class GithubReleasesJsonSerializerContext : JsonSerializerContext
|
public partial class GithubReleasesJsonSerializerContext : JsonSerializerContext
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,6 @@
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An unknown error.
|
/// An unknown error.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Unknown = 0xDEAD
|
Unknown = 0xDEAD,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -874,7 +874,7 @@ namespace Ryujinx.Ui
|
||||||
DiscordIntegrationModule.SwitchToPlayingState(_emulationContext.Processes.ActiveApplication.ProgramIdText,
|
DiscordIntegrationModule.SwitchToPlayingState(_emulationContext.Processes.ActiveApplication.ProgramIdText,
|
||||||
_emulationContext.Processes.ActiveApplication.ApplicationControlProperties.Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString());
|
_emulationContext.Processes.ActiveApplication.ApplicationControlProperties.Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString());
|
||||||
|
|
||||||
_applicationLibrary.LoadAndSaveMetaData(_emulationContext.Processes.ActiveApplication.ProgramIdText, appMetadata =>
|
ApplicationLibrary.LoadAndSaveMetaData(_emulationContext.Processes.ActiveApplication.ProgramIdText, appMetadata =>
|
||||||
{
|
{
|
||||||
appMetadata.LastPlayed = DateTime.UtcNow;
|
appMetadata.LastPlayed = DateTime.UtcNow;
|
||||||
});
|
});
|
||||||
|
@ -1017,7 +1017,7 @@ namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
if (_gameLoaded)
|
if (_gameLoaded)
|
||||||
{
|
{
|
||||||
_applicationLibrary.LoadAndSaveMetaData(titleId, appMetadata =>
|
ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata =>
|
||||||
{
|
{
|
||||||
if (appMetadata.LastPlayed.HasValue)
|
if (appMetadata.LastPlayed.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -1156,7 +1156,7 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
_tableStore.SetValue(treeIter, 0, newToggleValue);
|
_tableStore.SetValue(treeIter, 0, newToggleValue);
|
||||||
|
|
||||||
_applicationLibrary.LoadAndSaveMetaData(titleId, appMetadata =>
|
ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata =>
|
||||||
{
|
{
|
||||||
appMetadata.Favorite = newToggleValue;
|
appMetadata.Favorite = newToggleValue;
|
||||||
});
|
});
|
||||||
|
@ -1321,7 +1321,7 @@ namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
|
if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
|
||||||
{
|
{
|
||||||
SaveWindowSizePosition();
|
SaveWindowSizePosition();
|
||||||
End();
|
End();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1337,9 +1337,9 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
Move(ConfigurationState.Instance.Ui.WindowStartup.WindowPositionX, ConfigurationState.Instance.Ui.WindowStartup.WindowPositionY);
|
Move(ConfigurationState.Instance.Ui.WindowStartup.WindowPositionX, ConfigurationState.Instance.Ui.WindowStartup.WindowPositionY);
|
||||||
|
|
||||||
if (ConfigurationState.Instance.Ui.WindowStartup.WindowMaximized)
|
if (ConfigurationState.Instance.Ui.WindowStartup.WindowMaximized)
|
||||||
{
|
{
|
||||||
Maximize();
|
Maximize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ namespace Ryujinx.Ui
|
||||||
ConfigurationState.Instance.Ui.WindowStartup.WindowPositionX.Value = windowXPos;
|
ConfigurationState.Instance.Ui.WindowStartup.WindowPositionX.Value = windowXPos;
|
||||||
ConfigurationState.Instance.Ui.WindowStartup.WindowPositionY.Value = windowYPos;
|
ConfigurationState.Instance.Ui.WindowStartup.WindowPositionY.Value = windowYPos;
|
||||||
|
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopEmulation_Pressed(object sender, EventArgs args)
|
private void StopEmulation_Pressed(object sender, EventArgs args)
|
||||||
|
@ -1633,7 +1633,7 @@ namespace Ryujinx.Ui
|
||||||
_virtualFileSystem,
|
_virtualFileSystem,
|
||||||
_emulationContext.Processes.ActiveApplication.ProgramId,
|
_emulationContext.Processes.ActiveApplication.ProgramId,
|
||||||
_emulationContext.Processes.ActiveApplication.ApplicationControlProperties
|
_emulationContext.Processes.ActiveApplication.ApplicationControlProperties
|
||||||
.Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString(),
|
.Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString(),
|
||||||
_currentEmulatedGamePath);
|
_currentEmulatedGamePath);
|
||||||
|
|
||||||
window.Destroyed += CheatWindow_Destroyed;
|
window.Destroyed += CheatWindow_Destroyed;
|
||||||
|
@ -1861,4 +1861,4 @@ namespace Ryujinx.Ui
|
||||||
UpdateGameTable();
|
UpdateGameTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue