diff --git a/source/gfx/gfxutils.c b/source/gfx/gfxutils.c index ed5fdeb..bcd1bc9 100644 --- a/source/gfx/gfxutils.c +++ b/source/gfx/gfxutils.c @@ -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; } diff --git a/source/hid/hid.c b/source/hid/hid.c index 07ef44b..237bfa1 100644 --- a/source/hid/hid.c +++ b/source/hid/hid.c @@ -4,6 +4,7 @@ #include "../gfx/gfx.h" #include #include +#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; diff --git a/source/script/args.c b/source/script/args.c index 0d8a5ff..005375c 100644 --- a/source/script/args.c +++ b/source/script/args.c @@ -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; diff --git a/source/tegraexplorer/mainmenu.c b/source/tegraexplorer/mainmenu.c index 9ee9d3b..2250a61 100644 --- a/source/tegraexplorer/mainmenu.c +++ b/source/tegraexplorer/mainmenu.c @@ -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(){ diff --git a/source/utils/utils.c b/source/utils/utils.c index 1b81d42..10c8b2c 100644 --- a/source/utils/utils.c +++ b/source/utils/utils.c @@ -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); diff --git a/source/utils/utils.h b/source/utils/utils.h index 5c79840..74beb3f 100644 --- a/source/utils/utils.h +++ b/source/utils/utils.h @@ -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); \ No newline at end of file