aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/AppHost.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-07 23:03:27 +0200
committerGitHub <noreply@github.com>2023-07-07 23:03:27 +0200
commit6c515e18228b93c4d856129ba55a692e830cbdaa (patch)
tree661a3be3cf71c5276e82cb4fcc13b39f9e7f9f90 /src/Ryujinx.Ava/AppHost.cs
parent8a363b5df2387bd254a3dd48bfd3c9884ff74dab (diff)
[Ryujinx.Ava] Address dotnet-format issues (#5361)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Silence dotnet format IDE0059 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address dotnet format CA1401 warnings * Address remaining dotnet format analyzer warnings * Address review comments * dotnet-format fixes after rebase * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Format if-blocks correctly * Another rebase, another dotnet format run * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Add comments to disabled warnings * Remove a few unused parameters * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Address IDE0260 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * dotnet format pass with new editorconfig * Fix naming style issues * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Revert one suggestion * Second dotnet format pass and fix build issues * Final pass of dotnet format * Add trailing commas * Fix formatting issues * Keep unnecessary assignment in IconColorPicker.cs * Use using declarations and extend resource lifetimes * Fix rebase issues * Adjust comment spacing * Fix typo * Fix naming issues * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Revert unintentional change * Remove unused file * Remove static keyword from ViewModels Binding of static members doesn't work and is silently ignored. --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
Diffstat (limited to 'src/Ryujinx.Ava/AppHost.cs')
-rw-r--r--src/Ryujinx.Ava/AppHost.cs233
1 files changed, 117 insertions, 116 deletions
diff --git a/src/Ryujinx.Ava/AppHost.cs b/src/Ryujinx.Ava/AppHost.cs
index c2b1064b..7c1ce542 100644
--- a/src/Ryujinx.Ava/AppHost.cs
+++ b/src/Ryujinx.Ava/AppHost.cs
@@ -1,4 +1,5 @@
using ARMeilleure.Translation;
+using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Input;
@@ -26,6 +27,7 @@ using Ryujinx.Graphics.GAL.Multithreading;
using Ryujinx.Graphics.Gpu;
using Ryujinx.Graphics.OpenGL;
using Ryujinx.Graphics.Vulkan;
+using Ryujinx.HLE;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.HOS;
using Ryujinx.HLE.HOS.Services.Account.Acc;
@@ -41,7 +43,6 @@ using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
-using SPB.Graphics.Exceptions;
using SPB.Graphics.Vulkan;
using System;
using System.Collections.Generic;
@@ -50,10 +51,12 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
using static Ryujinx.Ava.UI.Helpers.Win32NativeInterop;
+using AntiAliasing = Ryujinx.Common.Configuration.AntiAliasing;
using Image = SixLabors.ImageSharp.Image;
using InputManager = Ryujinx.Input.HLE.InputManager;
using Key = Ryujinx.Input.Key;
using MouseButton = Ryujinx.Input.MouseButton;
+using ScalingFilter = Ryujinx.Common.Configuration.ScalingFilter;
using Size = Avalonia.Size;
using Switch = Ryujinx.HLE.Switch;
@@ -61,31 +64,31 @@ namespace Ryujinx.Ava
{
internal class AppHost
{
- private const int CursorHideIdleTime = 5; // Hide Cursor seconds.
+ private const int CursorHideIdleTime = 5; // Hide Cursor seconds.
private const float MaxResolutionScale = 4.0f; // Max resolution hotkeys can scale to before wrapping.
- private const int TargetFps = 60;
- private const float VolumeDelta = 0.05f;
+ private const int TargetFps = 60;
+ private const float VolumeDelta = 0.05f;
- private static readonly Cursor InvisibleCursor = new(StandardCursorType.None);
- private readonly IntPtr InvisibleCursorWin;
- private readonly IntPtr DefaultCursorWin;
+ private static readonly Cursor _invisibleCursor = new(StandardCursorType.None);
+ private readonly IntPtr _invisibleCursorWin;
+ private readonly IntPtr _defaultCursorWin;
- private readonly long _ticksPerFrame;
+ private readonly long _ticksPerFrame;
private readonly Stopwatch _chrono;
- private long _ticks;
+ private long _ticks;
- private readonly AccountManager _accountManager;
+ private readonly AccountManager _accountManager;
private readonly UserChannelPersistence _userChannelPersistence;
- private readonly InputManager _inputManager;
+ private readonly InputManager _inputManager;
private readonly MainWindowViewModel _viewModel;
- private readonly IKeyboard _keyboardInterface;
- private readonly TopLevel _topLevel;
- public RendererHost _rendererHost;
+ private readonly IKeyboard _keyboardInterface;
+ private readonly TopLevel _topLevel;
+ public RendererHost RendererHost;
private readonly GraphicsDebugLevel _glLogLevel;
- private float _newVolume;
- private KeyboardHotkeyState _prevHotkeyState;
+ private float _newVolume;
+ private KeyboardHotkeyState _prevHotkeyState;
private long _lastCursorMoveTime;
private bool _isCursorInRenderer = true;
@@ -94,14 +97,14 @@ namespace Ryujinx.Ava
private bool _isActive;
private bool _renderingStarted;
- private ManualResetEvent _gpuDoneEvent;
+ private readonly ManualResetEvent _gpuDoneEvent;
- private IRenderer _renderer;
- private readonly Thread _renderingThread;
+ private IRenderer _renderer;
+ private readonly Thread _renderingThread;
private readonly CancellationTokenSource _gpuCancellationTokenSource;
private WindowsMultimediaTimerResolution _windowsMultimediaTimerResolution;
- private bool _dialogShown;
+ private bool _dialogShown;
private readonly bool _isFirmwareTitle;
private readonly object _lockObject = new();
@@ -109,55 +112,55 @@ namespace Ryujinx.Ava
public event EventHandler AppExit;
public event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent;
- public VirtualFileSystem VirtualFileSystem { get; }
- public ContentManager ContentManager { get; }
- public NpadManager NpadManager { get; }
+ public VirtualFileSystem VirtualFileSystem { get; }
+ public ContentManager ContentManager { get; }
+ public NpadManager NpadManager { get; }
public TouchScreenManager TouchScreenManager { get; }
- public Switch Device { get; set; }
+ public Switch Device { get; set; }
- public int Width { get; private set; }
- public int Height { get; private set; }
- public string ApplicationPath { get; private set; }
- public bool ScreenshotRequested { get; set; }
+ public int Width { get; private set; }
+ public int Height { get; private set; }
+ public string ApplicationPath { get; private set; }
+ public bool ScreenshotRequested { get; set; }
public AppHost(
- RendererHost renderer,
- InputManager inputManager,
- string applicationPath,
- VirtualFileSystem virtualFileSystem,
- ContentManager contentManager,
- AccountManager accountManager,
+ RendererHost renderer,
+ InputManager inputManager,
+ string applicationPath,
+ VirtualFileSystem virtualFileSystem,
+ ContentManager contentManager,
+ AccountManager accountManager,
UserChannelPersistence userChannelPersistence,
- MainWindowViewModel viewmodel,
- TopLevel topLevel)
+ MainWindowViewModel viewmodel,
+ TopLevel topLevel)
{
- _viewModel = viewmodel;
- _inputManager = inputManager;
- _accountManager = accountManager;
+ _viewModel = viewmodel;
+ _inputManager = inputManager;
+ _accountManager = accountManager;
_userChannelPersistence = userChannelPersistence;
- _renderingThread = new Thread(RenderLoop) { Name = "GUI.RenderThread" };
- _lastCursorMoveTime = Stopwatch.GetTimestamp();
- _glLogLevel = ConfigurationState.Instance.Logger.GraphicsDebugLevel;
- _topLevel = topLevel;
+ _renderingThread = new Thread(RenderLoop) { Name = "GUI.RenderThread" };
+ _lastCursorMoveTime = Stopwatch.GetTimestamp();
+ _glLogLevel = ConfigurationState.Instance.Logger.GraphicsDebugLevel;
+ _topLevel = topLevel;
_inputManager.SetMouseDriver(new AvaloniaMouseDriver(_topLevel, renderer));
_keyboardInterface = (IKeyboard)_inputManager.KeyboardDriver.GetGamepad("0");
- NpadManager = _inputManager.CreateNpadManager();
+ NpadManager = _inputManager.CreateNpadManager();
TouchScreenManager = _inputManager.CreateTouchScreenManager();
- ApplicationPath = applicationPath;
- VirtualFileSystem = virtualFileSystem;
- ContentManager = contentManager;
+ ApplicationPath = applicationPath;
+ VirtualFileSystem = virtualFileSystem;
+ ContentManager = contentManager;
- _rendererHost = renderer;
+ RendererHost = renderer;
- _chrono = new Stopwatch();
+ _chrono = new Stopwatch();
_ticksPerFrame = Stopwatch.Frequency / TargetFps;
if (ApplicationPath.StartsWith("@SystemContent"))
{
- ApplicationPath = _viewModel.VirtualFileSystem.SwitchPathToSystemPath(ApplicationPath);
+ ApplicationPath = VirtualFileSystem.SwitchPathToSystemPath(ApplicationPath);
_isFirmwareTitle = true;
}
@@ -170,21 +173,21 @@ namespace Ryujinx.Ava
if (OperatingSystem.IsWindows())
{
- InvisibleCursorWin = CreateEmptyCursor();
- DefaultCursorWin = CreateArrowCursor();
+ _invisibleCursorWin = CreateEmptyCursor();
+ _defaultCursorWin = CreateArrowCursor();
}
ConfigurationState.Instance.System.IgnoreMissingServices.Event += UpdateIgnoreMissingServicesState;
- ConfigurationState.Instance.Graphics.AspectRatio.Event += UpdateAspectRatioState;
- ConfigurationState.Instance.System.EnableDockedMode.Event += UpdateDockedModeState;
- ConfigurationState.Instance.System.AudioVolume.Event += UpdateAudioVolumeState;
- ConfigurationState.Instance.System.EnableDockedMode.Event += UpdateDockedModeState;
- ConfigurationState.Instance.System.AudioVolume.Event += UpdateAudioVolumeState;
- ConfigurationState.Instance.Graphics.AntiAliasing.Event += UpdateAntiAliasing;
- ConfigurationState.Instance.Graphics.ScalingFilter.Event += UpdateScalingFilter;
- ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event += UpdateScalingFilterLevel;
+ ConfigurationState.Instance.Graphics.AspectRatio.Event += UpdateAspectRatioState;
+ ConfigurationState.Instance.System.EnableDockedMode.Event += UpdateDockedModeState;
+ ConfigurationState.Instance.System.AudioVolume.Event += UpdateAudioVolumeState;
+ ConfigurationState.Instance.System.EnableDockedMode.Event += UpdateDockedModeState;
+ ConfigurationState.Instance.System.AudioVolume.Event += UpdateAudioVolumeState;
+ ConfigurationState.Instance.Graphics.AntiAliasing.Event += UpdateAntiAliasing;
+ ConfigurationState.Instance.Graphics.ScalingFilter.Event += UpdateScalingFilter;
+ ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event += UpdateScalingFilterLevel;
- ConfigurationState.Instance.Multiplayer.LanInterfaceId.Event += UpdateLanInterfaceIdState;
+ ConfigurationState.Instance.Multiplayer.LanInterfaceId.Event += UpdateLanInterfaceIdState;
_gpuCancellationTokenSource = new CancellationTokenSource();
_gpuDoneEvent = new ManualResetEvent(false);
@@ -196,10 +199,10 @@ namespace Ryujinx.Ava
{
_lastCursorMoveTime = Stopwatch.GetTimestamp();
- if (_rendererHost.EmbeddedWindow.TransformedBounds != null)
+ if (RendererHost.EmbeddedWindow.TransformedBounds != null)
{
- var point = e.GetCurrentPoint(window).Position;
- var bounds = _rendererHost.EmbeddedWindow.TransformedBounds.Value.Clip;
+ var point = e.GetCurrentPoint(window).Position;
+ var bounds = RendererHost.EmbeddedWindow.TransformedBounds.Value.Clip;
_isCursorInRenderer = point.X >= bounds.X &&
point.X <= bounds.Width + bounds.X &&
@@ -220,7 +223,7 @@ namespace Ryujinx.Ava
_renderer.Window?.SetScalingFilterLevel(ConfigurationState.Instance.Graphics.ScalingFilterLevel.Value);
}
- private void UpdateScalingFilter(object sender, ReactiveEventArgs<Ryujinx.Common.Configuration.ScalingFilter> e)
+ private void UpdateScalingFilter(object sender, ReactiveEventArgs<ScalingFilter> e)
{
_renderer.Window?.SetScalingFilter((Graphics.GAL.ScalingFilter)ConfigurationState.Instance.Graphics.ScalingFilter.Value);
_renderer.Window?.SetScalingFilterLevel(ConfigurationState.Instance.Graphics.ScalingFilterLevel.Value);
@@ -234,7 +237,7 @@ namespace Ryujinx.Ava
if (OperatingSystem.IsWindows())
{
- SetCursor(DefaultCursorWin);
+ SetCursor(_defaultCursorWin);
}
});
}
@@ -243,11 +246,11 @@ namespace Ryujinx.Ava
{
Dispatcher.UIThread.Post(() =>
{
- _viewModel.Cursor = InvisibleCursor;
+ _viewModel.Cursor = _invisibleCursor;
if (OperatingSystem.IsWindows())
{
- SetCursor(InvisibleCursorWin);
+ SetCursor(_invisibleCursorWin);
}
});
}
@@ -271,12 +274,12 @@ namespace Ryujinx.Ava
lock (_lockObject)
{
DateTime currentTime = DateTime.Now;
- string filename = $"ryujinx_capture_{currentTime.Year}-{currentTime.Month:D2}-{currentTime.Day:D2}_{currentTime.Hour:D2}-{currentTime.Minute:D2}-{currentTime.Second:D2}.png";
+ string filename = $"ryujinx_capture_{currentTime.Year}-{currentTime.Month:D2}-{currentTime.Day:D2}_{currentTime.Hour:D2}-{currentTime.Minute:D2}-{currentTime.Second:D2}.png";
string directory = AppDataManager.Mode switch
{
AppDataManager.LaunchMode.Portable or AppDataManager.LaunchMode.Custom => Path.Combine(AppDataManager.BaseDirPath, "screenshots"),
- _ => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Ryujinx")
+ _ => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Ryujinx"),
};
string path = Path.Combine(directory, filename);
@@ -305,9 +308,9 @@ namespace Ryujinx.Ava
image.Mutate(x => x.Flip(FlipMode.Vertical));
}
- image.SaveAsPng(path, new PngEncoder()
+ image.SaveAsPng(path, new PngEncoder
{
- ColorType = PngColorType.Rgb
+ ColorType = PngColorType.Rgb,
});
image.Dispose();
@@ -336,21 +339,21 @@ namespace Ryujinx.Ava
_viewModel.IsGameRunning = true;
- var activeProcess = Device.Processes.ActiveApplication;
+ var activeProcess = Device.Processes.ActiveApplication;
- string titleNameSection = string.IsNullOrWhiteSpace(activeProcess.Name) ? string.Empty : $" {activeProcess.Name}";
+ string titleNameSection = string.IsNullOrWhiteSpace(activeProcess.Name) ? string.Empty : $" {activeProcess.Name}";
string titleVersionSection = string.IsNullOrWhiteSpace(activeProcess.DisplayVersion) ? string.Empty : $" v{activeProcess.DisplayVersion}";
- string titleIdSection = $" ({activeProcess.ProgramIdText.ToUpper()})";
- string titleArchSection = activeProcess.Is64Bit ? " (64-bit)" : " (32-bit)";
+ string titleIdSection = $" ({activeProcess.ProgramIdText.ToUpper()})";
+ string titleArchSection = activeProcess.Is64Bit ? " (64-bit)" : " (32-bit)";
Dispatcher.UIThread.InvokeAsync(() =>
{
_viewModel.Title = $"Ryujinx {Program.Version} -{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
});
- _viewModel.SetUIProgressHandlers(Device);
+ _viewModel.SetUiProgressHandlers(Device);
- _rendererHost.SizeChanged += Window_SizeChanged;
+ RendererHost.SizeChanged += Window_SizeChanged;
_isActive = true;
@@ -379,7 +382,7 @@ namespace Ryujinx.Ava
}
}
- private void UpdateAntiAliasing(object sender, ReactiveEventArgs<Ryujinx.Common.Configuration.AntiAliasing> e)
+ private void UpdateAntiAliasing(object sender, ReactiveEventArgs<AntiAliasing> e)
{
_renderer?.Window?.SetAntiAliasing((Graphics.GAL.AntiAliasing)e.NewValue);
}
@@ -419,7 +422,7 @@ namespace Ryujinx.Ava
}
_isStopped = true;
- _isActive = false;
+ _isActive = false;
}
public void DisposeContext()
@@ -448,16 +451,16 @@ namespace Ryujinx.Ava
{
if (Device.Processes != null)
{
- _viewModel.UpdateGameMetadata(Device.Processes.ActiveApplication.ProgramIdText);
+ MainWindowViewModel.UpdateGameMetadata(Device.Processes.ActiveApplication.ProgramIdText);
}
ConfigurationState.Instance.System.IgnoreMissingServices.Event -= UpdateIgnoreMissingServicesState;
- ConfigurationState.Instance.Graphics.AspectRatio.Event -= UpdateAspectRatioState;
- ConfigurationState.Instance.System.EnableDockedMode.Event -= UpdateDockedModeState;
- ConfigurationState.Instance.System.AudioVolume.Event -= UpdateAudioVolumeState;
- ConfigurationState.Instance.Graphics.ScalingFilter.Event -= UpdateScalingFilter;
- ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event -= UpdateScalingFilterLevel;
- ConfigurationState.Instance.Graphics.AntiAliasing.Event -= UpdateAntiAliasing;
+ ConfigurationState.Instance.Graphics.AspectRatio.Event -= UpdateAspectRatioState;
+ ConfigurationState.Instance.System.EnableDockedMode.Event -= UpdateDockedModeState;
+ ConfigurationState.Instance.System.AudioVolume.Event -= UpdateAudioVolumeState;
+ ConfigurationState.Instance.Graphics.ScalingFilter.Event -= UpdateScalingFilter;
+ ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event -= UpdateScalingFilterLevel;
+ ConfigurationState.Instance.Graphics.AntiAliasing.Event -= UpdateAntiAliasing;
_topLevel.PointerMoved -= TopLevel_PointerEnterOrMoved;
_topLevel.PointerEnter -= TopLevel_PointerEnterOrMoved;
@@ -477,7 +480,7 @@ namespace Ryujinx.Ava
_windowsMultimediaTimerResolution = null;
}
- if (_rendererHost.EmbeddedWindow is EmbeddedWindowOpenGL openGlWindow)
+ if (RendererHost.EmbeddedWindow is EmbeddedWindowOpenGL openGlWindow)
{
// Try to bind the OpenGL context before calling the shutdown event.
openGlWindow.MakeCurrent(false, false);
@@ -508,7 +511,7 @@ namespace Ryujinx.Ava
SystemVersion firmwareVersion = ContentManager.GetCurrentFirmwareVersion();
- if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+ if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
if (!SetupValidator.CanStartApplication(ContentManager, ApplicationPath, out UserError userError))
{
@@ -526,7 +529,7 @@ namespace Ryujinx.Ava
if (result != UserResult.Yes)
{
- await UserErrorDialog.ShowUserErrorDialog(userError, (desktop.MainWindow as MainWindow));
+ await UserErrorDialog.ShowUserErrorDialog(userError);
Device.Dispose();
return false;
@@ -535,7 +538,7 @@ namespace Ryujinx.Ava
if (!SetupValidator.TryFixStartApplication(ContentManager, ApplicationPath, userError, out _))
{
- await UserErrorDialog.ShowUserErrorDialog(userError, (desktop.MainWindow as MainWindow));
+ await UserErrorDialog.ShowUserErrorDialog(userError);
Device.Dispose();
return false;
@@ -558,7 +561,7 @@ namespace Ryujinx.Ava
}
else
{
- await UserErrorDialog.ShowUserErrorDialog(userError, (desktop.MainWindow as MainWindow));
+ await UserErrorDialog.ShowUserErrorDialog(userError);
Device.Dispose();
return false;
@@ -727,7 +730,7 @@ namespace Ryujinx.Ava
{
renderer = new VulkanRenderer(
Vk.GetApi(),
- (_rendererHost.EmbeddedWindow as EmbeddedWindowVulkan).CreateSurface,
+ (RendererHost.EmbeddedWindow as EmbeddedWindowVulkan).CreateSurface,
VulkanHelper.GetRequiredInstanceExtensions,
ConfigurationState.Instance.Graphics.PreferredGpu.Value);
}
@@ -738,18 +741,18 @@ namespace Ryujinx.Ava
BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading;
- var isGALthreaded = threadingMode == BackendThreading.On || (threadingMode == BackendThreading.Auto && renderer.PreferThreading);
- if (isGALthreaded)
+ var isGALThreaded = threadingMode == BackendThreading.On || (threadingMode == BackendThreading.Auto && renderer.PreferThreading);
+ if (isGALThreaded)
{
renderer = new ThreadedRenderer(renderer);
}
- Logger.Info?.PrintMsg(LogClass.Gpu, $"Backend Threading ({threadingMode}): {isGALthreaded}");
+ Logger.Info?.PrintMsg(LogClass.Gpu, $"Backend Threading ({threadingMode}): {isGALThreaded}");
// Initialize Configuration.
- var memoryConfiguration = ConfigurationState.Instance.System.ExpandRam.Value ? HLE.MemoryConfiguration.MemoryConfiguration6GiB : HLE.MemoryConfiguration.MemoryConfiguration4GiB;
+ var memoryConfiguration = ConfigurationState.Instance.System.ExpandRam.Value ? MemoryConfiguration.MemoryConfiguration6GiB : MemoryConfiguration.MemoryConfiguration4GiB;
- HLE.HLEConfiguration configuration = new(VirtualFileSystem,
+ HLEConfiguration configuration = new(VirtualFileSystem,
_viewModel.LibHacHorizonManager,
ContentManager,
_accountManager,
@@ -780,12 +783,12 @@ namespace Ryujinx.Ava
private static IHardwareDeviceDriver InitializeAudio()
{
- var availableBackends = new List<AudioBackend>()
+ var availableBackends = new List<AudioBackend>
{
AudioBackend.SDL2,
AudioBackend.SoundIo,
AudioBackend.OpenAl,
- AudioBackend.Dummy
+ AudioBackend.Dummy,
};
AudioBackend preferredBackend = ConfigurationState.Instance.System.AudioBackend.Value;
@@ -806,12 +809,10 @@ namespace Ryujinx.Ava
{
return new T();
}
- else
- {
- Logger.Warning?.Print(LogClass.Audio, $"{backend} is not supported, falling back to {nextBackend}.");
- return null;
- }
+ Logger.Warning?.Print(LogClass.Audio, $"{backend} is not supported, falling back to {nextBackend}.");
+
+ return null;
}
IHardwareDeviceDriver deviceDriver = null;
@@ -819,14 +820,14 @@ namespace Ryujinx.Ava
for (int i = 0; i < availableBackends.Count; i++)
{
AudioBackend currentBackend = availableBackends[i];
- AudioBackend nextBackend = i + 1 < availableBackends.Count ? availableBackends[i + 1] : AudioBackend.Dummy;
+ AudioBackend nextBackend = i + 1 < availableBackends.Count ? availableBackends[i + 1] : AudioBackend.Dummy;
deviceDriver = currentBackend switch
{
- AudioBackend.SDL2 => InitializeAudioBackend<SDL2HardwareDeviceDriver>(AudioBackend.SDL2, nextBackend),
+ AudioBackend.SDL2 => InitializeAudioBackend<SDL2HardwareDeviceDriver>(AudioBackend.SDL2, nextBackend),
AudioBackend.SoundIo => InitializeAudioBackend<SoundIoHardwareDeviceDriver>(AudioBackend.SoundIo, nextBackend),
- AudioBackend.OpenAl => InitializeAudioBackend<OpenALHardwareDeviceDriver>(AudioBackend.OpenAl, nextBackend),
- _ => new DummyHardwareDeviceDriver()
+ AudioBackend.OpenAl => InitializeAudioBackend<OpenALHardwareDeviceDriver>(AudioBackend.OpenAl, nextBackend),
+ _ => new DummyHardwareDeviceDriver(),
};
if (deviceDriver != null)
@@ -843,7 +844,7 @@ namespace Ryujinx.Ava
private void Window_SizeChanged(object sender, Size e)
{
- Width = (int)e.Width;
+ Width = (int)e.Width;
Height = (int)e.Height;
SetRendererWindowSize(e);
@@ -879,7 +880,7 @@ namespace Ryujinx.Ava
_renderer.ScreenCaptured += Renderer_ScreenCaptured;
- (_rendererHost.EmbeddedWindow as EmbeddedWindowOpenGL)?.InitializeBackgroundContext(_renderer);
+ (RendererHost.EmbeddedWindow as EmbeddedWindowOpenGL)?.InitializeBackgroundContext(_renderer);
Device.Gpu.Renderer.Initialize(_glLogLevel);
@@ -887,8 +888,8 @@ namespace Ryujinx.Ava
_renderer?.Window?.SetScalingFilter((Graphics.GAL.ScalingFilter)ConfigurationState.Instance.Graphics.ScalingFilter.Value);
_renderer?.Window?.SetScalingFilterLevel(ConfigurationState.Instance.Graphics.ScalingFilterLevel.Value);
- Width = (int)_rendererHost.Bounds.Width;
- Height = (int)_rendererHost.Bounds.Height;
+ Width = (int)RendererHost.Bounds.Width;
+ Height = (int)RendererHost.Bounds.Height;
_renderer.Window.SetSize((int)(Width * _topLevel.PlatformImpl.RenderScaling), (int)(Height * _topLevel.PlatformImpl.RenderScaling));
@@ -923,7 +924,7 @@ namespace Ryujinx.Ava
_viewModel.SwitchToRenderer(false);
}
- Device.PresentFrame(() => (_rendererHost.EmbeddedWindow as EmbeddedWindowOpenGL)?.SwapBuffers());
+ Device.PresentFrame(() => (RendererHost.EmbeddedWindow as EmbeddedWindowOpenGL)?.SwapBuffers());
}
if (_ticks >= _ticksPerFrame)
@@ -941,7 +942,7 @@ namespace Ryujinx.Ava
_gpuDoneEvent.Set();
});
- (_rendererHost.EmbeddedWindow as EmbeddedWindowOpenGL)?.MakeCurrent(true);
+ (RendererHost.EmbeddedWindow as EmbeddedWindowOpenGL)?.MakeCurrent(true);
}
public void UpdateStatus()
@@ -1175,4 +1176,4 @@ namespace Ryujinx.Ava
return state;
}
}
-} \ No newline at end of file
+}