mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-26 05:42:07 +00:00
Add reboot normally option, hide reboot to rcm on mariko
On mariko, rebooting normally will bypass fuses
This commit is contained in:
parent
7862a15e1d
commit
0129039d76
5 changed files with 34 additions and 22 deletions
|
@ -41,21 +41,15 @@ void _printEntry(MenuEntry_t entry, u32 maxLen, u8 highlighted, u32 bg){
|
|||
gfx_putc('\n');
|
||||
}
|
||||
|
||||
void FunctionMenuHandler(MenuEntry_t *entries, int entryCount, menuPaths *paths, u8 options){
|
||||
Vector_t ent = vecFromArray(entries, entryCount, sizeof(MenuEntry_t));
|
||||
gfx_clearscreen();
|
||||
gfx_putc('\n');
|
||||
int res = newMenu(&ent, 0, 79, 30, options, entryCount);
|
||||
if (paths[res] != NULL)
|
||||
paths[res]();
|
||||
}
|
||||
|
||||
int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 options, int entryCount) {
|
||||
vecPDefArray(MenuEntry_t*, entries, vec);
|
||||
u32 selected = startIndex;
|
||||
|
||||
while (entries[selected].skip || entries[selected].hide)
|
||||
while (entries[selected].skip || entries[selected].hide){
|
||||
selected++;
|
||||
if (selected >= vec->count)
|
||||
selected = 0;
|
||||
}
|
||||
|
||||
u32 lastIndex = selected;
|
||||
u32 startX = 0, startY = 0;
|
||||
|
@ -63,12 +57,6 @@ int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 op
|
|||
|
||||
u32 bgColor = (options & USELIGHTGREY) ? COLOR_DARKGREY : COLOR_DEFAULT;
|
||||
|
||||
/*
|
||||
if (options & ENABLEPAGECOUNT){
|
||||
screenLenY -= 2;
|
||||
startY += 32;
|
||||
}
|
||||
*/
|
||||
|
||||
bool redrawScreen = true;
|
||||
Input_t *input = hidRead();
|
||||
|
|
|
@ -44,5 +44,4 @@ typedef struct _menuEntry {
|
|||
|
||||
#define ARR_LEN(x) (sizeof(x) / sizeof(*x))
|
||||
|
||||
int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 options, int entryCount);
|
||||
void FunctionMenuHandler(MenuEntry_t *entries, int entryCount, menuPaths *paths, u8 options);
|
||||
int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 options, int entryCount);
|
|
@ -16,6 +16,9 @@
|
|||
#include "../fs/fsutils.h"
|
||||
#include <soc/fuse.h>
|
||||
#include "../utils/utils.h"
|
||||
#include "../config.h"
|
||||
|
||||
extern hekate_config h_cfg;
|
||||
|
||||
enum {
|
||||
MainExplore = 0,
|
||||
|
@ -31,6 +34,7 @@ enum {
|
|||
MainExit,
|
||||
MainPowerOff,
|
||||
MainRebootRCM,
|
||||
MainRebootNormal,
|
||||
MainRebootHekate,
|
||||
MainRebootAMS
|
||||
};
|
||||
|
@ -49,6 +53,7 @@ MenuEntry_t mainMenuEntries[] = {
|
|||
[MainExit] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Exit --"},
|
||||
[MainPowerOff] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Power off"},
|
||||
[MainRebootRCM] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to RCM"},
|
||||
[MainRebootNormal] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot normally"},
|
||||
[MainRebootHekate] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to bootloader/update.bin"},
|
||||
[MainRebootAMS] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to atmosphere/reboot_payload.bin"}
|
||||
};
|
||||
|
@ -99,7 +104,10 @@ void ViewKeys(){
|
|||
|
||||
void ViewCredits(){
|
||||
gfx_clearscreen();
|
||||
gfx_printf("\nTegraexplorer v%d.%d.%d\nBy SuchMemeManySkill\n\nBased on Lockpick_RCM & Hekate, from shchmue & CTCaer", LP_VER_MJ, LP_VER_MN, LP_VER_BF);
|
||||
gfx_printf("\nTegraexplorer v%d.%d.%d\nBy SuchMemeManySkill\n\nBased on Lockpick_RCM & Hekate, from shchmue & CTCaer\n\n\n", LP_VER_MJ, LP_VER_MN, LP_VER_BF);
|
||||
|
||||
if (hidRead()->r)
|
||||
gfx_printf("%k\"I'm not even sure if it works\" - meme", COLOR_ORANGE);
|
||||
hidWait();
|
||||
}
|
||||
|
||||
|
@ -132,9 +140,11 @@ menuPaths mainMenuPaths[] = {
|
|||
[MainRebootRCM] = reboot_rcm,
|
||||
[MainPowerOff] = power_off,
|
||||
[MainViewCredits] = ViewCredits,
|
||||
[MainRebootNormal] = reboot_normal,
|
||||
};
|
||||
|
||||
void EnterMainMenu(){
|
||||
int res = 0;
|
||||
while (1){
|
||||
if (sd_get_card_removed())
|
||||
sd_unmount();
|
||||
|
@ -152,8 +162,15 @@ void EnterMainMenu(){
|
|||
// -- Exit --
|
||||
mainMenuEntries[MainRebootAMS].hide = (!sd_mounted || !FileExists("sd:/atmosphere/reboot_payload.bin"));
|
||||
mainMenuEntries[MainRebootHekate].hide = (!sd_mounted || !FileExists("sd:/bootloader/update.bin"));
|
||||
mainMenuEntries[MainRebootRCM].hide = h_cfg.t210b01;
|
||||
|
||||
FunctionMenuHandler(mainMenuEntries, ARR_LEN(mainMenuEntries), mainMenuPaths, ALWAYSREDRAW);
|
||||
gfx_clearscreen();
|
||||
gfx_putc('\n');
|
||||
|
||||
Vector_t ent = vecFromArray(mainMenuEntries, ARR_LEN(mainMenuEntries), sizeof(MenuEntry_t));
|
||||
res = newMenu(&ent, res, 79, 30, ALWAYSREDRAW, 0);
|
||||
if (mainMenuPaths[res] != NULL)
|
||||
mainMenuPaths[res]();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,17 +9,24 @@
|
|||
#include "../gfx/menu.h"
|
||||
#include "../hid/hid.h"
|
||||
#include "../fs/fsutils.h"
|
||||
#include "../config.h"
|
||||
|
||||
extern hekate_config h_cfg;
|
||||
|
||||
extern int launch_payload(char *path);
|
||||
|
||||
void ALWAYS_INLINE power_off(){
|
||||
power_set_state(POWER_OFF);
|
||||
power_set_state(POWER_OFF_RESET);
|
||||
}
|
||||
|
||||
void ALWAYS_INLINE reboot_rcm(){
|
||||
power_set_state(REBOOT_RCM);
|
||||
}
|
||||
|
||||
void ALWAYS_INLINE reboot_normal(){
|
||||
power_set_state((h_cfg.t210b01) ? REBOOT_BYPASS_FUSES : POWER_OFF_REBOOT);
|
||||
}
|
||||
|
||||
void RebootToPayloadOrRcm(){
|
||||
if (FileExists("sd:/atmosphere/reboot_payload.bin"))
|
||||
launch_payload("sd:/atmosphere/reboot_payload.bin");
|
||||
|
|
|
@ -11,4 +11,5 @@ void RebootToPayloadOrRcm();
|
|||
char *ShowKeyboard(const char *toEdit, u8 alwaysRet);
|
||||
|
||||
void power_off();
|
||||
void reboot_rcm();
|
||||
void reboot_rcm();
|
||||
void reboot_normal();
|
Loading…
Reference in a new issue