Improve top-down screen mode

This commit is contained in:
d0k3 2017-04-26 01:53:13 +02:00
parent 893f98b343
commit fe19600828
4 changed files with 24 additions and 22 deletions

View File

@ -17,7 +17,7 @@ include $(DEVKITARM)/ds_rules
# SPECS is the directory containing the important build and link files # SPECS is the directory containing the important build and link files
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
export TARGET := GodMode9 export TARGET := GodMode9
ifeq ($(MODE),safe) ifeq ($(SAFEMODE),1)
export TARGET := SafeMode9 export TARGET := SafeMode9
endif endif
BUILD := build BUILD := build
@ -50,10 +50,14 @@ else
CFLAGS += -DFONT_6X10 CFLAGS += -DFONT_6X10
endif endif
ifeq ($(MODE),safe) ifeq ($(SAFEMODE),1)
CFLAGS += -DSAFEMODE CFLAGS += -DSAFEMODE
endif endif
ifeq ($(SWITCH_SCREENS),1)
CFLAGS += -DSWITCH_SCREENS
endif
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH) ASFLAGS := -g $(ARCH)
@ -87,7 +91,7 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/gm9*.*))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/gm9*.*)))
ifeq ($(MODE),safe) ifeq ($(SAFEMODE),1)
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/sm9*.*))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/sm9*.*)))
endif endif

View File

