misc: Overhaul DirtyHacks saving to support storing a value alongside an off/off flag.

This commit is contained in:
Evan Husted 2024-12-29 21:17:01 -06:00
parent f5ce539de9
commit f362bef43d
13 changed files with 190 additions and 27 deletions

View file

@ -66,6 +66,8 @@ namespace Ryujinx.Ava.UI.ViewModels
private string _ldnServer;
private bool _xc2MenuSoftlockFix = ConfigurationState.Instance.Hacks.Xc2MenuSoftlockFix;
private bool _shaderTranslationThreadSleep = ConfigurationState.Instance.Hacks.EnableShaderCompilationThreadSleep;
private int _shaderTranslationSleepDelay = ConfigurationState.Instance.Hacks.ShaderCompilationThreadSleepDelay;
public int ResolutionScale
{
@ -287,6 +289,28 @@ namespace Ryujinx.Ava.UI.ViewModels
OnPropertyChanged();
}
}
public bool ShaderTranslationDelayEnabled
{
get => _shaderTranslationThreadSleep;
set
{
_shaderTranslationThreadSleep = value;
OnPropertyChanged();
}
}
public int ShaderTranslationDelay
{
get => _shaderTranslationSleepDelay;
set
{
_shaderTranslationSleepDelay = value;
OnPropertyChanged();
}
}
public int Language { get; set; }
public int Region { get; set; }
@ -763,6 +787,8 @@ namespace Ryujinx.Ava.UI.ViewModels
// Dirty Hacks
config.Hacks.Xc2MenuSoftlockFix.Value = Xc2MenuSoftlockFixEnabled;
config.Hacks.EnableShaderCompilationThreadSleep.Value = ShaderTranslationDelayEnabled;
config.Hacks.ShaderCompilationThreadSleepDelay.Value = ShaderTranslationDelay;
config.ToFileFormat().SaveConfig(Program.ConfigurationPath);
@ -809,5 +835,11 @@ namespace Ryujinx.Ava.UI.ViewModels
"there is a low chance that the game will softlock, " +
"the submenu won't show up, while background music is still there.");
});
public static string ShaderTranslationDelayTooltip { get; } = Lambda.String(sb =>
{
sb.Append(
"This hack applies the delay you specify every time shaders are attempted to be translated.");
});
}
}

View file

@ -42,6 +42,33 @@
VerticalAlignment="Center"
Text="Xenoblade Chronicles 2 Menu Softlock Fix" />
</StackPanel>
<Separator/>
<StackPanel
Margin="0,10,0,0"
Orientation="Horizontal"
HorizontalAlignment="Center"
ToolTip.Tip="{Binding ShaderTranslationDelayTooltip}">
<CheckBox
Margin="0"
IsChecked="{Binding ShaderTranslationDelayEnabled}"/>
<TextBlock VerticalAlignment="Center"
Text="Arbitrary Delay on Shader Translation"/>
</StackPanel>
<Slider HorizontalAlignment="Center"
Value="{Binding ShaderTranslationDelay}"
ToolTip.Tip="{Binding ShaderTranslationDelay}"
Width="175"
Margin="0,-3,0,0"
Height="32"
Padding="0,-5"
TickFrequency="1"
IsSnapToTickEnabled="True"
LargeChange="10"
SmallChange="1"
VerticalAlignment="Center"
Minimum="1"
Maximum="1000" />
<Separator/>
</StackPanel>
</Border>
</ScrollViewer>