mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-23 10:21:55 +01:00
973d8b2005
*Converted every 4 spaces to a tab to make the source consistent on those
20 lines
407 B
C
20 lines
407 B
C
#include <string.h>
|
|
#include <gctypes.h>
|
|
|
|
bool PatchDOL(u8 * Address, int Size, const u8 * SearchPattern, int SearchSize, const u8 * PatchData, int PatchSize)
|
|
{
|
|
u8 * Addr = Address;
|
|
u8 * Addr_end = Address + Size;
|
|
|
|
while (Addr <= Addr_end - SearchSize)
|
|
{
|
|
if (memcmp(Addr, SearchPattern, SearchSize) == 0)
|
|
{
|
|
memcpy(Addr, PatchData, PatchSize);
|
|
return true;
|
|
}
|
|
Addr += 4;
|
|
}
|
|
return false;
|
|
}
|