mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 06:17:10 +02:00
Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)
See merge request ryubing/ryujinx!47
This commit is contained in:
parent
d03ae9c164
commit
ea027d65a7
309 changed files with 1018 additions and 1247 deletions
|
@ -118,7 +118,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
|
||||
await ContentDialogHelper.ShowWindowAsync(_mainWindow.SettingsWindow, _mainWindow);
|
||||
_mainWindow.SettingsWindow = null;
|
||||
this.Close();
|
||||
Close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,5 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Platform.Storage;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Tools.FsSystem.NcaUtils;
|
||||
using Ryujinx.Ava.Common;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Common.Models;
|
||||
using Ryujinx.Ava.Systems.AppLibrary;
|
||||
using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Ava.UI.Views.Dialog;
|
||||
using Ryujinx.Ava.UI.Windows;
|
||||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Helper;
|
||||
using Ryujinx.HLE.HOS;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Controls
|
||||
{
|
||||
|
|
|
@ -2,17 +2,15 @@ using Avalonia.Logging;
|
|||
using Avalonia.Utilities;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Common.Logging;
|
||||
using System;
|
||||
using System.Text;
|
||||
using AvaLogger = Avalonia.Logging.Logger;
|
||||
using AvaLogLevel = Avalonia.Logging.LogEventLevel;
|
||||
using RyuLogClass = Ryujinx.Common.Logging.LogClass;
|
||||
using RyuLogger = Ryujinx.Common.Logging.Logger;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Helpers
|
||||
{
|
||||
using AvaLogger = Avalonia.Logging.Logger;
|
||||
using AvaLogLevel = LogEventLevel;
|
||||
using RyuLogClass = LogClass;
|
||||
using RyuLogger = Ryujinx.Common.Logging.Logger;
|
||||
|
||||
internal class LoggerAdapter : ILogSink
|
||||
{
|
||||
private static bool _avaloniaLogsEnabled = ConfigurationState.Instance.Logger.EnableAvaloniaLog;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
|
@ -36,7 +35,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
|
||||
internal delegate nint WindowProc(nint hWnd, WindowsMessages msg, nint wParam, nint lParam);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct WndClassEx
|
||||
{
|
||||
public int cbSize;
|
||||
|
|
|
@ -257,7 +257,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
Led = new LedConfigController
|
||||
{
|
||||
EnableLed = EnableLedChanging,
|
||||
TurnOffLed = this.TurnOffLed,
|
||||
TurnOffLed = TurnOffLed,
|
||||
UseRainbow = UseRainbowLed,
|
||||
LedColor = LedColor.ToUInt32()
|
||||
},
|
||||
|
|
|
@ -2,7 +2,6 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Models.Input
|
||||
{
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace Ryujinx.Ava.UI.Renderer
|
|||
_ => throw new NotImplementedException()
|
||||
};
|
||||
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
EmbeddedWindow.WindowCreated += CurrentWindow_WindowCreated;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Systems;
|
||||
using Ryujinx.Ava.Systems.AppLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
|
||||
namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
|
@ -30,19 +30,18 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public string BootsInfoText { get; set; }
|
||||
public string NothingInfoText { get; set; }
|
||||
|
||||
|
||||
private IEnumerable<CompatibilityEntry> _currentEntries = CompatibilityDatabase.Entries;
|
||||
|
||||
private string[] _ownedGameTitleIds = [];
|
||||
|
||||
private Func<CompatibilityEntry, object> _sortKeySelector = x => x.GameName; // Default sort by GameName
|
||||
private readonly Func<CompatibilityEntry, object> _sortKeySelector = x => x.GameName; // Default sort by GameName
|
||||
|
||||
public IEnumerable<CompatibilityEntry> CurrentEntries => OnlyShowOwnedGames
|
||||
? _currentEntries.Where(x =>
|
||||
x.TitleId.Check(tid => _ownedGameTitleIds.ContainsIgnoreCase(tid)))
|
||||
: _currentEntries;
|
||||
|
||||
public CompatibilityViewModel() {}
|
||||
public CompatibilityViewModel() { }
|
||||
|
||||
private void AppCountUpdated(object _, ApplicationCountUpdatedEventArgs __)
|
||||
=> _ownedGameTitleIds = _appLibrary.Applications.Keys.Select(x => x.ToString("X16")).ToArray();
|
||||
|
@ -57,11 +56,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
public void CountByStatus()
|
||||
{
|
||||
PlayableInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListPlayable] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListPlayable);
|
||||
InGameInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListIngame] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListIngame);
|
||||
MenusInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListMenus] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListMenus);
|
||||
BootsInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListBoots] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListBoots);
|
||||
NothingInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListNothing] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListNothing);
|
||||
PlayableInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListPlayable] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListPlayable);
|
||||
InGameInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListIngame] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListIngame);
|
||||
MenusInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListMenus] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListMenus);
|
||||
BootsInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListBoots] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListBoots);
|
||||
NothingInfoText = LocaleManager.Instance[LocaleKeys.CompatibilityListNothing] + ": " + CurrentEntries.Count(x => x.Status == LocaleKeys.CompatibilityListNothing);
|
||||
|
||||
_onlyShowOwnedGames = true;
|
||||
}
|
||||
|
@ -87,7 +86,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void NameSorting(int nameSort = 0)
|
||||
{
|
||||
_sorting.Name = nameSort;
|
||||
|
@ -162,6 +160,5 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Svg.Skia;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
|
@ -100,7 +99,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
public bool CanClearLed => SelectedGamepad.Name.ContainsIgnoreCase("DualSense");
|
||||
|
||||
public event Action NotifyChangesEvent;
|
||||
|
||||
|
||||
public string ChosenProfile
|
||||
{
|
||||
get => _chosenProfile;
|
||||
|
@ -327,13 +326,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
PlayerIndexes.Add(new(PlayerIndex.Handheld, LocaleManager.Instance[LocaleKeys.ControllerSettingsHandheld]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void LoadConfiguration(InputConfig inputConfig = null)
|
||||
{
|
||||
if (UseGlobalConfig && Program.UseExtraConfig)
|
||||
{
|
||||
Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId);
|
||||
Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -980,7 +977,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
if (Device == 0)
|
||||
{
|
||||
newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == this.PlayerId));
|
||||
newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == PlayerId));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -57,7 +57,6 @@ using Key = Ryujinx.Input.Key;
|
|||
using MissingKeyException = LibHac.Common.Keys.MissingKeyException;
|
||||
using Path = System.IO.Path;
|
||||
using ShaderCacheLoadingState = Ryujinx.Graphics.Gpu.Shader.ShaderCacheState;
|
||||
using UserId = Ryujinx.HLE.HOS.Services.Account.Acc.UserId;
|
||||
|
||||
namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
|
@ -1595,9 +1594,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
// Code where conditions will be executed after loading user configuration
|
||||
if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != backendThreadingInit)
|
||||
{
|
||||
Rebooter.RebootAppWithGame(application.Path,
|
||||
Rebooter.RebootAppWithGame(application.Path,
|
||||
[
|
||||
"--bt",
|
||||
"--bt",
|
||||
ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString()
|
||||
]);
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public bool IsGameTitleNotNull => !string.IsNullOrEmpty(GameTitle);
|
||||
public double PanelOpacity => IsGameTitleNotNull ? 0.5 : 1;
|
||||
|
||||
|
||||
public int ResolutionScale
|
||||
{
|
||||
get => _resolutionScale;
|
||||
|
@ -144,11 +143,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public bool EnableDockedMode { get; set; }
|
||||
public bool EnableKeyboard { get; set; }
|
||||
public bool EnableMouse { get; set; }
|
||||
public bool DisableInputWhenOutOfFocus { get; set; }
|
||||
public bool DisableInputWhenOutOfFocus { get; set; }
|
||||
public int FocusLostActionType { get; set; }
|
||||
|
||||
public bool UseGlobalInputConfig
|
||||
{
|
||||
{
|
||||
get => _useInputGlobalConfig;
|
||||
set
|
||||
{
|
||||
|
@ -163,7 +162,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
public VSyncMode VSyncMode
|
||||
{
|
||||
get => _vSyncMode;
|
||||
get => _vSyncMode;
|
||||
set
|
||||
{
|
||||
if (value is VSyncMode.Custom or VSyncMode.Switch or VSyncMode.Unbounded)
|
||||
|
@ -226,7 +225,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public bool EnablePptc { get; set; }
|
||||
public bool EnableLowPowerPptc { get; set; }
|
||||
|
||||
|
||||
public long TurboMultiplier
|
||||
{
|
||||
get => _turboModeMultiplier;
|
||||
|
@ -577,7 +575,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
public void LoadCurrentConfiguration(bool global = false)
|
||||
{
|
||||
ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance;
|
||||
ConfigurationState config = global ? ConfigurationState.InstanceExtra : ConfigurationState.Instance;
|
||||
|
||||
// User Interface
|
||||
EnableDiscordIntegration = config.EnableDiscordIntegration;
|
||||
|
@ -688,7 +686,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
public void SaveSettings(bool global = false)
|
||||
{
|
||||
ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance;
|
||||
ConfigurationState config = global ? ConfigurationState.InstanceExtra : ConfigurationState.Instance;
|
||||
|
||||
// User Interface
|
||||
config.EnableDiscordIntegration.Value = EnableDiscordIntegration;
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
|||
{
|
||||
_currentAssigner = new ButtonKeyAssigner(button);
|
||||
|
||||
this.Focus(NavigationMethod.Pointer);
|
||||
Focus(NavigationMethod.Pointer);
|
||||
|
||||
PointerPressed += MouseClick;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||
{
|
||||
_currentAssigner = new ButtonKeyAssigner(button);
|
||||
|
||||
this.Focus(NavigationMethod.Pointer);
|
||||
Focus(NavigationMethod.Pointer);
|
||||
|
||||
PointerPressed += MouseClick;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Avalonia.Controls;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Avalonia.Interactivity;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
if (DataContext is not CompatibilityViewModel cvm)
|
||||
return;
|
||||
|
||||
cvm.NameSorting(int.Parse(sortStrategy));
|
||||
cvm.NameSorting(int.Parse(sortStrategy));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,5 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
cvm.StatusSorting(int.Parse(sortStrategy));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
|
||||
|
||||
_ = this.GetObservable(IsActiveProperty).Subscribe(it => ViewModel.IsActive = it);
|
||||
this.ScalingChanged += OnScalingChanged;
|
||||
ScalingChanged += OnScalingChanged;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
private void OnScalingChanged(object sender, EventArgs e)
|
||||
{
|
||||
Program.DesktopScaleFactor = this.RenderScaling;
|
||||
Program.DesktopScaleFactor = RenderScaling;
|
||||
}
|
||||
|
||||
private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e)
|
||||
|
@ -563,16 +563,16 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
public static void UpdateGraphicsConfig()
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1
|
||||
? ConfigurationState.Instance.Graphics.ResScaleCustom
|
||||
|
||||
GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1
|
||||
? ConfigurationState.Instance.Graphics.ResScaleCustom
|
||||
: ConfigurationState.Instance.Graphics.ResScale;
|
||||
GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
|
||||
GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
|
||||
GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache;
|
||||
GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
|
||||
GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
|
||||
GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache;
|
||||
GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression;
|
||||
GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE;
|
||||
#pragma warning restore IDE0055
|
||||
GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE;
|
||||
|
||||
}
|
||||
|
||||
private void VolumeStatus_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue