trunk/src/emu/romload.c
| r25411 | r25412 | |
| 374 | 374 | for missing files |
| 375 | 375 | -------------------------------------------------*/ |
| 376 | 376 | |
| 377 | | static void handle_missing_file(romload_private *romdata, const rom_entry *romp, astring tried_file_names) |
| 377 | static void handle_missing_file(romload_private *romdata, const rom_entry *romp, astring tried_file_names, chd_error chderr) |
| 378 | 378 | { |
| 379 | 379 | if(tried_file_names.len() != 0) |
| 380 | 380 | tried_file_names = " (tried in " + tried_file_names + ")"; |
| 381 | 381 | |
| 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 | |
| 382 | 392 | /* optional files are okay */ |
| 383 | 393 | if (ROM_ISOPTIONAL(romp)) |
| 384 | 394 | { |
| 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()); |
| 386 | 397 | romdata->warnings++; |
| 387 | 398 | } |
| 388 | 399 | |
| 389 | 400 | /* no good dumps are okay */ |
| 390 | 401 | else if (hash_collection(ROM_GETHASHDATA(romp)).flag(hash_collection::FLAG_NO_DUMP)) |
| 391 | 402 | { |
| 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()); |
| 393 | 405 | romdata->knownbad++; |
| 394 | 406 | } |
| 395 | 407 | |
| 396 | 408 | /* anything else is bad */ |
| 397 | 409 | else |
| 398 | 410 | { |
| 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()); |
| 400 | 413 | romdata->errors++; |
| 401 | 414 | } |
| 402 | 415 | } |
| r25411 | r25412 | |
| 904 | 917 | LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp))); |
| 905 | 918 | astring tried_file_names; |
| 906 | 919 | 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); |
| 908 | 921 | |
| 909 | 922 | /* loop until we run out of reloads */ |
| 910 | 923 | do |
| r25411 | r25412 | |
| 1179 | 1192 | err = chd_error(open_disk_image(romdata->machine().options(), &romdata->machine().system(), romp, chd->orig_chd(), locationtag)); |
| 1180 | 1193 | if (err != CHDERR_NONE) |
| 1181 | 1194 | { |
| 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); |
| 1194 | 1196 | global_free(chd); |
| 1195 | 1197 | continue; |
| 1196 | 1198 | } |