Previous 199869 Revisions Next

r21851 Thursday 14th March, 2013 at 10:10:17 UTC by Fabio Priuli
romload: attempt to improve loaded rom percentage display. nw.

namely, with this change the emulator displays first a "Loading Game N%" while loading MAME game or MESS system roms,
then it switches to "Loading Software %N" while loading from softlist (this also applies to Megatech, ST-V and NeoGeo lists in MAME)

I'm not completely happy with passing a "from_list" boolean to modify the behavior, but I have found no better solution.
If you find any, please be my guest and replace this solution with yours.
[src/emu]romload.c

trunk/src/emu/romload.c
r21850r21851
465465    messages about ROM loading to the user
466466-------------------------------------------------*/
467467
468static void display_loading_rom_message(romload_private *romdata, const char *name)
468static void display_loading_rom_message(romload_private *romdata, const char *name, bool from_list)
469469{
470470   char buffer[200];
471471
472472   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));
474474   else
475475      sprintf(buffer, "Loading Complete");
476476
r21850r21851
483483    results of ROM loading
484484-------------------------------------------------*/
485485
486static void display_rom_load_results(romload_private *romdata)
486static void display_rom_load_results(romload_private *romdata, bool from_list)
487487{
488488   /* final status display */
489   display_loading_rom_message(romdata, NULL);
489   display_loading_rom_message(romdata, NULL, from_list);
490490
491491   /* if we had errors, they are fatal */
492492   if (romdata->errors != 0)
r21850r21851
553553    up the parent and loading by checksum
554554-------------------------------------------------*/
555555
556static int open_rom_file(romload_private *romdata, const char *regiontag, const rom_entry *romp, astring &tried_file_names)
556static int open_rom_file(romload_private *romdata, const char *regiontag, const rom_entry *romp, astring &tried_file_names, bool from_list)
557557{
558558   file_error filerr = FILERR_NOT_FOUND;
559559   UINT32 romsize = rom_file_size(romp);
560560   tried_file_names = "";
561561
562562   /* update status display */
563   display_loading_rom_message(romdata, ROM_GETNAME(romp));
563   display_loading_rom_message(romdata, ROM_GETNAME(romp), from_list);
564564
565565   /* extract CRC to use for searching */
566566   UINT32 crc = 0;
r21850r21851
866866    for a region
867867-------------------------------------------------*/
868868
869static void process_rom_entries(romload_private *romdata, const char *regiontag, const rom_entry *parent_region, const rom_entry *romp, device_t *device)
869static 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)
870870{
871871   UINT32 lastflags = 0;
872872
r21850r21851
903903         /* open the file if it is a non-BIOS or matches the current BIOS */
904904         LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp)));
905905         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))
907907            handle_missing_file(romdata, romp, tried_file_names);
908908
909909         /* loop until we run out of reloads */
r21850r21851
13881388     
13891389      /* now process the entries in the region */
13901390      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);
13921392      else if (ROMREGION_ISDISKDATA(region))
13931393         process_disk_entries(romdata, core_strdup(regiontag.cstr()), region, region + 1, locationtag);
13941394   }
r21850r21851
14011401   }
14021402
14031403   /* display the results and exit */
1404   display_rom_load_results(romdata);
1404   display_rom_load_results(romdata, TRUE);
14051405}
14061406
14071407
r21850r21851
14531453#endif
14541454
14551455            /* 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);
14571457         }
14581458         else if (ROMREGION_ISDISKDATA(region))
14591459            process_disk_entries(romdata, regiontag, region, region + 1, NULL);
r21850r21851
15121512   process_region_list(romdata);
15131513
15141514   /* display the results and exit */
1515   display_rom_load_results(romdata);
1515   display_rom_load_results(romdata, FALSE);
15161516}
15171517
15181518

Previous 199869 Revisions Next


© 1997-2024 The MAME Team