add dump to sd file option

This commit is contained in:
Such Meme, Many Skill
2019-08-20 01:26:39 +02:00
parent d000f86c89
commit 9281e4bbbc
3 changed files with 34 additions and 9 deletions

View File

@@ -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;