mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-03-01 16:10:53 +01:00
misc: chore: Add warning logs for invalid ips patch attempts
This commit is contained in:
parent
10d20c1ae3
commit
534f92506b
@ -71,16 +71,24 @@ namespace Ryujinx.HLE.Loaders.Mods
|
||||
int patchOffset = (int)offset;
|
||||
int patchSize = patch.Length;
|
||||
|
||||
if (patchOffset < protectedOffset || patchOffset > memory.Length)
|
||||
if (patchOffset < protectedOffset)
|
||||
{
|
||||
continue; // Add warning?
|
||||
Logger.Warning?.Print(LogClass.ModLoader, $"Attempted to patch protected memory ({patchOffset:x} is within protected boundary of {protectedOffset:x}).");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (patchOffset > memory.Length)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.ModLoader, $"Attempted to patch out of bounds memory (offset {patchOffset} ({patchOffset:x}) exceeds memory buffer length {memory.Length}).");
|
||||
continue;
|
||||
}
|
||||
|
||||
patchOffset -= protectedOffset;
|
||||
|
||||
if (patchOffset + patchSize > memory.Length)
|
||||
{
|
||||
patchSize = memory.Length - patchOffset; // Add warning?
|
||||
Logger.Warning?.Print(LogClass.ModLoader, $"Patch offset ({patchOffset:x}) + size ({patchSize}) is greater than the size of the memory buffer ({memory.Length}). Attempting to fix this...");
|
||||
patchSize = memory.Length - patchOffset;
|
||||
}
|
||||
|
||||
Logger.Info?.Print(LogClass.ModLoader, $"Patching address offset {patchOffset:x} <= {BitConverter.ToString(patch).Replace('-', ' ')} len={patchSize}");
|
||||
|
Loading…
x
Reference in New Issue
Block a user