Minor code style/comment changes

To match official build
This commit is contained in:
Aurora 2016-02-08 23:46:01 +01:00
parent f140bcd75c
commit 1131589c19
2 changed files with 20 additions and 16 deletions

View File

@ -29,8 +29,8 @@ void getSDMMC(void *pos, u32 *off, u32 size){
//Get DCD values
unsigned char buf[4];
int p;
u32 addr = 0;
u32 additive = 0;
u32 addr = 0,
additive = 0;
memcpy((void*)buf, (void*)(*off+0x0A), 4);
for (p = 0; p < 4; p++) addr |= ((u32) buf[p]) << (8 * p);
memcpy((void*)buf, (void*)(*off+0x0E), 4);
@ -49,7 +49,7 @@ void getEmuRW(void *pos, u32 size, u32 *readOff, u32 *writeOff){
}
void getMPU(void *pos, u32 *off, u32 size){
//Look for MPU code
//Look for MPU pattern
unsigned char pattern[] = {0x03, 0x00, 0x24, 0x00, 0x00, 0x00, 0x10};
*off = (u32)memsearch(pos, pattern, size, 7);
@ -59,6 +59,6 @@ void getEmuCode(void *pos, u32 *off, u32 size){
void *proc9 = memsearch(pos, "Process9", size, 8);
unsigned char pattern[] = {0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF};
//We're looking for the last spot before Process9
//Looking for the last spot before Process9
*off = (u32)memsearch(pos, pattern, size - (size - (u32)(proc9 - pos)), 6) + 0xF;
}

View File

@ -59,10 +59,10 @@ u8 loadEmu(void){
emuCodeOffset = 0;
//Read emunand code from SD
getEmuCode(firmLocation, &emuCodeOffset, firmSize);
const char path[] = "/rei/emunand/emunand.bin";
u32 size = fileSize(path);
if (!size) return 1;
getEmuCode(firmLocation, &emuCodeOffset, firmSize);
fileRead((u8*)emuCodeOffset, path, size);
//Find and patch emunand related offsets
@ -94,22 +94,24 @@ u8 patchFirm(void){
//If L is pressed, boot SysNAND with the SDCard FIRM
if(mode && !(pressed & BUTTON_L1)) if (loadEmu()) return 1;
//Disable signature checks
u32 sigOffset = 0,
sigOffset2 = 0;
//Disable signature checks
getSignatures(firmLocation, firmSize, &sigOffset, &sigOffset2);
memcpy((u8*)sigOffset, sigPat1, sizeof(sigPat1));
memcpy((u8*)sigOffset2, sigPat2, sizeof(sigPat2));
//Apply reboot patch and write patched FIRM
if(!console && mode &&
((fileSize("/rei/reversereboot") > 0) == (pressed & BUTTON_A))){
u32 rebootOffset = 0,
rebootOffset2 = 0;
getReboot(firmLocation, firmSize, &rebootOffset, &rebootOffset2);
//Read reboot code from SD and write patched FIRM path in memory
char path[] = "/rei/reboot/reboot1.bin";
u32 size = fileSize(path);
if (!size) return 1;
getReboot(firmLocation, firmSize, &rebootOffset, &rebootOffset2);
fileRead((u8*)rebootOffset, path, size);
memcpy((u8*)rebootOffset + size, L"sdmc:", 10);
memcpy((u8*)rebootOffset + size + 10, L"" PATCHED_FIRM_PATH, sizeof(PATCHED_FIRM_PATH) * 2);
@ -117,6 +119,8 @@ u8 patchFirm(void){
size = fileSize(path);
if (!size) return 1;
fileRead((u8*)rebootOffset2, path, size);
//Write patched FIRM to SDCard
if (fileWrite((u8*)firmLocation, PATCHED_FIRM_PATH, firmSize) != 0) return 1;
}