mGUI: Load parent directory if last used directory is missing (fixes #3379)
This commit is contained in:
parent
39ab641953
commit
08430fc058
1
CHANGES
1
CHANGES
@ -22,6 +22,7 @@ Other fixes:
|
|||||||
- GBA: Fix getting game info for multiboot ROMs
|
- GBA: Fix getting game info for multiboot ROMs
|
||||||
- GBA Core: Fix booting into BIOS when skip BIOS is enabled
|
- GBA Core: Fix booting into BIOS when skip BIOS is enabled
|
||||||
- GBA Hardware: Fix loading states unconditionally overwriting GPIO memory
|
- GBA Hardware: Fix loading states unconditionally overwriting GPIO memory
|
||||||
|
- mGUI: Load parent directory if last used directory is missing (fixes mgba.io/i/3379)
|
||||||
- Qt: Fix savestate preview sizes with different scales (fixes mgba.io/i/2560)
|
- Qt: Fix savestate preview sizes with different scales (fixes mgba.io/i/2560)
|
||||||
- Qt: Fix potential crash when configuring shortcuts
|
- Qt: Fix potential crash when configuring shortcuts
|
||||||
Misc:
|
Misc:
|
||||||
|
@ -10,9 +10,12 @@
|
|||||||
|
|
||||||
CXX_GUARD_START
|
CXX_GUARD_START
|
||||||
|
|
||||||
|
#include <mgba/core/log.h>
|
||||||
#include <mgba-util/gui.h>
|
#include <mgba-util/gui.h>
|
||||||
#include <mgba-util/vector.h>
|
#include <mgba-util/vector.h>
|
||||||
|
|
||||||
|
mLOG_DECLARE_CATEGORY(GUI_MENU);
|
||||||
|
|
||||||
#define GUI_V_V (struct GUIVariant) { .type = GUI_VARIANT_VOID }
|
#define GUI_V_V (struct GUIVariant) { .type = GUI_VARIANT_VOID }
|
||||||
#define GUI_V_U(U) (struct GUIVariant) { .type = GUI_VARIANT_UNSIGNED, .v.u = (U) }
|
#define GUI_V_U(U) (struct GUIVariant) { .type = GUI_VARIANT_UNSIGNED, .v.u = (U) }
|
||||||
#define GUI_V_I(I) (struct GUIVariant) { .type = GUI_VARIANT_INT, .v.i = (I) }
|
#define GUI_V_I(I) (struct GUIVariant) { .type = GUI_VARIANT_INT, .v.i = (I) }
|
||||||
|
@ -163,7 +163,16 @@ bool GUISelectFile(struct GUIParams* params, char* outPath, size_t outLen, bool
|
|||||||
.subtitle = params->currentPath,
|
.subtitle = params->currentPath,
|
||||||
};
|
};
|
||||||
GUIMenuItemListInit(&menu.items, 0);
|
GUIMenuItemListInit(&menu.items, 0);
|
||||||
_refreshDirectory(params, params->currentPath, &menu.items, filterName, filterContents, preselect);
|
while (true) {
|
||||||
|
if (_refreshDirectory(params, params->currentPath, &menu.items, filterName, filterContents, preselect)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (strncmp(params->currentPath, params->basePath, PATH_MAX) == 0 || !params->currentPath[0]) {
|
||||||
|
mLOG(GUI_MENU, ERROR, "Failed to load base directory");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_upDirectory(params->currentPath);
|
||||||
|
}
|
||||||
menu.index = params->fileIndex;
|
menu.index = params->fileIndex;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
DEFINE_VECTOR(GUIMenuItemList, struct GUIMenuItem);
|
DEFINE_VECTOR(GUIMenuItemList, struct GUIMenuItem);
|
||||||
DEFINE_VECTOR(GUIMenuSavedList, struct GUIMenuSavedState);
|
DEFINE_VECTOR(GUIMenuSavedList, struct GUIMenuSavedState);
|
||||||
|
|
||||||
|
mLOG_DEFINE_CATEGORY(GUI_MENU, "GUI Menu", "gui.menu");
|
||||||
|
|
||||||
void _itemNext(struct GUIMenuItem* item, bool wrap) {
|
void _itemNext(struct GUIMenuItem* item, bool wrap) {
|
||||||
if (wrap || item->state < item->nStates - 1) {
|
if (wrap || item->state < item->nStates - 1) {
|
||||||
unsigned oldState = item->state;
|
unsigned oldState = item->state;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user