mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 06:17:10 +02:00
Revert "Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)"
This reverts merge request !47
This commit is contained in:
parent
faf9e3cdd7
commit
77a797f154
307 changed files with 1245 additions and 1016 deletions
|
@ -118,7 +118,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
|
||||
await ContentDialogHelper.ShowWindowAsync(_mainWindow.SettingsWindow, _mainWindow);
|
||||
_mainWindow.SettingsWindow = null;
|
||||
Close();
|
||||
this.Close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
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,15 +2,17 @@ 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,4 +1,5 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
|
@ -35,7 +36,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
|
||||
internal delegate nint WindowProc(nint hWnd, WindowsMessages msg, nint wParam, nint lParam);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct WndClassEx
|
||||
{
|
||||
public int cbSize;
|
||||
|
|
|
@ -257,7 +257,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
Led = new LedConfigController
|
||||
{
|
||||
EnableLed = EnableLedChanging,
|
||||
TurnOffLed = TurnOffLed,
|
||||
TurnOffLed = this.TurnOffLed,
|
||||
UseRainbow = UseRainbowLed,
|
||||
LedColor = LedColor.ToUInt32()
|
||||
},
|
||||
|
|
|
@ -2,6 +2,7 @@ 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,6 +37,7 @@ 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,18 +30,19 @@ 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 readonly Func<CompatibilityEntry, object> _sortKeySelector = x => x.GameName; // Default sort by GameName
|
||||
private 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();
|
||||
|
@ -56,11 +57,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;
|
||||
}
|
||||
|
@ -86,6 +87,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void NameSorting(int nameSort = 0)
|
||||
{
|
||||
_sorting.Name = nameSort;
|
||||
|
@ -160,5 +162,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Svg.Skia;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
|
@ -99,7 +100,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
public bool CanClearLed => SelectedGamepad.Name.ContainsIgnoreCase("DualSense");
|
||||
|
||||
public event Action NotifyChangesEvent;
|
||||
|
||||
|
||||
public string ChosenProfile
|
||||
{
|
||||
get => _chosenProfile;
|
||||
|
@ -326,11 +327,13 @@ 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
|
||||
{
|
||||
|
@ -977,7 +980,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
if (Device == 0)
|
||||
{
|
||||
newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == PlayerId));
|
||||
newConfig.Remove(newConfig.FirstOrDefault(x => x.PlayerIndex == this.PlayerId));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@ 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
|
||||
{
|
||||
|
@ -1594,9 +1595,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,6 +86,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public bool IsGameTitleNotNull => !string.IsNullOrEmpty(GameTitle);
|
||||
public double PanelOpacity => IsGameTitleNotNull ? 0.5 : 1;
|
||||
|
||||
|
||||
public int ResolutionScale
|
||||
{
|
||||
get => _resolutionScale;
|
||||
|
@ -143,11 +144,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
|
||||
{
|
||||
|
@ -162,7 +163,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)
|
||||
|
@ -225,6 +226,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public bool EnablePptc { get; set; }
|
||||
public bool EnableLowPowerPptc { get; set; }
|
||||
|
||||
|
||||
public long TurboMultiplier
|
||||
{
|
||||
get => _turboModeMultiplier;
|
||||
|
@ -575,7 +577,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;
|
||||
|
@ -686,7 +688,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);
|
||||
|
||||
Focus(NavigationMethod.Pointer);
|
||||
this.Focus(NavigationMethod.Pointer);
|
||||
|
||||
PointerPressed += MouseClick;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||
{
|
||||
_currentAssigner = new ButtonKeyAssigner(button);
|
||||
|
||||
Focus(NavigationMethod.Pointer);
|
||||
this.Focus(NavigationMethod.Pointer);
|
||||
|
||||
PointerPressed += MouseClick;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Avalonia.Interactivity;
|
||||
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,5 +65,6 @@ 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);
|
||||
ScalingChanged += OnScalingChanged;
|
||||
this.ScalingChanged += OnScalingChanged;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
private void OnScalingChanged(object sender, EventArgs e)
|
||||
{
|
||||
Program.DesktopScaleFactor = RenderScaling;
|
||||
Program.DesktopScaleFactor = this.RenderScaling;
|
||||
}
|
||||
|
||||
private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e)
|
||||
|
@ -563,16 +563,16 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
public static void UpdateGraphicsConfig()
|
||||
{
|
||||
|
||||
GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1
|
||||
? ConfigurationState.Instance.Graphics.ResScaleCustom
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
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;
|
||||
|
||||
GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE;
|
||||
#pragma warning restore IDE0055
|
||||
}
|
||||
|
||||
private void VolumeStatus_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue