mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-22 11:56:42 +00:00
add dump to sd file option
This commit is contained in:
parent
d000f86c89
commit
9281e4bbbc
3 changed files with 34 additions and 9 deletions
|
@ -13,20 +13,22 @@ int _openfilemenu(char *path, char *clipboardpath){
|
|||
meme_clearscreen();
|
||||
FILINFO fno;
|
||||
f_stat(path, &fno);
|
||||
char *options[5];
|
||||
char *options[6];
|
||||
int res = 0;
|
||||
int mres = -1;
|
||||
int ret = -1;
|
||||
int i = 4;
|
||||
bool payload = false;
|
||||
|
||||
addchartoarray("Back", options, 0);
|
||||
addchartoarray("Back\n", options, 0);
|
||||
addchartoarray("Copy to clipboard", options, 1);
|
||||
addchartoarray("Move to clipboard", options, 2);
|
||||
addchartoarray("Delete file", options, 3);
|
||||
addchartoarray("Delete file\n", options, 3);
|
||||
if (strstr(path, ".bin") != NULL){
|
||||
addchartoarray("Launch payload", options, i);
|
||||
payload = true;
|
||||
i++;
|
||||
}
|
||||
if (strcmp(strstr(path, "emmc:/"), path) == 0){
|
||||
addchartoarray("Dump to SD", options, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -54,7 +56,12 @@ int _openfilemenu(char *path, char *clipboardpath){
|
|||
if (mres == 0) f_unlink(path);
|
||||
break;
|
||||
default:
|
||||
if (payload) launch_payload(path, 0);
|
||||
if (strcmp(options[res - 1], "Launch payload") == 0) launch_payload(path, 0);
|
||||
else if (strcmp(options[res - 1], "Dump to SD") == 0) {
|
||||
int res = 0;
|
||||
res = dumptosd(path);
|
||||
if (res == 1) messagebox("Copy Failed\nInput or Output is invalid");
|
||||
}
|
||||
}
|
||||
|
||||
meme_clearscreen();
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "../storage/sdmmc.h"
|
||||
#include "graphics.h"
|
||||
|
||||
|
||||
void utils_gfx_init(){
|
||||
display_backlight_brightness(100, 1000);
|
||||
gfx_clear_grey(0x1B);
|
||||
|
@ -26,6 +25,25 @@ void removepartpath(char *path, char *root){
|
|||
if (strcmp(path, root) == 0) strcpy(path, temproot);
|
||||
}
|
||||
|
||||
int dumptosd(const char *path){
|
||||
f_mkdir("sd:/tegraexplorer");
|
||||
f_mkdir("sd:/tegraexplorer/nanddump");
|
||||
FILINFO fno;
|
||||
int res = 0;
|
||||
f_stat(path, &fno);
|
||||
char pathname[PATHSIZE];
|
||||
char foldername[75];
|
||||
strcpy(pathname, path);
|
||||
removepartpath(pathname, "emmc:");
|
||||
strcpy(foldername, strrchr(pathname, '/'));
|
||||
if (strcmp(foldername, "/") == 0) strcpy(foldername, "/root");
|
||||
sprintf(pathname, "%s%s", "sd:/tegraexplorer/nanddump", foldername);
|
||||
f_mkdir(pathname);
|
||||
sprintf(pathname, "%s%s%s%s", "sd:/tegraexplorer/nanddump", foldername, "/", fno.fname);
|
||||
res = copy(path, pathname);
|
||||
return res;
|
||||
}
|
||||
|
||||
void addpartpath(char *path, char *add, char *root){
|
||||
if (strcmp(path, root) != 0) strcat(path, "/");
|
||||
strcat(path, add);
|
||||
|
@ -153,7 +171,6 @@ int copy(const char *src, const char *dst){
|
|||
f_unlink(dst);
|
||||
}
|
||||
|
||||
|
||||
free(buff);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -15,4 +15,5 @@ int copy(const char *src, const char *dst);
|
|||
void addchartoarray(char *add, char *items[], int spot);
|
||||
int copywithpath(const char *src, const char *dstpath, int mode, char *app);
|
||||
void return_readable_byte_amounts(unsigned long int size, char *in);
|
||||
int getfilesize(const char *path);
|
||||
int getfilesize(const char *path);
|
||||
int dumptosd(const char *path);
|
Loading…
Reference in a new issue