mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-12-26 11:26:05 +00:00
Add some testing features
This commit is contained in:
parent
65f38ba459
commit
57714daa87
7 changed files with 84 additions and 14 deletions
|
@ -11,8 +11,8 @@
|
|||
|
||||
fs_entry fileobjects[500];
|
||||
char rootpath[10] = "";
|
||||
char currentpath[255] = "";
|
||||
char clipboard[255] = "";
|
||||
char currentpath[300] = "";
|
||||
char clipboard[300] = "";
|
||||
u8 clipboardhelper = 0;
|
||||
extern const char sizevalues[4][3];
|
||||
extern int launch_payload(char *path);
|
||||
|
@ -28,6 +28,38 @@ menu_item explfilemenu[8] = {
|
|||
{"\nLaunch Payload", COLOR_ORANGE, PAYLOAD, 1}
|
||||
};
|
||||
|
||||
void writecurpath(const char *in){
|
||||
/*
|
||||
if (currentpath != NULL)
|
||||
free(currentpath);
|
||||
|
||||
size_t len = strlen(in) + 1;
|
||||
currentpath = (char*) malloc (len);
|
||||
strcpy(currentpath, in);
|
||||
*/
|
||||
strcpy(currentpath, in);
|
||||
}
|
||||
|
||||
void writeclipboard(const char *in, bool operation, bool folder){
|
||||
//if (clipboard != NULL)
|
||||
// free(clipboard);
|
||||
|
||||
clipboardhelper = 0;
|
||||
|
||||
if (operation)
|
||||
clipboardhelper |= (OPERATION);
|
||||
|
||||
if (folder)
|
||||
clipboardhelper |= (ISDIR);
|
||||
|
||||
/*
|
||||
size_t len = strlen(in) + 1;
|
||||
clipboard = (char*) malloc (len);
|
||||
strcpy(clipboard, in);
|
||||
*/
|
||||
strcpy(clipboard, in);
|
||||
}
|
||||
|
||||
char *getnextloc(char *current, char *add){
|
||||
char *ret;
|
||||
size_t size = strlen(current) + strlen(add) + 1;
|
||||
|
@ -76,6 +108,11 @@ void addobject(char* name, int spot, bool isfol, bool isarc){
|
|||
size_t size = strlen(name) + 1;
|
||||
fileobjects[spot].property = 0;
|
||||
|
||||
if (fileobjects[spot].name != NULL){
|
||||
free(fileobjects[spot].name);
|
||||
fileobjects[spot].name = NULL;
|
||||
}
|
||||
|
||||
fileobjects[spot].name = (char*) malloc (size);
|
||||
strlcpy(fileobjects[spot].name, name, size);
|
||||
|
||||
|
@ -86,6 +123,7 @@ void addobject(char* name, int spot, bool isfol, bool isarc){
|
|||
int sizes = 0;
|
||||
FILINFO fno;
|
||||
f_stat(getnextloc(currentpath, name), &fno);
|
||||
|
||||
size = fno.fsize;
|
||||
|
||||
while (size > 1024){
|
||||
|
@ -127,7 +165,7 @@ void filemenu(const char *startpath){
|
|||
int amount, res, tempint;
|
||||
char temp[100];
|
||||
strcpy(rootpath, startpath);
|
||||
strcpy(currentpath, startpath);
|
||||
writecurpath(startpath);
|
||||
amount = readfolder(currentpath);
|
||||
|
||||
while (1){
|
||||
|
@ -137,7 +175,7 @@ void filemenu(const char *startpath){
|
|||
if (!strcmp(rootpath, currentpath))
|
||||
break;
|
||||
else {
|
||||
strcpy(currentpath, getprevloc(currentpath));
|
||||
writecurpath(getprevloc(currentpath));
|
||||
amount = readfolder(currentpath);
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +188,7 @@ void filemenu(const char *startpath){
|
|||
}
|
||||
else {
|
||||
if (fileobjects[res - 1].property & ISDIR){
|
||||
strcpy(currentpath, getnextloc(currentpath, fileobjects[res - 1].name));
|
||||
writecurpath(getnextloc(currentpath, fileobjects[res - 1].name));
|
||||
amount = readfolder(currentpath);
|
||||
}
|
||||
else {
|
||||
|
@ -172,8 +210,10 @@ void filemenu(const char *startpath){
|
|||
|
||||
switch (res){
|
||||
case COPY:
|
||||
writeclipboard(getnextloc(currentpath, fileobjects[res - 1].name), false, false);
|
||||
break;
|
||||
case MOVE:
|
||||
strcpy(clipboard, getnextloc(currentpath, fileobjects[res - 1].name));
|
||||
writeclipboard(getnextloc(currentpath, fileobjects[res - 1].name), true, false);
|
||||
break;
|
||||
case DELETE:
|
||||
msleep(100);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#define ISKB (1 << 5)
|
||||
#define ISB (1 << 4)
|
||||
|
||||
#define OPERATION (1 << 1)
|
||||
|
||||
/* Bit table for property:
|
||||
0000 0001: Directory bit
|
||||
0000 0010: Archive bit
|
||||
|
|
|
@ -16,7 +16,7 @@ const char fixedoptions[3][50] = {
|
|||
};
|
||||
|
||||
const char sizevalues[4][3] = {
|
||||
" B",
|
||||
"B ",
|
||||
"KB",
|
||||
"MB",
|
||||
"GB"
|
||||
|
|
|
@ -30,10 +30,11 @@ menu_item shutdownmenu[7] = {
|
|||
{"Reboot to Atmosphere", COLOR_GREEN, AMS, -1}
|
||||
};
|
||||
|
||||
menu_item toolsmenu[3] = {
|
||||
menu_item toolsmenu[4] = {
|
||||
{"-- TOOLS --\n", COLOR_VIOLET, -1, 0},
|
||||
{"Back", COLOR_WHITE, -1, 1},
|
||||
{"\nDisplay Console Info", COLOR_GREEN, DISPLAY_INFO, 1}
|
||||
{"\nDisplay Console Info", COLOR_GREEN, DISPLAY_INFO, 1},
|
||||
{"Display GPIO pins [DEV]", COLOR_RED, DISPLAY_GPIO, 1}
|
||||
};
|
||||
|
||||
void fillmainmenu(){
|
||||
|
@ -87,10 +88,13 @@ void te_main(){
|
|||
break;
|
||||
|
||||
case TOOLS:
|
||||
res = makemenu(toolsmenu, 3);
|
||||
res = makemenu(toolsmenu, 4);
|
||||
|
||||
if (res == DISPLAY_INFO)
|
||||
displayinfo();
|
||||
|
||||
if (res == DISPLAY_GPIO)
|
||||
displaygpio();
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ enum shutdownmenu_return {
|
|||
};
|
||||
|
||||
enum toolsmenu_return {
|
||||
DISPLAY_INFO = 1
|
||||
DISPLAY_INFO = 1,
|
||||
DISPLAY_GPIO
|
||||
};
|
||||
|
||||
//menu_item mainmenu[MAINMENU_AMOUNT];
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "../libs/fatfs/ff.h"
|
||||
#include "../gfx/gfx.h"
|
||||
#include "../utils/btn.h"
|
||||
#include "../soc/gpio.h"
|
||||
#include "../utils/util.h"
|
||||
|
||||
void displayinfo(){
|
||||
clearscreen();
|
||||
|
@ -19,8 +21,28 @@ void displayinfo(){
|
|||
tot_sect = (fs->n_fatent - 2) * fs->csize;
|
||||
fre_sect = fre_clust * fs->csize;
|
||||
|
||||
gfx_printf("%d KiB total\n%d KiB free\n\nPress any key to continue", tot_sect / 2, fre_sect / 2);
|
||||
|
||||
gfx_printf("%d KiB total\n%d KiB free\n\nPress any key to continue\n", tot_sect / 2, fre_sect / 2);
|
||||
|
||||
btn_wait();
|
||||
}
|
||||
|
||||
void displaygpio(){
|
||||
int res;
|
||||
clearscreen();
|
||||
gfx_printf("Updates gpio pins ever 50ms:\nPress power to exit");
|
||||
msleep(200);
|
||||
while (1){
|
||||
msleep(10);
|
||||
gfx_con_setpos(0, 63);
|
||||
|
||||
for (int i = 0; i <= 30; i++){
|
||||
gfx_printf("\nPort %d: ", i);
|
||||
for (int i2 = 7; i2 >= 0; i2--)
|
||||
gfx_printf("%d", gpio_read(i, (1 << i2)));
|
||||
}
|
||||
|
||||
res = btn_read();
|
||||
if (res & BTN_POWER)
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
void displayinfo();
|
||||
void displayinfo();
|
||||
void displaygpio();
|
Loading…
Reference in a new issue