Add fw dumping

- also fatfs is stupid
- also close files properly on a failed copy
- also check for errors during folder readouts
- also make sure holding vol- doesn't dump the keys anyway
This commit is contained in:
suchmememanyskill
2020-12-28 02:29:58 +01:00
parent 859ad2cc4c
commit 513bd804b1
18 changed files with 222 additions and 29 deletions

View File

@@ -30,13 +30,7 @@ MenuEntry_t MakeMenuOutFSEntry(FSEntry_t entry){
return out;
}
void clearFileVector(Vector_t *v){
vecPDefArray(FSEntry_t*, entries, v);
for (int i = 0; i < v->count; i++)
free(entries[i].name);
free(v->data);
}
void FileExplorer(char *path){
char *storedPath = CpyStr(path);
@@ -48,8 +42,15 @@ void FileExplorer(char *path){
gfx_clearscreen();
gfx_printf("Loading...\r");
//gfx_printf(" ");
Vector_t fileVec = ReadFolder(storedPath);
int readRes = 0;
Vector_t fileVec = ReadFolder(storedPath, &readRes);
if (readRes){
clearFileVector(&fileVec);
DrawError(newErrCode(readRes));
return;
}
vecDefArray(FSEntry_t*, fsEntries, fileVec);
topEntries[0].name = storedPath;