diff --git a/src/Ryujinx.HLE/HOS/ModLoader.cs b/src/Ryujinx.HLE/HOS/ModLoader.cs index b6cfb6578..f9bef49a0 100644 --- a/src/Ryujinx.HLE/HOS/ModLoader.cs +++ b/src/Ryujinx.HLE/HOS/ModLoader.cs @@ -749,8 +749,28 @@ namespace Ryujinx.HLE.HOS } List cheats = mods.Cheats; - Dictionary processExes = tamperInfo.BuildIds.Zip(tamperInfo.CodeAddresses, (k, v) => new { k, v }) - .ToDictionary(x => x.k[..Math.Min(Cheat.CheatIdSize, x.k.Length)], x => x.v); + Dictionary processExes = new(); + + foreach ((string buildId, ulong codeAddress) in tamperInfo.BuildIds.Zip(tamperInfo.CodeAddresses)) + { + string normalizedBuildId = buildId[..Math.Min(Cheat.CheatIdSize, buildId.Length)]; + + if (processExes.TryGetValue(normalizedBuildId, out ulong existingAddress)) + { + if (existingAddress != codeAddress) + { + Logger.Warning?.Print( + LogClass.ModLoader, + $"Duplicate BuildId prefix '{normalizedBuildId}' has different code addresses. " + + $"Existing: 0x{existingAddress:X}, duplicate: 0x{codeAddress:X}. " + + $"Keeping the first one."); + } + + continue; + } + + processExes.Add(normalizedBuildId, codeAddress); + } foreach (Cheat cheat in cheats) {