diff --git a/src/ARMeilleure/Optimizations.cs b/src/ARMeilleure/Optimizations.cs index 8fe478e47..0536302e8 100644 --- a/src/ARMeilleure/Optimizations.cs +++ b/src/ARMeilleure/Optimizations.cs @@ -5,6 +5,9 @@ namespace ARMeilleure public static class Optimizations { + // low-core count PPTC + public static bool EcoFriendly { get; set; } = false; + public static bool FastFP { get; set; } = true; public static bool AllowLcqInFunctionTable { get; set; } = true; diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs index 5aa464310..c09588392 100644 --- a/src/ARMeilleure/Translation/PTC/Ptc.cs +++ b/src/ARMeilleure/Translation/PTC/Ptc.cs @@ -795,10 +795,15 @@ namespace ARMeilleure.Translation.PTC return; } + + int degreeOfParallelism = Environment.ProcessorCount; + if (Optimizations.EcoFriendly) + degreeOfParallelism /= 3; + // If there are enough cores lying around, we leave one alone for other tasks. - if (degreeOfParallelism > 4) + if (degreeOfParallelism > 4 && !Optimizations.EcoFriendly) { degreeOfParallelism--; } diff --git a/src/Ryujinx.Graphics.Vulkan/MemoryAllocator.cs b/src/Ryujinx.Graphics.Vulkan/MemoryAllocator.cs index 339754db1..a28322a25 100644 --- a/src/Ryujinx.Graphics.Vulkan/MemoryAllocator.cs +++ b/src/Ryujinx.Graphics.Vulkan/MemoryAllocator.cs @@ -76,9 +76,7 @@ namespace Ryujinx.Graphics.Vulkan } } - internal int FindSuitableMemoryTypeIndex( - uint memoryTypeBits, - MemoryPropertyFlags flags) + internal int FindSuitableMemoryTypeIndex(uint memoryTypeBits, MemoryPropertyFlags flags) { for (int i = 0; i < _physicalDevice.PhysicalDeviceMemoryProperties.MemoryTypeCount; i++) { diff --git a/src/Ryujinx.Headless.SDL2/StatusUpdatedEventArgs.cs b/src/Ryujinx.Headless.SDL2/StatusUpdatedEventArgs.cs index 0b199d128..cd7715712 100644 --- a/src/Ryujinx.Headless.SDL2/StatusUpdatedEventArgs.cs +++ b/src/Ryujinx.Headless.SDL2/StatusUpdatedEventArgs.cs @@ -2,23 +2,20 @@ using System; namespace Ryujinx.Headless.SDL2 { - class StatusUpdatedEventArgs : EventArgs + class StatusUpdatedEventArgs( + bool vSyncEnabled, + string dockedMode, + string aspectRatio, + string gameStatus, + string fifoStatus, + string gpuName) + : EventArgs { - public bool VSyncEnabled; - public string DockedMode; - public string AspectRatio; - public string GameStatus; - public string FifoStatus; - public string GpuName; - - public StatusUpdatedEventArgs(bool vSyncEnabled, string dockedMode, string aspectRatio, string gameStatus, string fifoStatus, string gpuName) - { - VSyncEnabled = vSyncEnabled; - DockedMode = dockedMode; - AspectRatio = aspectRatio; - GameStatus = gameStatus; - FifoStatus = fifoStatus; - GpuName = gpuName; - } + public bool VSyncEnabled = vSyncEnabled; + public string DockedMode = dockedMode; + public string AspectRatio = aspectRatio; + public string GameStatus = gameStatus; + public string FifoStatus = fifoStatus; + public string GpuName = gpuName; } } diff --git a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs index bc0a7e660..08eacc4ee 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs @@ -12,16 +12,9 @@ namespace Ryujinx.Input.SDL2 { class SDL2Keyboard : IKeyboard { - private class ButtonMappingEntry + private readonly record struct ButtonMappingEntry(GamepadButtonInputId To, Key From) { - public readonly GamepadButtonInputId To; - public readonly Key From; - - public ButtonMappingEntry(GamepadButtonInputId to, Key from) - { - To = to; - From = from; - } + public bool IsValid => To is not GamepadButtonInputId.Unbound && From is not Key.Unbound; } private readonly object _userMappingLock = new(); diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs index 77c4c4260..5f3c1e21e 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs @@ -15,7 +15,7 @@ namespace Ryujinx.UI.Common.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 52; + public const int CurrentVersion = 53; /// /// Version of the configuration file format @@ -207,6 +207,11 @@ namespace Ryujinx.UI.Common.Configuration /// public bool EnablePtc { get; set; } + /// + /// Enables or disables low-power profiled translation cache persistency loading + /// + public bool EnableLowPowerPtc { get; set; } + /// /// Enables or disables guest Internet access /// diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index ceb9728d5..de33595ea 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -327,6 +327,11 @@ namespace Ryujinx.UI.Common.Configuration /// public ReactiveObject EnablePtc { get; private set; } + /// + /// Enables or disables low-power profiled translation cache persistency loading + /// + public ReactiveObject EnableLowPowerPtc { get; private set; } + /// /// Enables or disables guest Internet access /// @@ -382,6 +387,8 @@ namespace Ryujinx.UI.Common.Configuration EnableDockedMode.Event += static (sender, e) => LogValueChange(e, nameof(EnableDockedMode)); EnablePtc = new ReactiveObject(); EnablePtc.Event += static (sender, e) => LogValueChange(e, nameof(EnablePtc)); + EnableLowPowerPtc = new ReactiveObject(); + EnableLowPowerPtc.Event += static (sender, e) => LogValueChange(e, nameof(EnableLowPowerPtc)); EnableInternetAccess = new ReactiveObject(); EnableInternetAccess.Event += static (sender, e) => LogValueChange(e, nameof(EnableInternetAccess)); EnableFsIntegrityChecks = new ReactiveObject(); @@ -706,6 +713,7 @@ namespace Ryujinx.UI.Common.Configuration EnableMacroHLE = Graphics.EnableMacroHLE, EnableColorSpacePassthrough = Graphics.EnableColorSpacePassthrough, EnablePtc = System.EnablePtc, + EnableLowPowerPtc = System.EnableLowPowerPtc, EnableInternetAccess = System.EnableInternetAccess, EnableFsIntegrityChecks = System.EnableFsIntegrityChecks, FsGlobalAccessLogMode = System.FsGlobalAccessLogMode, @@ -1495,6 +1503,15 @@ namespace Ryujinx.UI.Common.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 53) + { + Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 53."); + + configurationFileFormat.EnableLowPowerPtc = false; + + configurationFileUpdated = true; + } + Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog; Graphics.ResScale.Value = configurationFileFormat.ResScale; Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom; @@ -1534,6 +1551,7 @@ namespace Ryujinx.UI.Common.Configuration Graphics.EnableMacroHLE.Value = configurationFileFormat.EnableMacroHLE; Graphics.EnableColorSpacePassthrough.Value = configurationFileFormat.EnableColorSpacePassthrough; System.EnablePtc.Value = configurationFileFormat.EnablePtc; + System.EnableLowPowerPtc.Value = configurationFileFormat.EnableLowPowerPtc; System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess; System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks; System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode; diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index c27e70313..82ed4e0ff 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -406,6 +406,8 @@ namespace Ryujinx.Ava public void Start() { + ARMeilleure.Optimizations.EcoFriendly = ConfigurationState.Instance.System.EnableLowPowerPtc; + if (OperatingSystem.IsWindows()) { _windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1); diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 717d3b0ac..9171081a0 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -150,6 +150,7 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnableMouse { get; set; } public bool EnableVsync { get; set; } public bool EnablePptc { get; set; } + public bool EnableLowPowerPptc { get; set; } public bool EnableInternetAccess { get; set; } public bool EnableFsIntegrityChecks { get; set; } public bool IgnoreMissingServices { get; set; } @@ -448,6 +449,7 @@ namespace Ryujinx.Ava.UI.ViewModels // CPU EnablePptc = config.System.EnablePtc; + EnableLowPowerPptc = config.System.EnableLowPowerPtc; MemoryMode = (int)config.System.MemoryManagerMode.Value; UseHypervisor = config.System.UseHypervisor; @@ -548,6 +550,7 @@ namespace Ryujinx.Ava.UI.ViewModels // CPU config.System.EnablePtc.Value = EnablePptc; + config.System.EnableLowPowerPtc.Value = EnableLowPowerPptc; config.System.MemoryManagerMode.Value = (MemoryManagerMode)MemoryMode; config.System.UseHypervisor.Value = UseHypervisor; diff --git a/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml index c74d3dd57..9670199a0 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml @@ -1,4 +1,4 @@ - + + +