Compare commits

..

4 Commits

Author SHA1 Message Date
Aurora
b6b309140b Fixed typo 2016-02-20 23:57:59 +01:00
Aurora
af83d31e8d New button combos
No more complaints about triggering the cameras!
2016-02-20 23:25:00 +01:00
Aurora
9b58208c12 Fix booting emuNAND with a > 9.6 FIRM
Hoping this is the last derp...
2016-02-20 22:15:37 +01:00
Aurora
005855dccb Fix derps, improved readability
Thanks xorhash for noticing
2016-02-20 17:55:58 +01:00
2 changed files with 15 additions and 16 deletions

View File

@@ -36,10 +36,9 @@ u8 loadFirm(u8 a9lhBoot){
section = firmLocation->section;
/* If L and R are pressed on a 9.0/2 SysNAND, or L on an updated
SysNAND, boot 9.0 FIRM */
if((!updatedSys & ((pressed & BUTTON_L1R1) == BUTTON_L1R1)) |
(updatedSys & (pressed & BUTTON_L1))) mode = 0;
/* If L is pressed, and on an updated SysNAND setup the SAFE MODE combo
is not pressed, boot 9.0 FIRM */
if((pressed & BUTTON_L1) && !(updatedSys && pressed == SAFEMODE)) mode = 0;
//If not using an A9LH setup, do so by decrypting FIRM0
if(!a9lhSetup && !mode){
@@ -79,7 +78,7 @@ u8 loadEmu(void){
char path[] = "/rei/emunand/emunand.bin";
u32 size = fileSize(path);
if (!size) return 1;
if(!console | !mode) nandRedir[5] = 0xA4;
if(!console || !mode) nandRedir[5] = 0xA4;
//Find offset for emuNAND code from the offset in nandRedir
u8 *emuCodeTmp = &nandRedir[4];
emuCodeOffset = *(u32*)emuCodeTmp - (u32)section[2].address +
@@ -98,7 +97,7 @@ u8 loadEmu(void){
*pos_offset = emuOffset;
*pos_header = emuHeader;
//Patch emuNAND code in memory for O3DS and 9.0 N3DS
if(!console | !mode){
if(!console || !mode){
u32 *pos_instr = memsearch((u32*)emuCodeOffset, "\xA6\x01\x08\x30", size, 4);
memcpy((u8*)pos_instr, emuInstr, sizeof(emuInstr));
}
@@ -116,13 +115,13 @@ u8 loadEmu(void){
//Patches
u8 patchFirm(void){
/* If L is pressed on a 9.0/9.2 SysNAND, or L+R on a > 9.2 SysNAND,
or the 9.0 FIRM is loaded on a > 9.2 SysNAND, boot emuNAND */
if((updatedSys & ((!mode) | (((pressed & BUTTON_L1R1) == BUTTON_L1R1) &
(pressed != SAFEMODE)))) | ((!updatedSys) & mode & !(pressed & BUTTON_L1))){
/* If L or R aren't pressed on a 9.0/9.2 SysNAND, or the 9.0 FIRM is selected
or R is pressed on a > 9.2 SysNAND, boot emuNAND */
if((updatedSys && (!mode || ((pressed & BUTTON_R1) && pressed != SAFEMODE))) ||
(!updatedSys && mode && !(pressed & (BUTTON_L1 | BUTTON_R1)))){
if (loadEmu()) return 1;
}
else if (a9lhSetup){
else if(a9lhSetup){
//Patch FIRM partitions writes on SysNAND to protect A9LH
u32 writeOffset = 0;
getFIRMWrite(firmLocation, firmSize, &writeOffset);
@@ -138,8 +137,8 @@ u8 patchFirm(void){
memcpy((u8*)sigOffset2, sigPat2, sizeof(sigPat2));
//Apply FIRM reboot patch. Not needed on N3DS
if((!console) & mode & (pressed != SAFEMODE) &
!(fileExists("/rei/reversereboot") ^ (pressed & BUTTON_A))){
if(!console && mode && pressed != SAFEMODE &&
fileExists("/rei/reversereboot") == (pressed & BUTTON_A)){
u32 rebootOffset = 0,
rebootOffset2 = 0;

View File

@@ -10,13 +10,13 @@
#define PDN_MPCORE_CFG (*(u8*)0x10140FFC)
#define HID_PAD ((~*(u16*)0x10146000) & 0xFFF)
#define BUTTON_L1R1 (3 << 8)
#define BUTTON_R1 (1 << 8)
#define BUTTON_L1 (1 << 9)
#define BUTTON_A 1
#define SAFEMODE (BUTTON_L1R1 | BUTTON_A | (1 << 6))
#define SAFEMODE (BUTTON_L1 | BUTTON_R1 | BUTTON_A | (1 << 6))
#define PATCHED_FIRM_PATH "/rei/patched_firmware.bin"
u8 loadFirm(u8 a9lh);
u8 loadFirm(u8 a9lhBoot);
u8 loadEmu(void);
u8 patchFirm(void);
void launchFirm(void);