General fixes and cleanup

Thanks @Kazuma77 for pointing that stuff out!
This commit is contained in:
d0k3 2017-11-20 17:50:48 +01:00
parent b5f2c64e77
commit c18ac35d45
7 changed files with 36 additions and 44 deletions

View File

@ -17,14 +17,13 @@ export RELDIR := release
# Definitions for initial RAM disk # Definitions for initial RAM disk
VRAM_OUT := $(OUTDIR)/vram0.tar VRAM_OUT := $(OUTDIR)/vram0.tar
VRAM_FLAGS := --format=v7 --blocking-factor=1 VRAM_FLAGS := --format=v7 --blocking-factor=1
VRAM_BASE := README.md resources/$(FLAVOR)_splash.qlz
VRAM_DATA := data VRAM_DATA := data
# Definitions for ARM binaries # Definitions for ARM binaries
export INCLUDE := -I"$(shell pwd)/common" export INCLUDE := -I"$(shell pwd)/common"
export ASFLAGS := -g -x assembler-with-cpp $(INCLUDE) 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 \ -g -O2 -Wall -Wextra -Wpedantic -Wcast-align -Wno-main \
-fomit-frame-pointer -ffast-math -std=gnu11 \ -fomit-frame-pointer -ffast-math -std=gnu11 \
-Wno-unused-function $(INCLUDE) -Wno-unused-function $(INCLUDE)
@ -63,8 +62,8 @@ release: clean
vram0: vram0:
@mkdir -p "$(OUTDIR)" @mkdir -p "$(OUTDIR)"
@echo "Creating $(VRAM_OUT)" @echo "Creating $(VRAM_OUT)"
@tar cf $(VRAM_OUT) $(VRAM_FLAGS) --xform='s/^$(VRAM_DATA)\///' $(VRAM_DATA)/* @tar cf $(VRAM_OUT) $(VRAM_FLAGS) --xform='s/^.*\///' $(README) $(SPLASH)
@tar rf $(VRAM_OUT) $(VRAM_FLAGS) --xform='s/^.*\///' $(VRAM_BASE) @-tar rf $(VRAM_OUT) $(VRAM_FLAGS) --xform='s/^$(VRAM_DATA)\///' $(VRAM_DATA)/*
elf: elf:
@set -e; for elf in $(ELF); do \ @set -e; for elf in $(ELF); do \

View File

@ -6,6 +6,8 @@ rwildcard = $(foreach d, $(wildcard $1*), \
$(call rwildcard, $d/, $2)) $(call rwildcard, $d/, $2))
FLAVOR := GodMode9 FLAVOR := GodMode9
README := README.md
SPLASH = resources/$(FLAVOR)_splash.qlz
ifeq ($(FONT),ORIG) ifeq ($(FONT),ORIG)
CFLAGS += -DFONT_ORIGINAL CFLAGS += -DFONT_ORIGINAL
@ -34,6 +36,7 @@ endif
ifeq ($(AUTORUN_SCRIPT),1) ifeq ($(AUTORUN_SCRIPT),1)
CFLAGS += -DAUTORUN_SCRIPT CFLAGS += -DAUTORUN_SCRIPT
README :=
endif endif
ifdef FIXED_BRIGHTNESS ifdef FIXED_BRIGHTNESS

View File

@ -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. * __`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). * __`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: 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. * __`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.

View File

@ -34,17 +34,6 @@
#define STATIC_ASSERT(...) \ #define STATIC_ASSERT(...) \
_Static_assert((__VA_ARGS__), #__VA_ARGS__) _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 // input / output paths
#define SUPPORT_PATH "0:/gm9/support" #define SUPPORT_PATH "0:/gm9/support"
#define SCRIPT_PATH "0:/gm9/scripts" #define SCRIPT_PATH "0:/gm9/scripts"

View File

@ -123,7 +123,7 @@ u32 LoadKeyDb(const char* path_db, AesKeyInfo* keydb, u32 bsize) {
} else { } else {
// check for hardcoded key database // check for hardcoded key database
u64 aeskeydb_bin_size = 0; 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; fsize = (aeskeydb_bin_size <= bsize) ? aeskeydb_bin_size : 0;
if (fsize) memcpy(keydb, aeskeydb_bin, aeskeydb_bin_size); if (fsize) memcpy(keydb, aeskeydb_bin, aeskeydb_bin_size);

View File

@ -61,6 +61,33 @@ static DirStruct* clipboard = (DirStruct*) (DIR_BUFFER + 0x78000);
static PaneData* panedata = (PaneData*) (DIR_BUFFER + 0xF0000); 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) { void GetTimeString(char* timestr, bool forced_update, bool full_year) {
static DsTime dstime; static DsTime dstime;
static u64 timer = (u64) -1; // this ensures we don't check the time too often 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); 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) { u32 GodMode(int entrypoint) {
const u32 quick_stp = (MAIN_SCREEN == TOP_SCREEN) ? 20 : 19; const u32 quick_stp = (MAIN_SCREEN == TOP_SCREEN) ? 20 : 19;
u32 exit_mode = GODMODE_EXIT_POWEROFF; u32 exit_mode = GODMODE_EXIT_POWEROFF;
@ -2291,7 +2292,7 @@ u32 GodMode(int entrypoint) {
return exit_mode; return exit_mode;
} }
#ifdef AUTORUN_SCRIPT #else
u32 ScriptRunner(int entrypoint) { u32 ScriptRunner(int entrypoint) {
// show splash and initialize // show splash and initialize
ClearScreenF(true, true, COLOR_STD_BG); ClearScreenF(true, true, COLOR_STD_BG);

View File

@ -7,7 +7,6 @@
// known file names inside VRAM0 TAR // known file names inside VRAM0 TAR
#define VRAM0_AUTORUN_GM9 "autorun.gm9" #define VRAM0_AUTORUN_GM9 "autorun.gm9"
#define VRAM0_README_MD "README.md" #define VRAM0_README_MD "README.md"
#define VRAM0_AESKEY_DB "aeskey.db"
#define VRAM0_SPLASH_QLZ FLAVOR "_splash.qlz" #define VRAM0_SPLASH_QLZ FLAVOR "_splash.qlz"