From 0db85d0aa983b8e4093f02b157c3563582326160 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Wed, 5 Mar 2025 23:57:48 -0600 Subject: [PATCH] HLE: optional hack: disable IsAnyInternetRequestAccepted --- src/Ryujinx.Common/Configuration/DirtyHack.cs | 3 ++- .../HOS/Services/Nifm/IStaticService.cs | 4 ++-- .../Services/Nifm/StaticService/IGeneralService.cs | 5 +++-- .../Configuration/ConfigurationState.Migration.cs | 4 +--- .../Configuration/ConfigurationState.Model.cs | 13 +++++-------- .../UI/ViewModels/SettingsHacksViewModel.cs | 12 +++++++++++- src/Ryujinx/UI/ViewModels/SettingsViewModel.cs | 2 ++ .../UI/Views/Settings/SettingsHacksView.axaml | 14 +++++++++++++- 8 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/Ryujinx.Common/Configuration/DirtyHack.cs b/src/Ryujinx.Common/Configuration/DirtyHack.cs index 3959c0a997..71ac88f563 100644 --- a/src/Ryujinx.Common/Configuration/DirtyHack.cs +++ b/src/Ryujinx.Common/Configuration/DirtyHack.cs @@ -9,7 +9,8 @@ namespace Ryujinx.Common.Configuration public enum DirtyHack : byte { Xc2MenuSoftlockFix = 1, - ShaderTranslationDelay = 2 + // ShaderTranslationDelay = 2 + NifmServiceDisableIsAnyInternetRequestAccepted = 3 } public readonly struct EnabledDirtyHack(DirtyHack hack, int value) diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs index 96e71cd078..d669caba1a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/IStaticService.cs @@ -13,7 +13,7 @@ public IStaticService(ServiceCtx context) { } // CreateGeneralServiceOld() -> object public ResultCode CreateGeneralServiceOld(ServiceCtx context) { - MakeObject(context, new IGeneralService()); + MakeObject(context, new IGeneralService(context)); return ResultCode.Success; } @@ -22,7 +22,7 @@ public ResultCode CreateGeneralServiceOld(ServiceCtx context) // CreateGeneralService(u64, pid) -> object public ResultCode CreateGeneralService(ServiceCtx context) { - MakeObject(context, new IGeneralService()); + MakeObject(context, new IGeneralService(context)); return ResultCode.Success; } diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index a5a822db3e..dd4efce6ee 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs @@ -1,4 +1,5 @@ using Ryujinx.Common; +using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; using Ryujinx.Common.Utilities; using Ryujinx.HLE.HOS.Services.Nifm.StaticService.GeneralService; @@ -17,12 +18,12 @@ class IGeneralService : DisposableIpcService private UnicastIPAddressInformation _targetAddressInfoCache = null; private string _cacheChosenInterface = null; - public IGeneralService() + public IGeneralService(ServiceCtx context) { _generalServiceDetail = new GeneralServiceDetail { ClientId = GeneralServiceManager.Count, - IsAnyInternetRequestAccepted = true, // NOTE: Why not accept any internet request? + IsAnyInternetRequestAccepted = !context.Device.DirtyHacks.IsEnabled(DirtyHack.NifmServiceDisableIsAnyInternetRequestAccepted), // NOTE: Why not accept any internet request? }; NetworkChange.NetworkAddressChanged += LocalInterfaceCacheHandler; diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs index 7d1313597f..b10cc39267 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs @@ -160,9 +160,7 @@ in _migrations.OrderBy(x => x.Key)) DirtyHacks hacks = new (cff.DirtyHacks ?? []); Hacks.Xc2MenuSoftlockFix.Value = hacks.IsEnabled(DirtyHack.Xc2MenuSoftlockFix); - - Hacks.EnableShaderTranslationDelay.Value = hacks.IsEnabled(DirtyHack.ShaderTranslationDelay); - Hacks.ShaderTranslationDelay.Value = hacks[DirtyHack.ShaderTranslationDelay].CoerceAtLeast(0); + } if (configurationFileUpdated) diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs index 3e607369ce..b52c624e39 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs @@ -683,18 +683,15 @@ public class HacksSection public ReactiveObject Xc2MenuSoftlockFix { get; private set; } - public ReactiveObject EnableShaderTranslationDelay { get; private set; } - - public ReactiveObject ShaderTranslationDelay { get; private set; } + public ReactiveObject DisableNifmIsAnyInternetRequestAccepted { get; private set; } public HacksSection() { ShowDirtyHacks = new ReactiveObject(); Xc2MenuSoftlockFix = new ReactiveObject(); Xc2MenuSoftlockFix.Event += HackChanged; - EnableShaderTranslationDelay = new ReactiveObject(); - EnableShaderTranslationDelay.Event += HackChanged; - ShaderTranslationDelay = new ReactiveObject(); + DisableNifmIsAnyInternetRequestAccepted = new ReactiveObject(); + DisableNifmIsAnyInternetRequestAccepted.Event += HackChanged; } private void HackChanged(object sender, ReactiveEventArgs rxe) @@ -725,8 +722,8 @@ public EnabledDirtyHack[] EnabledHacks if (Xc2MenuSoftlockFix) Apply(DirtyHack.Xc2MenuSoftlockFix); - if (EnableShaderTranslationDelay) - Apply(DirtyHack.ShaderTranslationDelay, ShaderTranslationDelay); + if (DisableNifmIsAnyInternetRequestAccepted) + Apply(DirtyHack.NifmServiceDisableIsAnyInternetRequestAccepted); return enabledHacks.ToArray(); diff --git a/src/Ryujinx/UI/ViewModels/SettingsHacksViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsHacksViewModel.cs index 816e85c98d..022b7481ea 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsHacksViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsHacksViewModel.cs @@ -16,11 +16,12 @@ public SettingsHacksViewModel(SettingsViewModel settingsVm) } [ObservableProperty] private bool _xc2MenuSoftlockFix = ConfigurationState.Instance.Hacks.Xc2MenuSoftlockFix; + [ObservableProperty] private bool _nifmDisableIsAnyInternetRequestAccepted = ConfigurationState.Instance.Hacks.DisableNifmIsAnyInternetRequestAccepted; public static string Xc2MenuFixTooltip { get; } = Lambda.String(sb => { sb.AppendLine( - "This fix applies a 2ms delay (via 'Thread.Sleep(2)') every time the game tries to read data from the emulated Switch filesystem.") + "This hack applies a 2ms delay (via 'Thread.Sleep(2)') every time the game tries to read data from the emulated Switch filesystem.") .AppendLine(); sb.AppendLine("From the issue on GitHub:").AppendLine(); @@ -29,5 +30,14 @@ public SettingsHacksViewModel(SettingsViewModel settingsVm) "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 NifmDisableIsAnyInternetRequestAcceptedTooltip { get; } = Lambda.String(sb => + { + sb.AppendLine( + "This hack simply sets 'IsAnyInternetRequestAccepted' to 'false' when initializing the Nifm IGeneralService.") + .AppendLine(); + + sb.Append("Lets DOOM 2016 go in game."); + }); } } diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 5dc5b789f1..a092e97f25 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -757,6 +757,8 @@ public void SaveSettings() // Dirty Hacks config.Hacks.Xc2MenuSoftlockFix.Value = DirtyHacks.Xc2MenuSoftlockFix; + config.Hacks.DisableNifmIsAnyInternetRequestAccepted.Value = + DirtyHacks.NifmDisableIsAnyInternetRequestAccepted; config.ToFileFormat().SaveConfig(Program.ConfigurationPath); diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHacksView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsHacksView.axaml index 4cf96366a0..229f9e866a 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHacksView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsHacksView.axaml @@ -29,7 +29,7 @@ + Text="Highly specific hacks & tricks to alleviate performance issues, crashing, or freezing. Can cause issues." /> + + + +