trunk/src/emu/uimain.c
r17653 | r17654 | |
367 | 367 | -------------------------------------------------*/ |
368 | 368 | int ui_menu_slot_devices::slot_get_current_index(device_slot_interface *slot) |
369 | 369 | { |
370 | | const char *current = machine().options().value(slot->device().tag()+1); |
| 370 | astring temp; |
| 371 | const char *current = machine().options().main_value(temp,slot->device().tag()+1); |
371 | 372 | const slot_interface* intf = slot->get_slot_interfaces(); |
372 | 373 | int val = -1; |
373 | 374 | for (int i = 0; intf[i].name != NULL; i++) { |
r17653 | r17654 | |
421 | 422 | -------------------------------------------------*/ |
422 | 423 | const char *ui_menu_slot_devices::get_slot_device(device_slot_interface *slot) |
423 | 424 | { |
424 | | return machine().options().value(slot->device().tag()+1); |
| 425 | astring temp; |
| 426 | return machine().options().main_value(temp,slot->device().tag()+1); |
425 | 427 | } |
426 | 428 | |
427 | 429 | |
r17653 | r17654 | |
551 | 553 | astring error; |
552 | 554 | machine().options().set_value("bios", val-1, OPTION_PRIORITY_CMDLINE, error); |
553 | 555 | assert(!error); |
| 556 | } else { |
| 557 | astring error; |
| 558 | astring value; |
| 559 | astring temp; |
| 560 | value.printf("%s,bios=%d",machine().options().main_value(temp,dev->owner()->tag()+1),val-1); |
| 561 | machine().options().set_value(dev->owner()->tag()+1, value.cstr(), OPTION_PRIORITY_CMDLINE, error); |
| 562 | assert(!error); |
554 | 563 | } |
555 | 564 | reset(UI_MENU_RESET_REMEMBER_REF); |
556 | 565 | } |
trunk/src/emu/romload.c
r17653 | r17654 | |
283 | 283 | from SystemBios structure and OPTION_BIOS |
284 | 284 | -------------------------------------------------*/ |
285 | 285 | |
286 | | static void determine_bios_rom(rom_load_data *romdata) |
| 286 | static void determine_bios_rom(rom_load_data *romdata, device_t *device,const char *specbios) |
287 | 287 | { |
288 | | const char *specbios = romdata->machine().options().bios(); |
289 | 288 | const char *defaultname = NULL; |
290 | 289 | const rom_entry *rom; |
291 | 290 | int default_no = 1; |
292 | 291 | int bios_count = 0; |
293 | 292 | |
294 | 293 | |
295 | | device_t &rootdevice = romdata->machine().config().root_device(); |
296 | | rootdevice.set_system_bios(0); |
| 294 | device->set_system_bios(0); |
297 | 295 | /* first determine the default BIOS name */ |
298 | | for (rom = rootdevice.rom_region(); !ROMENTRY_ISEND(rom); rom++) |
| 296 | for (rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++) |
299 | 297 | if (ROMENTRY_ISDEFAULT_BIOS(rom)) |
300 | 298 | defaultname = ROM_GETNAME(rom); |
301 | 299 | |
302 | 300 | /* look for a BIOS with a matching name */ |
303 | | for (rom = rootdevice.rom_region(); !ROMENTRY_ISEND(rom); rom++) |
| 301 | for (rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++) |
304 | 302 | if (ROMENTRY_ISSYSTEM_BIOS(rom)) |
305 | 303 | { |
306 | 304 | const char *biosname = ROM_GETNAME(rom); |
r17653 | r17654 | |
310 | 308 | /* Allow '-bios n' to still be used */ |
311 | 309 | sprintf(bios_number, "%d", bios_flags - 1); |
312 | 310 | if (mame_stricmp(bios_number, specbios) == 0 || mame_stricmp(biosname, specbios) == 0) |
313 | | rootdevice.set_system_bios(bios_flags); |
| 311 | device->set_system_bios(bios_flags); |
314 | 312 | if (defaultname != NULL && mame_stricmp(biosname, defaultname) == 0) |
315 | 313 | default_no = bios_flags; |
316 | 314 | bios_count++; |
317 | 315 | } |
318 | 316 | |
319 | 317 | /* if none found, use the default */ |
320 | | if (rootdevice.system_bios() == 0 && bios_count > 0) |
| 318 | if (device->system_bios() == 0 && bios_count > 0) |
321 | 319 | { |
322 | 320 | /* if we got neither an empty string nor 'default' then warn the user */ |
323 | 321 | if (specbios[0] != 0 && strcmp(specbios, "default") != 0 && romdata != NULL) |
r17653 | r17654 | |
327 | 325 | } |
328 | 326 | |
329 | 327 | /* set to default */ |
330 | | rootdevice.set_system_bios(default_no); |
| 328 | device->set_system_bios(default_no); |
331 | 329 | } |
332 | | rootdevice.set_default_bios(default_no); |
333 | | LOG(("Using System BIOS: %d\n", rootdevice.system_bios())); |
| 330 | device->set_default_bios(default_no); |
| 331 | LOG(("For \"%s\" using System BIOS: %d\n", device->tag(), device->system_bios())); |
334 | 332 | } |
335 | 333 | |
336 | 334 | |
r17653 | r17654 | |
352 | 350 | for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) |
353 | 351 | for (region = rom_first_region(*device); region != NULL; region = rom_next_region(region)) |
354 | 352 | for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) |
355 | | if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == romdata->machine().config().root_device().system_bios()) |
| 353 | if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device->system_bios()) |
356 | 354 | { |
357 | 355 | romdata->romstotal++; |
358 | 356 | romdata->romstotalsize += rom_file_size(rom); |
r17653 | r17654 | |
848 | 846 | for a region |
849 | 847 | -------------------------------------------------*/ |
850 | 848 | |
851 | | static void process_rom_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *parent_region, const rom_entry *romp) |
| 849 | static void process_rom_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *parent_region, const rom_entry *romp, device_t *device) |
852 | 850 | { |
853 | 851 | UINT32 lastflags = 0; |
854 | 852 | |
r17653 | r17654 | |
878 | 876 | /* handle files */ |
879 | 877 | else if (ROMENTRY_ISFILE(romp)) |
880 | 878 | { |
881 | | int irrelevantbios = (ROM_GETBIOSFLAGS(romp) != 0 && ROM_GETBIOSFLAGS(romp) != romdata->machine().config().root_device().system_bios()); |
| 879 | int irrelevantbios = (ROM_GETBIOSFLAGS(romp) != 0 && ROM_GETBIOSFLAGS(romp) != device->system_bios()); |
882 | 880 | const rom_entry *baserom = romp; |
883 | 881 | int explength = 0; |
884 | 882 | |
r17653 | r17654 | |
1357 | 1355 | |
1358 | 1356 | /* now process the entries in the region */ |
1359 | 1357 | if (ROMREGION_ISROMDATA(region)) |
1360 | | process_rom_entries(romdata, locationtag, region, region + 1); |
| 1358 | process_rom_entries(romdata, locationtag, region, region + 1, device); |
1361 | 1359 | else if (ROMREGION_ISDISKDATA(region)) |
1362 | 1360 | process_disk_entries(romdata, core_strdup(regiontag.cstr()), region, region + 1, locationtag); |
1363 | 1361 | } |
r17653 | r17654 | |
1421 | 1419 | #endif |
1422 | 1420 | |
1423 | 1421 | /* now process the entries in the region */ |
1424 | | process_rom_entries(romdata, device->shortname(), region, region + 1); |
| 1422 | process_rom_entries(romdata, device->shortname(), region, region + 1, device); |
1425 | 1423 | } |
1426 | 1424 | else if (ROMREGION_ISDISKDATA(region)) |
1427 | 1425 | process_disk_entries(romdata, regiontag, region, region + 1, NULL); |
r17653 | r17654 | |
1456 | 1454 | romdata->m_machine = &machine; |
1457 | 1455 | |
1458 | 1456 | /* figure out which BIOS we are using */ |
1459 | | determine_bios_rom(romdata); |
| 1457 | device_iterator deviter(romdata->machine().config().root_device()); |
| 1458 | for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) { |
| 1459 | if (device->rom_region()) { |
| 1460 | const char *specbios; |
| 1461 | astring temp; |
| 1462 | if (strcmp(device->tag(),":")==0) { |
| 1463 | specbios = romdata->machine().options().bios(); |
| 1464 | } else { |
| 1465 | specbios = romdata->machine().options().sub_value(temp,device->owner()->tag()+1,"bios"); |
| 1466 | } |
| 1467 | determine_bios_rom(romdata, device, specbios); |
| 1468 | } |
| 1469 | } |
1460 | 1470 | |
1461 | 1471 | /* count the total number of ROMs */ |
1462 | 1472 | count_roms(romdata); |