From ad8cfb8c5be599176d113eac0b8e4e7f540e1d70 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Thu, 14 Mar 2013 09:23:20 +0000 Subject: [PATCH] (MESS) romload: fixed loaded rom percentage going beyond 100% with softlist entries. nw. previously, loading from softlist was using the bios romsize as totalsize to load, explaining both the erratic percentage values in systems like AES and the totalsize = 0 error in NES and other bios-less systems, which was requiring a special workaround. handling is still not perfect (e.g I think that first the bios is loaded and counter goes to 100%, then the cart is loaded and the count restarts from 0%, so it would be better to have a separate message for the softlist loading, but I need to study in depth the code before such a change), but it's definitely better than having AES carts loading up to 12575% or NES skipping completely the soft percentage due to totalsize =0... --- src/emu/romload.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/emu/romload.c b/src/emu/romload.c index 4502db1a64a..f90c1e67e10 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -469,9 +469,7 @@ static void display_loading_rom_message(romload_private *romdata, const char *na { char buffer[200]; - // 2010-04, FP - FIXME: in MESS, load_software_part_region sometimes calls this with romstotalsize = 0! - // as a temp workaround, I added a check for romstotalsize !=0. - if (name != NULL && romdata->romstotalsize) + if (name != NULL) sprintf(buffer, "Loading (%d%%)", (UINT32)(100 * (UINT64)romdata->romsloadedsize / (UINT64)romdata->romstotalsize)); else sprintf(buffer, "Loading Complete"); @@ -1375,7 +1373,15 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom else fill_random(romdata->machine(), romdata->region->base(), romdata->region->bytes()); #endif - + + /* update total number of roms */ + for (const rom_entry *rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) + if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device->system_bios()) + { + romdata->romstotal++; + romdata->romstotalsize += rom_file_size(rom); + } + /* now process the entries in the region */ if (ROMREGION_ISROMDATA(region)) process_rom_entries(romdata, locationtag, region, region + 1, device); @@ -1384,7 +1390,8 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom } /* now go back and post-process all the regions */ - for (region = start_region; region != NULL; region = rom_next_region(region)) { + for (region = start_region; region != NULL; region = rom_next_region(region)) + { device->subtag(regiontag, ROMREGION_GETTAG(region)); region_post_process(romdata, regiontag.cstr(), ROMREGION_ISINVERTED(region)); }