mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-22 20:06:43 +00:00
Clean up code with enums
This commit is contained in:
parent
746b263527
commit
c0c020e505
2 changed files with 73 additions and 13 deletions
|
@ -10,26 +10,26 @@ extern void sd_unmount();
|
||||||
bool sd_mounted = false;
|
bool sd_mounted = false;
|
||||||
|
|
||||||
menu_item mainmenu[MAINMENU_AMOUNT] = {
|
menu_item mainmenu[MAINMENU_AMOUNT] = {
|
||||||
{"[SD:/] SD CARD", COLOR_GREEN, 1, 1},
|
{"[SD:/] SD CARD", COLOR_GREEN, SD_CARD, 1},
|
||||||
{"[EMMC:/] ?", COLOR_GREEN, 2, 1},
|
{"[EMMC:/] ?", COLOR_GREEN, EMMC, 1},
|
||||||
{"\nMount/Unmount SD", COLOR_WHITE, 3, 1},
|
{"\nMount/Unmount SD", COLOR_WHITE, MOUNT_SD, 1},
|
||||||
{"Tools", COLOR_VIOLET, 4, 1},
|
{"Tools", COLOR_VIOLET, TOOLS, 1},
|
||||||
{"\nCredits", COLOR_WHITE, 5, 1},
|
{"\nCredits", COLOR_WHITE, CREDITS, 1},
|
||||||
{"Exit", COLOR_WHITE, 6, 1}
|
{"Exit", COLOR_WHITE, EXIT, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
menu_item shutdownmenu[5] = {
|
menu_item shutdownmenu[5] = {
|
||||||
{"-- EXIT --\n", COLOR_ORANGE, -1, 0},
|
{"-- EXIT --\n", COLOR_ORANGE, -1, 0},
|
||||||
{"Back", COLOR_WHITE, 1, 1},
|
{"Back", COLOR_WHITE, -1, 1},
|
||||||
{"\nReboot to RCM", COLOR_VIOLET, 2, 1},
|
{"\nReboot to RCM", COLOR_VIOLET, REBOOT_RCM, 1},
|
||||||
{"Reboot normally", COLOR_ORANGE, 3, 1},
|
{"Reboot normally", COLOR_ORANGE, REBOOT_NORMAL, 1},
|
||||||
{"Power off", COLOR_BLUE, 4, 1}
|
{"Power off", COLOR_BLUE, POWER_OFF, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
menu_item toolsmenu[3] = {
|
menu_item toolsmenu[3] = {
|
||||||
{"-- TOOLS --\n", COLOR_VIOLET, -1, 0},
|
{"-- TOOLS --\n", COLOR_VIOLET, -1, 0},
|
||||||
{"Back", COLOR_WHITE, 1, 1},
|
{"Back", COLOR_WHITE, -1, 1},
|
||||||
{"\nDisplay Console Info", COLOR_GREEN, 2, 1}
|
{"\nDisplay Console Info", COLOR_GREEN, DISPLAY_INFO, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
void fillmainmenu(){
|
void fillmainmenu(){
|
||||||
|
@ -66,6 +66,46 @@ void te_main(){
|
||||||
fillmainmenu();
|
fillmainmenu();
|
||||||
res = makemenu(mainmenu, MAINMENU_AMOUNT);
|
res = makemenu(mainmenu, MAINMENU_AMOUNT);
|
||||||
|
|
||||||
|
switch(res){
|
||||||
|
case SD_CARD:
|
||||||
|
break;
|
||||||
|
case EMMC:
|
||||||
|
break;
|
||||||
|
case MOUNT_SD:
|
||||||
|
if (sd_mounted){
|
||||||
|
sd_mounted = false;
|
||||||
|
sd_unmount();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sd_mounted = sd_mount();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TOOLS:
|
||||||
|
res = makemenu(toolsmenu, 3);
|
||||||
|
|
||||||
|
if (res == DISPLAY_INFO)
|
||||||
|
displayinfo();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CREDITS:
|
||||||
|
message(CREDITS_MESSAGE, COLOR_WHITE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EXIT:
|
||||||
|
res = makemenu(shutdownmenu, 5);
|
||||||
|
|
||||||
|
if (res == REBOOT_RCM)
|
||||||
|
reboot_rcm();
|
||||||
|
else if (res == REBOOT_NORMAL)
|
||||||
|
reboot_normal();
|
||||||
|
else if (res == POWER_OFF)
|
||||||
|
power_off(); //todo declock bpmp
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (res == 3){
|
if (res == 3){
|
||||||
if (sd_mounted){
|
if (sd_mounted){
|
||||||
sd_mounted = false;
|
sd_mounted = false;
|
||||||
|
@ -94,5 +134,6 @@ void te_main(){
|
||||||
else if (res == 4)
|
else if (res == 4)
|
||||||
power_off(); //todo declock bpmp
|
power_off(); //todo declock bpmp
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,6 +11,25 @@ typedef struct _menu_item {
|
||||||
short property;
|
short property;
|
||||||
} menu_item;
|
} menu_item;
|
||||||
|
|
||||||
menu_item mainmenu[MAINMENU_AMOUNT];
|
enum mainmenu_return {
|
||||||
|
SD_CARD = 1,
|
||||||
|
EMMC,
|
||||||
|
MOUNT_SD,
|
||||||
|
TOOLS,
|
||||||
|
CREDITS,
|
||||||
|
EXIT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum shutdownmenu_return {
|
||||||
|
REBOOT_RCM = 1,
|
||||||
|
REBOOT_NORMAL,
|
||||||
|
POWER_OFF
|
||||||
|
};
|
||||||
|
|
||||||
|
enum toolsmenu_return {
|
||||||
|
DISPLAY_INFO = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
//menu_item mainmenu[MAINMENU_AMOUNT];
|
||||||
|
|
||||||
void te_main();
|
void te_main();
|
Loading…
Reference in a new issue