No reason for these not to be u8s

This commit is contained in:
Aurora 2016-03-26 19:21:17 +01:00
parent feff28a4fe
commit 441c143b3e
2 changed files with 8 additions and 8 deletions

View File

@ -35,7 +35,7 @@ void getEmunandSect(u32 *off, u32 *head, u32 emuNAND){
u32 getSDMMC(void *pos, u32 size){ u32 getSDMMC(void *pos, u32 size){
//Look for struct code //Look for struct code
const unsigned char pattern[] = {0x21, 0x20, 0x18, 0x20}; const u8 pattern[] = {0x21, 0x20, 0x18, 0x20};
const u8 *off = (u8 *)memsearch(pos, pattern, size, 4) - 1; const u8 *off = (u8 *)memsearch(pos, pattern, size, 4) - 1;
return *(u32 *)(off + 0x0A) + *(u32 *)(off + 0x0E); return *(u32 *)(off + 0x0A) + *(u32 *)(off + 0x0E);
@ -43,7 +43,7 @@ u32 getSDMMC(void *pos, u32 size){
void getEmuRW(void *pos, u32 size, u32 *readOff, u32 *writeOff){ void getEmuRW(void *pos, u32 size, u32 *readOff, u32 *writeOff){
//Look for read/write code //Look for read/write code
const unsigned char pattern[] = {0x1E, 0x00, 0xC8, 0x05}; const u8 pattern[] = {0x1E, 0x00, 0xC8, 0x05};
*writeOff = (u32)memsearch(pos, pattern, size, 4) - 6; *writeOff = (u32)memsearch(pos, pattern, size, 4) - 6;
*readOff = (u32)memsearch((void *)(*writeOff - 0x1000), pattern, 0x1000, 4) - 6; *readOff = (u32)memsearch((void *)(*writeOff - 0x1000), pattern, 0x1000, 4) - 6;
@ -51,13 +51,13 @@ void getEmuRW(void *pos, u32 size, u32 *readOff, u32 *writeOff){
u32 *getMPU(void *pos, u32 size){ u32 *getMPU(void *pos, u32 size){
//Look for MPU pattern //Look for MPU pattern
const unsigned char pattern[] = {0x03, 0x00, 0x24, 0x00}; const u8 pattern[] = {0x03, 0x00, 0x24, 0x00};
return (u32 *)memsearch(pos, pattern, size, 4); return (u32 *)memsearch(pos, pattern, size, 4);
} }
void *getEmuCode(u8 *pos, u32 size, u8 *proc9Offset){ void *getEmuCode(u8 *pos, u32 size, u8 *proc9Offset){
const unsigned char pattern[] = {0x00, 0xFF, 0xFF, 0xFF}; const u8 pattern[] = {0x00, 0xFF, 0xFF, 0xFF};
//Looking for the last free space before Process9 //Looking for the last free space before Process9
return (u8 *)memsearch(pos, pattern, size - (size - (u32)(proc9Offset - pos)), 4) + 0xD; return (u8 *)memsearch(pos, pattern, size - (size - (u32)(proc9Offset - pos)), 4) + 0xD;

View File

@ -29,8 +29,8 @@ u8 *getProc9(void *pos, u32 size){
void getSignatures(void *pos, u32 size, u32 *off, u32 *off2){ void getSignatures(void *pos, u32 size, u32 *off, u32 *off2){
//Look for signature checks //Look for signature checks
const unsigned char pattern[] = {0xC0, 0x1C, 0x76, 0xE7}; const u8 pattern[] = {0xC0, 0x1C, 0x76, 0xE7};
const unsigned char pattern2[] = {0xB5, 0x22, 0x4D, 0x0C}; const u8 pattern2[] = {0xB5, 0x22, 0x4D, 0x0C};
*off = (u32)memsearch(pos, pattern, size, 4); *off = (u32)memsearch(pos, pattern, size, 4);
*off2 = (u32)memsearch(pos, pattern2, size, 4) - 1; *off2 = (u32)memsearch(pos, pattern2, size, 4) - 1;
@ -38,7 +38,7 @@ void getSignatures(void *pos, u32 size, u32 *off, u32 *off2){
void *getReboot(void *pos, u32 size){ void *getReboot(void *pos, u32 size){
//Look for FIRM reboot code //Look for FIRM reboot code
const unsigned char pattern[] = {0xDE, 0x1F, 0x8D, 0xE2}; const u8 pattern[] = {0xDE, 0x1F, 0x8D, 0xE2};
return (u8 *)memsearch(pos, pattern, size, 4) - 0x10; return (u8 *)memsearch(pos, pattern, size, 4) - 0x10;
} }
@ -56,7 +56,7 @@ u32 getfOpen(u8 *proc9Offset, void *rebootOffset){
u16 *getFirmWrite(void *pos, u32 size){ u16 *getFirmWrite(void *pos, u32 size){
//Look for FIRM writing code //Look for FIRM writing code
u8 *const off = (u8 *)memsearch(pos, "exe:", size, 4); u8 *const off = (u8 *)memsearch(pos, "exe:", size, 4);
const unsigned char pattern[] = {0x00, 0x28, 0x01, 0xDA}; const u8 pattern[] = {0x00, 0x28, 0x01, 0xDA};
return (u16 *)memsearch(off - 0x100, pattern, 0x100, 4); return (u16 *)memsearch(off - 0x100, pattern, 0x100, 4);
} }