Merge branch 'master' into developer
This commit is contained in:
commit
9c1b585054
@ -35,7 +35,7 @@ patch:
|
|||||||
add r1, sp, #(0xb0 - 0xac)
|
add r1, sp, #(0xb0 - 0xac)
|
||||||
|
|
||||||
push {r0-r11, lr}
|
push {r0-r11, lr}
|
||||||
|
|
||||||
ldr r9, [r3] ; load the address of the code section
|
ldr r9, [r3] ; load the address of the code section
|
||||||
ldr r8, [r4] ; load the address of the exheader
|
ldr r8, [r4] ; load the address of the exheader
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ patch:
|
|||||||
ldr r0, [r5]
|
ldr r0, [r5]
|
||||||
add r0, r4
|
add r0, r4
|
||||||
blx memcpy
|
blx memcpy
|
||||||
|
|
||||||
skipPatch:
|
skipPatch:
|
||||||
|
|
||||||
ldrh r0, [r5, #6]
|
ldrh r0, [r5, #6]
|
||||||
@ -100,7 +100,7 @@ memcmp:
|
|||||||
sub r6, r7
|
sub r6, r7
|
||||||
cmp r6, #0
|
cmp r6, #0
|
||||||
beq cmp_loop
|
beq cmp_loop
|
||||||
|
|
||||||
cmp_loop_end:
|
cmp_loop_end:
|
||||||
mov r0, r6
|
mov r0, r6
|
||||||
pop {r4-r7, pc}
|
pop {r4-r7, pc}
|
||||||
@ -126,7 +126,7 @@ memcpy:
|
|||||||
|
|
||||||
patchesStart:
|
patchesStart:
|
||||||
; SCFG_EXT bit31 patches, based on https://github.com/ahezard/twl_firm_patcher (credits where they're due)
|
; SCFG_EXT bit31 patches, based on https://github.com/ahezard/twl_firm_patcher (credits where they're due)
|
||||||
|
|
||||||
.word 0x07368 ; offset
|
.word 0x07368 ; offset
|
||||||
.halfword 1 ; type (0: relative to the start of TwlBg's code; 1: relative to the start of the dev SRL launcher)
|
.halfword 1 ; type (0: relative to the start of TwlBg's code; 1: relative to the start of the dev SRL launcher)
|
||||||
.halfword 4 ; size (must be a multiple of 4)
|
.halfword 4 ; size (must be a multiple of 4)
|
||||||
|
@ -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)
|
||||||
|
@ -92,29 +92,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