From c6457888234e9fe2162b7f760f6e28c3065e66ee Mon Sep 17 00:00:00 2001 From: sorgelig Date: Sat, 27 Jul 2019 21:00:05 +0800 Subject: [PATCH] NeoGeo: fix file selector. --- file_io.cpp | 4 ++-- file_io.h | 1 + menu.cpp | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/file_io.cpp b/file_io.cpp index 1c2b875..4517fff 100644 --- a/file_io.cpp +++ b/file_io.cpp @@ -950,7 +950,7 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons if (mode == SCANF_INIT) { file_name[0] = 0; - if (is_neogeo_core() && !(options & (SCANO_CORES | SCANO_UMOUNT))) + if (options & SCANO_NEOGEO) { neogeo_scan_xml(); uint32_t len = strlen(HomeDir); @@ -1077,7 +1077,7 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons } } - if (is_neogeo_core() && !(options & (SCANO_CORES | SCANO_UMOUNT))) + if (options & SCANO_NEOGEO) { if (de->d_type != DT_DIR) continue; if (!strcmp(de->d_name, ".")) continue; diff --git a/file_io.h b/file_io.h index 9411e7f..a0ec97c 100644 --- a/file_io.h +++ b/file_io.h @@ -41,6 +41,7 @@ dirent* flist_SelectedItem(); #define SCANO_UMOUNT 2 // allow backspace key #define SCANO_CORES 4 // only include subdirectories with prefix '_' #define SCANO_COEFF 8 +#define SCANO_NEOGEO 16 void FindStorage(); int getStorage(int from_setting); diff --git a/menu.cpp b/menu.cpp index 3f3d1ea..692bff5 100644 --- a/menu.cpp +++ b/menu.cpp @@ -1504,7 +1504,7 @@ void HandleUI(void) if (p[idx] >= '0' && p[idx] <= '9') ioctl_index = p[idx] - '0'; substrcpy(ext, p, 1); while (strlen(ext) % 3) strcat(ext, " "); - SelectFile(ext, SCANO_DIR, MENU_8BIT_MAIN_FILE_SELECTED, MENU_8BIT_MAIN1); + SelectFile(ext, SCANO_DIR | (is_neogeo_core() ? SCANO_NEOGEO : 0), MENU_8BIT_MAIN_FILE_SELECTED, MENU_8BIT_MAIN1); } else if (p[0] == 'S') { @@ -1574,7 +1574,7 @@ void HandleUI(void) case MENU_8BIT_MAIN_FILE_SELECTED: printf("File selected: %s\n", SelectedPath); - if (is_neogeo_core()) + if (fs_Options & SCANO_NEOGEO) { if (!neogeo_romset_tx(SelectedPath)) { @@ -3125,7 +3125,8 @@ void HandleUI(void) strcpy(SelectedDir, SelectedPath); strcat(SelectedPath, "/"); } - if (is_neogeo_core()) + + if (fs_Options & SCANO_NEOGEO) { strcat(SelectedPath, neogeo_get_name(flist_SelectedItem()->d_ino)); }