1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-26 05:42:07 +00:00

add #define SCRIPT_ONLY

This commit is contained in:
suchmememanyskill 2021-07-26 20:47:23 +02:00
parent d2a0786875
commit 8807af9109

View file

@ -23,6 +23,7 @@
#include "../fs/menus/filemenu.h" #include "../fs/menus/filemenu.h"
#define INCLUDE_BUILTIN_SCRIPTS 1 #define INCLUDE_BUILTIN_SCRIPTS 1
//#define SCRIPT_ONLY 1
#ifdef INCLUDE_BUILTIN_SCRIPTS #ifdef INCLUDE_BUILTIN_SCRIPTS
#include "../../build/TegraExplorer/script/builtin.h" #include "../../build/TegraExplorer/script/builtin.h"
@ -31,6 +32,7 @@
extern hekate_config h_cfg; extern hekate_config h_cfg;
enum { enum {
#ifndef SCRIPT_ONLY
MainExplore = 0, MainExplore = 0,
MainBrowseSd, MainBrowseSd,
MainMountSd, MainMountSd,
@ -41,6 +43,9 @@ enum {
MainViewKeys, MainViewKeys,
MainViewCredits, MainViewCredits,
MainExit, MainExit,
#else
MainExit = 0,
#endif
MainPowerOff, MainPowerOff,
MainRebootRCM, MainRebootRCM,
MainRebootNormal, MainRebootNormal,
@ -50,6 +55,7 @@ enum {
}; };
MenuEntry_t mainMenuEntries[] = { MenuEntry_t mainMenuEntries[] = {
#ifndef SCRIPT_ONLY
[MainExplore] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "-- Explore --"}, [MainExplore] = {.optionUnion = COLORTORGB(COLOR_WHITE) | SKIPBIT, .name = "-- Explore --"},
[MainBrowseSd] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Browse SD"}, [MainBrowseSd] = {.optionUnion = COLORTORGB(COLOR_GREEN), .name = "Browse SD"},
[MainMountSd] = {.optionUnion = COLORTORGB(COLOR_YELLOW)}, // To mount/unmount the SD [MainMountSd] = {.optionUnion = COLORTORGB(COLOR_YELLOW)}, // To mount/unmount the SD
@ -59,6 +65,7 @@ MenuEntry_t mainMenuEntries[] = {
[MainPartitionSd] = {.optionUnion = COLORTORGB(COLOR_ORANGE), .name = "Partition the sd"}, [MainPartitionSd] = {.optionUnion = COLORTORGB(COLOR_ORANGE), .name = "Partition the sd"},
[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"}, [MainViewCredits] = {.optionUnion = COLORTORGB(COLOR_YELLOW), .name = "Credits"},
#endif
[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"},
@ -148,17 +155,19 @@ void MountOrUnmountSD(){
} }
menuPaths mainMenuPaths[] = { menuPaths mainMenuPaths[] = {
#ifndef SCRIPT_ONLY
[MainBrowseSd] = HandleSD, [MainBrowseSd] = HandleSD,
[MainMountSd] = MountOrUnmountSD, [MainMountSd] = MountOrUnmountSD,
[MainBrowseEmmc] = HandleEMMC, [MainBrowseEmmc] = HandleEMMC,
[MainBrowseEmummc] = HandleEMUMMC, [MainBrowseEmummc] = HandleEMUMMC,
[MainPartitionSd] = FormatSD, [MainPartitionSd] = FormatSD,
[MainViewKeys] = ViewKeys, [MainViewKeys] = ViewKeys,
[MainViewCredits] = ViewCredits,
#endif
[MainRebootAMS] = RebootToAMS, [MainRebootAMS] = RebootToAMS,
[MainRebootHekate] = RebootToHekate, [MainRebootHekate] = RebootToHekate,
[MainRebootRCM] = reboot_rcm, [MainRebootRCM] = reboot_rcm,
[MainPowerOff] = power_off, [MainPowerOff] = power_off,
[MainViewCredits] = ViewCredits,
[MainRebootNormal] = reboot_normal, [MainRebootNormal] = reboot_normal,
}; };
@ -168,6 +177,7 @@ void EnterMainMenu(){
if (sd_get_card_removed()) if (sd_get_card_removed())
sd_unmount(); sd_unmount();
#ifndef SCRIPT_ONLY
// -- Explore -- // -- Explore --
mainMenuEntries[MainBrowseSd].hide = !sd_mounted; mainMenuEntries[MainBrowseSd].hide = !sd_mounted;
mainMenuEntries[MainMountSd].name = (sd_mounted) ? "Unmount SD" : "Mount SD"; mainMenuEntries[MainMountSd].name = (sd_mounted) ? "Unmount SD" : "Mount SD";
@ -181,7 +191,7 @@ void EnterMainMenu(){
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; mainMenuEntries[MainRebootRCM].hide = h_cfg.t210b01;
#endif
// -- Scripts -- // -- Scripts --
#ifndef INCLUDE_BUILTIN_SCRIPTS #ifndef INCLUDE_BUILTIN_SCRIPTS
mainMenuEntries[MainScripts].hide = (!sd_mounted || !FileExists("sd:/tegraexplorer/scripts")); mainMenuEntries[MainScripts].hide = (!sd_mounted || !FileExists("sd:/tegraexplorer/scripts"));
@ -248,7 +258,6 @@ void EnterMainMenu(){
MenuEntry_t entry = entArray[res]; MenuEntry_t entry = entArray[res];
FSEntry_t fsEntry = {.name = entry.name, .sizeUnion = entry.sizeUnion}; FSEntry_t fsEntry = {.name = entry.name, .sizeUnion = entry.sizeUnion};
RunScript("sd:/tegraexplorer/scripts", fsEntry); RunScript("sd:/tegraexplorer/scripts", fsEntry);
hidWait();
#ifdef INCLUDE_BUILTIN_SCRIPTS #ifdef INCLUDE_BUILTIN_SCRIPTS
} }
#endif #endif