Small cleanup
This commit is contained in:
parent
eba56d0f64
commit
fc3a69d9ca
@ -95,16 +95,14 @@ static inline void patchNandRw(u8 *pos, u32 size, u32 branchOffset)
|
|||||||
|
|
||||||
static inline void patchMpu(u8 *pos, u32 size)
|
static inline void patchMpu(u8 *pos, u32 size)
|
||||||
{
|
{
|
||||||
const u32 mpuPatch[3] = {0x00360003, 0x00200603, 0x001C0603};
|
|
||||||
|
|
||||||
//Look for MPU pattern
|
//Look for MPU pattern
|
||||||
const u8 pattern[] = {0x03, 0x00, 0x24, 0x00};
|
const u8 pattern[] = {0x03, 0x00, 0x24, 0x00};
|
||||||
|
|
||||||
u32 *off = (u32 *)memsearch(pos, pattern, size, 4);
|
u32 *off = (u32 *)memsearch(pos, pattern, size, 4);
|
||||||
|
|
||||||
off[0] = mpuPatch[0];
|
off[0] = 0x00360003;
|
||||||
off[6] = mpuPatch[1];
|
off[6] = 0x00200603;
|
||||||
off[9] = mpuPatch[2];
|
off[9] = 0x001C0603;
|
||||||
}
|
}
|
||||||
|
|
||||||
void patchEmuNand(u8 *arm9Section, u32 arm9SectionSize, u8 *process9Offset, u32 process9Size, u32 emuHeader, u32 branchAdditive)
|
void patchEmuNand(u8 *arm9Section, u32 arm9SectionSize, u8 *process9Offset, u32 process9Size, u32 emuHeader, u32 branchAdditive)
|
||||||
|
@ -90,29 +90,25 @@ void patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr)
|
|||||||
|
|
||||||
void patchFirmWrites(u8 *pos, u32 size)
|
void patchFirmWrites(u8 *pos, u32 size)
|
||||||
{
|
{
|
||||||
const u16 writeBlock[2] = {0x2000, 0x46C0};
|
|
||||||
|
|
||||||
//Look for FIRM writing code
|
//Look for FIRM writing code
|
||||||
u8 *const off1 = memsearch(pos, "exe:", size, 4);
|
u8 *const off1 = memsearch(pos, "exe:", size, 4);
|
||||||
const u8 pattern[] = {0x00, 0x28, 0x01, 0xDA};
|
const u8 pattern[] = {0x00, 0x28, 0x01, 0xDA};
|
||||||
|
|
||||||
u16 *off2 = (u16 *)memsearch(off1 - 0x100, pattern, 0x100, 4);
|
u16 *off2 = (u16 *)memsearch(off1 - 0x100, pattern, 0x100, 4);
|
||||||
|
|
||||||
off2[0] = writeBlock[0];
|
off2[0] = 0x2000;
|
||||||
off2[1] = writeBlock[1];
|
off2[1] = 0x46C0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void patchOldFirmWrites(u8 *pos, u32 size)
|
void patchOldFirmWrites(u8 *pos, u32 size)
|
||||||
{
|
{
|
||||||
const u16 writeBlockOld[2] = {0x2400, 0xE01D};
|
|
||||||
|
|
||||||
//Look for FIRM writing code
|
//Look for FIRM writing code
|
||||||
const u8 pattern[] = {0x04, 0x1E, 0x1D, 0xDB};
|
const u8 pattern[] = {0x04, 0x1E, 0x1D, 0xDB};
|
||||||
|
|
||||||
u16 *off = (u16 *)memsearch(pos, pattern, size, 4);
|
u16 *off = (u16 *)memsearch(pos, pattern, size, 4);
|
||||||
|
|
||||||
off[0] = writeBlockOld[0];
|
off[0] = 0x2400;
|
||||||
off[1] = writeBlockOld[1];
|
off[1] = 0xE01D;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reimplementSvcBackdoor(u8 *pos, u32 *arm11SvcTable, u8 **freeK11Space)
|
void reimplementSvcBackdoor(u8 *pos, u32 *arm11SvcTable, u8 **freeK11Space)
|
||||||
|
Reference in New Issue
Block a user