diff --git a/include/arm11/menu/menu_fb3ds.h b/include/arm11/menu/menu_fb3ds.h index 834f0b6..0c3f22d 100644 --- a/include/arm11/menu/menu_fb3ds.h +++ b/include/arm11/menu/menu_fb3ds.h @@ -80,7 +80,7 @@ { "Boot from file...", DESC_BOOT_FILE, &DummyFunc, 2 }, { "NAND tools...", DESC_NAND_TOOLS, NULL, 7 }, { "Miscellaneous...", DESC_MISC, NULL, 8 }, - { "Debug...", "Debug menu.", NULL, 9 } + { "Debug...", LOREM, NULL, 9 } } }, { // 1 @@ -133,7 +133,7 @@ { // 9 "Debug", 1, NULL, 0, // this will not show in the release version { - { "View current settings", "View current settings", &SetView, 0 } + { "View current settings", LOREM, &SetView, 0 } } } }; diff --git a/source/arm11/menu/menu.c b/source/arm11/menu/menu.c index bca9fdc..20ef30f 100644 --- a/source/arm11/menu/menu.c +++ b/source/arm11/menu/menu.c @@ -25,7 +25,6 @@ #include "arm11/config.h" #include "arm11/console.h" #include "arm11/fmt.h" -#include "arm11/power.h" #include "hardware/gfx.h" @@ -61,7 +60,7 @@ if (configDataExist(KBootOption1Buttons + index)) { char* keycombo = (char*) configCopyText(KBootOption1Buttons + index); - ee_snprintf(desc_ww, 512, "%s\nCurrent: %s\nKeycombo: %s", desc, slot_path, keycombo); + ee_snprintf(desc_ww, 512, "%s\nCurrent: %s\nButtons: %s", desc, slot_path, keycombo); free(keycombo); } else @@ -173,7 +172,7 @@ GFX_waitForEvent(GFX_EVENT_PDC0, true); // VBlank if(hidGetPowerButton(true)) // handle power button - power_off(); + break; // deinits & poweroff outside of this function hidScanInput(); const u32 kDown = hidKeysDown(); diff --git a/source/arm11/menu/menu_fsel.c b/source/arm11/menu/menu_fsel.c index f4c3238..56eae9c 100644 --- a/source/arm11/menu/menu_fsel.c +++ b/source/arm11/menu/menu_fsel.c @@ -29,7 +29,6 @@ #include "arm11/hardware/hid.h" #include "arm11/hardware/timer.h" #include "arm11/console.h" -#include "arm11/power.h" #include "arm11/debug.h" #include "arm11/fmt.h" @@ -353,7 +352,7 @@ } u32 dbutton_cooldown = 0; - while(true) + while(result) { // update file browser (on demand) if (index != last_index) { @@ -376,8 +375,9 @@ } dbutton_cooldown = 0; - if(hidGetPowerButton(true)) // handle power button - power_off(); + // handle power button + if(hidGetPowerButton(false)) + result = false; hidScanInput(); const u32 kDown = hidKeysDown(); @@ -390,7 +390,6 @@ else if (kDown & KEY_HOME) { result = false; - break; } else if ((kDown & KEY_A) && n_entries) { diff --git a/source/arm11/menu/menu_func.c b/source/arm11/menu/menu_func.c index eda9dc0..3507650 100644 --- a/source/arm11/menu/menu_func.c +++ b/source/arm11/menu/menu_func.c @@ -26,6 +26,7 @@ #include "arm11/console.h" #include "arm11/config.h" #include "arm11/fmt.h" +#include "arm11/power.h" // we need a better solution for this later (!!!) void updateScreens(void) @@ -78,7 +79,11 @@ // if bit4 of param is set, reset slot and return if (param & 0x10) - return (configSetKeyData(KBootOption1 + slot, NULL)) ? 0 : 1; + { + u32 res = (configSetKeyData(KBootOption1Buttons + slot, NULL) && + configSetKeyData(KBootOption1 + slot, NULL)) ? 0 : 1; + return res; + } if (configDataExist(KBootOption1 + slot)) start = (char*) configGetData(KBootOption1 + slot); @@ -121,7 +126,7 @@ } } if (first) // backup solution for no buttons - ee_sprintf(ptr, "(no buttons held)"); + ee_sprintf(ptr, "(no buttons)"); // clear console consoleSelect(con); @@ -147,29 +152,30 @@ // update screens updateScreens(); - // check hold duration - u32 vBlanks = 0; + // check for buttons until held for ~1.5sec u32 kHeldNew = 0; do { - GFX_waitForEvent(GFX_EVENT_PDC0, true); - hidScanInput(); - kHeldNew = hidKeysHeld(); + // check hold duration + u32 vBlanks = 0; + do + { + GFX_waitForEvent(GFX_EVENT_PDC0, true); + if(hidGetPowerButton(false)) return 1; + + hidScanInput(); + kHeldNew = hidKeysHeld(); + if(hidKeysDown() & KEY_SHELL) sleepmode(); + } + while ((kHeld == kHeldNew) && (++vBlanks < 100)); - if(hidGetPowerButton(true)) power_off(); - else if(hidKeysDown() & KEY_SHELL) sleepmode(); - } while ((kHeld == kHeldNew) && (++vBlanks < 100)); - - // check keys - if (kHeldNew & KEY_HOME) - { - return 1; + // check HOME key + if (kHeldNew & KEY_HOME) return 1; } - else if ((kHeld == kHeldNew) && (kHeld & 0xfff)) - { - break; - } + while (!((kHeld|kHeldNew) & 0xfff)); + // repeat checks until actual buttons are held + if (kHeld == kHeldNew) break; kHeld = kHeldNew; } @@ -217,7 +223,7 @@ } hidScanInput(); } - while (!(hidKeysDown() & KEY_B)); + while (!(hidKeysDown() & (KEY_B|KEY_HOME))); return 0; } @@ -248,16 +254,15 @@ } updateScreens(); - // wait for B button + // wait for B / HOME button do { if(hidGetPowerButton(false)) // handle power button - { return 1; - } + hidScanInput(); } - while (!(hidKeysDown() & KEY_B)); + while (!(hidKeysDown() & (KEY_B|KEY_HOME))); return 0; } @@ -290,16 +295,18 @@ ee_printf_line_center("... everyone who contributed to 3dbrew.org"); updateScreens(); - // wait for B button + // wait for B button or HOME button + u32 kDown = 0; do { if(hidGetPowerButton(false)) // handle power button - { - return 1; - } + return 0; + hidScanInput(); + kDown = hidKeysDown(); + if (kDown & (KEY_SHELL)) sleepmode(); } - while (!(hidKeysDown() & KEY_B)); + while (!(kDown & (KEY_B|KEY_HOME))); return 0; }