Fix Crash TMNT Shredder's Revenges

merge-requests/117/head
Vova 2025-08-20 20:25:30 +10:00 committed by GreemDev
parent 7319a2dafc
commit 86179dbeaf
7 changed files with 55 additions and 2 deletions

View File

@ -10,7 +10,8 @@ namespace Ryujinx.Common.Configuration
{
Xc2MenuSoftlockFix = 1,
// ShaderTranslationDelay = 2
NifmServiceDisableIsAnyInternetRequestAccepted = 3
NifmServiceDisableIsAnyInternetRequestAccepted = 3,
TMNT_SRFix = 4
}
public readonly struct EnabledDirtyHack(DirtyHack hack, int value)

View File

@ -1,4 +1,5 @@
using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Cpu;
using Ryujinx.HLE.Exceptions;
@ -12,6 +13,7 @@ using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostDbgGpu;
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostProfGpu;
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap;
using Ryujinx.HLE.HOS.Services.Nv.Types;
using Ryujinx.HLE.HOS.Tamper.Operations;
using Ryujinx.Memory;
using System;
using System.Collections.Generic;
@ -46,6 +48,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv
{ "/dev/nvhost-dbg-gpu", typeof(NvHostDbgGpuDeviceFile) },
{ "/dev/nvhost-prof-gpu", typeof(NvHostProfGpuDeviceFile) },
};
private const string TMNT_SRTitleId = "0100fe701475a000";
private static bool IsTMNT_SR => TitleIDs.CurrentApplication.Value.OrDefault() is TMNT_SRTitleId;
public static IdDictionary DeviceFileIdRegistry = new();
@ -248,6 +254,19 @@ namespace Ryujinx.HLE.HOS.Services.Nv
int fd = context.RequestData.ReadInt32();
NvIoctl ioctlCommand = context.RequestData.ReadStruct<NvIoctl>();
if (context.Device.DirtyHacks.IsEnabled(DirtyHack.TMNT_SRFix) && IsTMNT_SR)
{
// Fix emulator crash before splash screen for
// TMNT Shredder's Revenges
if ((ioctlCommand.Type == NvIoctl.NvMapCustomMagic && (ioctlCommand.Number == 0x05 || ioctlCommand.Number == 0x09)) ||
(ioctlCommand.Type == NvIoctl.NvGpuAsMagic && (ioctlCommand.Number == 0x05 || ioctlCommand.Number == 0x06)))
{
System.Threading.Thread.Sleep(50);
Logger.Notice.Print(LogClass.ServiceNv, $"Type_{ioctlCommand.Type}, Command_{ioctlCommand.Number} Delay!");
}
}
errorCode = GetIoctlArgument(context, ioctlCommand, out Span<byte> arguments);
if (errorCode == NvResult.Success)

View File

@ -166,6 +166,7 @@ namespace Ryujinx.Ava.Systems.Configuration
DirtyHacks hacks = new(cff.DirtyHacks ?? []);
Hacks.Xc2MenuSoftlockFix.Value = hacks.IsEnabled(DirtyHack.Xc2MenuSoftlockFix);
Hacks.TMNT_SRFix.Value = hacks.IsEnabled(DirtyHack.TMNT_SRFix);
}

View File

@ -743,6 +743,8 @@ namespace Ryujinx.Ava.Systems.Configuration
public ReactiveObject<bool> Xc2MenuSoftlockFix { get; private set; }
public ReactiveObject<bool> TMNT_SRFix { get; private set; }
public ReactiveObject<bool> DisableNifmIsAnyInternetRequestAccepted { get; private set; }
public HacksSection()
@ -752,6 +754,8 @@ namespace Ryujinx.Ava.Systems.Configuration
Xc2MenuSoftlockFix.Event += HackChanged;
DisableNifmIsAnyInternetRequestAccepted = new ReactiveObject<bool>();
DisableNifmIsAnyInternetRequestAccepted.Event += HackChanged;
TMNT_SRFix = new ReactiveObject<bool>();
TMNT_SRFix.Event += HackChanged;
}
private void HackChanged(object sender, ReactiveEventArgs<bool> rxe)
@ -785,6 +789,9 @@ namespace Ryujinx.Ava.Systems.Configuration
if (DisableNifmIsAnyInternetRequestAccepted)
Apply(DirtyHack.NifmServiceDisableIsAnyInternetRequestAccepted);
if (TMNT_SRFix)
Apply(DirtyHack.TMNT_SRFix);
return enabledHacks.ToArray();
void Apply(DirtyHack hack, int value = 0)

View File

@ -17,7 +17,7 @@ namespace Ryujinx.Ava.UI.ViewModels
[ObservableProperty] private bool _xc2MenuSoftlockFix = ConfigurationState.Instance.Hacks.Xc2MenuSoftlockFix;
[ObservableProperty] private bool _nifmDisableIsAnyInternetRequestAccepted = ConfigurationState.Instance.Hacks.DisableNifmIsAnyInternetRequestAccepted;
[ObservableProperty] private bool _TMNT_SRFix = ConfigurationState.Instance.Hacks.TMNT_SRFix;
public static string Xc2MenuFixTooltip { get; } = Lambda.String(sb =>
{
sb.AppendLine(
@ -39,5 +39,15 @@ namespace Ryujinx.Ava.UI.ViewModels
sb.Append("Lets DOOM 2016 go in game.");
});
public static string TMNT_SRFixTooltip { get; } = Lambda.String(sb =>
{
sb.AppendLine(
"This fix adds an extra 50 ms to some Ioctl service calls. This prevents the game from crashing when the cutscene starts.")
.AppendLine();
sb.Append(
"Just give the game some time to properly interact with guest memory");
});
}
}

View File

@ -856,6 +856,7 @@ namespace Ryujinx.Ava.UI.ViewModels
config.Hacks.Xc2MenuSoftlockFix.Value = DirtyHacks.Xc2MenuSoftlockFix;
config.Hacks.DisableNifmIsAnyInternetRequestAccepted.Value =
DirtyHacks.NifmDisableIsAnyInternetRequestAccepted;
config.Hacks.TMNT_SRFix.Value = DirtyHacks.TMNT_SRFix;
config.ToFileFormat().SaveConfig(Program.ConfigurationPath);

View File

@ -55,6 +55,20 @@
VerticalAlignment="Center"
Text="Disable IsAnyInternetRequestAccepted" />
</StackPanel>
<Separator/>
<StackPanel
Margin="0,10,0,0"
Orientation="Horizontal"
HorizontalAlignment="Center"
ToolTip.Tip="{Binding DirtyHacks.TMNT_SRFixTooltip}">
<CheckBox
Margin="0"
IsChecked="{Binding DirtyHacks.TMNT_SRFix}"/>
<TextBlock
VerticalAlignment="Center"
Text="TMNT Shredder's Revenges Fix" />
</StackPanel>
<Separator/>
</StackPanel>
</Border>
</ScrollViewer>