From c677360a81a1b1e4b85efeeedf0909cfe1bcc176 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 5 Jun 2012 14:33:14 +0000 Subject: [PATCH] Expanded slot definition with clock and config so we can better define fixed slot devices where needed (no whatsnew) --- src/emu/dislot.c | 4 +++- src/emu/dislot.h | 12 ++++++++++-- src/emu/mconfig.c | 13 +++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/emu/dislot.c b/src/emu/dislot.c index 617377b7b71..ecd504568ab 100644 --- a/src/emu/dislot.c +++ b/src/emu/dislot.c @@ -20,7 +20,7 @@ device_slot_interface::~device_slot_interface() } -void device_slot_interface::static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,const input_device_default *default_input, bool fixed) +void device_slot_interface::static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,const input_device_default *default_input, const void *default_config, UINT32 default_clock, bool fixed) { device_slot_interface *slot; if (!device.interface(slot)) @@ -29,6 +29,8 @@ void device_slot_interface::static_set_slot_info(device_t &device, const slot_in slot->m_slot_interfaces = slots_info; slot->m_default_card = default_card; slot->m_input_defaults = default_input; + slot->m_default_config = default_config; + slot->m_default_clock = default_clock; slot->m_fixed = fixed; } diff --git a/src/emu/dislot.h b/src/emu/dislot.h index 58dcabccbda..4cc355f92a9 100644 --- a/src/emu/dislot.h +++ b/src/emu/dislot.h @@ -21,7 +21,11 @@ struct slot_interface }; #define MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, _fixed) \ - device_slot_interface::static_set_slot_info(*device, SLOT_INTERFACE_NAME(_slot_intf), _def_slot, DEVICE_INPUT_DEFAULTS_NAME(_def_inp), _fixed); + device_slot_interface::static_set_slot_info(*device, SLOT_INTERFACE_NAME(_slot_intf), _def_slot, DEVICE_INPUT_DEFAULTS_NAME(_def_inp), NULL, 0, _fixed); + +#define MCFG_DEVICE_SLOT_INTERFACE_FULL(_slot_intf, _def_slot, _def_inp, _def_config, _def_clock, _fixed) \ + device_slot_interface::static_set_slot_info(*device, SLOT_INTERFACE_NAME(_slot_intf), _def_slot, DEVICE_INPUT_DEFAULTS_NAME(_def_inp), _def_config, _def_clock, _fixed); + #define SLOT_INTERFACE_NAME(name) slot_interface_##name @@ -50,17 +54,21 @@ public: device_slot_interface(const machine_config &mconfig, device_t &device); virtual ~device_slot_interface(); - static void static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,const input_device_default *default_input, bool fixed); + static void static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,const input_device_default *default_input, const void *default_config, UINT32 default_clock, bool fixed); const slot_interface* get_slot_interfaces() const { return m_slot_interfaces; }; const char * get_default_card(const machine_config &config, emu_options &options) const { return m_default_card; }; virtual const char * get_default_card_software(const machine_config &config, emu_options &options) { return NULL; }; const input_device_default *input_ports_defaults() const { return m_input_defaults; } + const void *default_config() const { return m_default_config; } + const UINT32 default_clock() const { return m_default_clock; } const bool fixed() const { return m_fixed; } device_t* get_card_device(); protected: const char *m_default_card; const input_device_default *m_input_defaults; const slot_interface *m_slot_interfaces; + const void *m_default_config; + UINT32 m_default_clock; bool m_fixed; }; diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index b593adc8619..d74b7907a01 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -91,11 +91,16 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) { if ((!intf[i].internal) || (isdefault && intf[i].internal)) { - device_t *new_dev = device_add(&owner, intf[i].name, intf[i].devtype, 0); - found = true; const char *def = slot->get_default_card(*this, options); - if (def != NULL && strcmp(def, selval) == 0) - device_t::static_set_input_default(*new_dev, slot->input_ports_defaults()); + bool is_default = (def != NULL && strcmp(def, selval) == 0); + device_t *new_dev = device_add(&owner, intf[i].name, intf[i].devtype, is_default ? slot->default_clock() : 0); + found = true; + if (is_default) { + device_t::static_set_input_default(*new_dev, slot->input_ports_defaults()); + if (slot->default_config()) { + device_t::static_set_static_config(*new_dev, slot->default_config()); + } + } } } }