SettingsHacksViewModel.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using CommunityToolkit.Mvvm.ComponentModel;
  2. using Gommon;
  3. using Ryujinx.Ava.Utilities.Configuration;
  4. namespace Ryujinx.Ava.UI.ViewModels
  5. {
  6. public partial class SettingsHacksViewModel : BaseModel
  7. {
  8. private readonly SettingsViewModel _baseViewModel;
  9. public SettingsHacksViewModel() {}
  10. public SettingsHacksViewModel(SettingsViewModel settingsVm)
  11. {
  12. _baseViewModel = settingsVm;
  13. }
  14. [ObservableProperty] private bool _xc2MenuSoftlockFix = ConfigurationState.Instance.Hacks.Xc2MenuSoftlockFix;
  15. [ObservableProperty] private bool _shaderTranslationDelayEnabled = ConfigurationState.Instance.Hacks.EnableShaderTranslationDelay;
  16. private int _shaderTranslationSleepDelay = ConfigurationState.Instance.Hacks.ShaderTranslationDelay;
  17. public string ShaderTranslationDelayValueText => $"{ShaderTranslationDelay}ms";
  18. public int ShaderTranslationDelay
  19. {
  20. get => _shaderTranslationSleepDelay;
  21. set
  22. {
  23. _shaderTranslationSleepDelay = value;
  24. OnPropertiesChanged(nameof(ShaderTranslationDelay), nameof(ShaderTranslationDelayValueText));
  25. }
  26. }
  27. public static string Xc2MenuFixTooltip { get; } = Lambda.String(sb =>
  28. {
  29. sb.AppendLine(
  30. "This fix applies a 2ms delay (via 'Thread.Sleep(2)') every time the game tries to read data from the emulated Switch filesystem.")
  31. .AppendLine();
  32. sb.AppendLine("From the issue on GitHub:").AppendLine();
  33. sb.Append(
  34. "When clicking very fast from game main menu to 2nd submenu, " +
  35. "there is a low chance that the game will softlock, " +
  36. "the submenu won't show up, while background music is still there.");
  37. });
  38. public static string ShaderTranslationDelayTooltip { get; } = Lambda.String(sb =>
  39. {
  40. sb.AppendLine("This hack applies the delay you specify every time shaders are attempted to be translated.")
  41. .AppendLine();
  42. sb.Append("Configurable via slider, only when this option is enabled.");
  43. });
  44. }
  45. }