neogeo: support per-folder romsets.xml for children subfolders.

This commit is contained in:
sorgelig
2019-09-09 00:58:55 +08:00
parent 30daad09b4
commit 84699a650c
3 changed files with 15 additions and 7 deletions

View File

@@ -937,8 +937,6 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons
if (mode == SCANF_INIT)
{
file_name[0] = 0;
if (options & SCANO_NEOGEO) neogeo_scan_xml();
if ((options & SCANO_NOENTER) || !isPathDirectory(path))
{
char *p = strrchr(path, '/');
@@ -960,6 +958,8 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons
file_name[0] = 0;
}
if (options & SCANO_NEOGEO) neogeo_scan_xml(path);
sprintf(full_path, "%s/%s", getRootDir(), path);
int path_len = strlen(full_path);

View File

@@ -548,10 +548,12 @@ static void parse_xml(const char* filename, const SAX_Callbacks* sax, void* user
}
}
int neogeo_scan_xml()
int neogeo_scan_xml(char *path)
{
static char full_path[1024];
sprintf(full_path, "%s/%s/romsets.xml", getRootDir(), HomeDir);
sprintf(full_path, "%s/romsets.xml", path);
if(!FileExists(full_path)) sprintf(full_path, "%s/%s/romsets.xml", getRootDir(), HomeDir);
SAX_Callbacks sax;
SAX_Callbacks_init(&sax);
@@ -980,8 +982,14 @@ int neogeo_romset_tx(char* name)
if (!(system_type & 2))
{
sprintf(full_path, "%s/%s/romset.xml", getRootDir(), name);
if (!FileExists(full_path)) sprintf(full_path, "%s/%s/romsets.xml", getRootDir(), HomeDir);
if (!FileExists(full_path))
{
strcpy(full_path, name);
char *p = strrchr(full_path, '/');
if (p) *p = 0;
strcat(full_path, "/romsets.xml");
if (!FileExists(full_path)) sprintf(full_path, "%s/%s/romsets.xml", getRootDir(), HomeDir);
}
printf("xml for %s: %s\n", name, full_path);
SAX_Callbacks sax;

View File

@@ -6,5 +6,5 @@
#define NEO_FILE_SPR 3
int neogeo_romset_tx(char* name);
int neogeo_scan_xml();
int neogeo_scan_xml(char *path);
char *neogeo_get_altname(char *path, direntext_t *de);