Previous 15994 Revisions Next

r7715 Monday 5th April, 2010 at 11:24:11 UTC by Wilbert Pol
Fixed handling of multiple dataareas for one part.
[src/emu]romload.c romload.h
[src/mess]softlist.c

src/emu/romload.h
r7714r7715
325325void set_disk_handle(running_machine *machine, const char *region, mame_file *file, chd_file *chd);
326326
327327
328#ifdef MESS
329void load_software_part_region(running_device *device, char *swlist, char *swname, rom_entry *start_region);
330#endif
331
328332#endif   /* __ROMLOAD_H__ */
src/emu/romload.c
r7714r7715
12571257}
12581258
12591259
1260#ifdef MESS
12601261/*-------------------------------------------------
1262    load_software_part_region - load a software part
1263
1264    This is used by MESS when loading a piece of
1265    software. The code should be merged with
1266    process_region_list or updated to use a slight
1267    more general process_region_list.
1268-------------------------------------------------*/
1269
1270void load_software_part_region(running_device *device, char *swlist, char *swname, rom_entry *start_region)
1271{
1272   astring *regiontag = astring_alloc();
1273   astring *locationtag = astring_alloc();
1274   const rom_entry *region;
1275   rom_load_data *romdata = device->machine->romload_data;
1276
1277   /* Make sure we are passed a device */
1278   assert(device!=NULL);
1279
1280   astring_assemble_3( locationtag, swlist, PATH_SEPARATOR, swname );
1281
1282   romdata->errorstring.reset();
1283
1284   /* loop until we hit the end */
1285   for (region = start_region; region != NULL; region = rom_next_region(region))
1286   {
1287      UINT32 regionlength = ROMREGION_GETLENGTH(region);
1288      UINT32 regionflags = ROMREGION_GETFLAGS(region);
1289
1290      astring_assemble_3( regiontag, device->tag(), ":", ROMREGION_GETTAG(region) );
1291      LOG(("Processing region \"%s\" (length=%X)\n", astring_c(regiontag), regionlength));
1292
1293      /* the first entry must be a region */
1294      assert(ROMENTRY_ISREGION(region));
1295
1296      /* if this is a device region, override with the device width and endianness */
1297      if (devtag_get_device(romdata->machine, astring_c(regiontag)) != NULL)
1298         regionflags = normalize_flags_for_device(romdata->machine, regionflags, astring_c(regiontag));
1299
1300      /* remember the base and length */
1301      romdata->region = memory_region_alloc(romdata->machine, astring_c(regiontag), regionlength, regionflags);
1302      LOG(("Allocated %X bytes @ %p\n", romdata->region->length, romdata->region->base.v));
1303
1304      /* clear the region if it's requested */
1305      if (ROMREGION_ISERASE(region))
1306         memset(romdata->region->base.v, ROMREGION_GETERASEVAL(region), romdata->region->length);
1307
1308      /* or if it's sufficiently small (<= 4MB) */
1309      else if (romdata->region->length <= 0x400000)
1310         memset(romdata->region->base.v, 0, romdata->region->length);
1311
1312#ifdef MAME_DEBUG
1313      /* if we're debugging, fill region with random data to catch errors */
1314      else
1315         fill_random(romdata->machine, romdata->region->base.u8, romdata->region->length);
1316#endif
1317
1318      /* now process the entries in the region */
1319      if (ROMREGION_ISROMDATA(region))
1320         process_rom_entries(romdata, astring_c(locationtag), region + 1);
1321      else if (ROMREGION_ISDISKDATA(region))
1322         process_disk_entries(romdata, astring_c(locationtag), region + 1);
1323   }
1324
1325   /* now go back and post-process all the regions */
1326   for (region = start_region; region != NULL; region = rom_next_region(region))
1327      region_post_process(romdata, ROMREGION_GETTAG(region));
1328
1329   astring_free(regiontag);
1330   astring_free(locationtag);
1331
1332   /* display the results and exit */
1333   display_rom_load_results(romdata);
1334}
1335#endif
1336
1337
1338/*-------------------------------------------------
12611339    process_region_list - process a region list
12621340-------------------------------------------------*/
12631341
src/mess/softlist.c
r7714r7715
566566   switch(swlist->state.pos)
567567   {
568568      case POS_ROOT:
569         break;
570
569571      case POS_SOFT:
572         if ( ! strcmp( name, "part" ) && swlist->softinfo )
573         {
574            /* ROM_END */
575            add_rom_entry( swlist, NULL, NULL, 0, 0, ROMENTRYTYPE_END );
576         }
570577         break;
571578
572579      case POS_MAIN:
r7714r7715
577584         break;
578585
579586      case POS_PART:
580         if ( swlist->softinfo )
581         {
582            /* ROM_END */
583            add_rom_entry( swlist, NULL, NULL, 0, 0, ROMENTRYTYPE_END );
584         }
585587         break;
586588
587589      case POS_DATA:
r7714r7715
972974      }
973975   }
974976
975#if 0
976977   if ( software_part_ptr )
977978   {
978979      /* Load the software part */
r7714r7715
10001001
10011002      result = true;
10021003   }
1003#endif
10041004
10051005   /* Close the software list if it's still open */
10061006   if ( software_list_ptr )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team