fix:HLE/ModLoader: Cheat loading crashes if directory doesn't exist

This commit is contained in:
Barış Hamil 2024-08-04 12:46:04 +03:00
parent 263eb97f79
commit 387d9e20f4

View File

@ -741,6 +741,11 @@ namespace Ryujinx.HLE.HOS
internal static void EnableCheats(ulong applicationId, TamperMachine tamperMachine) internal static void EnableCheats(ulong applicationId, TamperMachine tamperMachine)
{ {
var contentDirectory = FindApplicationDir(new DirectoryInfo(Path.Combine(GetModsBasePath(), AmsContentsDir)), $"{applicationId:x16}"); var contentDirectory = FindApplicationDir(new DirectoryInfo(Path.Combine(GetModsBasePath(), AmsContentsDir)), $"{applicationId:x16}");
if (contentDirectory == null)
{
return;
}
string enabledCheatsPath = Path.Combine(contentDirectory.FullName, CheatDir, "enabled.txt"); string enabledCheatsPath = Path.Combine(contentDirectory.FullName, CheatDir, "enabled.txt");
if (File.Exists(enabledCheatsPath)) if (File.Exists(enabledCheatsPath))