neogeo: xml: hide attribute.

This commit is contained in:
sorgelig
2019-09-17 03:29:55 +08:00
parent c24b973fc4
commit 1d035ca0ef
2 changed files with 9 additions and 0 deletions

View File

@@ -1085,6 +1085,8 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons
char *altname = neogeo_get_altname(full_path, &dext);
if (altname)
{
if (altname == (char*)-1) continue;
dext.de.d_type = DT_REG;
memcpy(dext.altname, altname, sizeof(dext.altname));
}

View File

@@ -471,6 +471,7 @@ struct rom_info
{
char name[256];
char altname[256];
char hide;
};
static rom_info roms[1000];
@@ -505,6 +506,10 @@ static int xml_scan(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, const in
memset(roms[rom_cnt].altname, 0, sizeof(roms[rom_cnt].altname));
strncpy(roms[rom_cnt].altname, node->attributes[i].value, sizeof(roms[rom_cnt].altname) - 1);
}
else if (!strcasecmp(node->attributes[i].name, "hide"))
{
roms[rom_cnt].hide = 1;
}
}
rom_cnt++;
}
@@ -638,6 +643,7 @@ char *neogeo_get_altname(char *path, direntext_t *de)
char *p = strcasestr(roms[i].name, full_path);
if (p)
{
if (roms[i].hide) return (char*)-1;
if(p == roms[i].name) return roms[i].altname;
sprintf(full_path, "%s (%s)", roms[i].altname, de->altname);
@@ -646,6 +652,7 @@ char *neogeo_get_altname(char *path, direntext_t *de)
}
else if (!strcasecmp(de->altname, roms[i].name))
{
if (roms[i].hide) return (char*)-1;
return roms[i].altname;
}
}