mirror of https://github.com/mgba-emu/mgba.git
mGUI: Skip second scan loop when possible
This commit is contained in:
parent
0d96ba4f8f
commit
7640c38684
1
CHANGES
1
CHANGES
|
@ -92,6 +92,7 @@ Misc:
|
||||||
- Debugger: Keep track of global cycle count
|
- Debugger: Keep track of global cycle count
|
||||||
- FFmpeg: Add looping option for GIF/APNG
|
- FFmpeg: Add looping option for GIF/APNG
|
||||||
- mGUI: Show battery percentage
|
- mGUI: Show battery percentage
|
||||||
|
- mGUI: Skip second scan loop when possible
|
||||||
- Qt: Renderer can be changed while a game is running
|
- Qt: Renderer can be changed while a game is running
|
||||||
- Qt: Add hex index to palette view
|
- Qt: Add hex index to palette view
|
||||||
- Qt: Add transformation matrix info to sprite view
|
- Qt: Add transformation matrix info to sprite view
|
||||||
|
|
|
@ -89,6 +89,8 @@ static bool _refreshDirectory(struct GUIParams* params, const char* currentPath,
|
||||||
char* n2 = malloc(len);
|
char* n2 = malloc(len);
|
||||||
snprintf(n2, len, "%s/", name);
|
snprintf(n2, len, "%s/", name);
|
||||||
name = n2;
|
name = n2;
|
||||||
|
} else if (filterName && !filterName(name)) {
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
name = strdup(name);
|
name = strdup(name);
|
||||||
}
|
}
|
||||||
|
@ -96,11 +98,13 @@ static bool _refreshDirectory(struct GUIParams* params, const char* currentPath,
|
||||||
++items;
|
++items;
|
||||||
}
|
}
|
||||||
qsort(GUIMenuItemListGetPointer(currentFiles, 1), GUIMenuItemListSize(currentFiles) - 1, sizeof(struct GUIMenuItem), _strpcmp);
|
qsort(GUIMenuItemListGetPointer(currentFiles, 1), GUIMenuItemListSize(currentFiles) - 1, sizeof(struct GUIMenuItem), _strpcmp);
|
||||||
|
if (preselect || filterContents) {
|
||||||
i = 0;
|
i = 0;
|
||||||
size_t item = 0;
|
size_t item = 0;
|
||||||
while (item < GUIMenuItemListSize(currentFiles)) {
|
while (item < GUIMenuItemListSize(currentFiles)) {
|
||||||
++i;
|
++i;
|
||||||
if (!(i % SCANNING_THRESHOLD_2)) {
|
// If we're not filtering the contents, this loop is fast, so there's no need to show updates
|
||||||
|
if (filterContents && !(i % SCANNING_THRESHOLD_2)) {
|
||||||
uint32_t input = 0;
|
uint32_t input = 0;
|
||||||
GUIPollInput(params, &input, 0);
|
GUIPollInput(params, &input, 0);
|
||||||
if (input & (1 << GUI_INPUT_CANCEL)) {
|
if (input & (1 << GUI_INPUT_CANCEL)) {
|
||||||
|
@ -125,11 +129,7 @@ static bool _refreshDirectory(struct GUIParams* params, const char* currentPath,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool failed = false;
|
bool failed = false;
|
||||||
if (filterName && !filterName(testItem->title)) {
|
if (filterContents) {
|
||||||
failed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!failed && filterContents) {
|
|
||||||
struct VFile* vf = dir->openFile(dir, testItem->title, O_RDONLY);
|
struct VFile* vf = dir->openFile(dir, testItem->title, O_RDONLY);
|
||||||
if (!vf) {
|
if (!vf) {
|
||||||
failed = true;
|
failed = true;
|
||||||
|
@ -151,6 +151,7 @@ static bool _refreshDirectory(struct GUIParams* params, const char* currentPath,
|
||||||
++item;
|
++item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
dir->close(dir);
|
dir->close(dir);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue