mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-22 11:56:42 +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');
|
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) {
|
int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 options, int entryCount) {
|
||||||
vecPDefArray(MenuEntry_t*, entries, vec);
|
vecPDefArray(MenuEntry_t*, entries, vec);
|
||||||
u32 selected = startIndex;
|
u32 selected = startIndex;
|
||||||
|
|
||||||
while (entries[selected].skip || entries[selected].hide)
|
while (entries[selected].skip || entries[selected].hide){
|
||||||
selected++;
|
selected++;
|
||||||
|
if (selected >= vec->count)
|
||||||
|
selected = 0;
|
||||||
|
}
|
||||||
|
|
||||||
u32 lastIndex = selected;
|
u32 lastIndex = selected;
|
||||||
u32 startX = 0, startY = 0;
|
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;
|
u32 bgColor = (options & USELIGHTGREY) ? COLOR_DARKGREY : COLOR_DEFAULT;
|
||||||
|
|
||||||
/*
|
|
||||||
if (options & ENABLEPAGECOUNT){
|
|
||||||
screenLenY -= 2;
|
|
||||||
startY += 32;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool redrawScreen = true;
|
bool redrawScreen = true;
|
||||||
Input_t *input = hidRead();
|
Input_t *input = hidRead();
|
||||||
|
|
|
@ -44,5 +44,4 @@ typedef struct _menuEntry {
|
||||||
|
|
||||||
#define ARR_LEN(x) (sizeof(x) / sizeof(*x))
|
#define ARR_LEN(x) (sizeof(x) / sizeof(*x))
|
||||||
|
|
||||||
int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 options, int entryCount);
|
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);
|
|
|
@ -16,6 +16,9 @@
|
||||||
#include "../fs/fsutils.h"
|
#include "../fs/fsutils.h"
|
||||||
#include <soc/fuse.h>
|
#include <soc/fuse.h>
|
||||||
#include "../utils/utils.h"
|
#include "../utils/utils.h"
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
|
extern hekate_config h_cfg;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MainExplore = 0,
|
MainExplore = 0,
|
||||||
|
@ -31,6 +34,7 @@ enum {
|
||||||
MainExit,
|
MainExit,
|
||||||
MainPowerOff,
|
MainPowerOff,
|
||||||
MainRebootRCM,
|
MainRebootRCM,
|
||||||
|
MainRebootNormal,
|
||||||
MainRebootHekate,
|
MainRebootHekate,
|
||||||
MainRebootAMS
|
MainRebootAMS
|
||||||
};
|
};
|
||||||
|
@ -49,6 +53,7 @@ MenuEntry_t mainMenuEntries[] = {
|
||||||
[MainExit] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Exit --"},
|
[MainExit] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Exit --"},
|
||||||
[MainPowerOff] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Power off"},
|
[MainPowerOff] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Power off"},
|
||||||
[MainRebootRCM] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to RCM"},
|
[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"},
|
[MainRebootHekate] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to bootloader/update.bin"},
|
||||||
[MainRebootAMS] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to atmosphere/reboot_payload.bin"}
|
[MainRebootAMS] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to atmosphere/reboot_payload.bin"}
|
||||||
};
|
};
|
||||||
|
@ -99,7 +104,10 @@ void ViewKeys(){
|
||||||
|
|
||||||
void ViewCredits(){
|
void ViewCredits(){
|
||||||
gfx_clearscreen();
|
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();
|
hidWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,9 +140,11 @@ menuPaths mainMenuPaths[] = {
|
||||||
[MainRebootRCM] = reboot_rcm,
|
[MainRebootRCM] = reboot_rcm,
|
||||||
[MainPowerOff] = power_off,
|
[MainPowerOff] = power_off,
|
||||||
[MainViewCredits] = ViewCredits,
|
[MainViewCredits] = ViewCredits,
|
||||||
|
[MainRebootNormal] = reboot_normal,
|
||||||
};
|
};
|
||||||
|
|
||||||
void EnterMainMenu(){
|
void EnterMainMenu(){
|
||||||
|
int res = 0;
|
||||||
while (1){
|
while (1){
|
||||||
if (sd_get_card_removed())
|
if (sd_get_card_removed())
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
|
@ -152,8 +162,15 @@ void EnterMainMenu(){
|
||||||
// -- Exit --
|
// -- Exit --
|
||||||
mainMenuEntries[MainRebootAMS].hide = (!sd_mounted || !FileExists("sd:/atmosphere/reboot_payload.bin"));
|
mainMenuEntries[MainRebootAMS].hide = (!sd_mounted || !FileExists("sd:/atmosphere/reboot_payload.bin"));
|
||||||
mainMenuEntries[MainRebootHekate].hide = (!sd_mounted || !FileExists("sd:/bootloader/update.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 "../gfx/menu.h"
|
||||||
#include "../hid/hid.h"
|
#include "../hid/hid.h"
|
||||||
#include "../fs/fsutils.h"
|
#include "../fs/fsutils.h"
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
|
extern hekate_config h_cfg;
|
||||||
|
|
||||||
extern int launch_payload(char *path);
|
extern int launch_payload(char *path);
|
||||||
|
|
||||||
void ALWAYS_INLINE power_off(){
|
void ALWAYS_INLINE power_off(){
|
||||||
power_set_state(POWER_OFF);
|
power_set_state(POWER_OFF_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALWAYS_INLINE reboot_rcm(){
|
void ALWAYS_INLINE reboot_rcm(){
|
||||||
power_set_state(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(){
|
void RebootToPayloadOrRcm(){
|
||||||
if (FileExists("sd:/atmosphere/reboot_payload.bin"))
|
if (FileExists("sd:/atmosphere/reboot_payload.bin"))
|
||||||
launch_payload("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);
|
char *ShowKeyboard(const char *toEdit, u8 alwaysRet);
|
||||||
|
|
||||||
void power_off();
|
void power_off();
|
||||||
void reboot_rcm();
|
void reboot_rcm();
|
||||||
|
void reboot_normal();
|
Loading…
Reference in a new issue