Updated build system

Includes better handling for FLAVOR now, AUTO_UNLOCK for unlock
sequences and setting SD_TIMEOUT from make
This commit is contained in:
d0k3 2017-11-24 18:21:02 +01:00
parent 9217116a68
commit 63767e5eae
6 changed files with 23 additions and 22 deletions

View File

@ -5,9 +5,9 @@ rwildcard = $(foreach d, $(wildcard $1*), \
$(filter $(subst *, %, $2), $d) \ $(filter $(subst *, %, $2), $d) \
$(call rwildcard, $d/, $2)) $(call rwildcard, $d/, $2))
FLAVOR := GodMode9 FLAVOR ?= GodMode9
README := README.md README := README.md
SPLASH = resources/$(FLAVOR)_splash.qlz SPLASH = resources/$(FLAVOR)_splash.qlz
ifeq ($(FONT),ORIG) ifeq ($(FONT),ORIG)
CFLAGS += -DFONT_ORIGINAL CFLAGS += -DFONT_ORIGINAL
@ -21,9 +21,8 @@ else
CFLAGS += -DFONT_6X10 CFLAGS += -DFONT_6X10
endif endif
ifeq ($(SAFEMODE),1) ifeq ($(FLAVOR),SafeMode9)
CFLAGS += -DSAFEMODE CFLAGS += -DSAFEMODE
FLAVOR := SafeMode9
endif endif
ifeq ($(SALTMODE),1) ifeq ($(SALTMODE),1)
@ -39,10 +38,18 @@ ifeq ($(AUTORUN_SCRIPT),1)
README := README :=
endif endif
ifeq ($(AUTO_UNLOCK),1)
CFLAGS += -DAUTO_UNLOCK
endif
ifdef FIXED_BRIGHTNESS ifdef FIXED_BRIGHTNESS
CFLAGS += -DFIXED_BRIGHTNESS=$(FIXED_BRIGHTNESS) CFLAGS += -DFIXED_BRIGHTNESS=$(FIXED_BRIGHTNESS)
endif endif
ifdef SD_TIMEOUT
CFLAGS += -DSD_TIMEOUT=$(SD_TIMEOUT)
endif
ifdef NTRBOOT ifdef NTRBOOT
FTFLAGS = -S spi-retail FTFLAGS = -S spi-retail
FTDFLAGS = -S spi-dev FTDFLAGS = -S spi-dev

View File

