mirror of
https://github.com/holub/mame
synced 2025-05-22 05:38:52 +03:00
Expanded slot definition with clock and config so we can better define fixed slot devices where needed (no whatsnew)
This commit is contained in:
parent
4215a138d8
commit
c677360a81
@ -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;
|
device_slot_interface *slot;
|
||||||
if (!device.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_slot_interfaces = slots_info;
|
||||||
slot->m_default_card = default_card;
|
slot->m_default_card = default_card;
|
||||||
slot->m_input_defaults = default_input;
|
slot->m_input_defaults = default_input;
|
||||||
|
slot->m_default_config = default_config;
|
||||||
|
slot->m_default_clock = default_clock;
|
||||||
slot->m_fixed = fixed;
|
slot->m_fixed = fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,11 @@ struct slot_interface
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, _fixed) \
|
#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
|
#define SLOT_INTERFACE_NAME(name) slot_interface_##name
|
||||||
|
|
||||||
@ -50,17 +54,21 @@ public:
|
|||||||
device_slot_interface(const machine_config &mconfig, device_t &device);
|
device_slot_interface(const machine_config &mconfig, device_t &device);
|
||||||
virtual ~device_slot_interface();
|
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 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; };
|
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; };
|
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 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; }
|
const bool fixed() const { return m_fixed; }
|
||||||
device_t* get_card_device();
|
device_t* get_card_device();
|
||||||
protected:
|
protected:
|
||||||
const char *m_default_card;
|
const char *m_default_card;
|
||||||
const input_device_default *m_input_defaults;
|
const input_device_default *m_input_defaults;
|
||||||
const slot_interface *m_slot_interfaces;
|
const slot_interface *m_slot_interfaces;
|
||||||
|
const void *m_default_config;
|
||||||
|
UINT32 m_default_clock;
|
||||||
bool m_fixed;
|
bool m_fixed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,11 +91,16 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
|
|||||||
{
|
{
|
||||||
if ((!intf[i].internal) || (isdefault && intf[i].internal))
|
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);
|
const char *def = slot->get_default_card(*this, options);
|
||||||
if (def != NULL && strcmp(def, selval) == 0)
|
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());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user