mirror of https://github.com/mgba-emu/mgba.git
GUI: Test archives now, too
This commit is contained in:
parent
6cf4179a97
commit
5578273eb1
|
@ -110,18 +110,42 @@ static bool _refreshDirectory(struct GUIParams* params, const char* currentPath,
|
||||||
}
|
}
|
||||||
params->drawEnd();
|
params->drawEnd();
|
||||||
}
|
}
|
||||||
struct VFile* vf = dir->openFile(dir, GUIMenuItemListGetPointer(currentFiles, item)->title, O_RDONLY);
|
if (!filter) {
|
||||||
if (!vf) {
|
|
||||||
++item;
|
++item;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (filter && !filter(vf)) {
|
struct VDir* vd = dir->openDir(dir, GUIMenuItemListGetPointer(currentFiles, item)->title);
|
||||||
free(GUIMenuItemListGetPointer(currentFiles, item)->title);
|
if (vd) {
|
||||||
GUIMenuItemListShift(currentFiles, item, 1);
|
bool success = false;
|
||||||
} else {
|
struct VDirEntry* de;
|
||||||
++item;
|
while ((de = vd->listNext(vd)) && !success) {
|
||||||
|
struct VFile* vf2 = vd->openFile(vd, de->name(de), O_RDONLY);
|
||||||
|
if (!vf2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (filter(vf2)) {
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
vf2->close(vf2);
|
||||||
|
}
|
||||||
|
vd->close(vd);
|
||||||
|
if (success) {
|
||||||
|
++item;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
vf->close(vf);
|
struct VFile* vf = dir->openFile(dir, GUIMenuItemListGetPointer(currentFiles, item)->title, O_RDONLY);
|
||||||
|
if (vf) {
|
||||||
|
if (filter(vf)) {
|
||||||
|
++item;
|
||||||
|
} else {
|
||||||
|
free(GUIMenuItemListGetPointer(currentFiles, item)->title);
|
||||||
|
GUIMenuItemListShift(currentFiles, item, 1);
|
||||||
|
}
|
||||||
|
vf->close(vf);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
++item;
|
||||||
}
|
}
|
||||||
dir->close(dir);
|
dir->close(dir);
|
||||||
|
|
||||||
|
@ -163,18 +187,9 @@ bool GUISelectFile(struct GUIParams* params, char* outPath, size_t outLen, bool
|
||||||
if (!_refreshDirectory(params, outPath, &newFiles, filter)) {
|
if (!_refreshDirectory(params, outPath, &newFiles, filter)) {
|
||||||
_cleanFiles(&newFiles);
|
_cleanFiles(&newFiles);
|
||||||
GUIMenuItemListDeinit(&newFiles);
|
GUIMenuItemListDeinit(&newFiles);
|
||||||
struct VFile* vf = VFileOpen(outPath, O_RDONLY);
|
_cleanFiles(&menu.items);
|
||||||
if (!vf) {
|
GUIMenuItemListDeinit(&menu.items);
|
||||||
continue;
|
return true;
|
||||||
}
|
|
||||||
if (!filter || filter(vf)) {
|
|
||||||
vf->close(vf);
|
|
||||||
_cleanFiles(&menu.items);
|
|
||||||
GUIMenuItemListDeinit(&menu.items);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
vf->close(vf);
|
|
||||||
break;
|
|
||||||
} else {
|
} else {
|
||||||
_cleanFiles(&menu.items);
|
_cleanFiles(&menu.items);
|
||||||
GUIMenuItemListDeinit(&menu.items);
|
GUIMenuItemListDeinit(&menu.items);
|
||||||
|
|
Loading…
Reference in New Issue