added toggle in UI

This commit is contained in:
Max 2026-05-17 20:58:54 -04:00
parent 5a6b328d13
commit d9bc9efe3d
8 changed files with 103 additions and 4 deletions

View file

@ -200,6 +200,31 @@
"zh_TW": "使用 Hypervisor"
}
},
{
"ID": "SettingsTabSystemGCLowLatency",
"Translations": {
"ar_SA": "",
"de_DE": "",
"el_GR": "",
"en_US": "Use Low-latency Garbage Collector",
"es_ES": "Usa recolección de basura de baja latencia",
"fr_FR": "",
"he_IL": "",
"it_IT": "",
"ja_JP": "",
"ko_KR": "",
"no_NO": "",
"pl_PL": "",
"pt_BR": "",
"ru_RU": "",
"sv_SE": "",
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_TW": ""
}
},
{
"ID": "MenuBarFile",
"Translations": {
@ -16500,6 +16525,31 @@
"zh_TW": "變更客體記憶體的映射和存取方式。這會極大地影響模擬 CPU 效能。\n\n如果不確定請設定為主體略過檢查模式。"
}
},
{
"ID": "GCLowLatencyTooltip",
"Translations": {
"ar_SA": "",
"de_DE": "",
"el_GR": "",
"en_US": "Sets the garbage collector for the CLR to low-latency mode.\n\nThis may decrease stuttering at the cost of performance.\n\nLeave OFF if unsure.",
"es_ES": "",
"fr_FR": "",
"he_IL": "",
"it_IT": "",
"ja_JP": "",
"ko_KR": "",
"no_NO": "",
"pl_PL": "",
"pt_BR": "",
"ru_RU": "",
"sv_SE": "",
"th_TH": "",
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_TW": ""
}
},
{
"ID": "MemoryManagerSoftwareTooltip",
"Translations": {

View file

@ -580,7 +580,12 @@ namespace Ryujinx.Ava.Systems
{
_isActive = false;
_playTimer.Stop();
GCSettings.LatencyMode = GCLatencyMode.Interactive;
if (ConfigurationState.Instance.System.GCLowLatency)
{
Logger.Info?.Print(LogClass.Application, "Garbage collector set to interactive mode.");
}
}
private void Exit()
@ -664,7 +669,12 @@ namespace Ryujinx.Ava.Systems
_chrono.Stop();
_playTimer.Stop();
GCSettings.LatencyMode = GCLatencyMode.Interactive;
if (ConfigurationState.Instance.System.GCLowLatency)
{
Logger.Info?.Print(LogClass.Application, "Garbage collector set to interactive mode.");
}
}
public void DisposeGpu()
@ -918,8 +928,14 @@ namespace Ryujinx.Ava.Systems
ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText,
appMetadata => appMetadata.UpdatePreGame()
);
_playTimer.Start();
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
if (ConfigurationState.Instance.System.GCLowLatency)
{
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
Logger.Info?.Print(LogClass.Application, "Garbage collector set to low latency mode.");
}
}
internal void Resume()
@ -930,7 +946,12 @@ namespace Ryujinx.Ava.Systems
_playTimer.Start();
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowOldUI);
Logger.Info?.Print(LogClass.Emulation, "Emulation was resumed.");
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
if (ConfigurationState.Instance.System.GCLowLatency)
{
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
Logger.Info?.Print(LogClass.Application, "Garbage collector set to low latency mode.");
}
}
internal void Pause()
@ -941,7 +962,12 @@ namespace Ryujinx.Ava.Systems
_playTimer.Stop();
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowOldUI, LocaleManager.Instance[LocaleKeys.Paused]);
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused.");
GCSettings.LatencyMode = GCLatencyMode.Interactive;
if (ConfigurationState.Instance.System.GCLowLatency)
{
Logger.Info?.Print(LogClass.Application, "Garbage collector set to interactive mode.");
}
}
private void InitEmulatedSwitch()

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// <summary>
/// The current version of the file format
/// </summary>
public const int CurrentVersion = 72;
public const int CurrentVersion = 73;
/// <summary>
/// Version of the configuration file format
@ -470,6 +470,11 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Uses Hypervisor over JIT if available
/// </summary>
public bool UseHypervisor { get; set; }
/// <summary>
/// Enable or disable low-latency mode for garbage collection
/// </summary>
public bool GCLowLatency { get; set; }
/// <summary>
/// Enables or disables the GDB stub

View file

@ -112,6 +112,7 @@ namespace Ryujinx.Ava.Systems.Configuration
System.IgnoreControllerApplet.Value = cff.IgnoreApplet;
System.SkipUserProfilesManager.Value = cff.SkipUserProfiles;
System.UseHypervisor.Value = cff.UseHypervisor;
System.GCLowLatency.Value = cff.GCLowLatency;
UI.GuiColumns.FavColumn.Value = shouldLoadFromFile ? cff.GuiColumns.FavColumn : UI.GuiColumns.FavColumn.Value;
UI.GuiColumns.IconColumn.Value = shouldLoadFromFile ? cff.GuiColumns.IconColumn : UI.GuiColumns.IconColumn.Value;
@ -534,7 +535,8 @@ namespace Ryujinx.Ava.Systems.Configuration
{
if (cff.AudioBackend is AudioBackend.SDL2)
cff.AudioBackend = AudioBackend.SDL3;
})
}),
(72, static cff => cff.GCLowLatency = false)
);
}
}

View file

@ -417,6 +417,11 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Uses Hypervisor over JIT if available
/// </summary>
public ReactiveObject<bool> UseHypervisor { get; private set; }
/// <summary>
/// Enable or disable low-latency garbage collection
/// </summary>
public ReactiveObject<bool> GCLowLatency { get; private set; }
public SystemSection()
{
@ -471,6 +476,8 @@ namespace Ryujinx.Ava.Systems.Configuration
AudioVolume.LogChangesToValue(nameof(AudioVolume));
UseHypervisor = new ReactiveObject<bool>();
UseHypervisor.LogChangesToValue(nameof(UseHypervisor));
GCLowLatency = new ReactiveObject<bool>();
GCLowLatency.LogChangesToValue(nameof(GCLowLatency));
}
}

View file

@ -87,6 +87,7 @@ namespace Ryujinx.Ava.Systems.Configuration
IgnoreApplet = System.IgnoreControllerApplet,
SkipUserProfiles = System.SkipUserProfilesManager,
UseHypervisor = System.UseHypervisor,
GCLowLatency = System.GCLowLatency,
GuiColumns = new GuiColumns
{
FavColumn = UI.GuiColumns.FavColumn,

View file

@ -286,6 +286,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool IsVulkanSelected =>
GraphicsBackendIndex == 1 || (GraphicsBackendIndex == 0 && !OperatingSystem.IsMacOS());
public bool UseHypervisor { get; set; }
public bool GCLowLatency { get; set; }
public bool DisableP2P { get; set; }
public bool ShowDirtyHacks => ConfigurationState.Instance.Hacks.ShowDirtyHacks;
@ -689,6 +690,7 @@ namespace Ryujinx.Ava.UI.ViewModels
EnableLowPowerPptc = config.System.EnableLowPowerPtc;
MemoryMode = (int)config.System.MemoryManagerMode.Value;
UseHypervisor = config.System.UseHypervisor;
GCLowLatency = config.System.GCLowLatency;
TurboMultiplier = config.System.TickScalar;
// Graphics
@ -800,6 +802,7 @@ namespace Ryujinx.Ava.UI.ViewModels
config.System.EnableLowPowerPtc.Value = EnableLowPowerPptc;
config.System.MemoryManagerMode.Value = (MemoryManagerMode)MemoryMode;
config.System.UseHypervisor.Value = UseHypervisor;
config.System.GCLowLatency.Value = GCLowLatency;
config.System.TickScalar.Value = TurboMultiplier;
// Graphics

View file

@ -71,6 +71,11 @@
<TextBlock Text="{ext:Locale SettingsTabSystemUseHypervisor}"
ToolTip.Tip="{ext:Locale UseHypervisorTooltip}" />
</CheckBox>
<CheckBox
IsChecked="{Binding GCLowLatency}"
ToolTip.Tip="{ext:Locale GCLowLatencyTooltip}">
<TextBlock Text="{ext:Locale SettingsTabSystemGCLowLatency}" />
</CheckBox>
</StackPanel>
<Separator Height="1" />
<StackPanel