diff --git a/Directory.Packages.props b/Directory.Packages.props
index 5c21c5f85..e6be60790 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -10,6 +10,9 @@
+
+
+
@@ -34,6 +37,7 @@
+
diff --git a/src/ARMeilleure/Optimizations.cs b/src/ARMeilleure/Optimizations.cs
index 0536302e8..18390de31 100644
--- a/src/ARMeilleure/Optimizations.cs
+++ b/src/ARMeilleure/Optimizations.cs
@@ -6,7 +6,7 @@ namespace ARMeilleure
public static class Optimizations
{
// low-core count PPTC
- public static bool EcoFriendly { get; set; } = false;
+ public static bool LowPower { get; set; } = false;
public static bool FastFP { get; set; } = true;
@@ -54,8 +54,8 @@ namespace ARMeilleure
internal static bool UseSse41 => UseSse41IfAvailable && X86HardwareCapabilities.SupportsSse41;
internal static bool UseSse42 => UseSse42IfAvailable && X86HardwareCapabilities.SupportsSse42;
internal static bool UsePopCnt => UsePopCntIfAvailable && X86HardwareCapabilities.SupportsPopcnt;
- internal static bool UseAvx => UseAvxIfAvailable && X86HardwareCapabilities.SupportsAvx && !ForceLegacySse;
- internal static bool UseAvx512F => UseAvx512FIfAvailable && X86HardwareCapabilities.SupportsAvx512F && !ForceLegacySse;
+ internal static bool UseAvx => UseAvxIfAvailable && X86HardwareCapabilities.SupportsAvx && !ForceLegacySse;
+ internal static bool UseAvx512F => UseAvx512FIfAvailable && X86HardwareCapabilities.SupportsAvx512F && !ForceLegacySse;
internal static bool UseAvx512Vl => UseAvx512VlIfAvailable && X86HardwareCapabilities.SupportsAvx512Vl && !ForceLegacySse;
internal static bool UseAvx512Bw => UseAvx512BwIfAvailable && X86HardwareCapabilities.SupportsAvx512Bw && !ForceLegacySse;
internal static bool UseAvx512Dq => UseAvx512DqIfAvailable && X86HardwareCapabilities.SupportsAvx512Dq && !ForceLegacySse;
diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs
index c09588392..fa178eace 100644
--- a/src/ARMeilleure/Translation/PTC/Ptc.cs
+++ b/src/ARMeilleure/Translation/PTC/Ptc.cs
@@ -799,11 +799,11 @@ namespace ARMeilleure.Translation.PTC
int degreeOfParallelism = Environment.ProcessorCount;
- if (Optimizations.EcoFriendly)
+ if (Optimizations.LowPower)
degreeOfParallelism /= 3;
// If there are enough cores lying around, we leave one alone for other tasks.
- if (degreeOfParallelism > 4 && !Optimizations.EcoFriendly)
+ if (degreeOfParallelism > 4 && !Optimizations.LowPower)
{
degreeOfParallelism--;
}
diff --git a/src/Ryujinx.Common/Ryujinx.Common.csproj b/src/Ryujinx.Common/Ryujinx.Common.csproj
index da2f13a21..722509f33 100644
--- a/src/Ryujinx.Common/Ryujinx.Common.csproj
+++ b/src/Ryujinx.Common/Ryujinx.Common.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs
index 0767cc9d6..33f227edb 100644
--- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs
+++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/FFmpegContext.cs
@@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg
int avCodecMajorVersion = avCodecRawVersion >> 16;
int avCodecMinorVersion = (avCodecRawVersion >> 8) & 0xFF;
- // libavcodec 59.24 changed AvCodec to move its private API and also move the codec function to an union.
+ // libavcodec 59.24 changed AvCodec to move its private API and also move the codec function to a union.
if (avCodecMajorVersion > 59 || (avCodecMajorVersion == 59 && avCodecMinorVersion > 24))
{
_decodeFrame = Marshal.GetDelegateForFunctionPointer(((FFCodec*)_codec)->CodecCallback);
diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/Decoder.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/Decoder.cs
index 14877dd55..3ec99192d 100644
--- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/Decoder.cs
+++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/Decoder.cs
@@ -26,8 +26,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264
{
Surface outSurf = (Surface)output;
- if (outSurf.RequestedWidth != _oldOutputWidth ||
- outSurf.RequestedHeight != _oldOutputHeight)
+ if (outSurf.RequestedWidth != _oldOutputWidth || outSurf.RequestedHeight != _oldOutputHeight)
{
_context.Dispose();
_context = new FFmpegContext(AVCodecID.AV_CODEC_ID_H264);
@@ -38,7 +37,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264
Span bs = Prepend(bitstream, SpsAndPpsReconstruction.Reconstruct(ref pictureInfo, _workBuffer));
- return _context.DecodeFrame(outSurf, bs) == 0;
+ return _context.DecodeFrame(outSurf, bs) is 0;
}
private static byte[] Prepend(ReadOnlySpan data, ReadOnlySpan prep)
diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/H264BitStreamWriter.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/H264BitStreamWriter.cs
index 57ab9fb53..28ea47104 100644
--- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/H264BitStreamWriter.cs
+++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/H264BitStreamWriter.cs
@@ -3,23 +3,13 @@ using System.Numerics;
namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264
{
- struct H264BitStreamWriter
+ struct H264BitStreamWriter(byte[] workBuffer)
{
private const int BufferSize = 8;
- private readonly byte[] _workBuffer;
-
- private int _offset;
- private int _buffer;
- private int _bufferPos;
-
- public H264BitStreamWriter(byte[] workBuffer)
- {
- _workBuffer = workBuffer;
- _offset = 0;
- _buffer = 0;
- _bufferPos = 0;
- }
+ private int _offset = 0;
+ private int _buffer = 0;
+ private int _bufferPos = 0;
public void WriteBit(bool value)
{
@@ -59,9 +49,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264
private int GetFreeBufferBits()
{
if (_bufferPos == BufferSize)
- {
Flush();
- }
return BufferSize - _bufferPos;
}
@@ -70,7 +58,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264
{
if (_bufferPos != 0)
{
- _workBuffer[_offset++] = (byte)_buffer;
+ workBuffer[_offset++] = (byte)_buffer;
_buffer = 0;
_bufferPos = 0;
@@ -84,10 +72,8 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264
Flush();
}
- public readonly Span AsSpan()
- {
- return new Span(_workBuffer)[.._offset];
- }
+ public readonly Span AsSpan()
+ => new Span(workBuffer)[.._offset];
public void WriteU(uint value, int valueSize) => WriteBits((int)value, valueSize);
public void WriteSe(int value) => WriteExpGolombCodedInt(value);
diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs
index 61e42775c..d12cb8f77 100644
--- a/src/Ryujinx.HLE/Switch.cs
+++ b/src/Ryujinx.HLE/Switch.cs
@@ -68,36 +68,6 @@ namespace Ryujinx.HLE
#pragma warning restore IDE0055
}
- public bool LoadCart(string exeFsDir, string romFsFile = null)
- {
- return Processes.LoadUnpackedNca(exeFsDir, romFsFile);
- }
-
- public bool LoadXci(string xciFile, ulong applicationId = 0)
- {
- return Processes.LoadXci(xciFile, applicationId);
- }
-
- public bool LoadNca(string ncaFile)
- {
- return Processes.LoadNca(ncaFile);
- }
-
- public bool LoadNsp(string nspFile, ulong applicationId = 0)
- {
- return Processes.LoadNsp(nspFile, applicationId);
- }
-
- public bool LoadProgram(string fileName)
- {
- return Processes.LoadNxo(fileName);
- }
-
- public bool WaitFifo()
- {
- return Gpu.GPFifo.WaitForCommands();
- }
-
public void ProcessFrame()
{
Gpu.ProcessShaderCacheQueue();
@@ -105,40 +75,22 @@ namespace Ryujinx.HLE
Gpu.GPFifo.DispatchCalls();
}
- public bool ConsumeFrameAvailable()
- {
- return Gpu.Window.ConsumeFrameAvailable();
- }
+ public bool LoadCart(string exeFsDir, string romFsFile = null) => Processes.LoadUnpackedNca(exeFsDir, romFsFile);
+ public bool LoadXci(string xciFile, ulong applicationId = 0) => Processes.LoadXci(xciFile, applicationId);
+ public bool LoadNca(string ncaFile) => Processes.LoadNca(ncaFile);
+ public bool LoadNsp(string nspFile, ulong applicationId = 0) => Processes.LoadNsp(nspFile, applicationId);
+ public bool LoadProgram(string fileName) => Processes.LoadNxo(fileName);
- public void PresentFrame(Action swapBuffersCallback)
- {
- Gpu.Window.Present(swapBuffersCallback);
- }
+ public void SetVolume(float volume) => AudioDeviceDriver.Volume = Math.Clamp(volume, 0f, 1f);
+ public float GetVolume() => AudioDeviceDriver.Volume;
+ public bool IsAudioMuted() => AudioDeviceDriver.Volume == 0;
- public void SetVolume(float volume)
- {
- AudioDeviceDriver.Volume = Math.Clamp(volume, 0f, 1f);
- }
+ public void EnableCheats() => ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine);
- public float GetVolume()
- {
- return AudioDeviceDriver.Volume;
- }
-
- public void EnableCheats()
- {
- ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine);
- }
-
- public bool IsAudioMuted()
- {
- return AudioDeviceDriver.Volume == 0;
- }
-
- public void DisposeGpu()
- {
- Gpu.Dispose();
- }
+ public bool WaitFifo() => Gpu.GPFifo.WaitForCommands();
+ public bool ConsumeFrameAvailable() => Gpu.Window.ConsumeFrameAvailable();
+ public void PresentFrame(Action swapBuffersCallback) => Gpu.Window.Present(swapBuffersCallback);
+ public void DisposeGpu() => Gpu.Dispose();
public void Dispose()
{
diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs
index 82ed4e0ff..6b983a09d 100644
--- a/src/Ryujinx/AppHost.cs
+++ b/src/Ryujinx/AppHost.cs
@@ -396,7 +396,7 @@ namespace Ryujinx.Ava
}
}
- private void SaveBitmapAsPng(SKBitmap bitmap, string path)
+ private static void SaveBitmapAsPng(SKBitmap bitmap, string path)
{
using var data = bitmap.Encode(SKEncodedImageFormat.Png, 100);
using var stream = File.OpenWrite(path);
@@ -406,8 +406,6 @@ namespace Ryujinx.Ava
public void Start()
{
- ARMeilleure.Optimizations.EcoFriendly = ConfigurationState.Instance.System.EnableLowPowerPtc;
-
if (OperatingSystem.IsWindows())
{
_windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1);
@@ -540,9 +538,8 @@ namespace Ryujinx.Ava
private void Dispose()
{
if (Device.Processes != null)
- {
MainWindowViewModel.UpdateGameMetadata(Device.Processes.ActiveApplication.ProgramIdText);
- }
+
ConfigurationState.Instance.System.IgnoreMissingServices.Event -= UpdateIgnoreMissingServicesState;
ConfigurationState.Instance.Graphics.AspectRatio.Event -= UpdateAspectRatioState;
diff --git a/src/Ryujinx/Common/Locale/LocaleExtension.cs b/src/Ryujinx/Common/Locale/LocaleExtension.cs
index fe6cdd32a..fd7159c16 100644
--- a/src/Ryujinx/Common/Locale/LocaleExtension.cs
+++ b/src/Ryujinx/Common/Locale/LocaleExtension.cs
@@ -8,26 +8,20 @@ namespace Ryujinx.Ava.Common.Locale
{
internal class LocaleExtension(LocaleKeys key) : MarkupExtension
{
- public LocaleKeys Key { get; } = key;
+ private ClrPropertyInfo PropertyInfo
+ => new(
+ "Item",
+ _ => LocaleManager.Instance[key],
+ null,
+ typeof(string)
+ );
- public override object ProvideValue(IServiceProvider serviceProvider)
- {
- var builder = new CompiledBindingPathBuilder();
-
- builder.Property(
- new ClrPropertyInfo("Item",
- _ => LocaleManager.Instance[Key],
- null,
- typeof(string)
- ),
- PropertyInfoAccessorFactory.CreateInpcPropertyAccessor);
-
- var binding = new CompiledBindingExtension(builder.Build())
- {
- Source = LocaleManager.Instance
- };
-
- return binding.ProvideValue(serviceProvider);
- }
+ public override object ProvideValue(IServiceProvider serviceProvider) =>
+ new CompiledBindingExtension(
+ new CompiledBindingPathBuilder()
+ .Property(PropertyInfo, PropertyInfoAccessorFactory.CreateInpcPropertyAccessor)
+ .Build()
+ ) { Source = LocaleManager.Instance }
+ .ProvideValue(serviceProvider);
}
}
diff --git a/src/Ryujinx/UI/Controls/NavigationDialogHost.axaml.cs b/src/Ryujinx/UI/Controls/NavigationDialogHost.axaml.cs
index a32c052bf..869656669 100644
--- a/src/Ryujinx/UI/Controls/NavigationDialogHost.axaml.cs
+++ b/src/Ryujinx/UI/Controls/NavigationDialogHost.axaml.cs
@@ -3,6 +3,7 @@ using Avalonia.Controls;
using Avalonia.Styling;
using Avalonia.Threading;
using FluentAvalonia.UI.Controls;
+using Gommon;
using LibHac;
using LibHac.Common;
using LibHac.Fs;
@@ -84,10 +85,7 @@ namespace Ryujinx.Ava.UI.Controls
Padding = new Thickness(0),
};
- contentDialog.Closed += (sender, args) =>
- {
- content.ViewModel.Dispose();
- };
+ contentDialog.Closed += (_, _) => content.ViewModel.Dispose();
Style footer = new(x => x.Name("DialogSpace").Child().OfType());
footer.Setters.Add(new Setter(IsVisibleProperty, false));
@@ -109,12 +107,9 @@ namespace Ryujinx.Ava.UI.Controls
ViewModel.Profiles.Clear();
ViewModel.LostProfiles.Clear();
- var profiles = AccountManager.GetAllUsers().OrderBy(x => x.Name);
-
- foreach (var profile in profiles)
- {
- ViewModel.Profiles.Add(new UserProfile(profile, this));
- }
+ AccountManager.GetAllUsers()
+ .OrderBy(x => x.Name)
+ .ForEach(profile => ViewModel.Profiles.Add(new UserProfile(profile, this)));
var saveDataFilter = SaveDataFilter.Make(programId: default, saveType: SaveDataType.Account, default, saveDataId: default, index: default);
diff --git a/src/Ryujinx/UI/Helpers/ContentDialogHelper.cs b/src/Ryujinx/UI/Helpers/ContentDialogHelper.cs
index 434771eca..28f4c0e98 100644
--- a/src/Ryujinx/UI/Helpers/ContentDialogHelper.cs
+++ b/src/Ryujinx/UI/Helpers/ContentDialogHelper.cs
@@ -84,7 +84,7 @@ namespace Ryujinx.Ava.UI.Helpers
return await ShowContentDialog(title, content, primaryButton, secondaryButton, closeButton, primaryButtonResult, deferResetEvent, deferCloseAction);
}
- public async static Task ShowDeferredContentDialog(
+ public static Task ShowDeferredContentDialog(
StyleableWindow window,
string title,
string primaryText,
@@ -98,7 +98,7 @@ namespace Ryujinx.Ava.UI.Helpers
{
bool startedDeferring = false;
- return await ShowTextDialog(
+ return ShowTextDialog(
title,
primaryText,
secondaryText,
@@ -148,8 +148,8 @@ namespace Ryujinx.Ava.UI.Helpers
{
Grid content = new()
{
- RowDefinitions = new RowDefinitions { new(), new() },
- ColumnDefinitions = new ColumnDefinitions { new(GridLength.Auto), new() },
+ RowDefinitions = [new(), new()],
+ ColumnDefinitions = [new(GridLength.Auto), new()],
MinHeight = 80,
};
@@ -194,14 +194,13 @@ namespace Ryujinx.Ava.UI.Helpers
return content;
}
- public static async Task CreateInfoDialog(
+ public static Task CreateInfoDialog(
string primary,
string secondaryText,
string acceptButton,
string closeButton,
- string title)
- {
- return await ShowTextDialog(
+ string title)
+ => ShowTextDialog(
title,
primary,
secondaryText,
@@ -209,17 +208,15 @@ namespace Ryujinx.Ava.UI.Helpers
"",
closeButton,
(int)Symbol.Important);
- }
- internal static async Task CreateConfirmationDialog(
+ internal static Task CreateConfirmationDialog(
string primaryText,
string secondaryText,
string acceptButtonText,
string cancelButtonText,
string title,
- UserResult primaryButtonResult = UserResult.Yes)
- {
- return await ShowTextDialog(
+ UserResult primaryButtonResult = UserResult.Yes)
+ => ShowTextDialog(
string.IsNullOrWhiteSpace(title) ? LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle] : title,
primaryText,
secondaryText,
@@ -228,21 +225,17 @@ namespace Ryujinx.Ava.UI.Helpers
cancelButtonText,
(int)Symbol.Help,
primaryButtonResult);
- }
- internal static async Task CreateLocalizedConfirmationDialog(
- string primaryText,
- string secondaryText) =>
- await CreateConfirmationDialog(
+ internal static Task CreateLocalizedConfirmationDialog(string primaryText, string secondaryText)
+ => CreateConfirmationDialog(
primaryText,
secondaryText,
LocaleManager.Instance[LocaleKeys.InputDialogYes],
LocaleManager.Instance[LocaleKeys.InputDialogNo],
LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
- internal static async Task CreateUpdaterInfoDialog(string primary, string secondaryText)
- {
- await ShowTextDialog(
+ internal static Task CreateUpdaterInfoDialog(string primary, string secondaryText)
+ => ShowTextDialog(
LocaleManager.Instance[LocaleKeys.DialogUpdaterTitle],
primary,
secondaryText,
@@ -250,11 +243,9 @@ namespace Ryujinx.Ava.UI.Helpers
"",
LocaleManager.Instance[LocaleKeys.InputDialogOk],
(int)Symbol.Important);
- }
- internal static async Task CreateWarningDialog(string primary, string secondaryText)
- {
- await ShowTextDialog(
+ internal static Task CreateWarningDialog(string primary, string secondaryText)
+ => ShowTextDialog(
LocaleManager.Instance[LocaleKeys.DialogWarningTitle],
primary,
secondaryText,
@@ -262,13 +253,12 @@ namespace Ryujinx.Ava.UI.Helpers
"",
LocaleManager.Instance[LocaleKeys.InputDialogOk],
(int)Symbol.Important);
- }
- internal static async Task CreateErrorDialog(string errorMessage, string secondaryErrorMessage = "")
+ internal static Task CreateErrorDialog(string errorMessage, string secondaryErrorMessage = "")
{
Logger.Error?.Print(LogClass.Application, errorMessage);
- await ShowTextDialog(
+ return ShowTextDialog(
LocaleManager.Instance[LocaleKeys.DialogErrorTitle],
LocaleManager.Instance[LocaleKeys.DialogErrorMessage],
errorMessage,
diff --git a/src/Ryujinx/UI/Models/SaveModel.cs b/src/Ryujinx/UI/Models/SaveModel.cs
index 181295b06..86608a1c0 100644
--- a/src/Ryujinx/UI/Models/SaveModel.cs
+++ b/src/Ryujinx/UI/Models/SaveModel.cs
@@ -5,6 +5,7 @@ using Ryujinx.Ava.UI.Windows;
using Ryujinx.HLE.FileSystem;
using Ryujinx.UI.App.Common;
using Ryujinx.UI.Common.Helper;
+using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -18,7 +19,7 @@ namespace Ryujinx.Ava.UI.Models
public ulong SaveId { get; }
public ProgramId TitleId { get; }
- public string TitleIdString => $"{TitleId.Value:X16}";
+ public string TitleIdString => TitleId.ToString();
public UserId UserId { get; }
public bool InGameList { get; }
public string Title { get; }
@@ -46,7 +47,7 @@ namespace Ryujinx.Ava.UI.Models
TitleId = info.ProgramId;
UserId = info.UserId;
- var appData = MainWindow.MainWindowViewModel.Applications.FirstOrDefault(x => x.IdString.ToUpper() == TitleIdString);
+ var appData = MainWindow.ViewModel.Applications.FirstOrDefault(x => x.IdString.Equals(TitleIdString, StringComparison.OrdinalIgnoreCase));
InGameList = appData != null;