@ -21,12 +21,12 @@ These short instructions apply to all users who have [boot9strap](https://github
You may now run GodMode9 via holding the X Button (or any other button you chose) at startup. See below for a list of stuff you can do with it. You may now run GodMode9 via holding the X Button (or any other button you chose) at startup. See below for a list of stuff you can do with it.
## How to run & build this / developer info ## How to build this / developer info
Copy `GodMode9.firm` to somewhere on your SD card (maybe refer to your CFW instructions) and run it from there. FIRM payloads can be ran from [Luma3DS](https://github.com/AuroraWright/Luma3DS), [boot9strap](https://github.com/SciresM/boot9strap) or from GodMode9 itself. Build this with `make firm` (requires [firmtool](https://github.com/TuxSH/firmtool) installed). Build `GodMode9.firm` via `make firm` (requires [firmtool](https://github.com/TuxSH/firmtool) installed). On macOS, you may have to install [gnu-tar](https://www.gnu.org/software/tar/) first - do so in terminal via `brew install gnu-tar --with-default-names`.
If you are a developer and you are building this, you may also just run `make release` to get a nice, release-ready package of all required files. To build __SafeMode9__ (a bricksafe variant of GodMode9, with limited write permissions) instead of GodMode9, compile with `make SAFEMODE=1`. To switch screens, compile with `make SWITCH_SCREENS=1`. For additional customization, you may choose the internal font via `make FONT=6X10`, `make FONT=ACORN`, `make FONT=GB` or `make FONT=ORIG`. You may also hardcode the brightness via `make FIXED_BRIGHTNESS=x`, whereas `x` is a value between 0...15. You may run `make release` to get a nice, release-ready package of all required files. To build __SafeMode9__ (a bricksafe variant of GodMode9, with limited write permissions) instead of GodMode9, compile with `make FLAVOR=SafeMode9`. To switch screens, compile with `make SWITCH_SCREENS=1`. For additional customization, you may choose the internal font via `make FONT=6X10`, `make FONT=ACORN`, `make FONT=GB` or `make FONT=ORIG`. You may also hardcode the brightness via `make FIXED_BRIGHTNESS=x`, whereas `x` is a value between 0...15.
Further customization is possible by hardcoding `aeskeydb.bin` (just put the file into the `data` folder when compiling). All files put into the `data` folder will turn up in the `V:` drive, but keep in mind there's a hard 3MB limit for all files inside, including overhead. A standalone script runner is compiled by providing `autorun.gm9` (again, in the data folder) and building with `make AUTORUN_SCRIPT=1`. Further customization is possible by hardcoding `aeskeydb.bin` (just put the file into the `data` folder when compiling). All files put into the `data` folder will turn up in the `V:` drive, but keep in mind there's a hard 3MB limit for all files inside, including overhead. A standalone script runner is compiled by providing `autorun.gm9` (again, in the `data` folder) and building with `make AUTORUN_SCRIPT=1`.
To build a .firm signed with SPI boot keys (for ntrboot and the like), run `make NTRBOOT=1`. You may need to rename the output files if the ntrboot installer you use uses hardcoded filenames. Some features such as boot9 / boot11 access are not currently available from the ntrboot environment. To build a .firm signed with SPI boot keys (for ntrboot and the like), run `make NTRBOOT=1`. You may need to rename the output files if the ntrboot installer you use uses hardcoded filenames. Some features such as boot9 / boot11 access are not currently available from the ntrboot environment.

View File

@ -316,6 +316,7 @@ bool ShowPrompt(bool ask, const char *format, ...)
return ret; return ret;
} }
#ifndef AUTO_UNLOCK
#define PRNG (*(volatile u32*)0x10011000) #define PRNG (*(volatile u32*)0x10011000)
bool ShowUnlockSequence(u32 seqlvl, const char *format, ...) { bool ShowUnlockSequence(u32 seqlvl, const char *format, ...) {
const char dpad_symbols[] = { '\x1A', '\x1B', '\x18', '\x19' }; // R L D U const char dpad_symbols[] = { '\x1A', '\x1B', '\x18', '\x19' }; // R L D U
@ -395,6 +396,7 @@ bool ShowUnlockSequence(u32 seqlvl, const char *format, ...) {
return (lvl >= seqlen); return (lvl >= seqlen);
} }
#endif
u32 ShowSelectPrompt(u32 n, const char** options, const char *format, ...) { u32 ShowSelectPrompt(u32 n, const char** options, const char *format, ...) {
u32 str_width, str_height; u32 str_width, str_height;

View File

@ -43,6 +43,12 @@
#define COLOR_TRANSPARENT COLOR_SUPERFUCHSIA #define COLOR_TRANSPARENT COLOR_SUPERFUCHSIA
#ifndef AUTO_UNLOCK
bool ShowUnlockSequence(u32 seqlvl, const char *format, ...);
#else
#define ShowUnlockSequence ShowPrompt
#endif
void ClearScreen(unsigned char *screen, int color); void ClearScreen(unsigned char *screen, int color);
void ClearScreenF(bool clear_main, bool clear_alt, int color); void ClearScreenF(bool clear_main, bool clear_alt, int color);
void DrawRectangle(u8* screen, int x, int y, int width, int height, int color); void DrawRectangle(u8* screen, int x, int y, int width, int height, int color);
@ -65,7 +71,6 @@ void FormatBytes(char* str, u64 bytes);
void ShowString(const char *format, ...); void ShowString(const char *format, ...);
void ShowIconString(u8* icon, int w, int h, const char *format, ...); void ShowIconString(u8* icon, int w, int h, const char *format, ...);
bool ShowPrompt(bool ask, const char *format, ...); bool ShowPrompt(bool ask, const char *format, ...);
bool ShowUnlockSequence(u32 seqlvl, const char *format, ...);
u32 ShowSelectPrompt(u32 n, const char** options, const char *format, ...); u32 ShowSelectPrompt(u32 n, const char** options, const char *format, ...);
bool ShowStringPrompt(char* inputstr, u32 max_size, const char *format, ...); bool ShowStringPrompt(char* inputstr, u32 max_size, const char *format, ...);
u64 ShowHexPrompt(u64 start_val, u32 n_digits, const char *format, ...); u64 ShowHexPrompt(u64 start_val, u32 n_digits, const char *format, ...);

View File

@ -171,19 +171,11 @@ bool SetWritePermissions(u32 perm, bool add_perm) {
if (!ShowUnlockSequence(6, "!THIS IS YOUR ONLY WARNING!\n \nYou want to enable SysNAND\nlvl3 writing permissions.\n \nThis enables you to OVERWRITE\n%s", IS_SIGHAX ? "your B9S installation and/or\nBRICK your console!" : IS_A9LH ? "your A9LH installation and/or\nBRICK your console!" : "essential system files and/or\nBRICK your console!")) if (!ShowUnlockSequence(6, "!THIS IS YOUR ONLY WARNING!\n \nYou want to enable SysNAND\nlvl3 writing permissions.\n \nThis enables you to OVERWRITE\n%s", IS_SIGHAX ? "your B9S installation and/or\nBRICK your console!" : IS_A9LH ? "your A9LH installation and/or\nBRICK your console!" : "essential system files and/or\nBRICK your console!"))
return false; return false;
break; break;
case PERM_ALL: // not accessible from GM9
if (!ShowUnlockSequence(3, "!Better be careful!\n \nYou want to enable ALL\nwriting permissions.\n \nThis enables you to do some\nreally dangerous stuff!"))
return false;
break;
default: default:
ShowPrompt(false, "Unlock write permission is not allowed."); ShowPrompt(false, "Unlock write permission is not allowed.");
return false; return false;
break; break;
#else #else
case PERM_ALL: // dito (???)
if (!ShowUnlockSequence(2, "You want to enable ALL safe\nwriting permissions.\n \nThis enables you to modify\nsystem data, installations,\nuser data & savegames."))
return false;
break;
default: default:
ShowPrompt(false, "Can't unlock write permission.\nTry GodMode9 instead!"); ShowPrompt(false, "Can't unlock write permission.\nTry GodMode9 instead!");
return false; return false;

View File

@ -18,11 +18,6 @@
#define PERM_XORPAD (1UL<<12) // can't be enabled, placeholder #define PERM_XORPAD (1UL<<12) // can't be enabled, placeholder
#define PERM_CART (1UL<<13) // can't be enabled, placeholder #define PERM_CART (1UL<<13) // can't be enabled, placeholder
#define PERM_BASE (PERM_SDCARD | PERM_IMAGE | PERM_RAMDRIVE | PERM_EMU_LVL0 | PERM_SYS_LVL0) #define PERM_BASE (PERM_SDCARD | PERM_IMAGE | PERM_RAMDRIVE | PERM_EMU_LVL0 | PERM_SYS_LVL0)
#ifndef SAFEMODE
#define PERM_ALL (PERM_BASE | PERM_SDDATA | PERM_EMU_LVL1 | PERM_SYS_LVL2 | PERM_MEMORY)
#else
#define PERM_ALL (PERM_BASE | PERM_SDDATA | PERM_EMU_LVL1 | PERM_SYS_LVL1)
#endif
// permission levels / colors // permission levels / colors
#define PERM_BLUE (GetWritePermissions()&PERM_MEMORY) #define PERM_BLUE (GetWritePermissions()&PERM_MEMORY)