From 28526214ba4d72b68e3ad38116bacee399e6f7ba Mon Sep 17 00:00:00 2001 From: GreemDev Date: Sat, 29 Mar 2025 02:37:01 -0500 Subject: [PATCH] misc: chore: Simplify usages of HLEConfiguration constructor --- src/Ryujinx/Headless/HeadlessRyujinx.Init.cs | 77 ++++++---------- .../Configuration/ConfigurationState.Model.cs | 88 ++++++------------- 2 files changed, 55 insertions(+), 110 deletions(-) diff --git a/src/Ryujinx/Headless/HeadlessRyujinx.Init.cs b/src/Ryujinx/Headless/HeadlessRyujinx.Init.cs index f07d91164..0d0196748 100644 --- a/src/Ryujinx/Headless/HeadlessRyujinx.Init.cs +++ b/src/Ryujinx/Headless/HeadlessRyujinx.Init.cs @@ -312,60 +312,37 @@ namespace Ryujinx.Headless return new OpenGLRenderer(); } - + private static Switch InitializeEmulationContext(WindowBase window, IRenderer renderer, Options options) => new( + + new HleConfiguration( + options.DramSize, + options.SystemLanguage, + options.SystemRegion, + options.VSyncMode, + !options.DisableDockedMode, + !options.DisablePTC, + ITickSource.RealityTickScalar, + options.EnableInternetAccess, + !options.DisableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None, + options.FsGlobalAccessLogMode, + options.SystemTimeOffset, + options.SystemTimeZone, + options.MemoryManagerMode, #if DEBUG - new HleConfiguration( - options.DramSize, - options.SystemLanguage, - options.SystemRegion, - options.VSyncMode, - !options.DisableDockedMode, - !options.DisablePTC, - ITickSource.RealityTickScalar, - options.EnableInternetAccess, - !options.DisableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None, - options.FsGlobalAccessLogMode, - options.SystemTimeOffset, - options.SystemTimeZone, - options.MemoryManagerMode, - options.IgnoreMissingServices, - options.AspectRatio, - options.AudioVolume, - options.UseHypervisor ?? true, - options.MultiplayerLanInterfaceId, - Common.Configuration.Multiplayer.MultiplayerMode.Disabled, - false, - string.Empty, - string.Empty, - options.CustomVSyncInterval - ) -#else - new HleConfiguration( - options.DramSize, - options.SystemLanguage, - options.SystemRegion, - options.VSyncMode, - !options.DisableDockedMode, - !options.DisablePTC, - options.EnableInternetAccess, - !options.DisableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None, - options.FsGlobalAccessLogMode, - options.SystemTimeOffset, - options.SystemTimeZone, - options.MemoryManagerMode, - options.AspectRatio, - options.AudioVolume, - options.UseHypervisor ?? true, - options.MultiplayerLanInterfaceId, - Common.Configuration.Multiplayer.MultiplayerMode.Disabled, - false, - string.Empty, - string.Empty, - options.CustomVSyncInterval - ) + options.IgnoreMissingServices, #endif + options.AspectRatio, + options.AudioVolume, + options.UseHypervisor ?? true, + options.MultiplayerLanInterfaceId, + Common.Configuration.Multiplayer.MultiplayerMode.Disabled, + false, + string.Empty, + string.Empty, + options.CustomVSyncInterval + ) .Configure( _virtualFileSystem, _libHacHorizonManager, diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs index d12f285e3..316ea6480 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs @@ -843,68 +843,36 @@ namespace Ryujinx.Ava.Systems.Configuration } public HleConfiguration CreateHleConfiguration() => + new( + System.DramSize, + System.Language.Value.ToHLE(), + System.Region.Value.ToHLE(), + Graphics.VSyncMode, + System.EnableDockedMode, + System.EnablePtc, + System.TickScalar, + System.EnableInternetAccess, + System.EnableFsIntegrityChecks + ? IntegrityCheckLevel.ErrorOnInvalid + : IntegrityCheckLevel.None, + System.FsGlobalAccessLogMode, + System.MatchSystemTime + ? 0 + : System.SystemTimeOffset, + System.TimeZone, + System.MemoryManagerMode, #if DEBUG - new( - System.DramSize, - System.Language.Value.ToHLE(), - System.Region.Value.ToHLE(), - Graphics.VSyncMode, - System.EnableDockedMode, - System.EnablePtc, - System.TickScalar, - System.EnableInternetAccess, - System.EnableFsIntegrityChecks - ? IntegrityCheckLevel.ErrorOnInvalid - : IntegrityCheckLevel.None, - System.FsGlobalAccessLogMode, - System.MatchSystemTime - ? 0 - : System.SystemTimeOffset, - System.TimeZone, - System.MemoryManagerMode, CommandLineState.IgnoreMissingServices, - Graphics.AspectRatio, - System.AudioVolume, - System.UseHypervisor, - Multiplayer.LanInterfaceId, - Multiplayer.Mode, - Multiplayer.DisableP2p, - Multiplayer.LdnPassphrase, - Instance.Multiplayer.GetLdnServer(), - Instance.Graphics.CustomVSyncInterval, - Instance.Hacks.ShowDirtyHacks ? Instance.Hacks.EnabledHacks : null); -#else - new( - System.DramSize, - System.Language.Value.ToHLE(), - System.Region.Value.ToHLE(), - Graphics.VSyncMode, - System.EnableDockedMode, - System.EnablePtc, - System.TickScalar, - System.EnableInternetAccess, - System.EnableFsIntegrityChecks - ? IntegrityCheckLevel.ErrorOnInvalid - : IntegrityCheckLevel.None, - System.FsGlobalAccessLogMode, - System.MatchSystemTime - ? 0 - : System.SystemTimeOffset, - System.TimeZone, - System.MemoryManagerMode, - Graphics.AspectRatio, - System.AudioVolume, - System.UseHypervisor, - Multiplayer.LanInterfaceId, - Multiplayer.Mode, - Multiplayer.DisableP2p, - Multiplayer.LdnPassphrase, - Instance.Multiplayer.GetLdnServer(), - Instance.Graphics.CustomVSyncInterval, - Instance.Hacks.ShowDirtyHacks ? Instance.Hacks.EnabledHacks : null); #endif - Multiplayer.GetLdnServer(), - Graphics.CustomVSyncInterval, - Hacks.ShowDirtyHacks ? Hacks.EnabledHacks : null); + Graphics.AspectRatio, + System.AudioVolume, + System.UseHypervisor, + Multiplayer.LanInterfaceId, + Multiplayer.Mode, + Multiplayer.DisableP2p, + Multiplayer.LdnPassphrase, + Instance.Multiplayer.GetLdnServer(), + Instance.Graphics.CustomVSyncInterval, + Instance.Hacks.ShowDirtyHacks ? Instance.Hacks.EnabledHacks : null); } }