misc: Code cleanups.

This commit is contained in:
Evan Husted 2024-11-01 12:00:07 -05:00
parent 67ab54e2bb
commit 6911e288bc
9 changed files with 69 additions and 68 deletions

View File

@ -855,6 +855,7 @@ namespace ARMeilleure.Translation.PTC
Thread thread = new(TranslateFuncs)
{
IsBackground = true,
Name = "Ptc.TranslateThread." + i
};
threads.Add(thread);
@ -885,6 +886,7 @@ namespace ARMeilleure.Translation.PTC
Thread preSaveThread = new(PreSave)
{
IsBackground = true,
Name = "Ptc.DiskWriter"
};
preSaveThread.Start();
}

View File

@ -10,6 +10,7 @@
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
<PackageReference Include="MsgPack.Cli" />
<PackageReference Include="System.Management" />
<PackageReference Include="Humanizer" />
<PackageReference Include="Gommon" />
</ItemGroup>

View File

@ -104,25 +104,27 @@ namespace Ryujinx.Graphics.Vulkan
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;
_preferredGpuId = preferredGpuId;
Api = api;
Shaders = new HashSet<ShaderCollection>();
Textures = new HashSet<ITexture>();
Samplers = new HashSet<SamplerHolder>();
if (OperatingSystem.IsMacOS())
{
MVKInitialization.Initialize();
Shaders = [];
Textures = [];
Samplers = [];
// 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)
{
FormatCapabilities = new FormatCapabilities(Api, _physicalDevice.PhysicalDevice);

View File

@ -15,7 +15,7 @@ namespace Ryujinx.HLE.Loaders.Processes
var nacpData = new BlitStruct<ApplicationControlProperty>(1);
ulong programId = metaLoader.GetProgramId();
device.Configuration.VirtualFileSystem.ModLoader.CollectMods(new[] { programId });
device.Configuration.VirtualFileSystem.ModLoader.CollectMods([programId]);
if (programId != 0)
{

View File

@ -1,3 +1,4 @@
using Humanizer;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Configuration.Hid;
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 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"
+ $"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.";
return DisplayMessageDialog("Controller Applet", message);

View File

@ -51,7 +51,6 @@
<ItemGroup>
<PackageReference Include="DiscordRichPresence" />
<PackageReference Include="DynamicData" />
<PackageReference Include="Humanizer" />
<PackageReference Include="securifybv.ShellLink" />
</ItemGroup>

View File

@ -604,21 +604,20 @@ namespace Ryujinx.Ava
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.CanFixStartApplication(ContentManager, ApplicationPath, userError, out firmwareVersion))
{
if (userError == UserError.NoFirmware)
if (userError is UserError.NoFirmware)
{
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(
LocaleManager.Instance[LocaleKeys.DialogFirmwareNoFirmwareInstalledMessage],
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstallEmbeddedMessage, firmwareVersion.VersionString),
LocaleManager.Instance[LocaleKeys.InputDialogYes],
LocaleManager.Instance[LocaleKeys.InputDialogNo],
"");
string.Empty);
if (result != UserResult.Yes)
{
@ -638,7 +637,7 @@ namespace Ryujinx.Ava
}
// Tell the user that we installed a firmware for them.
if (userError == UserError.NoFirmware)
if (userError is UserError.NoFirmware)
{
firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
@ -648,7 +647,7 @@ namespace Ryujinx.Ava
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstalledMessage, firmwareVersion.VersionString),
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstallEmbeddedSuccessMessage, firmwareVersion.VersionString),
LocaleManager.Instance[LocaleKeys.InputDialogOk],
"",
string.Empty,
LocaleManager.Instance[LocaleKeys.RyujinxInfo]);
}
}
@ -661,7 +660,6 @@ namespace Ryujinx.Ava
}
}
}
}
Logger.Notice.Print(LogClass.Application, $"Using Firmware Version: {firmwareVersion?.VersionString}");
@ -820,20 +818,12 @@ namespace Ryujinx.Ava
VirtualFileSystem.ReloadKeySet();
// Initialize Renderer.
IRenderer renderer;
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan)
{
renderer = new VulkanRenderer(
Vk.GetApi(),
IRenderer renderer = ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl
? new OpenGLRenderer()
: VulkanRenderer.Create(
ConfigurationState.Instance.Graphics.PreferredGpu,
(RendererHost.EmbeddedWindow as EmbeddedWindowVulkan)!.CreateSurface,
VulkanHelper.GetRequiredInstanceExtensions,
ConfigurationState.Instance.Graphics.PreferredGpu.Value);
}
else
{
renderer = new OpenGLRenderer();
}
VulkanHelper.GetRequiredInstanceExtensions);
BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 177 KiB

View File

@ -109,7 +109,7 @@ namespace Ryujinx.Ava.UI.Windows
private static void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
{
if (Application.Current is App app)
app.ApplyConfiguredTheme();
app.ApplyConfiguredTheme(ConfigurationState.Instance.UI.BaseStyle);
}
protected override void OnClosed(EventArgs e)
@ -664,8 +664,14 @@ namespace Ryujinx.Ava.UI.Windows
Dispatcher.UIThread.InvokeAsync(async () =>
{
await ContentDialogHelper.ShowTextDialog(LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
await ContentDialogHelper.ShowTextDialog(
LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
msg,
string.Empty,
string.Empty,
string.Empty,
LocaleManager.Instance[LocaleKeys.InputDialogOk],
(int)Symbol.Checkmark);
});
}
}