trunk/src/emu/dislot.c
| r26148 | r26149 | |
| 46 | 46 | return options; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | void device_slot_interface::static_set_card_default_bios(device_t &device, const char *card, const char *default_bios) |
| 50 | { |
| 51 | static_alloc_card_options(device, card)->m_default_bios = default_bios; |
| 52 | } |
| 53 | |
| 49 | 54 | void device_slot_interface::static_set_card_machine_config(device_t &device, const char *card, const machine_config_constructor machine_config) |
| 50 | 55 | { |
| 51 | 56 | static_alloc_card_options(device, card)->m_machine_config = machine_config; |
| r26148 | r26149 | |
| 66 | 71 | static_alloc_card_options(device, card)->m_clock = clock; |
| 67 | 72 | } |
| 68 | 73 | |
| 74 | const char *device_slot_interface::card_default_bios(const char *card) const |
| 75 | { |
| 76 | device_card_options *options = m_card_options.find(card); |
| 77 | if (options != NULL) |
| 78 | return options->m_default_bios; |
| 79 | return NULL; |
| 80 | } |
| 81 | |
| 69 | 82 | const machine_config_constructor device_slot_interface::card_machine_config(const char *card) const |
| 70 | 83 | { |
| 71 | 84 | device_card_options *options = m_card_options.find(card); |
trunk/src/emu/dislot.h
| r26148 | r26149 | |
| 25 | 25 | #define MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_card, _fixed) \ |
| 26 | 26 | device_slot_interface::static_set_slot_info(*device, SLOT_INTERFACE_NAME(_slot_intf), _def_card, _fixed); |
| 27 | 27 | |
| 28 | #define MCFG_DEVICE_CARD_DEFAULT_BIOS(card, _default_bios) \ |
| 29 | device_slot_interface::static_set_card_default_bios(*device, card, _default_bios); |
| 30 | |
| 28 | 31 | #define MCFG_DEVICE_CARD_MACHINE_CONFIG(card, _machine_config_name) \ |
| 29 | 32 | device_slot_interface::static_set_card_machine_config(*device, card, MACHINE_CONFIG_NAME(_machine_config_name)); |
| 30 | 33 | |
| r26148 | r26149 | |
| 58 | 61 | friend class simple_list<device_card_options>; |
| 59 | 62 | |
| 60 | 63 | private: |
| 64 | const char *m_default_bios; |
| 61 | 65 | machine_config_constructor m_machine_config; |
| 62 | 66 | const input_device_default *m_input_device_defaults; |
| 63 | 67 | const void *m_config; |
| r26148 | r26149 | |
| 76 | 80 | |
| 77 | 81 | static void static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,bool fixed); |
| 78 | 82 | static device_card_options *static_alloc_card_options(device_t &device, const char *card); |
| 83 | static void static_set_card_default_bios(device_t &device, const char *card, const char *default_bios); |
| 79 | 84 | static void static_set_card_machine_config(device_t &device, const char *card, const machine_config_constructor machine_config); |
| 80 | 85 | static void static_set_card_device_input_defaults(device_t &device, const char *card, const input_device_default *default_input); |
| 81 | 86 | static void static_set_card_config(device_t &device, const char *card, const void *config); |
| r26148 | r26149 | |
| 83 | 88 | const slot_interface* get_slot_interfaces() const { return m_slot_interfaces; }; |
| 84 | 89 | const char * get_default_card() const { return m_default_card; }; |
| 85 | 90 | virtual const char * get_default_card_software(const machine_config &config, emu_options &options) { return NULL; }; |
| 91 | const char *card_default_bios(const char *card) const; |
| 86 | 92 | const machine_config_constructor card_machine_config(const char *card) const; |
| 87 | 93 | const input_device_default *card_input_device_defaults(const char *card) const; |
| 88 | 94 | const void *card_config(const char *card) const; |
trunk/src/emu/device.h
| r26148 | r26149 | |
| 141 | 141 | ioport_constructor input_ports() const { return device_input_ports(); } |
| 142 | 142 | UINT8 default_bios() const { return m_default_bios; } |
| 143 | 143 | UINT8 system_bios() const { return m_system_bios; } |
| 144 | astring default_bios_tag() const { return m_default_bios_tag; } |
| 144 | 145 | |
| 145 | 146 | // interface helpers |
| 146 | 147 | template<class _DeviceClass> bool interface(_DeviceClass *&intf) { intf = dynamic_cast<_DeviceClass *>(this); return (intf != NULL); } |
| r26148 | r26149 | |
| 175 | 176 | static void static_set_clock(device_t &device, UINT32 clock); |
| 176 | 177 | static void static_set_static_config(device_t &device, const void *config) { device.m_static_config = config; } |
| 177 | 178 | static void static_set_input_default(device_t &device, const input_device_default *config) { device.m_input_defaults = config; } |
| 179 | static void static_set_default_bios_tag(device_t &device, const char *tag) { astring default_bios_tag(tag); device.m_default_bios_tag = default_bios_tag; } |
| 178 | 180 | |
| 179 | 181 | // state helpers |
| 180 | 182 | void config_complete(); |
| r26148 | r26149 | |
| 278 | 280 | |
| 279 | 281 | UINT8 m_system_bios; // the system BIOS we wish to load |
| 280 | 282 | UINT8 m_default_bios; // the default system BIOS |
| 283 | astring m_default_bios_tag; // tag of the default system BIOS |
| 284 | |
| 281 | 285 | private: |
| 282 | 286 | // private helpers |
| 283 | 287 | device_t *add_subdevice(device_type type, const char *tag, UINT32 clock); |
trunk/src/emu/mconfig.c
| r26148 | r26149 | |
| 65 | 65 | device_t *new_dev = device_add(&owner, intf[i].name, intf[i].devtype, slot->card_clock(selval)); |
| 66 | 66 | found = true; |
| 67 | 67 | |
| 68 | const char *default_bios = slot->card_default_bios(selval); |
| 69 | if (default_bios != NULL) |
| 70 | { |
| 71 | device_t::static_set_default_bios_tag(*new_dev, default_bios); |
| 72 | } |
| 73 | |
| 68 | 74 | machine_config_constructor additions = slot->card_machine_config(selval); |
| 69 | 75 | if (additions != NULL) |
| 70 | 76 | (*additions)(const_cast<machine_config &>(*this), new_dev); |
trunk/src/emu/romload.c
| r26148 | r26149 | |
| 282 | 282 | from SystemBios structure and OPTION_BIOS |
| 283 | 283 | -------------------------------------------------*/ |
| 284 | 284 | |
| 285 | | static void determine_bios_rom(romload_private *romdata, device_t *device,const char *specbios) |
| 285 | static void determine_bios_rom(romload_private *romdata, device_t *device, const char *specbios) |
| 286 | 286 | { |
| 287 | 287 | const char *defaultname = NULL; |
| 288 | 288 | const rom_entry *rom; |
| 289 | 289 | int default_no = 1; |
| 290 | 290 | int bios_count = 0; |
| 291 | 291 | |
| 292 | device->set_system_bios(0); |
| 292 | 293 | |
| 293 | | device->set_system_bios(0); |
| 294 | 294 | /* first determine the default BIOS name */ |
| 295 | 295 | for (rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++) |
| 296 | 296 | if (ROMENTRY_ISDEFAULT_BIOS(rom)) |
| r26148 | r26149 | |
| 1498 | 1498 | specbios = romdata->machine().options().bios(); |
| 1499 | 1499 | } else { |
| 1500 | 1500 | specbios = romdata->machine().options().sub_value(temp,device->owner()->tag()+1,"bios"); |
| 1501 | if (strlen(specbios) == 0) { |
| 1502 | specbios = device->default_bios_tag().cstr(); |
| 1503 | } |
| 1501 | 1504 | } |
| 1502 | 1505 | determine_bios_rom(romdata, device, specbios); |
| 1503 | 1506 | } |