Cleaned Makefile, added confirmation prompt on stage2 install, SD unmounting/remounting wheh coming back to menu after stage2 install
This commit is contained in:
parent
29e8281729
commit
78111b5dc7
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,4 @@
|
|||||||
out
|
out
|
||||||
CakeHax
|
|
||||||
CakeBrah
|
|
||||||
build
|
build
|
||||||
*.bin
|
*.bin
|
||||||
*.3dsx
|
*.3dsx
|
||||||
|
26
Makefile
26
Makefile
@ -4,21 +4,14 @@ CC := arm-none-eabi-gcc
|
|||||||
AS := arm-none-eabi-as
|
AS := arm-none-eabi-as
|
||||||
LD := arm-none-eabi-ld
|
LD := arm-none-eabi-ld
|
||||||
OC := arm-none-eabi-objcopy
|
OC := arm-none-eabi-objcopy
|
||||||
OPENSSL := openssl
|
|
||||||
|
|
||||||
PYTHON3 := python
|
|
||||||
PYTHON_VER_MAJOR := $(word 2, $(subst ., , $(shell python --version 2>&1)))
|
|
||||||
ifneq ($(PYTHON_VER_MAJOR), 3)
|
|
||||||
PYTHON3 := py -3
|
|
||||||
endif
|
|
||||||
|
|
||||||
name := SafeA9LHInstaller
|
name := SafeA9LHInstaller
|
||||||
|
|
||||||
dir_source := source
|
dir_source := source
|
||||||
dir_build := build
|
|
||||||
dir_mset := CakeHax
|
dir_mset := CakeHax
|
||||||
dir_out := out
|
|
||||||
dir_ninjhax := CakeBrah
|
dir_ninjhax := CakeBrah
|
||||||
|
dir_build := build
|
||||||
|
dir_out := out
|
||||||
|
|
||||||
ASFLAGS := -mlittle-endian -mcpu=arm946e-s -march=armv5te
|
ASFLAGS := -mlittle-endian -mcpu=arm946e-s -march=armv5te
|
||||||
CFLAGS := -Wall -Wextra -MMD -MP -marm $(ASFLAGS) -fno-builtin -fshort-wchar -std=c11 -Wno-main -O2 -ffast-math
|
CFLAGS := -Wall -Wextra -MMD -MP -marm $(ASFLAGS) -fno-builtin -fshort-wchar -std=c11 -Wno-main -O2 -ffast-math
|
||||||
@ -41,26 +34,35 @@ a9lh: $(dir_out)/arm9loaderhax.bin
|
|||||||
.PHONY: ninjhax
|
.PHONY: ninjhax
|
||||||
ninjhax: $(dir_out)/3ds/$(name)
|
ninjhax: $(dir_out)/3ds/$(name)
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
|
release: $(dir_out)/$(name).zip
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@$(MAKE) $(FLAGS) -C $(dir_mset) clean
|
@$(MAKE) $(FLAGS) -C $(dir_mset) clean
|
||||||
@$(MAKE) $(FLAGS) -C $(dir_ninjhax) clean
|
@$(MAKE) $(FLAGS) -C $(dir_ninjhax) clean
|
||||||
@rm -rf $(dir_out) $(dir_build)
|
@rm -rf $(dir_out) $(dir_build)
|
||||||
|
|
||||||
$(dir_out)/$(name).dat: $(dir_build)/main.bin
|
$(dir_out):
|
||||||
|
@mkdir -p "$(dir_out)"
|
||||||
|
|
||||||
|
$(dir_out)/$(name).dat: $(dir_build)/main.bin $(dir_out)
|
||||||
@mkdir -p $(dir_out)
|
@mkdir -p $(dir_out)
|
||||||
@$(MAKE) $(FLAGS) -C $(dir_mset) launcher
|
@$(MAKE) $(FLAGS) -C $(dir_mset) launcher
|
||||||
dd if=$(dir_build)/main.bin of=$@ bs=512 seek=144
|
dd if=$(dir_build)/main.bin of=$@ bs=512 seek=144
|
||||||
|
|
||||||
$(dir_out)/arm9loaderhax.bin: $(dir_build)/main.bin
|
$(dir_out)/arm9loaderhax.bin: $(dir_build)/main.bin $(dir_out)
|
||||||
@cp -av $(dir_build)/main.bin $@
|
@cp -av $(dir_build)/main.bin $@
|
||||||
|
|
||||||
$(dir_out)/3ds/$(name):
|
$(dir_out)/3ds/$(name): $(dir_out)
|
||||||
@mkdir -p $(dir_out)/3ds/$(name)
|
@mkdir -p $(dir_out)/3ds/$(name)
|
||||||
@$(MAKE) $(FLAGS) -C $(dir_ninjhax)
|
@$(MAKE) $(FLAGS) -C $(dir_ninjhax)
|
||||||
@mv $(dir_out)/$(name).3dsx $@
|
@mv $(dir_out)/$(name).3dsx $@
|
||||||
@mv $(dir_out)/$(name).smdh $@
|
@mv $(dir_out)/$(name).smdh $@
|
||||||
|
|
||||||
|
$(dir_out)/$(name).zip: launcher a9lh ninjhax
|
||||||
|
@cd $(dir_out) && zip -9 -r $(name) *
|
||||||
|
|
||||||
$(dir_build)/main.bin: $(dir_build)/main.elf
|
$(dir_build)/main.bin: $(dir_build)/main.elf
|
||||||
$(OC) -S -O binary $< $@
|
$(OC) -S -O binary $< $@
|
||||||
|
|
||||||
|
@ -349,16 +349,16 @@ void generateSector(u8 *keySector){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Test the OTP to be correct by verifying key2
|
//Test the OTP to be correct by verifying key2
|
||||||
u32 testOtp(u32 a9lhBoot){
|
u32 testOtp(u32 a9lhBoot, void *tempOffset){
|
||||||
//Read keysector from NAND
|
//Read keysector from NAND
|
||||||
sdmmc_nand_readsectors(0x96, 0x1, (vu8 *)0x24500000);
|
sdmmc_nand_readsectors(0x96, 0x1, (vu8 *)tempOffset);
|
||||||
|
|
||||||
//Decrypt key2
|
//Decrypt key2
|
||||||
aes_use_keyslot(0x11);
|
aes_use_keyslot(0x11);
|
||||||
aes((void *)0x24500000 + 0x10, (void *)0x24500000 + 0x10, 1, NULL, AES_ECB_DECRYPT_MODE, 0);
|
aes((void *)tempOffset + 0x10, (void *)tempOffset + 0x10, 1, NULL, AES_ECB_DECRYPT_MODE, 0);
|
||||||
|
|
||||||
//Test key2
|
//Test key2
|
||||||
if(memcmp((void *)0x24500000 + 0x10, a9lhBoot ? a9lhKey2 : key2, 0x10) != 0) return 0;
|
if(memcmp((void *)tempOffset + 0x10, a9lhBoot ? a9lhKey2 : key2, 0x10) != 0) return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,5 +81,5 @@ void readFirm0(u8 *outbuf, u32 size);
|
|||||||
void writeFirm(u8 *inbuf, u32 offset, u32 size);
|
void writeFirm(u8 *inbuf, u32 offset, u32 size);
|
||||||
void setupKeyslot0x11(u32 a9lhBoot, const u8 *otp);
|
void setupKeyslot0x11(u32 a9lhBoot, const u8 *otp);
|
||||||
void generateSector(u8 *keySector);
|
void generateSector(u8 *keySector);
|
||||||
u32 testOtp(u32 a9lhBoot);
|
u32 testOtp(u32 a9lhBoot, void *tempOffset);
|
||||||
u32 verifyHash(const void *data, u32 size, const u8 *hash);
|
u32 verifyHash(const void *data, u32 size, const u8 *hash);
|
@ -12,6 +12,11 @@ u32 mountSD(void){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 unmountSD(void){
|
||||||
|
if(f_mount(NULL, "0:", 1) != FR_OK) return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
u32 fileRead(u8 *dest, const char *path, u32 size){
|
u32 fileRead(u8 *dest, const char *path, u32 size){
|
||||||
FRESULT fr;
|
FRESULT fr;
|
||||||
FIL fp;
|
FIL fp;
|
||||||
|
@ -7,5 +7,6 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
u32 mountSD(void);
|
u32 mountSD(void);
|
||||||
|
u32 unmountSD(void);
|
||||||
u32 fileRead(u8 *dest, const char *path, u32 size);
|
u32 fileRead(u8 *dest, const char *path, u32 size);
|
||||||
u32 fileSize(const char *path);
|
u32 fileSize(const char *path);
|
@ -21,20 +21,23 @@ static const u8 firm1Hash[0x20] = {
|
|||||||
0x2D, 0x3D, 0x56, 0x6C, 0x6A, 0x1A, 0x8E, 0x52, 0x54, 0xE3, 0x89, 0xC2, 0x95, 0x06, 0x23, 0xE5
|
0x2D, 0x3D, 0x56, 0x6C, 0x6A, 0x1A, 0x8E, 0x52, 0x54, 0xE3, 0x89, 0xC2, 0x95, 0x06, 0x23, 0xE5
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *path;
|
|
||||||
static u32 size;
|
|
||||||
int pos_y;
|
int pos_y;
|
||||||
|
|
||||||
static void installStage2(u32 mode){
|
static void installStage2(u32 mode){
|
||||||
//Read stage2
|
//Read stage2
|
||||||
path = "a9lh/payload_stage2.bin";
|
const char path[] = "a9lh/payload_stage2.bin";
|
||||||
size = fileSize(path);
|
u32 size = fileSize(path);
|
||||||
if(!size || size > MAXSTAGE2SIZE)
|
if(!size || size > MAX_STAGE2_SIZE)
|
||||||
shutdown(1, "Error: stage2.bin doesn't exist or exceeds\nmax size");
|
shutdown(1, "Error: stage2.bin doesn't exist or exceeds\nmax size");
|
||||||
memset((u8 *)STAGE2OFFSET, 0, MAXSTAGE2SIZE);
|
memset((u8 *)STAGE2_OFFSET, 0, MAX_STAGE2_SIZE);
|
||||||
fileRead((u8 *)STAGE2OFFSET, path, size);
|
fileRead((u8 *)STAGE2_OFFSET, path, size);
|
||||||
|
|
||||||
if(mode) return;
|
if(mode) return;
|
||||||
sdmmc_nand_writesectors(0x5C000, 0x20, (vu8 *)STAGE2OFFSET);
|
|
||||||
|
sdmmc_nand_writesectors(0x5C000, 0x20, (vu8 *)STAGE2_OFFSET);
|
||||||
|
|
||||||
|
//Unmount the SD card
|
||||||
|
unmountSD();
|
||||||
shutdown(2, "Stage2 update: success!");
|
shutdown(2, "Stage2 update: success!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,63 +49,74 @@ void installer(void){
|
|||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
clearScreens();
|
clearScreens();
|
||||||
drawString("Safe A9LH Installer v1.3", 10, 10, 0xff9900);
|
drawString("Safe A9LH Installer v1.3.1", 10, 10, COLOR_TITLE);
|
||||||
pos_y = drawString("Thanks to delebile, #cakey and StandardBus", 10, 40, 0xFFFFFF);
|
pos_y = drawString("Thanks to delebile, #cakey and StandardBus", 10, 40, COLOR_WHITE);
|
||||||
pos_y = drawString("Press SELECT for a full install", 10, pos_y + SPACING_VERT, 0xFFFFFF);
|
pos_y = drawString("Press SELECT for a full install", 10, pos_y + SPACING_VERT, COLOR_WHITE);
|
||||||
if(a9lhBoot){ pos_y = drawString("Press START to only update stage2", 10, pos_y, 0xFFFFFF);
|
if(a9lhBoot){ pos_y = drawString("Press START to only update stage2", 10, pos_y, COLOR_WHITE);
|
||||||
pos_y = drawString("(Only do stage2 updates from the fork you use!)", 10, pos_y, 0x0000FF); }
|
pos_y = drawString("(Only do stage2 updates from the fork you use!)", 10, pos_y, COLOR_RED); }
|
||||||
pos_y = drawString("Press any other button to shutdown", 10, pos_y, 0xFFFFFF);
|
pos_y = drawString("Press any other button to shutdown", 10, pos_y, COLOR_WHITE);
|
||||||
|
|
||||||
u16 pressed = waitInput();
|
u16 pressed = waitInput();
|
||||||
if(a9lhBoot && pressed == BUTTON_START) installStage2(0);
|
if(a9lhBoot && pressed == BUTTON_START){
|
||||||
|
pos_y = drawString("Stage2 update: are you sure? Press A to confirm", 10, pos_y + SPACING_VERT, COLOR_RED);
|
||||||
|
if(waitInput() == BUTTON_A){
|
||||||
|
mountSD();
|
||||||
|
installStage2(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(pressed == BUTTON_SELECT) break;
|
else if(pressed == BUTTON_SELECT) break;
|
||||||
else shutdown(0, NULL);
|
else shutdown(0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Mount the SD card
|
||||||
|
mountSD();
|
||||||
|
|
||||||
|
const char *path;
|
||||||
|
|
||||||
//If making a first install, we need the OTP
|
//If making a first install, we need the OTP
|
||||||
if(!a9lhBoot){
|
if(!a9lhBoot){
|
||||||
//Read OTP
|
//Read OTP
|
||||||
path = "a9lh/otp.bin";
|
path = "a9lh/otp.bin";
|
||||||
if(fileSize(path) != 256)
|
if(fileSize(path) != 256)
|
||||||
shutdown(1, "Error: otp.bin doesn't exist or has a wrong size");
|
shutdown(1, "Error: otp.bin doesn't exist or has a wrong size");
|
||||||
fileRead((u8 *)OTPOFFSET, path, 256);
|
fileRead((u8 *)OTP_OFFSET, path, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Setup the key sector de/encryption with the SHA register or otp.bin
|
//Setup the key sector de/encryption with the SHA register or otp.bin
|
||||||
setupKeyslot0x11(a9lhBoot, (u8 *)OTPOFFSET);
|
setupKeyslot0x11(a9lhBoot, (u8 *)OTP_OFFSET);
|
||||||
|
|
||||||
if(a9lhBoot && !testOtp(a9lhBoot))
|
if(a9lhBoot && !testOtp(a9lhBoot, (void *)TEMP_OFFSET))
|
||||||
shutdown(1, "Error: the OTP hash is invalid");
|
shutdown(1, "Error: the OTP hash is invalid");
|
||||||
|
|
||||||
if(!a9lhBoot && console && !testOtp(a9lhBoot))
|
if(!a9lhBoot && console && !testOtp(a9lhBoot, (void *)TEMP_OFFSET))
|
||||||
shutdown(1, "Error: otp.bin is invalid or corrupted");
|
shutdown(1, "Error: otp.bin is invalid or corrupted");
|
||||||
|
|
||||||
//Calculate the CTR for the 3DS partitions
|
//Calculate the CTR for the 3DS partitions
|
||||||
getNandCTR();
|
getNandCTR();
|
||||||
|
|
||||||
//Test that the CTR is correct
|
//Test that the CTR is correct
|
||||||
readFirm0((u8 *)TEMPOFFSET, 0x200);
|
readFirm0((u8 *)TEMP_OFFSET, 0x200);
|
||||||
if(memcmp((void *)TEMPOFFSET, "FIRM", 4) != 0)
|
if(memcmp((void *)TEMP_OFFSET, "FIRM", 4) != 0)
|
||||||
shutdown(1, "Error: failed to setup FIRM encryption");
|
shutdown(1, "Error: failed to setup FIRM encryption");
|
||||||
|
|
||||||
//Read decrypted key sector
|
//Read decrypted key sector
|
||||||
path = "a9lh/secret_sector.bin";
|
path = "a9lh/secret_sector.bin";
|
||||||
if(fileSize(path) != 0x200)
|
if(fileSize(path) != 0x200)
|
||||||
shutdown(1, "Error: secret_sector.bin doesn't exist or has\na wrong size");
|
shutdown(1, "Error: secret_sector.bin doesn't exist or has\na wrong size");
|
||||||
fileRead((u8 *)SECTOROFFSET, path, 0x200);
|
fileRead((u8 *)SECTOR_OFFSET, path, 0x200);
|
||||||
if(!verifyHash((u8 *)SECTOROFFSET, 0x200, sectorHash))
|
if(!verifyHash((u8 *)SECTOR_OFFSET, 0x200, sectorHash))
|
||||||
shutdown(1, "Error: secret_sector.bin is invalid or corrupted");
|
shutdown(1, "Error: secret_sector.bin is invalid or corrupted");
|
||||||
|
|
||||||
//Generate and encrypt a per-console A9LH key sector
|
//Generate and encrypt a per-console A9LH key sector
|
||||||
generateSector((void *)SECTOROFFSET);
|
generateSector((void *)SECTOR_OFFSET);
|
||||||
|
|
||||||
//Read FIRM0
|
//Read FIRM0
|
||||||
path = "a9lh/firm0.bin";
|
path = "a9lh/firm0.bin";
|
||||||
u32 firm0Size = fileSize(path);
|
u32 firm0Size = fileSize(path);
|
||||||
if(!firm0Size)
|
if(!firm0Size)
|
||||||
shutdown(1, "Error: firm0.bin doesn't exist");
|
shutdown(1, "Error: firm0.bin doesn't exist");
|
||||||
fileRead((u8 *)FIRM0OFFSET, path, firm0Size);
|
fileRead((u8 *)FIRM0_OFFSET, path, firm0Size);
|
||||||
if(!verifyHash((u8 *)FIRM0OFFSET, firm0Size, firm0Hash))
|
if(!verifyHash((u8 *)FIRM0_OFFSET, firm0Size, firm0Hash))
|
||||||
shutdown(1, "Error: firm0.bin is invalid or corrupted");
|
shutdown(1, "Error: firm0.bin is invalid or corrupted");
|
||||||
|
|
||||||
//Read FIRM1
|
//Read FIRM1
|
||||||
@ -110,26 +124,26 @@ void installer(void){
|
|||||||
u32 firm1Size = fileSize(path);
|
u32 firm1Size = fileSize(path);
|
||||||
if(!firm1Size)
|
if(!firm1Size)
|
||||||
shutdown(1, "Error: firm1.bin doesn't exist");
|
shutdown(1, "Error: firm1.bin doesn't exist");
|
||||||
fileRead((u8 *)FIRM1OFFSET, path, firm1Size);
|
fileRead((u8 *)FIRM1_OFFSET, path, firm1Size);
|
||||||
if(!verifyHash((u8 *)FIRM1OFFSET, firm1Size, firm1Hash))
|
if(!verifyHash((u8 *)FIRM1_OFFSET, firm1Size, firm1Hash))
|
||||||
shutdown(1, "Error: firm1.bin is invalid or corrupted");
|
shutdown(1, "Error: firm1.bin is invalid or corrupted");
|
||||||
|
|
||||||
//Inject stage1
|
//Inject stage1
|
||||||
path = "a9lh/payload_stage1.bin";
|
path = "a9lh/payload_stage1.bin";
|
||||||
size = fileSize(path);
|
u32 size = fileSize(path);
|
||||||
if(!size || size > MAXSTAGE1SIZE)
|
if(!size || size > MAX_STAGE1_SIZE)
|
||||||
shutdown(1, "Error: stage1.bin doesn't exist or exceeds\nmax size");
|
shutdown(1, "Error: stage1.bin doesn't exist or exceeds\nmax size");
|
||||||
fileRead((u8 *)STAGE1OFFSET, path, size);
|
fileRead((u8 *)STAGE1_OFFSET, path, size);
|
||||||
|
|
||||||
installStage2(1);
|
installStage2(1);
|
||||||
|
|
||||||
pos_y = drawString("All checks passed, installing...", 10, pos_y + SPACING_VERT, 0xFFFFFF);
|
pos_y = drawString("All checks passed, installing...", 10, pos_y + SPACING_VERT, COLOR_WHITE);
|
||||||
|
|
||||||
//Point of no return, install stuff in the safest order
|
//Point of no return, install stuff in the safest order
|
||||||
sdmmc_nand_writesectors(0x5C000, 0x20, (vu8 *)STAGE2OFFSET);
|
sdmmc_nand_writesectors(0x5C000, 0x20, (vu8 *)STAGE2_OFFSET);
|
||||||
writeFirm((u8 *)FIRM1OFFSET, 1, firm1Size);
|
writeFirm((u8 *)FIRM1_OFFSET, 1, firm1Size);
|
||||||
writeFirm((u8 *)FIRM0OFFSET, 0, firm0Size);
|
writeFirm((u8 *)FIRM0_OFFSET, 0, firm0Size);
|
||||||
sdmmc_nand_writesectors(0x96, 0x1, (vu8 *)SECTOROFFSET);
|
sdmmc_nand_writesectors(0x96, 0x1, (vu8 *)SECTOR_OFFSET);
|
||||||
|
|
||||||
shutdown(1, "Full install: success!");
|
shutdown(1, "Full install: success!");
|
||||||
}
|
}
|
@ -5,14 +5,14 @@
|
|||||||
#define PDN_MPCORE_CFG (*(vu8 *)0x10140FFC)
|
#define PDN_MPCORE_CFG (*(vu8 *)0x10140FFC)
|
||||||
#define PDN_SPI_CNT (*(vu8 *)0x101401C0)
|
#define PDN_SPI_CNT (*(vu8 *)0x101401C0)
|
||||||
|
|
||||||
#define OTPOFFSET 0x24000000
|
#define OTP_OFFSET 0x24000000
|
||||||
#define SECTOROFFSET 0x24100000
|
#define SECTOR_OFFSET 0x24100000
|
||||||
#define FIRM0OFFSET 0x24200000
|
#define FIRM0_OFFSET 0x24200000
|
||||||
#define FIRM1OFFSET 0x24300000
|
#define FIRM1_OFFSET 0x24300000
|
||||||
#define STAGE1OFFSET FIRM0OFFSET + 0xF0400
|
#define STAGE1_OFFSET FIRM0_OFFSET + 0xF0400
|
||||||
#define STAGE2OFFSET 0x24400000
|
#define STAGE2_OFFSET 0x24400000
|
||||||
#define MAXSTAGE1SIZE 0x1C00
|
#define MAX_STAGE1_SIZE 0x1C00
|
||||||
#define MAXSTAGE2SIZE 0x2800
|
#define MAX_STAGE2_SIZE 0x2800
|
||||||
#define TEMPOFFSET 0x24500000
|
#define TEMP_OFFSET 0x24500000
|
||||||
|
|
||||||
void installer(void);
|
void installer(void);
|
@ -6,15 +6,11 @@
|
|||||||
* Minimalist CFW for N3DS
|
* Minimalist CFW for N3DS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fs.h"
|
|
||||||
#include "installer.h"
|
#include "installer.h"
|
||||||
#include "screeninit.h"
|
#include "screeninit.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define PDN_GPU_CNT (*(vu8 *)0x10141200)
|
|
||||||
|
|
||||||
void main(void){
|
void main(void){
|
||||||
mountSD();
|
initScreens();
|
||||||
if(PDN_GPU_CNT == 0x1) initLCD();
|
|
||||||
installer();
|
installer();
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
#include "screeninit.h"
|
#include "screeninit.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
|
|
||||||
void initLCD(void){
|
void initScreens(void){
|
||||||
vu32 *const arm11 = (vu32 *)0x1FFFFFF8;
|
vu32 *const arm11 = (vu32 *)0x1FFFFFF8;
|
||||||
|
|
||||||
void __attribute__((naked)) ARM11(void){
|
void __attribute__((naked)) ARM11(void){
|
||||||
@ -9,8 +9,8 @@ void initLCD(void){
|
|||||||
*(vu32 *)0x10141200 = 0x1007F;
|
*(vu32 *)0x10141200 = 0x1007F;
|
||||||
*(vu32 *)0x10202014 = 0x00000001;
|
*(vu32 *)0x10202014 = 0x00000001;
|
||||||
*(vu32 *)0x1020200C &= 0xFFFEFFFE;
|
*(vu32 *)0x1020200C &= 0xFFFEFFFE;
|
||||||
*(vu32 *)0x10202240 = 0x39;
|
*(vu32 *)0x10202240 = 0x45;
|
||||||
*(vu32 *)0x10202A40 = 0x39;
|
*(vu32 *)0x10202A40 = 0x45;
|
||||||
*(vu32 *)0x10202244 = 0x1023E;
|
*(vu32 *)0x10202244 = 0x1023E;
|
||||||
*(vu32 *)0x10202A44 = 0x1023E;
|
*(vu32 *)0x10202A44 = 0x1023E;
|
||||||
|
|
||||||
@ -103,6 +103,8 @@ void initLCD(void){
|
|||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
*arm11 = (u32)ARM11;
|
if(PDN_GPU_CNT == 0x1){
|
||||||
while(*arm11);
|
*arm11 = (u32)ARM11;
|
||||||
|
while(*arm11);
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,4 +2,6 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
void initLCD(void);
|
#define PDN_GPU_CNT (*(vu8 *)0x10141200)
|
||||||
|
|
||||||
|
void initScreens(void);
|
@ -27,11 +27,12 @@ u16 waitInput(void){
|
|||||||
|
|
||||||
void shutdown(u32 mode, char *message){
|
void shutdown(u32 mode, char *message){
|
||||||
if(mode){
|
if(mode){
|
||||||
pos_y = drawString(message, 10, pos_y + SPACING_VERT, 0xFFFFFF);
|
pos_y = drawString(message, 10, pos_y + SPACING_VERT, COLOR_WHITE);
|
||||||
if(mode == 1) drawString("Press any button to shutdown", 10, pos_y, 0xFFFFFF);
|
if(mode == 1) drawString("Press any button to shutdown", 10, pos_y, COLOR_WHITE);
|
||||||
else {
|
else {
|
||||||
pos_y = drawString("Press START or SELECT to return to menu", 10, pos_y, 0x0000FF);
|
pos_y = drawString("Press START or SELECT to return to menu", 10, pos_y, COLOR_RED);
|
||||||
pos_y = drawString("Press any other button to shutdown", 10, pos_y, 0xFFFFFF);
|
pos_y = drawString("(SD will be unmounted until the next install)", 10, pos_y, COLOR_RED);
|
||||||
|
pos_y = drawString("Press any other button to shutdown", 10, pos_y, COLOR_WHITE);
|
||||||
}
|
}
|
||||||
u16 pressed = waitInput();
|
u16 pressed = waitInput();
|
||||||
if(mode == 2 && (pressed & (BUTTON_START | BUTTON_SELECT))) return;
|
if(mode == 2 && (pressed & (BUTTON_START | BUTTON_SELECT))) return;
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
#define HID_PAD ((~*(vu16 *)0x10146000) & 0xFFF)
|
#define HID_PAD ((~*(vu16 *)0x10146000) & 0xFFF)
|
||||||
#define BUTTON_START (1 << 3)
|
#define BUTTON_START (1 << 3)
|
||||||
#define BUTTON_SELECT (1 << 2)
|
#define BUTTON_SELECT (1 << 2)
|
||||||
|
#define BUTTON_A 1
|
||||||
|
|
||||||
|
#define COLOR_TITLE 0xFF9900
|
||||||
|
#define COLOR_WHITE 0xFFFFFF
|
||||||
|
#define COLOR_RED 0x0000FF
|
||||||
|
|
||||||
extern int pos_y;
|
extern int pos_y;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user