diff --git a/Makefile b/Makefile index bcebca3..deab93f 100644 --- a/Makefile +++ b/Makefile @@ -17,14 +17,13 @@ export RELDIR := release # Definitions for initial RAM disk VRAM_OUT := $(OUTDIR)/vram0.tar VRAM_FLAGS := --format=v7 --blocking-factor=1 -VRAM_BASE := README.md resources/$(FLAVOR)_splash.qlz VRAM_DATA := data # Definitions for ARM binaries export INCLUDE := -I"$(shell pwd)/common" export ASFLAGS := -g -x assembler-with-cpp $(INCLUDE) -export CFLAGS := -DDBUILTS="\"$(DBUILTS)\"" -DDBUILTL="\"$(DBUILTL)\"" -DVERSION="\"$(VERSION)\"" -DFLAVOR="\"$(FLAVOR)"\" \ +export CFLAGS := -DDBUILTS="\"$(DBUILTS)\"" -DDBUILTL="\"$(DBUILTL)\"" -DVERSION="\"$(VERSION)\"" -DFLAVOR="\"$(FLAVOR)\"" \ -g -O2 -Wall -Wextra -Wpedantic -Wcast-align -Wno-main \ -fomit-frame-pointer -ffast-math -std=gnu11 \ -Wno-unused-function $(INCLUDE) @@ -63,8 +62,8 @@ release: clean vram0: @mkdir -p "$(OUTDIR)" @echo "Creating $(VRAM_OUT)" - @tar cf $(VRAM_OUT) $(VRAM_FLAGS) --xform='s/^$(VRAM_DATA)\///' $(VRAM_DATA)/* - @tar rf $(VRAM_OUT) $(VRAM_FLAGS) --xform='s/^.*\///' $(VRAM_BASE) + @tar cf $(VRAM_OUT) $(VRAM_FLAGS) --xform='s/^.*\///' $(README) $(SPLASH) + @-tar rf $(VRAM_OUT) $(VRAM_FLAGS) --xform='s/^$(VRAM_DATA)\///' $(VRAM_DATA)/* elf: @set -e; for elf in $(ELF); do \ diff --git a/Makefile.common b/Makefile.common index 246b6d1..d838bef 100644 --- a/Makefile.common +++ b/Makefile.common @@ -6,6 +6,8 @@ rwildcard = $(foreach d, $(wildcard $1*), \ $(call rwildcard, $d/, $2)) FLAVOR := GodMode9 +README := README.md +SPLASH = resources/$(FLAVOR)_splash.qlz ifeq ($(FONT),ORIG) CFLAGS += -DFONT_ORIGINAL @@ -34,6 +36,7 @@ endif ifeq ($(AUTORUN_SCRIPT),1) CFLAGS += -DAUTORUN_SCRIPT + README := endif ifdef FIXED_BRIGHTNESS diff --git a/README.md b/README.md index 84231f3..c99d1f0 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ GodMode9 provides access to system data via drives, a listing of what each drive * __`T: TICKET.DB IMAGE`__: Ticket database files can be mounted and accessed via this drive. This provides easy and quick access to all tickets inside the `ticket.db`. This is read-only. * __`M: MEMORY VIRTUAL`__: This provides access to various memory regions. This is protected by a special write permission, and caution is advised when doing modifications inside this drive. This drive also gives access to `boot9.bin`, `boot11.bin` and `otp.bin` (sighaxed systems only). * __`X: NAND XORPADS`__: This drive contains XORpads for all NAND partitions. XORpads can be used to decrypt NAND partitions outside of the 3DS console with the help of [additional software](https://github.com/d0k3/3DSFAT16tool/releases). This is read-only. +* __`X: VRAM VIRTUAL`__: This drive resides in the first VRAM bank and contains files essential to GodMode9. The splash logo (in QLZ format) and the readme file is found there, also any file that is provided inside the `data` folder at build time. This is read-only. * __`Z: LAST SEARCH`__: After a search operation, search results are found inside this drive. The drive can be accessed at a later point to return to the former search results. diff --git a/arm9/source/common/common.h b/arm9/source/common/common.h index 48aeb1d..1bf25b6 100644 --- a/arm9/source/common/common.h +++ b/arm9/source/common/common.h @@ -34,17 +34,6 @@ #define STATIC_ASSERT(...) \ _Static_assert((__VA_ARGS__), #__VA_ARGS__) -// GodMode9 / SafeMode9 ("flavor" / splash screen) -#ifndef SAFEMODE -#define FLAVOR "GodMode9" -#define QLZ_SPLASH_H "gm9_splash_qlz.h" -#define QLZ_SPLASH gm9_splash_qlz -#else -#define FLAVOR "SafeMode9" -#define QLZ_SPLASH_H "sm9_splash_baby_qlz.h" -#define QLZ_SPLASH sm9_splash_baby_qlz -#endif - // input / output paths #define SUPPORT_PATH "0:/gm9/support" #define SCRIPT_PATH "0:/gm9/scripts" diff --git a/arm9/source/crypto/keydb.c b/arm9/source/crypto/keydb.c index 1fef802..30e3ba7 100644 --- a/arm9/source/crypto/keydb.c +++ b/arm9/source/crypto/keydb.c @@ -123,7 +123,7 @@ u32 LoadKeyDb(const char* path_db, AesKeyInfo* keydb, u32 bsize) { } else { // check for hardcoded key database u64 aeskeydb_bin_size = 0; - void* aeskeydb_bin = FindVTarFileInfo(VRAM0_AESKEY_DB, &aeskeydb_bin_size); + void* aeskeydb_bin = FindVTarFileInfo(KEYDB_NAME, &aeskeydb_bin_size); fsize = (aeskeydb_bin_size <= bsize) ? aeskeydb_bin_size : 0; if (fsize) memcpy(keydb, aeskeydb_bin, aeskeydb_bin_size); diff --git a/arm9/source/godmode.c b/arm9/source/godmode.c index f26497b..db6c681 100644 --- a/arm9/source/godmode.c +++ b/arm9/source/godmode.c @@ -61,6 +61,33 @@ static DirStruct* clipboard = (DirStruct*) (DIR_BUFFER + 0x78000); static PaneData* panedata = (PaneData*) (DIR_BUFFER + 0xF0000); +u32 SplashInit(const char* modestr) { + void* splash = FindVTarFileInfo(VRAM0_SPLASH_QLZ, NULL); + const char* namestr = FLAVOR " " VERSION; + const char* loadstr = "booting..."; + const u32 pos_xb = 10; + const u32 pos_yb = 10; + const u32 pos_xu = SCREEN_WIDTH_BOT - 10 - GetDrawStringWidth(loadstr); + const u32 pos_yu = SCREEN_HEIGHT - 10 - GetDrawStringHeight(loadstr); + + ClearScreenF(true, true, COLOR_STD_BG); + if (splash) QlzDecompress(TOP_SCREEN, splash, 0); + else DrawStringF(TOP_SCREEN, 10, 10, COLOR_STD_FONT, COLOR_TRANSPARENT, "(" VRAM0_SPLASH_QLZ " not found)"); + if (modestr) DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(modestr), + SCREEN_HEIGHT - 10 - GetDrawStringHeight(modestr), COLOR_STD_FONT, COLOR_TRANSPARENT, modestr); + + DrawStringF(BOT_SCREEN, pos_xb, pos_yb, COLOR_STD_FONT, COLOR_STD_BG, "%s\n%*.*s\n%s\n \n \n%s\n%s\n \n%s\n%s", + namestr, strnlen(namestr, 64), strnlen(namestr, 64), + "------------------------------", "https://github.com/d0k3/GodMode9", + "Releases:", "https://github.com/d0k3/GodMode9/releases/", // this won't fit with a 8px width font + "Hourlies:", "https://d0k3.secretalgorithm.com/"); + DrawStringF(BOT_SCREEN, pos_xu, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, loadstr); + DrawStringF(BOT_SCREEN, pos_xb, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, "built: " DBUILTL); + + return 0; +} + +#ifndef AUTORUN_SCRIPT 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 @@ -1712,32 +1739,6 @@ u32 HomeMoreMenu(char* current_path) { return HomeMoreMenu(current_path); } -u32 SplashInit(const char* modestr) { - void* splash = FindVTarFileInfo(VRAM0_SPLASH_QLZ, NULL); - const char* namestr = FLAVOR " " VERSION; - const char* loadstr = "booting..."; - const u32 pos_xb = 10; - const u32 pos_yb = 10; - const u32 pos_xu = SCREEN_WIDTH_BOT - 10 - GetDrawStringWidth(loadstr); - const u32 pos_yu = SCREEN_HEIGHT - 10 - GetDrawStringHeight(loadstr); - - ClearScreenF(true, true, COLOR_STD_BG); - if (splash) QlzDecompress(TOP_SCREEN, splash, 0); - else DrawStringF(TOP_SCREEN, 10, 10, COLOR_STD_FONT, COLOR_TRANSPARENT, "(" VRAM0_SPLASH_QLZ " not found)"); - if (modestr) DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(modestr), - SCREEN_HEIGHT - 10 - GetDrawStringHeight(modestr), COLOR_STD_FONT, COLOR_TRANSPARENT, modestr); - - DrawStringF(BOT_SCREEN, pos_xb, pos_yb, COLOR_STD_FONT, COLOR_STD_BG, "%s\n%*.*s\n%s\n \n \n%s\n%s\n \n%s\n%s", - namestr, strnlen(namestr, 64), strnlen(namestr, 64), - "------------------------------", "https://github.com/d0k3/GodMode9", - "Releases:", "https://github.com/d0k3/GodMode9/releases/", // this won't fit with a 8px width font - "Hourlies:", "https://d0k3.secretalgorithm.com/"); - DrawStringF(BOT_SCREEN, pos_xu, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, loadstr); - DrawStringF(BOT_SCREEN, pos_xb, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, "built: " DBUILTL); - - return 0; -} - u32 GodMode(int entrypoint) { const u32 quick_stp = (MAIN_SCREEN == TOP_SCREEN) ? 20 : 19; u32 exit_mode = GODMODE_EXIT_POWEROFF; @@ -2291,7 +2292,7 @@ u32 GodMode(int entrypoint) { return exit_mode; } -#ifdef AUTORUN_SCRIPT +#else u32 ScriptRunner(int entrypoint) { // show splash and initialize ClearScreenF(true, true, COLOR_STD_BG); diff --git a/arm9/source/system/vram0.h b/arm9/source/system/vram0.h index b927ea4..415cd3c 100644 --- a/arm9/source/system/vram0.h +++ b/arm9/source/system/vram0.h @@ -7,7 +7,6 @@ // known file names inside VRAM0 TAR #define VRAM0_AUTORUN_GM9 "autorun.gm9" #define VRAM0_README_MD "README.md" -#define VRAM0_AESKEY_DB "aeskey.db" #define VRAM0_SPLASH_QLZ FLAVOR "_splash.qlz"