@ -16,10 +16,10 @@ These short instructions apply to all users who have ARM9loaderhax and [Luma3DS]
* Get good versions of `aeskeydb.bin`, `seeddb.bin` and `encTitlekeys.bin` from somewhere (don't ask me!) and put these three files into `sd:/` or `sd:/files9` (optional but recommended for full functionality). * Get good versions of `aeskeydb.bin`, `seeddb.bin` and `encTitlekeys.bin` from somewhere (don't ask me!) and put these three files into `sd:/` or `sd:/files9` (optional but recommended for full functionality).
* Possibly helpful info: If you wonder how to backup your NAND, press the HOME button and enter the menu titled `More...`. You may also backup your NAND via just copying the `nand.bin` / `nand_min.bin` file in `S:/`. * Possibly helpful info: If you wonder how to backup your NAND, press the HOME button and enter the menu titled `More...`. You may also backup your NAND via just copying the `nand.bin` / `nand_min.bin` file in `S:/`.
You may now run GodMode9 via the X Button (or any other button you chose). 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 this / entry points ## How to run this / entry points / developer info
GodMode9 can be built to run from a number of entry points, descriptions are below. Note that you need to be on or below 3DS firmware version v11.2 (v9.2 if not using SafeHax/FastHax) or have ARM9loaderhax installed for any of these to work. All entrypoint files are included in the release archive. GodMode9 can be built to run from a number of entry points, descriptions are below. Note that you need to be on or below 3DS firmware version v11.2 (v9.2 if not using SafeHax/FastHax) or have ARM9loaderhax installed for any of these to work. All entrypoint files are included in the release archive.
* __A9LH, Brahma & SafeHax__: Copy `GodMode9.bin` to somewhere on your SD card and run it via either [arm9loaderhax](https://3ds.guide/), [Brahma](https://github.com/delebile/Brahma2) or [FastHax](https://github.com/nedwill/fasthax)/[SafeHax](https://github.com/TiniVi/safehax). Brahma derivatives / loaders (such as [BrahmaLoader](https://gbatemp.net/threads/release-easily-load-payloads-in-hb-launcher-via-brahma-2-mod.402857/)) and A9LH chainloaders (such as [Luma3DS](https://github.com/AuroraWright/Luma3DS) and [BootCTR9](https://github.com/hartmannaf/BootCtr9)) will work with this as well. Build this with `make binary`. * __A9LH, Brahma & SafeHax__: Copy `GodMode9.bin` to somewhere on your SD card and run it via either [arm9loaderhax](https://3ds.guide/), [Brahma](https://github.com/delebile/Brahma2) or [FastHax](https://github.com/nedwill/fasthax)/[SafeHax](https://github.com/TiniVi/safehax). Brahma derivatives / loaders (such as [BrahmaLoader](https://gbatemp.net/threads/release-easily-load-payloads-in-hb-launcher-via-brahma-2-mod.402857/)) and A9LH chainloaders (such as [Luma3DS](https://github.com/AuroraWright/Luma3DS) and [BootCTR9](https://github.com/hartmannaf/BootCtr9)) will work with this as well. Build this with `make binary`.
* __Homebrew Launcher__: Copy `GodMode9.3dsx` & `GodMode9.smdh` into `/3DS/GodMode9` on your SD card. Run this via [Smealums Homebrew Launcher](http://smealum.github.io/3ds/), [Mashers Grid Launcher](https://gbatemp.net/threads/release-homebrew-launcher-with-grid-layout.397527/) or any other compatible software. Build this with `make brahma`. * __Homebrew Launcher__: Copy `GodMode9.3dsx` & `GodMode9.smdh` into `/3DS/GodMode9` on your SD card. Run this via [Smealums Homebrew Launcher](http://smealum.github.io/3ds/), [Mashers Grid Launcher](https://gbatemp.net/threads/release-homebrew-launcher-with-grid-layout.397527/) or any other compatible software. Build this with `make brahma`.
@ -27,7 +27,7 @@ GodMode9 can be built to run from a number of entry points, descriptions are bel
* __CakeHax MSET__: Copy `GodMode9.dat` to the root of your SD card and `GodMode9.nds` to anywhere on the SD card. You can then run it either via MSET and GodMode9.nds. Build this via `make cakerop`. * __CakeHax MSET__: Copy `GodMode9.dat` to the root of your SD card and `GodMode9.nds` to anywhere on the SD card. You can then run it either via MSET and GodMode9.nds. Build this via `make cakerop`.
* __Gateway Browser Exploit__: Copy Launcher.dat to your SD card root and run this via http://go.gateway-3ds.com/ from your 3DS browser. Build this with `make gateway`. Please note: __this entrypoint is deprecated__. While it may still work at the present time with little to no problems, bugs will no more be fixed and it may be completely removed at a later time. Use CakeHax instead. * __Gateway Browser Exploit__: Copy Launcher.dat to your SD card root and run this via http://go.gateway-3ds.com/ from your 3DS browser. Build this with `make gateway`. Please note: __this entrypoint is deprecated__. While it may still work at the present time with little to no problems, bugs will no more be fixed and it may be completely removed at a later time. Use CakeHax instead.
If you are a developer and you are building this, you may also just run `make release` to build all files at once. To build __SafeMode9__ (a bricksafe variant of GodMode9, with limited write permissions) instead of GodMode9, compile with `make MODE=safe`. For additional customization, you may also choose the internal font via `make FONT=6X10`, `make FONT=ACORN`, `make FONT=GB` and `make FONT=ORIG`. If you are a developer and you are building this, you may also just run `make release` to build all files at once. 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`.
## Write permissions system ## Write permissions system

View File

@ -48,9 +48,6 @@
#define QLZ_SPLASH sm9_splash_baby_qlz #define QLZ_SPLASH sm9_splash_baby_qlz
#endif #endif
// define this to switch top / bottom screen
// #define SWITCH_SCREENS
// GodMode9 version // GodMode9 version
#define VERSION "1.1.3" #define VERSION "1.1.3"

View File

@ -49,11 +49,11 @@ void DrawUserInterface(const char* curr_path, DirEntry* curr_entry, DirStruct* c
const u32 n_cb_show = 8; const u32 n_cb_show = 8;
const u32 bartxt_start = (FONT_HEIGHT_EXT == 10) ? 1 : 2; const u32 bartxt_start = (FONT_HEIGHT_EXT == 10) ? 1 : 2;
const u32 bartxt_x = 2; const u32 bartxt_x = 2;
const u32 bartxt_rx = SCREEN_WIDTH_MAIN - (19*FONT_WIDTH_EXT) - bartxt_x; const u32 bartxt_rx = SCREEN_WIDTH_TOP - (19*FONT_WIDTH_EXT) - bartxt_x;
const u32 info_start = 18; const u32 info_start = (MAIN_SCREEN == TOP_SCREEN) ? 18 : 2; // leave space for the topbar when required
const u32 instr_x = (SCREEN_WIDTH_MAIN - (36*FONT_WIDTH_EXT)) / 2; const u32 instr_x = (SCREEN_WIDTH_MAIN - (34*FONT_WIDTH_EXT)) / 2;
const u32 len_path = SCREEN_WIDTH_MAIN - ((SCREEN_WIDTH_MAIN >= 400) ? 160 : 120); const u32 len_path = SCREEN_WIDTH_TOP - 120;
const u32 len_info = (SCREEN_WIDTH_MAIN - ((SCREEN_WIDTH_MAIN >= 400) ? 80 : 40)) / 2; const u32 len_info = (SCREEN_WIDTH_MAIN - ((SCREEN_WIDTH_MAIN >= 400) ? 80 : 20)) / 2;
char tempstr[64]; char tempstr[64];
static u32 state_prev = 0xFFFFFFFF; static u32 state_prev = 0xFFFFFFFF;
@ -71,20 +71,20 @@ void DrawUserInterface(const char* curr_path, DirEntry* curr_entry, DirStruct* c
} }
// top bar - current path & free/total storage // top bar - current path & free/total storage
DrawRectangle(MAIN_SCREEN, 0, 0, SCREEN_WIDTH_MAIN, 12, COLOR_TOP_BAR); DrawRectangle(TOP_SCREEN, 0, 0, SCREEN_WIDTH_TOP, 12, COLOR_TOP_BAR);
if (strncmp(curr_path, "", 256) != 0) { if (strncmp(curr_path, "", 256) != 0) {
char bytestr0[32]; char bytestr0[32];
char bytestr1[32]; char bytestr1[32];
TruncateString(tempstr, curr_path, len_path / FONT_WIDTH_EXT, 8); TruncateString(tempstr, curr_path, len_path / FONT_WIDTH_EXT, 8);
DrawStringF(MAIN_SCREEN, bartxt_x, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, tempstr); DrawStringF(TOP_SCREEN, bartxt_x, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, tempstr);
DrawStringF(MAIN_SCREEN, bartxt_rx, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "%19.19s", "LOADING..."); DrawStringF(TOP_SCREEN, bartxt_rx, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "%19.19s", "LOADING...");
FormatBytes(bytestr0, GetFreeSpace(curr_path)); FormatBytes(bytestr0, GetFreeSpace(curr_path));
FormatBytes(bytestr1, GetTotalSpace(curr_path)); FormatBytes(bytestr1, GetTotalSpace(curr_path));
snprintf(tempstr, 64, "%s/%s", bytestr0, bytestr1); snprintf(tempstr, 64, "%s/%s", bytestr0, bytestr1);
DrawStringF(MAIN_SCREEN, bartxt_rx, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "%19.19s", tempstr); DrawStringF(TOP_SCREEN, bartxt_rx, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "%19.19s", tempstr);
} else { } else {
DrawStringF(MAIN_SCREEN, bartxt_x, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "[root]"); DrawStringF(TOP_SCREEN, bartxt_x, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "[root]");
DrawStringF(MAIN_SCREEN, bartxt_rx, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "%19.19s", FLAVOR); DrawStringF(TOP_SCREEN, bartxt_rx, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "%19.19s", FLAVOR);
} }
// left top - current file info // left top - current file info
@ -164,8 +164,8 @@ void DrawDirContents(DirStruct* contents, u32 cursor, u32* scroll) {
const int str_width = (SCREEN_WIDTH_ALT-3) / FONT_WIDTH_EXT; const int str_width = (SCREEN_WIDTH_ALT-3) / FONT_WIDTH_EXT;
const u32 bar_height_min = 32; const u32 bar_height_min = 32;
const u32 bar_width = 2; const u32 bar_width = 2;
const u32 start_y = 2;
const u32 stp_y = 12; const u32 stp_y = 12;
const u32 start_y = (MAIN_SCREEN == TOP_SCREEN) ? 2 : 2 + stp_y;
const u32 pos_x = 0; const u32 pos_x = 0;
const u32 lines = (SCREEN_HEIGHT-start_y+stp_y-1) / stp_y; const u32 lines = (SCREEN_HEIGHT-start_y+stp_y-1) / stp_y;
u32 pos_y = start_y; u32 pos_y = start_y;
@ -1244,6 +1244,7 @@ u32 HomeMoreMenu(char* current_path, DirStruct* current_dir, DirStruct* clipboar
if (GetLegitSector0x96(legit_sector) == 0) { if (GetLegitSector0x96(legit_sector) == 0) {
ShowString("Searching secret sector..."); ShowString("Searching secret sector...");
const char* path_sector = OUTPUT_PATH "/" SECRET_NAME; const char* path_sector = OUTPUT_PATH "/" SECRET_NAME;
// we can safely assume the output path exists at that point
lsector = FileSetData(path_sector, legit_sector, 0x200, 0, true); lsector = FileSetData(path_sector, legit_sector, 0x200, 0, true);
} }
ShowPrompt(false, "Built in " OUTPUT_PATH ":\n \n%18.18-s %s\n%18.18-s %s\n%18.18-s %s\n%18.18-s %s", ShowPrompt(false, "Built in " OUTPUT_PATH ":\n \n%18.18-s %s\n%18.18-s %s\n%18.18-s %s\n%18.18-s %s",
@ -1376,8 +1377,8 @@ u32 GodMode() {
curr_entry->marked = mark_next; curr_entry->marked = mark_next;
mark_next = -2; mark_next = -2;
} }
DrawUserInterface(current_path, curr_entry, clipboard, N_PANES ? pane - panedata + 1 : 0);
DrawDirContents(current_dir, cursor, &scroll); DrawDirContents(current_dir, cursor, &scroll);
DrawUserInterface(current_path, curr_entry, clipboard, N_PANES ? pane - panedata + 1 : 0);
u32 pad_state = InputWait(); u32 pad_state = InputWait();
bool switched = (pad_state & BUTTON_R1); bool switched = (pad_state & BUTTON_R1);