1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-09 21:51:48 +00:00

Small tweaks

- swap crash for credits
- home now reboots to atmosphere/reboot_payload.bin, or rcm if not found
This commit is contained in:
suchmememanyskill 2021-01-01 11:43:31 +01:00
parent a39b3b2460
commit b818b577e9
6 changed files with 26 additions and 17 deletions

View file

@ -14,7 +14,7 @@ void gfx_clearscreen(){
gfx_boxGrey(0, 703, 1279, 719, 0xFF); gfx_boxGrey(0, 703, 1279, 719, 0xFF);
gfx_boxGrey(0, 0, 1279, 15, 0xFF); gfx_boxGrey(0, 0, 1279, 15, 0xFF);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
gfx_printf("Tegraexplorer %d.%d.%d | Battery: %3d%%\n", LP_VER_MJ, LP_VER_MN, LP_VER_BF, battery >> 8); gfx_printf("Tegraexplorer b%d.%d.%d | Battery: %3d%%\n", LP_VER_MJ, LP_VER_MN, LP_VER_BF, battery >> 8);
RESETCOLOR; RESETCOLOR;
} }

View file

@ -4,6 +4,7 @@
#include "../gfx/gfx.h" #include "../gfx/gfx.h"
#include <utils/types.h> #include <utils/types.h>
#include <utils/util.h> #include <utils/util.h>
#include "../utils/utils.h"
static Input_t inputs = {0}; static Input_t inputs = {0};
u16 LbaseX = 0, LbaseY = 0, RbaseX = 0, RbaseY = 0; u16 LbaseX = 0, LbaseY = 0, RbaseX = 0, RbaseY = 0;
@ -19,7 +20,7 @@ Input_t *hidRead(){
// utils_takeScreenshot(); // utils_takeScreenshot();
if (controller->home) if (controller->home)
reboot_rcm(); RebootToPayloadOrRcm();
inputs.buttons = controller->buttons; inputs.buttons = controller->buttons;

View file

@ -350,9 +350,7 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
if (resLen < val.integerType) if (resLen < val.integerType)
return ErrValue(ERRSYNTAX); return ErrValue(ERRSYNTAX);
char *temp = malloc(resLen - val.integerType + 1); char *temp = utils_copyStringSize(res.stringType, resLen - val.integerType);
memcpy(temp, res.stringType, resLen - val.integerType);
temp[resLen - val.integerType] = 0;
freeVariable(res); freeVariable(res);
res.stringType = temp; res.stringType = temp;
@ -363,9 +361,7 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
if (resLen < val.integerType) if (resLen < val.integerType)
return ErrValue(ERRSYNTAX); return ErrValue(ERRSYNTAX);
char *temp = malloc(resLen - val.integerType + 1); char *temp = CpyStr(res.stringType + val.integerType);
memcpy(temp, res.stringType + val.integerType, resLen - val.integerType);
temp[resLen - val.integerType] = 0;
freeVariable(res); freeVariable(res);
res.stringType = temp; res.stringType = temp;

View file

@ -22,10 +22,10 @@ enum {
MainBrowseEmmc, MainBrowseEmmc,
MainBrowseEmummc, MainBrowseEmummc,
MainTools, MainTools,
MainCauseException,
MainPartitionSd, MainPartitionSd,
MainDumpFw, MainDumpFw,
MainViewKeys, MainViewKeys,
MainViewCredits,
MainExit, MainExit,
MainPowerOff, MainPowerOff,
MainRebootRCM, MainRebootRCM,
@ -40,10 +40,10 @@ MenuEntry_t mainMenuEntries[] = {
[MainBrowseEmmc] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Browse EMMC"}, [MainBrowseEmmc] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Browse EMMC"},
[MainBrowseEmummc] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Browse EMUMMC"}, [MainBrowseEmummc] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Browse EMUMMC"},
[MainTools] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Tools --"}, [MainTools] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "\n-- Tools --"},
[MainCauseException] = {.optionUnion = COLORTORGB(COLOR_RED), .name = "Cause an exception"},
[MainPartitionSd] = {.optionUnion = COLORTORGB(COLOR_ORANGE), .name = "Partition the sd"}, [MainPartitionSd] = {.optionUnion = COLORTORGB(COLOR_ORANGE), .name = "Partition the sd"},
[MainDumpFw] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Dump Firmware"}, [MainDumpFw] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Dump Firmware"},
[MainViewKeys] = {.optionUnion = COLORTORGB(COLOR_YELLOW), .name = "View dumped keys"}, [MainViewKeys] = {.optionUnion = COLORTORGB(COLOR_YELLOW), .name = "View dumped keys"},
[MainViewCredits] = {.optionUnion = COLORTORGB(COLOR_YELLOW), .name = "Credits"},
[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"},
@ -70,10 +70,6 @@ void HandleEMUMMC(){
GptMenu(MMC_CONN_EMUMMC); GptMenu(MMC_CONN_EMUMMC);
} }
void CrashTE(){
gfx_printf("%d", *((int*)0));
}
void ViewKeys(){ void ViewKeys(){
gfx_clearscreen(); gfx_clearscreen();
for (int i = 0; i < 3; i++){ for (int i = 0; i < 3; i++){
@ -93,6 +89,12 @@ void ViewKeys(){
hidWait(); hidWait();
} }
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);
hidWait();
}
extern bool sd_mounted; extern bool sd_mounted;
extern bool is_sd_inited; extern bool is_sd_inited;
extern int launch_payload(char *path); extern int launch_payload(char *path);
@ -114,7 +116,6 @@ menuPaths mainMenuPaths[] = {
[MainMountSd] = MountOrUnmountSD, [MainMountSd] = MountOrUnmountSD,
[MainBrowseEmmc] = HandleEMMC, [MainBrowseEmmc] = HandleEMMC,
[MainBrowseEmummc] = HandleEMUMMC, [MainBrowseEmummc] = HandleEMUMMC,
[MainCauseException] = CrashTE,
[MainPartitionSd] = FormatSD, [MainPartitionSd] = FormatSD,
[MainDumpFw] = DumpSysFw, [MainDumpFw] = DumpSysFw,
[MainViewKeys] = ViewKeys, [MainViewKeys] = ViewKeys,
@ -122,6 +123,7 @@ menuPaths mainMenuPaths[] = {
[MainRebootHekate] = RebootToHekate, [MainRebootHekate] = RebootToHekate,
[MainRebootRCM] = reboot_rcm, [MainRebootRCM] = reboot_rcm,
[MainPowerOff] = power_off, [MainPowerOff] = power_off,
[MainViewCredits] = ViewCredits,
}; };
void EnterMainMenu(){ void EnterMainMenu(){

View file

@ -8,6 +8,15 @@
#include "../gfx/gfx.h" #include "../gfx/gfx.h"
#include "../gfx/menu.h" #include "../gfx/menu.h"
#include "../hid/hid.h" #include "../hid/hid.h"
#include "../fs/fsutils.h"
extern int launch_payload(char *path);
void RebootToPayloadOrRcm(){
if (FileExists("sd:/atmosphere/reboot_payload.bin"))
launch_payload("sd:/atmosphere/reboot_payload.bin");
reboot_rcm();
}
char *CpyStr(const char* in){ char *CpyStr(const char* in){
int len = strlen(in); int len = strlen(in);

View file

@ -5,6 +5,7 @@ char *CpyStr(const char* in);
void MaskIn(char *mod, u32 bitstream, char mask); void MaskIn(char *mod, u32 bitstream, char mask);
bool StrEndsWith(char *begin, char *end); bool StrEndsWith(char *begin, char *end);
void WaitFor(u32 ms); void WaitFor(u32 ms);
void RebootToPayloadOrRcm();
#define FREE(x) free(x); x = NULL; #define FREE(x) free(x); x = NULL;
char *ShowKeyboard(const char *toEdit, u8 alwaysRet); char *ShowKeyboard(const char *toEdit, u8 alwaysRet);