datecode auto uses xml target

This commit is contained in:
CrazyRedMachine 2024-05-01 12:31:14 +02:00
parent 11ee17f48b
commit 25fa51d831

View File

@ -1452,12 +1452,17 @@ char *get_datecode_from_patches() {
for (uint16_t i=0; i<result.size(); i++) { for (uint16_t i=0; i<result.size(); i++) {
uint32_t found_limit = 0; uint32_t found_limit = 0;
property *patch_xml = load_prop_file(result[i].c_str()); property *patch_xml = load_prop_file(result[i].c_str());
READ_U32_OPT(patch_xml, property_search(patch_xml, NULL, "/patches/limits"), "music", found_limit) READ_U32_OPT(patch_xml, property_search(patch_xml, NULL, "/patches/limits"), "music", found_limit);
int res = property_node_refer(patch_xml, property_search(patch_xml, NULL, "/patches"), "target@",
PROPERTY_TYPE_ATTR, datecode, 11);
free(patch_xml); free(patch_xml);
if ( found_limit == music_limit ) if ( found_limit == music_limit )
{ {
if ( res != 11 )
{
LOG("WARNING: %s did not contain a valid target, fallback to filename\n", result[i].c_str()+10);
memcpy(datecode, result[i].c_str()+10+8, 10); memcpy(datecode, result[i].c_str()+10+8, 10);
}
return strdup(datecode); return strdup(datecode);
} }
} }