diff --git a/Makefile b/Makefile index 3ee2c53..cb98d21 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ LD := arm-none-eabi-ld OC := arm-none-eabi-objcopy name := SafeA9LHInstaller +version := $(shell git describe --abbrev=0 --tags) dir_source := source dir_mset := CakeHax @@ -15,6 +16,7 @@ dir_out := out 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 += -DTITLE="\"$(name) $(version)\"" FLAGS := name=$(name).dat dir_out=$(abspath $(dir_out)) ICON=$(abspath icon.png) APP_DESCRIPTION="Noob-proof ARM9LoaderHax installer/updater." APP_AUTHOR="Aurora Wright" --no-print-directory objects= $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \ diff --git a/source/installer.c b/source/installer.c index fdeb2b5..85ecfd8 100755 --- a/source/installer.c +++ b/source/installer.c @@ -39,7 +39,7 @@ void installer(void){ //Detect the console being used u32 console = (PDN_MPCORE_CFG == 1) ? 0 : 1; - drawString("Safe A9LH Installer v1.5.1", 10, 10, COLOR_TITLE); + drawString(TITLE, 10, 10, COLOR_TITLE); pos_y = drawString("Thanks to delebile, #cakey and StandardBus", 10, 40, COLOR_WHITE); pos_y = drawString(a9lhBoot ? "Press SELECT to update A9LH" : "Press SELECT for a full install", 10, pos_y + SPACING_VERT, COLOR_WHITE); pos_y = drawString("Press any other button to shutdown", 10, pos_y, COLOR_WHITE); @@ -111,7 +111,7 @@ void installer(void){ path = "a9lh/payload_stage1.bin"; u32 size = fileSize(path); if(!size || size > MAX_STAGE1_SIZE) - shutdown(1, "Error: stage1.bin doesn't exist or exceeds\nmax size"); + shutdown(1, "Error: payload_stage1.bin doesn't exist or\nexceeds max size"); memset((void *)STAGE1_OFFSET, 0, MAX_STAGE1_SIZE); fileRead((void *)STAGE1_OFFSET, path, size); @@ -119,7 +119,7 @@ void installer(void){ path = "a9lh/payload_stage2.bin"; size = fileSize(path); if(!size || size > MAX_STAGE2_SIZE) - shutdown(1, "Error: stage2.bin doesn't exist or exceeds\nmax size"); + shutdown(1, "Error: payload_stage2.bin doesn't exist or\nexceeds max size"); memset((void *)STAGE2_OFFSET, 0, MAX_STAGE2_SIZE); fileRead((void *)STAGE2_OFFSET, path, size); @@ -131,5 +131,5 @@ void installer(void){ sdmmc_nand_writesectors(0x96, 1, (vu8 *)SECTOR_OFFSET); } writeFirm((u8 *)FIRM0_OFFSET, 0, FIRM_SIZE); - shutdown(1, a9lhBoot ? "Update: success!" : "Full install: success!"); + shutdown(2, a9lhBoot ? "Update: success!" : "Full install: success!"); } \ No newline at end of file diff --git a/source/screeninit.c b/source/screeninit.c index 4456880..2d64c66 100644 --- a/source/screeninit.c +++ b/source/screeninit.c @@ -3,7 +3,7 @@ #include "i2c.h" void initScreens(void){ - vu32 *const arm11 = (vu32 *)0x1FFFFFF8; + vu32 *const arm11 = (u32 *)0x1FFFFFF8; void __attribute__((naked)) ARM11(void){ __asm(".word 0xF10C01C0"); diff --git a/source/utils.c b/source/utils.c index 811d990..90e7aa0 100755 --- a/source/utils.c +++ b/source/utils.c @@ -3,7 +3,7 @@ #include "i2c.h" u16 waitInput(void){ - u32 pressedkey = 0; + u32 pressedKey = 0; u16 key; //Wait for no keys to be pressed @@ -16,18 +16,17 @@ u16 waitInput(void){ //Make sure it's pressed for(u32 i = 0x13000; i; i--){ - if (key != HID_PAD) - break; - if(i == 1) pressedkey = 1; + if(key != HID_PAD) break; + if(i == 1) pressedKey = 1; } - } while(!pressedkey); + } while(!pressedKey); return key; } void shutdown(u32 mode, const char *message){ if(mode){ - pos_y = drawString(message, 10, pos_y + SPACING_VERT, COLOR_RED); + pos_y = drawString(message, 10, pos_y + SPACING_VERT, mode == 1 ? COLOR_RED : COLOR_GREEN); drawString("Press any button to shutdown", 10, pos_y, COLOR_WHITE); waitInput(); } diff --git a/source/utils.h b/source/utils.h index 4359ef8..7f1d941 100644 --- a/source/utils.h +++ b/source/utils.h @@ -8,8 +8,9 @@ #define COLOR_TITLE 0xFF9900 #define COLOR_WHITE 0xFFFFFF #define COLOR_RED 0x0000FF +#define COLOR_GREEN 0x00FF00 -extern int pos_y; +int pos_y; u16 waitInput(void); void shutdown(u32 mode, const char *message); \ No newline at end of file