From a97bf40efa80dc6615bb54163766e52a77128df3 Mon Sep 17 00:00:00 2001 From: rShadowhand Date: Tue, 24 May 2016 13:59:06 +0300 Subject: [PATCH] fix buttons and boot issues --- payload_stage1/source/main.c | 2 +- payload_stage2/source/main.c | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/payload_stage1/source/main.c b/payload_stage1/source/main.c index 55f9c47..e6fbcc1 100644 --- a/payload_stage1/source/main.c +++ b/payload_stage1/source/main.c @@ -10,7 +10,7 @@ void main() u32 pressed = HID_PAD; - if(pressed == SAFE_MODE || pressed == BUTTON_UP) //if home button is pressed + if(pressed == BUTTON_DOWN) //if home button is pressed { //Jump to alternate stage2 sdmmc_nand_readsectors(0x5A000, 0x64, (u8*)0x08006000); diff --git a/payload_stage2/source/main.c b/payload_stage2/source/main.c index 4b22447..eee0416 100644 --- a/payload_stage2/source/main.c +++ b/payload_stage2/source/main.c @@ -28,24 +28,17 @@ void main() FIL payload; unsigned int br; - const char firstPayload[] = "bootmgr.bin"; - const char secondPayload[] = "arm9loaderhax.bin"; - f_mount(&fs, "0:", 0); //This never fails due to deferred mounting - prepareForBoot(); - if(f_open(&payload, firstPayload, FA_READ) == FR_OK) - { - f_read(&payload, (void *)PAYLOAD_ADDRESS, f_size(&payload), &br); - ((void (*)())PAYLOAD_ADDRESS)(); - } - else if(f_open(&payload, secondPayload, FA_READ) == FR_OK) + if(f_open(&payload, "arm9loaderhax.bin", FA_READ) == FR_OK) { + prepareForBoot(); f_read(&payload, (void *)PAYLOAD_ADDRESS, f_size(&payload), &br); ((void (*)())PAYLOAD_ADDRESS)(); } else { - error("Couldn't find the payload.\nMake sure to have arm9loaderhax.bin in the root."); + prepareForBoot(); + error("Couldn't find the payload.\nMake sure to have arm9loaderhax.bin in the root."); } }