Allow compiling multi-script autorunners

This commit is contained in:
d0k3 2017-12-07 02:01:15 +01:00
parent 38d3b4b4dc
commit 3dd8a4764e
5 changed files with 14 additions and 9 deletions

View File

@ -33,7 +33,7 @@ ifeq ($(SWITCH_SCREENS),1)
CFLAGS += -DSWITCH_SCREENS
endif
ifeq ($(AUTORUN_SCRIPT),1)
ifeq ($(SCRIPT_RUNNER),1)
CFLAGS += -DAUTORUN_SCRIPT
README :=
endif

View File

@ -26,7 +26,7 @@ Build `GodMode9.firm` via `make firm` (requires [firmtool](https://github.com/Tu
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 SCRIPT_RUNNER=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.

View File

@ -77,7 +77,7 @@ u32 SplashInit(const char* modestr) {
return 0;
}
#ifndef AUTORUN_SCRIPT
#ifndef SCRIPT_RUNNER
void GetTimeString(char* timestr, bool forced_update, bool full_year) {
static DsTime dstime;
static u64 timer = (u64) -1; // this ensures we don't check the time too often
@ -2303,18 +2303,22 @@ u32 ScriptRunner(int entrypoint) {
while (HID_STATE); // wait until no buttons are pressed
while (timer_msec( timer ) < 500); // show splash for at least 0.5 sec
ClearScreenF(true, true, COLOR_STD_BG); // clear splash
// get script from VRAM0 TAR
u64 autorun_gm9_size = 0;
void* autorun_gm9 = FindVTarFileInfo(VRAM0_AUTORUN_GM9, &autorun_gm9_size);
if (autorun_gm9 && autorun_gm9_size) {
ClearScreenF(true, true, COLOR_STD_BG); // clear splash
// copy script to script buffer and run it
memset(SCRIPT_BUFFER, 0, SCRIPT_BUFFER_SIZE);
memcpy(SCRIPT_BUFFER, autorun_gm9, autorun_gm9_size);
ExecuteGM9Script(NULL);
} else ShowPrompt(false, "Compiled as script autorunner\nbut no autorun.gm9 provided.\n \nDerp!");
} else if (PathExist("V:/" VRAM0_SCRIPTS)) {
char loadpath[256];
if (FileSelector(loadpath, FLAVOR " scripts menu.\nSelect script:", "V:/" VRAM0_SCRIPTS, "*.gm9", true, false))
ExecuteGM9Script(loadpath);
} else ShowPrompt(false, "Compiled as script autorunner\nbut no script provided.\n \nDerp!");
// deinit
DeinitExtFS();

View File

@ -17,7 +17,7 @@ void main(int argc, char** argv, int entrypoint)
PXI_DoCMD(PXI_SCREENINIT, NULL, 0);
I2C_writeReg(I2C_DEV_MCU, 0x22, 0x2A);
#ifdef AUTORUN_SCRIPT
#ifdef SCRIPT_RUNNER
// Run the script runner
if (ScriptRunner(entrypoint) == GODMODE_EXIT_REBOOT)
#else

View File

@ -5,9 +5,10 @@
// known file names inside VRAM0 TAR
#define VRAM0_AUTORUN_GM9 "autorun.gm9"
#define VRAM0_README_MD "README.md"
#define VRAM0_SPLASH_PCX FLAVOR "_splash.pcx"
#define VRAM0_AUTORUN_GM9 "autorun.gm9"
#define VRAM0_SCRIPTS "scripts"
#define VRAM0_README_MD "README.md"
#define VRAM0_SPLASH_PCX FLAVOR "_splash.pcx"
#define VRAM0_OFFSET 0x18000000