mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-22 11:56:42 +00:00
Add main menu
This commit is contained in:
parent
a094ac4496
commit
7a35d2b00c
8 changed files with 61 additions and 28 deletions
|
@ -31,8 +31,6 @@
|
|||
#include "meme/main.h"
|
||||
#include "meme/utils.h"
|
||||
|
||||
#include "keys/keys.h"
|
||||
|
||||
sdmmc_t sd_sdmmc;
|
||||
sdmmc_storage_t sd_storage;
|
||||
__attribute__ ((aligned (16))) FATFS sd_fs;
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#include "../mem/emc.h"
|
||||
#include "../mem/sdram.h"
|
||||
#include "../soc/t210.h"
|
||||
#include "../sec/se.h"
|
||||
#include "../utils/types.h"
|
||||
#include "../keys/key_sources.inl"
|
||||
|
||||
extern void reloc_patcher(u32 payload_dst, u32 payload_src, u32 payload_size);
|
||||
extern boot_cfg_t b_cfg;
|
||||
|
@ -76,4 +79,4 @@ int launch_payload(char *path, bool update)
|
|||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
}
|
|
@ -53,7 +53,7 @@ void meme_clearscreen(){
|
|||
gfx_clear_grey(0x1B);
|
||||
gfx_con_setpos(0, 0);
|
||||
gfx_box(0, 0, 719, 15, COLOR_WHITE);
|
||||
gfx_printf("%k%pTegraExplorer, by SuchMemeManySkill\n%k%p", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT);
|
||||
gfx_printf("%k%pTegraExplorer\n%k%p", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT);
|
||||
}
|
||||
|
||||
void _printwithhighlight(int offset, int folderamount, char *items[], int highlight, unsigned int *muhbits, int *filesizes){
|
||||
|
|
|
@ -7,14 +7,16 @@
|
|||
#include "mainfunctions.h"
|
||||
#include "../libs/fatfs/ff.h"
|
||||
#include "../storage/sdmmc.h"
|
||||
#include "../utils/util.h"
|
||||
#include "../sec/se.h"
|
||||
#include "graphics.h"
|
||||
#include "external_utils.h"
|
||||
|
||||
extern bool sd_mount();
|
||||
extern void sd_unmount();
|
||||
|
||||
void meme_main(){
|
||||
utils_gfx_init();
|
||||
//static const u32 colors[7] = {COLOR_RED, COLOR_ORANGE, COLOR_YELLOW, COLOR_GREEN, COLOR_BLUE, COLOR_VIOLET, COLOR_DEFAULT};
|
||||
//gfx_printf("%k%pTegraExplorer, made by SuchMemeManySkill \n%k%p", colors[6], colors[3], colors[3], colors[6]);
|
||||
utils_gfx_init();
|
||||
|
||||
sdmmc_storage_t storage;
|
||||
sdmmc_t sdmmc;
|
||||
|
@ -22,23 +24,62 @@ void meme_main(){
|
|||
sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_4, SDMMC_BUS_WIDTH_8, 4);
|
||||
sdmmc_storage_set_mmc_partition(&storage, 1);
|
||||
|
||||
//f_rename("sd:/yeet.txt", "sd:/yote.txt");
|
||||
char *options[5];
|
||||
char *itemsinfolder[1000];
|
||||
unsigned int muhbits[1000];
|
||||
bool sd_mounted = false;
|
||||
sd_mounted = sd_mount();
|
||||
|
||||
char *itemsinfolder[500];
|
||||
unsigned int muhbits[500];
|
||||
while (1){
|
||||
int i = 0, ret = 0;
|
||||
if (sd_mounted){
|
||||
addchartoarray("[SD:/] SD card", options, i);
|
||||
i++;
|
||||
}
|
||||
else messagebox("\nSD INIT FAILED");
|
||||
addchartoarray("\nAbout", options, i);
|
||||
addchartoarray("Exit", options, i+1);
|
||||
|
||||
if (sd_mounted){
|
||||
sdexplorer(itemsinfolder, muhbits);
|
||||
meme_clearscreen();
|
||||
ret = gfx_menulist(32, options, (i + 2));
|
||||
|
||||
if (strcmp(options[ret - 1], "[SD:/] SD card") == 0){
|
||||
sdexplorer(itemsinfolder, muhbits);
|
||||
}
|
||||
else if (strcmp(options[ret - 1], "\nAbout") == 0){
|
||||
messagebox(ABOUT_MESSAGE);
|
||||
}
|
||||
else {
|
||||
meme_clearscreen();
|
||||
addchartoarray("Back", options, 0);
|
||||
addchartoarray("\nReboot to RCM", options, 1);
|
||||
addchartoarray("Reboot normally", options, 2);
|
||||
addchartoarray("Power off", options, 3);
|
||||
ret = gfx_menulist(32, options, 4);
|
||||
if (ret != 1) sd_unmount();
|
||||
switch(ret){
|
||||
case 2:
|
||||
reboot_rcm();
|
||||
case 3:
|
||||
reboot_normal();
|
||||
case 4:
|
||||
power_off();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (sd_mounted){
|
||||
|
||||
|
||||
//write file and folder menu
|
||||
//make clipboard and shit like that
|
||||
//figure out time from keys.c
|
||||
//figure out how to reboot to payloads https://github.com/CTCaer/hekate/blob/101c8bc1d0813da10016be771a9919c9e8112277/bootloader/main.c#L266
|
||||
gfx_printf("%k\n\nExited main loop, vol+ to reboot to rcm\nvol- to reboot normally\npower to power off\n", COLOR_GREEN);
|
||||
}
|
||||
else gfx_printf("%k%pSD INIT FAILED\n\nvol+ to reboot to rcm\nvol- to reboot normally\npower to power off", COLOR_RED, COLOR_DEFAULT);
|
||||
//gfx_printf("%k\n\nExited main loop, vol+ to reboot to rcm\nvol- to reboot normally\npower to power off\n", COLOR_GREEN);
|
||||
//}
|
||||
//else gfx_printf("%k%pSD INIT FAILED\n\nvol+ to reboot to rcm\nvol- to reboot normally\npower to power off", COLOR_RED, COLOR_DEFAULT);
|
||||
|
||||
utils_waitforpower();
|
||||
//utils_waitforpower();
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#define ABOUT_MESSAGE "\nCreator: Such Meme, Many Skill#2921\nCool guy: Denn\nTesters: PhazonicRidley, huhen\n\n\nProject based on code from:\n- Lockpick_RCM\n- Hekate"
|
||||
|
||||
void meme_main();
|
|
@ -74,7 +74,7 @@ void sdexplorer(char *items[], unsigned int *muhbits){
|
|||
gfx_con_setpos(0, 0);
|
||||
gfx_box(0, 0, 719, 15, COLOR_WHITE);
|
||||
folderamount = readfolder(items, muhbits, path);
|
||||
gfx_printf("%k%pTegraExplorer, by SuchMemeManySkill %d\n%k%p", COLOR_DEFAULT, COLOR_WHITE, folderamount - 2, COLOR_WHITE, COLOR_DEFAULT);
|
||||
gfx_printf("%k%pTegraExplorer %d\n%k%p", COLOR_DEFAULT, COLOR_WHITE, folderamount - 2, COLOR_WHITE, COLOR_DEFAULT);
|
||||
value = fileexplorergui(items, muhbits, path, folderamount);
|
||||
|
||||
if (value == 1) {
|
||||
|
|
|
@ -64,16 +64,6 @@ int getfilesize(const char *path){
|
|||
return fno.fsize;
|
||||
}
|
||||
|
||||
void utils_waitforpower(){
|
||||
u32 btn = btn_wait();
|
||||
if (btn & BTN_VOL_UP)
|
||||
reboot_rcm();
|
||||
else if (btn & BTN_VOL_DOWN)
|
||||
reboot_normal();
|
||||
else
|
||||
power_off();
|
||||
}
|
||||
|
||||
void addchartoarray(char *add, char *items[], int spot){
|
||||
size_t size = strlen(add) + 1;
|
||||
items[spot] = (char*) malloc (size);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define PATHSIZE 512
|
||||
|
||||
void utils_gfx_init();
|
||||
void utils_waitforpower();
|
||||
void removepartpath(char *path);
|
||||
void addpartpath(char *path, char *add);
|
||||
int readfolder(char *items[], unsigned int *muhbits, const char *path);
|
||||
|
|
Loading…
Reference in a new issue