Use concrete types when possible for improved performance
This commit is contained in:
@@ -261,7 +261,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
(int)Symbol.Important);
|
||||
|
||||
|
||||
internal static async Task<UserResult> CreateUpdaterUpToDateInfoDialog(string primary, string secondaryText)
|
||||
=> await ShowTextDialog(
|
||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterTitle],
|
||||
@@ -319,7 +319,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
|
||||
return response == UserResult.Yes;
|
||||
}
|
||||
|
||||
|
||||
internal static async Task<UserResult> CreateUpdaterChoiceDialog(string title, string primary, string secondaryText)
|
||||
{
|
||||
if (_isChoiceDialogOpen)
|
||||
@@ -456,7 +456,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
await dialogWindow.ShowDialog(_contentDialogOverlayWindow ?? mainWindow ?? GetMainWindow());
|
||||
}
|
||||
|
||||
private static Window GetMainWindow()
|
||||
private static MainWindow GetMainWindow()
|
||||
{
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime al)
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Ryujinx.Ava.UI.Renderer
|
||||
}
|
||||
|
||||
[SupportedOSPlatform("linux")]
|
||||
private IPlatformHandle CreateLinux(IPlatformHandle control)
|
||||
private PlatformHandle CreateLinux(IPlatformHandle control)
|
||||
{
|
||||
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ namespace Ryujinx.Ava.UI.Renderer
|
||||
}
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
IPlatformHandle CreateWin32(IPlatformHandle control)
|
||||
PlatformHandle CreateWin32(IPlatformHandle control)
|
||||
{
|
||||
_className = "NativeWindow-" + Guid.NewGuid();
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace Ryujinx.Ava.UI.Renderer
|
||||
}
|
||||
|
||||
[SupportedOSPlatform("macos")]
|
||||
IPlatformHandle CreateMacOS()
|
||||
PlatformHandle CreateMacOS()
|
||||
{
|
||||
// Create a new CAMetalLayer.
|
||||
ObjectiveC.Object layerObject = new("CAMetalLayer");
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
[ObservableProperty] private bool _isSubMenuOpen;
|
||||
[ObservableProperty] private ApplicationContextMenu _listAppContextMenu;
|
||||
[ObservableProperty] private ApplicationContextMenu _gridAppContextMenu;
|
||||
|
||||
|
||||
private bool _showLoadProgress;
|
||||
private bool _isGameRunning;
|
||||
private bool _isAmiiboRequested;
|
||||
@@ -126,7 +126,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
private int _customVSyncIntervalPercentageProxy;
|
||||
private ApplicationData _listSelectedApplication;
|
||||
private ApplicationData _gridSelectedApplication;
|
||||
|
||||
|
||||
// Key is Title ID
|
||||
public SafeDictionary<string, LdnGameData.Array> LdnData = [];
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
OnPropertyChanged(nameof(ShowFirmwareStatus));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ApplicationData ListSelectedApplication
|
||||
{
|
||||
get => _listSelectedApplication;
|
||||
@@ -332,7 +332,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
else if (_gridSelectedApplication == null && _gridAppContextMenu != null)
|
||||
GridAppContextMenu = null!;
|
||||
#pragma warning restore MVVMTK0034
|
||||
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
public bool OpenBcatSaveDirectoryEnabled => SelectedApplication.HasControlHolder && SelectedApplication.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0;
|
||||
|
||||
public bool ShowCustomVSyncIntervalPicker
|
||||
public bool ShowCustomVSyncIntervalPicker
|
||||
=> _isGameRunning && AppHost.Device.VSyncMode == VSyncMode.Custom;
|
||||
|
||||
public void UpdateVSyncIntervalPicker()
|
||||
@@ -529,7 +529,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
public bool ShowNames
|
||||
{
|
||||
get => ConfigurationState.Instance.UI.ShowNames && ConfigurationState.Instance.UI.GridSize > 1;
|
||||
get => ConfigurationState.Instance.UI.ShowNames && ConfigurationState.Instance.UI.GridSize > 1;
|
||||
set
|
||||
{
|
||||
ConfigurationState.Instance.UI.ShowNames.Value = value;
|
||||
@@ -710,7 +710,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
#region PrivateMethods
|
||||
|
||||
private static IComparer<ApplicationData> CreateComparer(bool ascending, Func<ApplicationData, IComparable> selector) =>
|
||||
private static SortExpressionComparer<ApplicationData> CreateComparer(bool ascending, Func<ApplicationData, IComparable> selector) =>
|
||||
ascending
|
||||
? SortExpressionComparer<ApplicationData>.Ascending(selector)
|
||||
: SortExpressionComparer<ApplicationData>.Descending(selector);
|
||||
@@ -818,10 +818,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
string message = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogFirmwareInstallerFirmwareInstallSuccessMessage, firmwareVersion.VersionString);
|
||||
|
||||
await ContentDialogHelper.CreateInfoDialog(
|
||||
dialogTitle,
|
||||
message,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
string.Empty,
|
||||
dialogTitle,
|
||||
message,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.RyujinxInfo]);
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, message);
|
||||
@@ -1134,11 +1134,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
await ContentDialogHelper.ShowTextDialog(
|
||||
LocaleManager.Instance[numAdded > 0 || numRemoved > 0 ? LocaleKeys.RyujinxConfirm : LocaleKeys.RyujinxInfo],
|
||||
msg,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
msg,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
(int)Symbol.Checkmark);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -179,17 +179,17 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
ApplicationLibrary.SaveTitleUpdatesForGame(ApplicationData, updates);
|
||||
}
|
||||
|
||||
private Task ShowNewUpdatesAddedDialog(int numAdded)
|
||||
private Task<UserResult> ShowNewUpdatesAddedDialog(int numAdded)
|
||||
{
|
||||
var msg = string.Format(LocaleManager.Instance[LocaleKeys.UpdateWindowUpdateAddedMessage], numAdded);
|
||||
return Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
return Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
await ContentDialogHelper.ShowTextDialog(
|
||||
LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
|
||||
msg,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
|
||||
msg,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
(int)Symbol.Checkmark
|
||||
));
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] DecompressYaz0(Stream stream)
|
||||
private static byte[] DecompressYaz0(MemoryStream stream)
|
||||
{
|
||||
using BinaryReader reader = new(stream);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
return false;
|
||||
}
|
||||
|
||||
private IComparer<SaveModel> GetComparer()
|
||||
private SortExpressionComparer<SaveModel> GetComparer()
|
||||
{
|
||||
return SortIndex switch
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
||||
public partial class SettingsHotkeysView : UserControl
|
||||
{
|
||||
private ButtonKeyAssigner _currentAssigner;
|
||||
private readonly IGamepadDriver _avaloniaKeyboardDriver;
|
||||
private readonly AvaloniaKeyboardDriver _avaloniaKeyboardDriver;
|
||||
|
||||
public SettingsHotkeysView()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user