Previous 199869 Revisions Next

r25412 Tuesday 24th September, 2013 at 15:07:13 UTC by Oliver Stöneberg
[MT03450] show detailed NOT FOUND messages for missing CHDs [Oliver Stöneberg]
[src/emu]romload.c

trunk/src/emu/romload.c
r25411r25412
374374    for missing files
375375-------------------------------------------------*/
376376
377static void handle_missing_file(romload_private *romdata, const rom_entry *romp, astring tried_file_names)
377static void handle_missing_file(romload_private *romdata, const rom_entry *romp, astring tried_file_names, chd_error chderr)
378378{
379379   if(tried_file_names.len() != 0)
380380      tried_file_names = " (tried in " + tried_file_names + ")";
381381
382   astring name(ROM_GETNAME(romp));
383
384   bool is_chd = (chderr != CHDERR_NONE);
385   if (is_chd)
386      name += ".chd";
387
388   bool is_chd_error = (is_chd && chderr != CHDERR_FILE_NOT_FOUND);
389   if (is_chd_error)
390      romdata->errorstring.catprintf("%s CHD ERROR: %s\n", name.cstr(), chd_file::error_string(chderr));
391
382392   /* optional files are okay */
383393   if (ROM_ISOPTIONAL(romp))
384394   {
385      romdata->errorstring.catprintf("OPTIONAL %s NOT FOUND%s\n", ROM_GETNAME(romp), tried_file_names.cstr());
395      if (!is_chd_error)
396         romdata->errorstring.catprintf("OPTIONAL %s NOT FOUND%s\n", name.cstr(), tried_file_names.cstr());
386397      romdata->warnings++;
387398   }
388399
389400   /* no good dumps are okay */
390401   else if (hash_collection(ROM_GETHASHDATA(romp)).flag(hash_collection::FLAG_NO_DUMP))
391402   {
392      romdata->errorstring.catprintf("%s NOT FOUND (NO GOOD DUMP KNOWN)%s\n", ROM_GETNAME(romp), tried_file_names.cstr());
403      if (!is_chd_error)
404         romdata->errorstring.catprintf("%s NOT FOUND (NO GOOD DUMP KNOWN)%s\n", name.cstr(), tried_file_names.cstr());
393405      romdata->knownbad++;
394406   }
395407
396408   /* anything else is bad */
397409   else
398410   {
399      romdata->errorstring.catprintf("%s NOT FOUND%s\n", ROM_GETNAME(romp), tried_file_names.cstr());
411      if (!is_chd_error)
412         romdata->errorstring.catprintf("%s NOT FOUND%s\n", name.cstr(), tried_file_names.cstr());
400413      romdata->errors++;
401414   }
402415}
r25411r25412
904917         LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp)));
905918         astring tried_file_names;
906919         if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp, tried_file_names, from_list))
907            handle_missing_file(romdata, romp, tried_file_names);
920            handle_missing_file(romdata, romp, tried_file_names, CHDERR_NONE);
908921
909922         /* loop until we run out of reloads */
910923         do
r25411r25412
11791192         err = chd_error(open_disk_image(romdata->machine().options(), &romdata->machine().system(), romp, chd->orig_chd(), locationtag));
11801193         if (err != CHDERR_NONE)
11811194         {
1182            if (err == CHDERR_FILE_NOT_FOUND)
1183               romdata->errorstring.catprintf("%s NOT FOUND\n", filename.cstr());
1184            else
1185               romdata->errorstring.catprintf("%s CHD ERROR: %s\n", filename.cstr(), chd_file::error_string(err));
1186
1187            /* if this is NO_DUMP, keep going, though the system may not be able to handle it */
1188            if (hashes.flag(hash_collection::FLAG_NO_DUMP))
1189               romdata->knownbad++;
1190            else if (ROM_ISOPTIONAL(romp))
1191               romdata->warnings++;
1192            else
1193               romdata->errors++;
1195            handle_missing_file(romdata, romp, astring(), err);
11941196            global_free(chd);
11951197            continue;
11961198         }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team