1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 11:56:42 +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, 0, 1279, 15, 0xFF);
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;
}

View file

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

View file

@ -349,10 +349,8 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
u32 resLen = strlen(res.stringType);
if (resLen < val.integerType)
return ErrValue(ERRSYNTAX);
char *temp = malloc(resLen - val.integerType + 1);
memcpy(temp, res.stringType, resLen - val.integerType);
temp[resLen - val.integerType] = 0;
char *temp = utils_copyStringSize(res.stringType, resLen - val.integerType);
freeVariable(res);
res.stringType = temp;
@ -362,10 +360,8 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
u32 resLen = strlen(res.stringType);
if (resLen < val.integerType)
return ErrValue(ERRSYNTAX);
char *temp = malloc(resLen - val.integerType + 1);
memcpy(temp, res.stringType + val.integerType, resLen - val.integerType);
temp[resLen - val.integerType] = 0;
char *temp = CpyStr(res.stringType + val.integerType);
freeVariable(res);
res.stringType = temp;

View file

@ -22,10 +22,10 @@ enum {
MainBrowseEmmc,
MainBrowseEmummc,
MainTools,
MainCauseException,
MainPartitionSd,
MainDumpFw,
MainViewKeys,
MainViewCredits,
MainExit,
MainPowerOff,
MainRebootRCM,
@ -40,10 +40,10 @@ MenuEntry_t mainMenuEntries[] = {
[MainBrowseEmmc] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Browse EMMC"},
[MainBrowseEmummc] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Browse EMUMMC"},
[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"},
[MainDumpFw] = {.optionUnion = COLORTORGB(COLOR_BLUE), .name = "Dump Firmware"},
[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 --"},
[MainPowerOff] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Power off"},
[MainRebootRCM] = {.optionUnion = COLORTORGB(COLOR_VIOLET), .name = "Reboot to RCM"},
@ -70,10 +70,6 @@ void HandleEMUMMC(){
GptMenu(MMC_CONN_EMUMMC);
}
void CrashTE(){
gfx_printf("%d", *((int*)0));
}
void ViewKeys(){
gfx_clearscreen();
for (int i = 0; i < 3; i++){
@ -93,6 +89,12 @@ void ViewKeys(){
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 is_sd_inited;
extern int launch_payload(char *path);
@ -114,7 +116,6 @@ menuPaths mainMenuPaths[] = {
[MainMountSd] = MountOrUnmountSD,
[MainBrowseEmmc] = HandleEMMC,
[MainBrowseEmummc] = HandleEMUMMC,
[MainCauseException] = CrashTE,
[MainPartitionSd] = FormatSD,
[MainDumpFw] = DumpSysFw,
[MainViewKeys] = ViewKeys,
@ -122,6 +123,7 @@ menuPaths mainMenuPaths[] = {
[MainRebootHekate] = RebootToHekate,
[MainRebootRCM] = reboot_rcm,
[MainPowerOff] = power_off,
[MainViewCredits] = ViewCredits,
};
void EnterMainMenu(){

View file

@ -8,6 +8,15 @@
#include "../gfx/gfx.h"
#include "../gfx/menu.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){
int len = strlen(in);

View file

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