mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-11-27 19:30:50 +01:00
misc: Code cleanups.
This commit is contained in:
parent
67ab54e2bb
commit
6911e288bc
@ -855,6 +855,7 @@ namespace ARMeilleure.Translation.PTC
|
|||||||
Thread thread = new(TranslateFuncs)
|
Thread thread = new(TranslateFuncs)
|
||||||
{
|
{
|
||||||
IsBackground = true,
|
IsBackground = true,
|
||||||
|
Name = "Ptc.TranslateThread." + i
|
||||||
};
|
};
|
||||||
|
|
||||||
threads.Add(thread);
|
threads.Add(thread);
|
||||||
@ -885,6 +886,7 @@ namespace ARMeilleure.Translation.PTC
|
|||||||
Thread preSaveThread = new(PreSave)
|
Thread preSaveThread = new(PreSave)
|
||||||
{
|
{
|
||||||
IsBackground = true,
|
IsBackground = true,
|
||||||
|
Name = "Ptc.DiskWriter"
|
||||||
};
|
};
|
||||||
preSaveThread.Start();
|
preSaveThread.Start();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
|
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
|
||||||
<PackageReference Include="MsgPack.Cli" />
|
<PackageReference Include="MsgPack.Cli" />
|
||||||
<PackageReference Include="System.Management" />
|
<PackageReference Include="System.Management" />
|
||||||
|
<PackageReference Include="Humanizer" />
|
||||||
<PackageReference Include="Gommon" />
|
<PackageReference Include="Gommon" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -104,25 +104,27 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;
|
public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;
|
||||||
|
|
||||||
public VulkanRenderer(Vk api, Func<Instance, Vk, SurfaceKHR> surfaceFunc, Func<string[]> requiredExtensionsFunc, string preferredGpuId)
|
public VulkanRenderer(Vk api, Func<Instance, Vk, SurfaceKHR> getSurface, Func<string[]> requiredExtensionsFunc, string preferredGpuId)
|
||||||
{
|
{
|
||||||
_getSurface = surfaceFunc;
|
_getSurface = getSurface;
|
||||||
_getRequiredExtensions = requiredExtensionsFunc;
|
_getRequiredExtensions = requiredExtensionsFunc;
|
||||||
_preferredGpuId = preferredGpuId;
|
_preferredGpuId = preferredGpuId;
|
||||||
Api = api;
|
Api = api;
|
||||||
Shaders = new HashSet<ShaderCollection>();
|
Shaders = [];
|
||||||
Textures = new HashSet<ITexture>();
|
Textures = [];
|
||||||
Samplers = new HashSet<SamplerHolder>();
|
Samplers = [];
|
||||||
|
|
||||||
if (OperatingSystem.IsMacOS())
|
|
||||||
{
|
|
||||||
MVKInitialization.Initialize();
|
|
||||||
|
|
||||||
// Any device running on MacOS is using MoltenVK, even Intel and AMD vendors.
|
// Any device running on MacOS is using MoltenVK, even Intel and AMD vendors.
|
||||||
IsMoltenVk = true;
|
if (IsMoltenVk = OperatingSystem.IsMacOS())
|
||||||
}
|
MVKInitialization.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static VulkanRenderer Create(
|
||||||
|
string preferredGpuId,
|
||||||
|
Func<Instance, Vk, SurfaceKHR> getSurface,
|
||||||
|
Func<string[]> getRequiredExtensions
|
||||||
|
) => new(Vk.GetApi(), getSurface, getRequiredExtensions, preferredGpuId);
|
||||||
|
|
||||||
private unsafe void LoadFeatures(uint maxQueueCount, uint queueFamilyIndex)
|
private unsafe void LoadFeatures(uint maxQueueCount, uint queueFamilyIndex)
|
||||||
{
|
{
|
||||||
FormatCapabilities = new FormatCapabilities(Api, _physicalDevice.PhysicalDevice);
|
FormatCapabilities = new FormatCapabilities(Api, _physicalDevice.PhysicalDevice);
|
||||||
|
@ -15,7 +15,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||||||
var nacpData = new BlitStruct<ApplicationControlProperty>(1);
|
var nacpData = new BlitStruct<ApplicationControlProperty>(1);
|
||||||
ulong programId = metaLoader.GetProgramId();
|
ulong programId = metaLoader.GetProgramId();
|
||||||
|
|
||||||
device.Configuration.VirtualFileSystem.ModLoader.CollectMods(new[] { programId });
|
device.Configuration.VirtualFileSystem.ModLoader.CollectMods([programId]);
|
||||||
|
|
||||||
if (programId != 0)
|
if (programId != 0)
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using Humanizer;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
@ -485,10 +486,10 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
{
|
{
|
||||||
string playerCount = args.PlayerCountMin == args.PlayerCountMax ? $"exactly {args.PlayerCountMin}" : $"{args.PlayerCountMin}-{args.PlayerCountMax}";
|
string playerCount = args.PlayerCountMin == args.PlayerCountMax ? $"exactly {args.PlayerCountMin}" : $"{args.PlayerCountMin}-{args.PlayerCountMax}";
|
||||||
|
|
||||||
string message = $"Application requests {playerCount} player(s) with:\n\n"
|
string message = $"Application requests {playerCount} {"player".ToQuantity(args.PlayerCountMin + args.PlayerCountMax, ShowQuantityAs.None)} with:\n\n"
|
||||||
+ $"TYPES: {args.SupportedStyles}\n\n"
|
+ $"TYPES: {args.SupportedStyles}\n\n"
|
||||||
+ $"PLAYERS: {string.Join(", ", args.SupportedPlayers)}\n\n"
|
+ $"PLAYERS: {string.Join(", ", args.SupportedPlayers)}\n\n"
|
||||||
+ (args.IsDocked ? "Docked mode set. Handheld is also invalid.\n\n" : "")
|
+ (args.IsDocked ? "Docked mode set. Handheld is also invalid.\n\n" : string.Empty)
|
||||||
+ "Please reconfigure Input now and then press OK.";
|
+ "Please reconfigure Input now and then press OK.";
|
||||||
|
|
||||||
return DisplayMessageDialog("Controller Applet", message);
|
return DisplayMessageDialog("Controller Applet", message);
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DiscordRichPresence" />
|
<PackageReference Include="DiscordRichPresence" />
|
||||||
<PackageReference Include="DynamicData" />
|
<PackageReference Include="DynamicData" />
|
||||||
<PackageReference Include="Humanizer" />
|
|
||||||
<PackageReference Include="securifybv.ShellLink" />
|
<PackageReference Include="securifybv.ShellLink" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -604,21 +604,20 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
SystemVersion firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
|
SystemVersion firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
|
||||||
|
|
||||||
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime)
|
||||||
{
|
{
|
||||||
if (!SetupValidator.CanStartApplication(ContentManager, ApplicationPath, out UserError userError))
|
if (!SetupValidator.CanStartApplication(ContentManager, ApplicationPath, out UserError userError))
|
||||||
{
|
|
||||||
{
|
{
|
||||||
if (SetupValidator.CanFixStartApplication(ContentManager, ApplicationPath, userError, out firmwareVersion))
|
if (SetupValidator.CanFixStartApplication(ContentManager, ApplicationPath, userError, out firmwareVersion))
|
||||||
{
|
{
|
||||||
if (userError == UserError.NoFirmware)
|
if (userError is UserError.NoFirmware)
|
||||||
{
|
{
|
||||||
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(
|
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(
|
||||||
LocaleManager.Instance[LocaleKeys.DialogFirmwareNoFirmwareInstalledMessage],
|
LocaleManager.Instance[LocaleKeys.DialogFirmwareNoFirmwareInstalledMessage],
|
||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstallEmbeddedMessage, firmwareVersion.VersionString),
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstallEmbeddedMessage, firmwareVersion.VersionString),
|
||||||
LocaleManager.Instance[LocaleKeys.InputDialogYes],
|
LocaleManager.Instance[LocaleKeys.InputDialogYes],
|
||||||
LocaleManager.Instance[LocaleKeys.InputDialogNo],
|
LocaleManager.Instance[LocaleKeys.InputDialogNo],
|
||||||
"");
|
string.Empty);
|
||||||
|
|
||||||
if (result != UserResult.Yes)
|
if (result != UserResult.Yes)
|
||||||
{
|
{
|
||||||
@ -638,7 +637,7 @@ namespace Ryujinx.Ava
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tell the user that we installed a firmware for them.
|
// Tell the user that we installed a firmware for them.
|
||||||
if (userError == UserError.NoFirmware)
|
if (userError is UserError.NoFirmware)
|
||||||
{
|
{
|
||||||
firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
|
firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
|
||||||
|
|
||||||
@ -648,7 +647,7 @@ namespace Ryujinx.Ava
|
|||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstalledMessage, firmwareVersion.VersionString),
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstalledMessage, firmwareVersion.VersionString),
|
||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstallEmbeddedSuccessMessage, firmwareVersion.VersionString),
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstallEmbeddedSuccessMessage, firmwareVersion.VersionString),
|
||||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||||
"",
|
string.Empty,
|
||||||
LocaleManager.Instance[LocaleKeys.RyujinxInfo]);
|
LocaleManager.Instance[LocaleKeys.RyujinxInfo]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -661,7 +660,6 @@ namespace Ryujinx.Ava
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Logger.Notice.Print(LogClass.Application, $"Using Firmware Version: {firmwareVersion?.VersionString}");
|
Logger.Notice.Print(LogClass.Application, $"Using Firmware Version: {firmwareVersion?.VersionString}");
|
||||||
|
|
||||||
@ -820,20 +818,12 @@ namespace Ryujinx.Ava
|
|||||||
VirtualFileSystem.ReloadKeySet();
|
VirtualFileSystem.ReloadKeySet();
|
||||||
|
|
||||||
// Initialize Renderer.
|
// Initialize Renderer.
|
||||||
IRenderer renderer;
|
IRenderer renderer = ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl
|
||||||
|
? new OpenGLRenderer()
|
||||||
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan)
|
: VulkanRenderer.Create(
|
||||||
{
|
ConfigurationState.Instance.Graphics.PreferredGpu,
|
||||||
renderer = new VulkanRenderer(
|
|
||||||
Vk.GetApi(),
|
|
||||||
(RendererHost.EmbeddedWindow as EmbeddedWindowVulkan)!.CreateSurface,
|
(RendererHost.EmbeddedWindow as EmbeddedWindowVulkan)!.CreateSurface,
|
||||||
VulkanHelper.GetRequiredInstanceExtensions,
|
VulkanHelper.GetRequiredInstanceExtensions);
|
||||||
ConfigurationState.Instance.Graphics.PreferredGpu.Value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
renderer = new OpenGLRenderer();
|
|
||||||
}
|
|
||||||
|
|
||||||
BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading;
|
BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading;
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 177 KiB |
@ -109,7 +109,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
private static void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
|
private static void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
|
||||||
{
|
{
|
||||||
if (Application.Current is App app)
|
if (Application.Current is App app)
|
||||||
app.ApplyConfiguredTheme();
|
app.ApplyConfiguredTheme(ConfigurationState.Instance.UI.BaseStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnClosed(EventArgs e)
|
protected override void OnClosed(EventArgs e)
|
||||||
@ -664,8 +664,14 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
|
|
||||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||||
{
|
{
|
||||||
await ContentDialogHelper.ShowTextDialog(LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
|
await ContentDialogHelper.ShowTextDialog(
|
||||||
msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
|
LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
|
||||||
|
msg,
|
||||||
|
string.Empty,
|
||||||
|
string.Empty,
|
||||||
|
string.Empty,
|
||||||
|
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||||
|
(int)Symbol.Checkmark);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user