trunk/src/emu/romload.c
| r21850 | r21851 | |
| 465 | 465 | messages about ROM loading to the user |
| 466 | 466 | -------------------------------------------------*/ |
| 467 | 467 | |
| 468 | | static void display_loading_rom_message(romload_private *romdata, const char *name) |
| 468 | static void display_loading_rom_message(romload_private *romdata, const char *name, bool from_list) |
| 469 | 469 | { |
| 470 | 470 | char buffer[200]; |
| 471 | 471 | |
| 472 | 472 | if (name != NULL) |
| 473 | | sprintf(buffer, "Loading (%d%%)", (UINT32)(100 * (UINT64)romdata->romsloadedsize / (UINT64)romdata->romstotalsize)); |
| 473 | sprintf(buffer, "Loading %s (%d%%)", from_list ? "Software" : emulator_info::get_capstartgamenoun(), (UINT32)(100 * (UINT64)romdata->romsloadedsize / (UINT64)romdata->romstotalsize)); |
| 474 | 474 | else |
| 475 | 475 | sprintf(buffer, "Loading Complete"); |
| 476 | 476 | |
| r21850 | r21851 | |
| 483 | 483 | results of ROM loading |
| 484 | 484 | -------------------------------------------------*/ |
| 485 | 485 | |
| 486 | | static void display_rom_load_results(romload_private *romdata) |
| 486 | static void display_rom_load_results(romload_private *romdata, bool from_list) |
| 487 | 487 | { |
| 488 | 488 | /* final status display */ |
| 489 | | display_loading_rom_message(romdata, NULL); |
| 489 | display_loading_rom_message(romdata, NULL, from_list); |
| 490 | 490 | |
| 491 | 491 | /* if we had errors, they are fatal */ |
| 492 | 492 | if (romdata->errors != 0) |
| r21850 | r21851 | |
| 553 | 553 | up the parent and loading by checksum |
| 554 | 554 | -------------------------------------------------*/ |
| 555 | 555 | |
| 556 | | static int open_rom_file(romload_private *romdata, const char *regiontag, const rom_entry *romp, astring &tried_file_names) |
| 556 | static int open_rom_file(romload_private *romdata, const char *regiontag, const rom_entry *romp, astring &tried_file_names, bool from_list) |
| 557 | 557 | { |
| 558 | 558 | file_error filerr = FILERR_NOT_FOUND; |
| 559 | 559 | UINT32 romsize = rom_file_size(romp); |
| 560 | 560 | tried_file_names = ""; |
| 561 | 561 | |
| 562 | 562 | /* update status display */ |
| 563 | | display_loading_rom_message(romdata, ROM_GETNAME(romp)); |
| 563 | display_loading_rom_message(romdata, ROM_GETNAME(romp), from_list); |
| 564 | 564 | |
| 565 | 565 | /* extract CRC to use for searching */ |
| 566 | 566 | UINT32 crc = 0; |
| r21850 | r21851 | |
| 866 | 866 | for a region |
| 867 | 867 | -------------------------------------------------*/ |
| 868 | 868 | |
| 869 | | static void process_rom_entries(romload_private *romdata, const char *regiontag, const rom_entry *parent_region, const rom_entry *romp, device_t *device) |
| 869 | static void process_rom_entries(romload_private *romdata, const char *regiontag, const rom_entry *parent_region, const rom_entry *romp, device_t *device, bool from_list) |
| 870 | 870 | { |
| 871 | 871 | UINT32 lastflags = 0; |
| 872 | 872 | |
| r21850 | r21851 | |
| 903 | 903 | /* open the file if it is a non-BIOS or matches the current BIOS */ |
| 904 | 904 | LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp))); |
| 905 | 905 | astring tried_file_names; |
| 906 | | if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp, tried_file_names)) |
| 906 | if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp, tried_file_names, from_list)) |
| 907 | 907 | handle_missing_file(romdata, romp, tried_file_names); |
| 908 | 908 | |
| 909 | 909 | /* loop until we run out of reloads */ |
| r21850 | r21851 | |
| 1388 | 1388 | |
| 1389 | 1389 | /* now process the entries in the region */ |
| 1390 | 1390 | if (ROMREGION_ISROMDATA(region)) |
| 1391 | | process_rom_entries(romdata, locationtag, region, region + 1, device); |
| 1391 | process_rom_entries(romdata, locationtag, region, region + 1, device, TRUE); |
| 1392 | 1392 | else if (ROMREGION_ISDISKDATA(region)) |
| 1393 | 1393 | process_disk_entries(romdata, core_strdup(regiontag.cstr()), region, region + 1, locationtag); |
| 1394 | 1394 | } |
| r21850 | r21851 | |
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | /* display the results and exit */ |
| 1404 | | display_rom_load_results(romdata); |
| 1404 | display_rom_load_results(romdata, TRUE); |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | 1407 | |
| r21850 | r21851 | |
| 1453 | 1453 | #endif |
| 1454 | 1454 | |
| 1455 | 1455 | /* now process the entries in the region */ |
| 1456 | | process_rom_entries(romdata, device->shortname(), region, region + 1, device); |
| 1456 | process_rom_entries(romdata, device->shortname(), region, region + 1, device, FALSE); |
| 1457 | 1457 | } |
| 1458 | 1458 | else if (ROMREGION_ISDISKDATA(region)) |
| 1459 | 1459 | process_disk_entries(romdata, regiontag, region, region + 1, NULL); |
| r21850 | r21851 | |
| 1512 | 1512 | process_region_list(romdata); |
| 1513 | 1513 | |
| 1514 | 1514 | /* display the results and exit */ |
| 1515 | | display_rom_load_results(romdata); |
| 1515 | display_rom_load_results(romdata, FALSE); |
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | 1518 | |