trunk/src/emu/romload.c
| r18734 | r18735 | |
| 374 | 374 | for missing files |
| 375 | 375 | -------------------------------------------------*/ |
| 376 | 376 | |
| 377 | | static void handle_missing_file(romload_private *romdata, const rom_entry *romp) |
| 377 | static void handle_missing_file(romload_private *romdata, const rom_entry *romp, astring tried_file_names) |
| 378 | 378 | { |
| 379 | if(tried_file_names.len() != 0) |
| 380 | tried_file_names = " (tried in " + tried_file_names + ")"; |
| 381 | |
| 379 | 382 | /* optional files are okay */ |
| 380 | 383 | if (ROM_ISOPTIONAL(romp)) |
| 381 | 384 | { |
| 382 | | romdata->errorstring.catprintf("OPTIONAL %s NOT FOUND\n", ROM_GETNAME(romp)); |
| 385 | romdata->errorstring.catprintf("OPTIONAL %s NOT FOUND%s\n", ROM_GETNAME(romp), tried_file_names.cstr()); |
| 383 | 386 | romdata->warnings++; |
| 384 | 387 | } |
| 385 | 388 | |
| 386 | 389 | /* no good dumps are okay */ |
| 387 | 390 | else if (hash_collection(ROM_GETHASHDATA(romp)).flag(hash_collection::FLAG_NO_DUMP)) |
| 388 | 391 | { |
| 389 | | romdata->errorstring.catprintf("%s NOT FOUND (NO GOOD DUMP KNOWN)\n", ROM_GETNAME(romp)); |
| 392 | romdata->errorstring.catprintf("%s NOT FOUND (NO GOOD DUMP KNOWN)%s\n", ROM_GETNAME(romp), tried_file_names.cstr()); |
| 390 | 393 | romdata->knownbad++; |
| 391 | 394 | } |
| 392 | 395 | |
| 393 | 396 | /* anything else is bad */ |
| 394 | 397 | else |
| 395 | 398 | { |
| 396 | | romdata->errorstring.catprintf("%s NOT FOUND\n", ROM_GETNAME(romp)); |
| 399 | romdata->errorstring.catprintf("%s NOT FOUND%s\n", ROM_GETNAME(romp), tried_file_names.cstr()); |
| 397 | 400 | romdata->errors++; |
| 398 | 401 | } |
| 399 | 402 | } |
| r18734 | r18735 | |
| 552 | 555 | up the parent and loading by checksum |
| 553 | 556 | -------------------------------------------------*/ |
| 554 | 557 | |
| 555 | | static int open_rom_file(romload_private *romdata, const char *regiontag, const rom_entry *romp) |
| 558 | static int open_rom_file(romload_private *romdata, const char *regiontag, const rom_entry *romp, astring &tried_file_names) |
| 556 | 559 | { |
| 557 | 560 | file_error filerr = FILERR_NOT_FOUND; |
| 558 | 561 | UINT32 romsize = rom_file_size(romp); |
| 562 | tried_file_names = ""; |
| 559 | 563 | |
| 560 | 564 | /* update status display */ |
| 561 | 565 | display_loading_rom_message(romdata, ROM_GETNAME(romp)); |
| r18734 | r18735 | |
| 567 | 571 | /* attempt reading up the chain through the parents. It automatically also |
| 568 | 572 | attempts any kind of load by checksum supported by the archives. */ |
| 569 | 573 | romdata->file = NULL; |
| 570 | | for (int drv = driver_list::find(romdata->machine().system()); romdata->file == NULL && drv != -1; drv = driver_list::clone(drv)) |
| 574 | for (int drv = driver_list::find(romdata->machine().system()); romdata->file == NULL && drv != -1; drv = driver_list::clone(drv)) { |
| 575 | if(tried_file_names.len() != 0) |
| 576 | tried_file_names += " "; |
| 577 | tried_file_names += driver_list::driver(drv).name; |
| 571 | 578 | filerr = common_process_file(romdata->machine().options(), driver_list::driver(drv).name, has_crc, crc, romp, &romdata->file); |
| 579 | } |
| 572 | 580 | |
| 573 | 581 | /* if the region is load by name, load the ROM from there */ |
| 574 | 582 | if (romdata->file == NULL && regiontag != NULL) |
| r18734 | r18735 | |
| 618 | 626 | // - if we are not using lists, we have regiontag only; |
| 619 | 627 | // - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname |
| 620 | 628 | if (!is_list) |
| 629 | { |
| 630 | tried_file_names += " " + tag1; |
| 621 | 631 | filerr = common_process_file(romdata->machine().options(), tag1.cstr(), has_crc, crc, romp, &romdata->file); |
| 632 | } |
| 622 | 633 | else |
| 623 | 634 | { |
| 624 | 635 | // try to load from list/setname |
| 625 | 636 | if ((romdata->file == NULL) && (tag2.cstr() != NULL)) |
| 637 | { |
| 638 | tried_file_names += " " + tag2; |
| 626 | 639 | filerr = common_process_file(romdata->machine().options(), tag2.cstr(), has_crc, crc, romp, &romdata->file); |
| 640 | } |
| 627 | 641 | // try to load from list/parentname |
| 628 | 642 | if ((romdata->file == NULL) && has_parent && (tag3.cstr() != NULL)) |
| 643 | { |
| 644 | tried_file_names += " " + tag3; |
| 629 | 645 | filerr = common_process_file(romdata->machine().options(), tag3.cstr(), has_crc, crc, romp, &romdata->file); |
| 646 | } |
| 630 | 647 | // try to load from setname |
| 631 | 648 | if ((romdata->file == NULL) && (tag4.cstr() != NULL)) |
| 649 | { |
| 650 | tried_file_names += " " + tag4; |
| 632 | 651 | filerr = common_process_file(romdata->machine().options(), tag4.cstr(), has_crc, crc, romp, &romdata->file); |
| 652 | } |
| 633 | 653 | // try to load from parentname |
| 634 | 654 | if ((romdata->file == NULL) && has_parent && (tag5.cstr() != NULL)) |
| 655 | { |
| 656 | tried_file_names += " " + tag5; |
| 635 | 657 | filerr = common_process_file(romdata->machine().options(), tag5.cstr(), has_crc, crc, romp, &romdata->file); |
| 658 | } |
| 636 | 659 | } |
| 637 | 660 | } |
| 638 | 661 | |
| r18734 | r18735 | |
| 881 | 904 | |
| 882 | 905 | /* open the file if it is a non-BIOS or matches the current BIOS */ |
| 883 | 906 | LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp))); |
| 884 | | if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp)) |
| 885 | | handle_missing_file(romdata, romp); |
| 907 | astring tried_file_names; |
| 908 | if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp, tried_file_names)) |
| 909 | handle_missing_file(romdata, romp, tried_file_names); |
| 886 | 910 | |
| 887 | 911 | /* loop until we run out of reloads */ |
| 888 | 912 | do |