Bug fixing round & add some emummc menus

Notable bugs fixed:
- pkg1id is now also used as foldername during fw dump
- Clearing of screen in _recursive functions is no longer hardcoded
- Folders get the correct file attributes
- first 16 MiB of partition during partitioning gets cleared now
This commit is contained in:
Such Meme, Many Skill
2020-01-30 23:53:27 +01:00
parent 9885308bce
commit eb8652c6ec
10 changed files with 75 additions and 28 deletions

View File

@@ -158,7 +158,10 @@ int del_recursive(char *path){
DIR dir;
FILINFO fno;
int res;
u32 x, y;
char *localpath = NULL;
gfx_con_getpos(&x, &y);
makestring(path, &localpath);
if ((res = f_opendir(&dir, localpath))){
@@ -171,7 +174,7 @@ int del_recursive(char *path){
del_recursive(getnextloc(localpath, fno.fname));
else {
gfx_box(0, 47, 719, 63, COLOR_DEFAULT);
gfx_box(0, y, 719, y + 16, COLOR_DEFAULT);
SWAPCOLOR(COLOR_RED);
gfx_printf("\r");
gfx_print_length(37, fno.fname);
@@ -197,14 +200,16 @@ int copy_recursive(char *path, char *dstpath){
DIR dir;
FILINFO fno;
int res;
u32 x, y;
char *startpath = NULL, *destpath = NULL, *destfoldername = NULL, *temp = NULL;
gfx_con_getpos(&x, &y);
makestring(path, &startpath);
makestring(strrchr(path, '/') + 1, &destfoldername);
destpath = (char*) malloc (strlen(dstpath) + strlen(destfoldername) + 2);
sprintf(destpath, (dstpath[strlen(dstpath) - 1] == '/') ? "%s%s" : "%s/%s", dstpath, destfoldername);
if ((res = f_opendir(&dir, startpath))){
message(COLOR_RED, "Error during f_opendir: %d", res);
@@ -213,15 +218,12 @@ int copy_recursive(char *path, char *dstpath){
f_mkdir(destpath);
if (f_stat(startpath, &fno))
return 22;
while (!f_readdir(&dir, &fno) && fno.fname[0]){
if (fno.fattrib & AM_DIR){
copy_recursive(getnextloc(startpath, fno.fname), destpath);
}
else {
gfx_box(0, 47, 719, 63, COLOR_DEFAULT);
gfx_box(0, y, 719, y + 16, COLOR_DEFAULT);
SWAPCOLOR(COLOR_GREEN);
gfx_printf("\r");
gfx_print_length(37, fno.fname);
@@ -240,9 +242,13 @@ int copy_recursive(char *path, char *dstpath){
free(startpath);
free(destpath);
free(destfoldername);
if (f_stat(startpath, &fno))
return 22;
if ((res = f_chmod(destpath, fno.fattrib, 0x3A)))
return res;
return 0;
}