diff --git a/Makefile b/Makefile index b49b4b4..909731a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .SUFFIXES: -TARGET := fastboot3ds.firm +TARGET := firm.bin ENTRY9 := 0x08000054 ENTRY11 := 0x1FF85040 SECTION0_ADR := 0x08000040 diff --git a/include/arm9/config.h b/include/arm9/config.h index 26f770c..81df1b6 100644 --- a/include/arm9/config.h +++ b/include/arm9/config.h @@ -11,6 +11,7 @@ KBootOption2Buttons, KBootOption3Buttons, KBootMode, + KDevMode, // ... KLast }; @@ -30,3 +31,5 @@ bool configDataExist(int key); const char *configGetKeyText(int key); bool configSetKeyData(int key, const void *data); +void configRestoreDefaults(); +bool configDevModeEnabled(); diff --git a/include/arm9/menu.h b/include/arm9/menu.h index 8720492..fc0fd80 100644 --- a/include/arm9/menu.h +++ b/include/arm9/menu.h @@ -60,7 +60,7 @@ // Use this to change to another sub-menu. // Call menuUpdateGlobalState and menuActState afterwards. -void menuSetReturnToState(int state); +bool menuSetReturnToState(int state); // Use this to change back to a previous sub-menu. // Call menuUpdateGlobalState and menuActState afterwards. void menuSetEnterNextState(int state); diff --git a/include/arm9/ui.h b/include/arm9/ui.h index 3f0415c..2c028fa 100644 --- a/include/arm9/ui.h +++ b/include/arm9/ui.h @@ -26,6 +26,7 @@ //void uiShowMessageWindow(format, args...); void uiPrintProgressBar(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int cur, unsigned int max); +void uiPrintDevModeRequirement(); void uiPrintBootWarning(); void uiPrintBootFailure(); bool uiCheckHomePressed(u32 msTimeout); diff --git a/source/arm9/config.c b/source/arm9/config.c index ef99bcd..4b32fa7 100644 --- a/source/arm9/config.c +++ b/source/arm9/config.c @@ -801,3 +801,16 @@ configSetKeyData(key, ""); } } + +bool configDevModeEnabled() +{ + const bool *enabled; + + enabled = configGetData(KDevMode); + + if(!enabled || *enabled == false) + return false; + + return true; +} + diff --git a/source/arm9/menu.c b/source/arm9/menu.c index f6e1018..63a7132 100644 --- a/source/arm9/menu.c +++ b/source/arm9/menu.c @@ -162,8 +162,8 @@ } else if(keys & KEY_B) // go back { - menuSetReturnToState(STATE_PREVIOUS); - cursor_pos = 0; + if(menuSetReturnToState(STATE_PREVIOUS)) + cursor_pos = 0; } break; @@ -273,14 +273,14 @@ } } -void menuSetReturnToState(int state) +bool menuSetReturnToState(int state) { int i; if(state == STATE_PREVIOUS) { - if(menu_previous_states_count == 0) - return; + if(menu_previous_states_count <= 1) + return false; state = menu_previous_states[menu_previous_states_count - 1]; menu_previous_states_count--; } @@ -302,6 +302,8 @@ menu_next_state = state; // emit event menu_event_state = MENU_EVENT_STATE_CHANGE; + + return true; } void menuSetEnterNextState(int state) diff --git a/source/arm9/ui.c b/source/arm9/ui.c index 762cea1..25437a5 100644 --- a/source/arm9/ui.c +++ b/source/arm9/ui.c @@ -250,6 +250,19 @@ consoleSelect(prevCon); }*/ +void uiPrintDevModeRequirement() +{ + // This should use uiShowMessageWindow some day... + uiPrintError("This feature is blocked!"); + uiPrintError("You must enable Developer Mode to use it."); + + do { + hidScanInput(); + u32 keys = hidKeysDown() & HID_KEY_MASK_ALL; + if(keys == KEY_A) + break; + } while(1); +} void uiPrintProgressBar(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int cur, unsigned int max)