summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-05-06 00:40:40 +1000
committer Vas Crabb <vas@vastheman.com>2018-05-06 00:51:27 +1000
commit4ea3cd0bc1f54e47a0d38a47afac38101549e9ee (patch)
treebbadc20010b6bad48cf321b1c864655587e4b8ad /src/emu
parentbba5127d7a73ca44fdc0dcab7286846c81206771 (diff)
Streamline machine configuration macros - everyone's a device edition.
Start replacing special device macros with additional constructors, starting with ISA, INTELLEC 4 and RS-232 buses. Allow an object finder to take on the target of another object finder. (For a combination of the previous two things in action, see either the INTELLEC 4 driver, or the Apple 2 PC Exporter card. Also check out looping over a device finder array to instantiate devices in some places. Lots of things no longer need to pass tags around.) Start supplying default clocks for things that have a standard clock or have all clocks internal. Eliminate the separate DEV versions of the DEVCB_ macros. Previously, the plain versions were a shortcut for DEVICE_SELF as the target. You can now supply a string tag (relative to current device being configured), an object finder (takes on the base and relative tag), or a reference to a device/interface (only do this if you know the device won't be replaced out from under it, but that's a safe assumption for your subdevices). In almost all cases, you can get the effect you want by supplying *this as the target. Eliminate sound and CPU versions of macros. They serve no useful purpose, provide no extra checks, make error messages longer, add indirection, and mislead newbies into thinking there's a difference. Remove a lot of now-unnecessary ":" prefixes binding things relative to machine root. Clean up some miscellaneous rot. Examples of new functionality in use in (some more subtle than others): * src/mame/drivers/intellec4.cpp * src/mame/drivers/tranz330.cpp * src/mame/drivers/osboren1.cpp * src/mame/drivers/zorba.cpp * src/mame/devices/smioc.cpp * src/devices/bus/a2bus/pc_xporter.cpp * src/devices/bus/isa/isa.h * src/devices/bus/isa/isa.h * src/devices/bus/intellec4/intellec4.h
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/devcb.h42
-rw-r--r--src/emu/devcpu.h22
-rw-r--r--src/emu/devfind.h11
-rw-r--r--src/emu/device.h5
-rw-r--r--src/emu/digfx.h2
-rw-r--r--src/emu/dislot.cpp5
-rw-r--r--src/emu/dislot.h12
-rw-r--r--src/emu/disound.h12
-rw-r--r--src/emu/drawgfx.h4
-rw-r--r--src/emu/drivers/testcpu.cpp4
-rw-r--r--src/emu/mconfig.cpp4
-rw-r--r--src/emu/softlist_dev.h6
-rw-r--r--src/emu/speaker.h11
-rw-r--r--src/emu/tilemap.h4
14 files changed, 57 insertions, 87 deletions
diff --git a/src/emu/devcb.h b/src/emu/devcb.h
index 2fd6e53ae19..120a5c47163 100644
--- a/src/emu/devcb.h
+++ b/src/emu/devcb.h
@@ -105,33 +105,19 @@ template <typename DescType> struct devcb_line_desc_creator
// MACROS
//**************************************************************************
-// wrappers for read callbacks into the owner device
-#define DEVCB_READLINE(_class, _func) (emu::detail::devcb_delegate_initialiser<read_line_delegate>(DEVICE_SELF, read_line_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-#define DEVCB_READ8(_class, _func) (emu::detail::devcb_delegate_initialiser<read8_delegate>(DEVICE_SELF, read8_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-#define DEVCB_READ16(_class, _func) (emu::detail::devcb_delegate_initialiser<read16_delegate>(DEVICE_SELF, read16_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-#define DEVCB_READ32(_class, _func) (emu::detail::devcb_delegate_initialiser<read32_delegate>(DEVICE_SELF, read32_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-#define DEVCB_READ64(_class, _func) (emu::detail::devcb_delegate_initialiser<read64_delegate>(DEVICE_SELF, read64_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-
// wrappers for read callbacks into any tagged device
-#define DEVCB_DEVREADLINE(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read_line_delegate>((tag), read_line_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-#define DEVCB_DEVREAD8(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read8_delegate>((tag), read8_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-#define DEVCB_DEVREAD16(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read16_delegate>((tag), read16_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-#define DEVCB_DEVREAD32(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read32_delegate>((tag), read32_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-#define DEVCB_DEVREAD64(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read64_delegate>((tag), read64_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-
-// wrappers for write callbacks into the owner device
-#define DEVCB_WRITELINE(_class, _func) (emu::detail::devcb_delegate_initialiser<write_line_delegate>(DEVICE_SELF, write_line_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-#define DEVCB_WRITE8(_class, _func) (emu::detail::devcb_delegate_initialiser<write8_delegate>(DEVICE_SELF, write8_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-#define DEVCB_WRITE16(_class, _func) (emu::detail::devcb_delegate_initialiser<write16_delegate>(DEVICE_SELF, write16_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-#define DEVCB_WRITE32(_class, _func) (emu::detail::devcb_delegate_initialiser<write32_delegate>(DEVICE_SELF, write32_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
-#define DEVCB_WRITE64(_class, _func) (emu::detail::devcb_delegate_initialiser<write64_delegate>(DEVICE_SELF, write64_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)nullptr)))
+#define DEVCB_READLINE(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read_line_delegate>((tag), read_line_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_READ8(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read8_delegate>((tag), read8_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_READ16(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read16_delegate>((tag), read16_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_READ32(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read32_delegate>((tag), read32_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_READ64(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<read64_delegate>((tag), read64_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
// wrappers for write callbacks into any tagged device
-#define DEVCB_DEVWRITELINE(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write_line_delegate>((tag), write_line_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-#define DEVCB_DEVWRITE8(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write8_delegate>((tag), write8_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-#define DEVCB_DEVWRITE16(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write16_delegate>((tag), write16_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-#define DEVCB_DEVWRITE32(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write32_delegate>((tag), write32_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
-#define DEVCB_DEVWRITE64(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write64_delegate>((tag), write64_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_WRITELINE(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write_line_delegate>((tag), write_line_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_WRITE8(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write8_delegate>((tag), write8_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_WRITE16(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write16_delegate>((tag), write16_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_WRITE32(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write32_delegate>((tag), write32_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
+#define DEVCB_WRITE64(tag, _class, _func) (emu::detail::devcb_delegate_initialiser<write64_delegate>((tag), write64_delegate(&_class::_func, #_class "::" #_func, emu::detail::devcb_delegate_get_tag(tag), (_class *)nullptr)))
// machine config helpers to add shift, mask, or address space configuration
#define MCFG_DEVCB_RSHIFT(_shift) devcb->set_rshift(_shift);
@@ -335,13 +321,14 @@ public:
// callback configuration
using devcb_base::set_callback;
template <typename Delegate>
- std::enable_if_t<set_helper<Delegate, void>::valid, devcb_base &> set_callback(emu::detail::devcb_delegate_initialiser<Delegate> &&desc)
+ std::enable_if_t<set_helper<Delegate, void>::valid, devcb_read_base &> set_callback(emu::detail::devcb_delegate_initialiser<Delegate> &&desc)
{
if (desc.m_base) reset(*desc.m_base, set_helper<Delegate, void>::type);
else reset(set_helper<Delegate, void>::type);
set_helper<Delegate, void>::apply(*this, std::move(desc.m_delegate));
return *this;
}
+ template <typename... Params> auto &chain(Params &&... args) { return chain_alloc().set_callback(std::forward<Params>(args)...); }
devcb_read_base &chain_alloc();
// resolution
@@ -429,14 +416,14 @@ public:
// callback configuration
using devcb_base::set_callback;
template <typename Delegate>
- std::enable_if_t<set_helper<Delegate, void>::valid, devcb_base &> set_callback(emu::detail::devcb_delegate_initialiser<Delegate> &&desc)
+ std::enable_if_t<set_helper<Delegate, void>::valid, devcb_write_base &> set_callback(emu::detail::devcb_delegate_initialiser<Delegate> &&desc)
{
if (desc.m_base) reset(*desc.m_base, set_helper<Delegate, void>::type);
else reset(set_helper<Delegate, void>::type);
set_helper<Delegate, void>::apply(*this, std::move(desc.m_delegate));
return *this;
}
- template <callback_type Type> devcb_base &set_callback(line_desc<Type> desc)
+ template <callback_type Type> devcb_write_base &set_callback(line_desc<Type> desc)
{
if (desc.m_base) reset(*desc.m_base, Type);
else reset(Type);
@@ -444,6 +431,7 @@ public:
m_target_int = desc.m_inputnum;
return *this;
}
+ template <typename... Params> auto &chain(Params &&... args) { return chain_alloc().set_callback(std::forward<Params>(args)...); }
devcb_write_base &chain_alloc();
// resolution
diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h
index 8d73127e1f7..3e4dd89f8ce 100644
--- a/src/emu/devcpu.h
+++ b/src/emu/devcpu.h
@@ -20,28 +20,6 @@
// CPU DEVICE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_CPU_ADD MCFG_DEVICE_ADD
-#define MCFG_CPU_MODIFY MCFG_DEVICE_MODIFY
-#define MCFG_CPU_REPLACE MCFG_DEVICE_REPLACE
-
-#define MCFG_CPU_CLOCK MCFG_DEVICE_CLOCK
-
-#define MCFG_CPU_PROGRAM_MAP MCFG_DEVICE_PROGRAM_MAP
-#define MCFG_CPU_DATA_MAP MCFG_DEVICE_DATA_MAP
-#define MCFG_CPU_IO_MAP MCFG_DEVICE_IO_MAP
-#define MCFG_CPU_OPCODES_MAP MCFG_DEVICE_OPCODES_MAP
-
-#define MCFG_CPU_VBLANK_INT_DRIVER MCFG_DEVICE_VBLANK_INT_DRIVER
-#define MCFG_CPU_PERIODIC_INT_DRIVER MCFG_DEVICE_PERIODIC_INT_DRIVER
-#define MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER
-#define MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE
-
-#define MCFG_CPU_VBLANK_INT_REMOVE MCFG_DEVICE_VBLANK_INT_REMOVE
-#define MCFG_CPU_PERIODIC_INT_REMOVE MCFG_DEVICE_PERIODIC_INT_REMOVE
-#define MCFG_CPU_IRQ_ACKNOWLEDGE_REMOVE MCFG_DEVICE_IRQ_ACKNOWLEDGE_REMOVE
-
-#define MCFG_CPU_DISASSEMBLE_OVERRIDE MCFG_DEVICE_DISASSEMBLE_OVERRIDE
-
// recompilation parameters
#define MCFG_CPU_FORCE_NO_DRC() \
dynamic_cast<cpu_device &>(*device).set_force_no_drc(true);
diff --git a/src/emu/devfind.h b/src/emu/devfind.h
index 9bd5ad48fde..b844eda145f 100644
--- a/src/emu/devfind.h
+++ b/src/emu/devfind.h
@@ -300,6 +300,17 @@ public:
/// until resolution time.
void set_tag(char const *tag);
+ /// \brief Set search tag
+ ///
+ /// Allows search tag to be changed after construction. Note that
+ /// this must be done before resolution time to take effect.
+ /// \param [in] finder Object finder to take the search base and tag
+ /// from.
+ void set_tag(finder_base const &finder)
+ {
+ std::tie(m_base, m_tag) = finder.finder_target();
+ }
+
/// \brief Is the object to be resolved before memory maps?
///
/// Some objects must be resolved before memory maps are loaded
diff --git a/src/emu/device.h b/src/emu/device.h
index cc8b5209945..a7b9d8707e3 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -261,10 +261,6 @@ public:
device_feature::type unemulated_features() const { return m_unemulated_features; }
device_feature::type imperfect_features() const { return m_imperfect_features; }
- std::unique_ptr<device_t> operator()(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) const
- {
- return m_creator(*this, mconfig, tag, owner, clock);
- }
std::unique_ptr<device_t> create(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) const
{
return m_creator(*this, mconfig, tag, owner, clock);
@@ -284,7 +280,6 @@ public:
using device_type_impl_base::device_type_impl_base;
using device_type_impl_base::create;
- using device_type_impl_base::operator();
template <typename... Params>
std::unique_ptr<DeviceClass> create(machine_config &mconfig, char const *tag, device_t *owner, Params &&... args) const
diff --git a/src/emu/digfx.h b/src/emu/digfx.h
index 8c4ebdb5fbe..f63231c7ad8 100644
--- a/src/emu/digfx.h
+++ b/src/emu/digfx.h
@@ -140,7 +140,7 @@ const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, {
//**************************************************************************
#define MCFG_GFXDECODE_ADD(_tag, _palette_tag, _info) \
- MCFG_DEVICE_ADD(_tag, GFXDECODE, 0) \
+ MCFG_DEVICE_ADD(_tag, GFXDECODE) \
MCFG_GFX_PALETTE(_palette_tag) \
MCFG_GFX_INFO(_info)
diff --git a/src/emu/dislot.cpp b/src/emu/dislot.cpp
index 37acf1dfddd..5086a658ab8 100644
--- a/src/emu/dislot.cpp
+++ b/src/emu/dislot.cpp
@@ -17,6 +17,7 @@
device_slot_interface::device_slot_interface(const machine_config &mconfig, device_t &device) :
device_interface(device, "slot"),
+ m_default_clock(0), // FIXME: zero to preserve behaviour - should probably be DERIVED_CLOCK(1, 1)
m_default_option(nullptr),
m_fixed(false),
m_card_device(nullptr)
@@ -62,7 +63,7 @@ device_slot_interface::slot_option &device_slot_interface::option_add(const char
if (m_options.count(name))
throw tag_add_exception(name);
- return *m_options.emplace(name, std::make_unique<slot_option>(name, devtype, true)).first->second;
+ return m_options.emplace(name, std::make_unique<slot_option>(name, devtype, true)).first->second->clock(m_default_clock);
}
@@ -79,7 +80,7 @@ device_slot_interface::slot_option &device_slot_interface::option_add_internal(c
if (m_options.count(name))
throw tag_add_exception(name);
- return *m_options.emplace(name, std::make_unique<slot_option>(name, devtype, false)).first->second;
+ return m_options.emplace(name, std::make_unique<slot_option>(name, devtype, false)).first->second->clock(m_default_clock);
}
diff --git a/src/emu/dislot.h b/src/emu/dislot.h
index be10da760cd..154e7452b10 100644
--- a/src/emu/dislot.h
+++ b/src/emu/dislot.h
@@ -110,8 +110,6 @@ public:
std::function<void (device_t *)> m_machine_config;
input_device_default const *m_input_device_defaults;
u32 m_clock;
-
- friend class device_slot_interface;
};
// construction/destruction
@@ -123,9 +121,9 @@ public:
void option_reset() { m_options.clear(); }
slot_option &option_add(const char *option, const device_type &devtype);
slot_option &option_add_internal(const char *option, const device_type &devtype);
- void set_option_default_bios(const char *option, const char *default_bios) { config_option(option)->m_default_bios = default_bios; }
- void set_option_machine_config(const char *option, std::function<void (device_t *)> machine_config) { config_option(option)->m_machine_config = machine_config; }
- void set_option_device_input_defaults(const char *option, const input_device_default *default_input) { config_option(option)->m_input_device_defaults = default_input; }
+ void set_option_default_bios(const char *option, const char *default_bios) { config_option(option)->default_bios(default_bios); }
+ template <typename T> void set_option_machine_config(const char *option, T &&machine_config) { config_option(option)->machine_config(std::forward<T>(machine_config)); }
+ void set_option_device_input_defaults(const char *option, const input_device_default *default_input) { config_option(option)->input_device_defaults(default_input); }
bool fixed() const { return m_fixed; }
bool has_selectable_options() const;
const char *default_option() const { return m_default_option; }
@@ -136,9 +134,13 @@ public:
void set_card_device(device_t *dev) { m_card_device = dev; }
const char *slot_name() const { return device().tag() + 1; }
+protected:
+ void set_default_clock(u32 clock) { m_default_clock = clock; }
+
private:
// internal state
std::unordered_map<std::string,std::unique_ptr<slot_option>> m_options;
+ u32 m_default_clock;
const char *m_default_option;
bool m_fixed;
device_t *m_card_device;
diff --git a/src/emu/disound.h b/src/emu/disound.h
index 05bba47f5b1..baa74321204 100644
--- a/src/emu/disound.h
+++ b/src/emu/disound.h
@@ -33,19 +33,9 @@ constexpr int AUTO_ALLOC_INPUT = 65535;
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_SOUND_ADD(_tag, _type, _clock) \
- MCFG_DEVICE_ADD(_tag, _type, _clock)
-#define MCFG_SOUND_MODIFY(_tag) \
- MCFG_DEVICE_MODIFY(_tag)
-
-#define MCFG_SOUND_CLOCK(_clock) \
- MCFG_DEVICE_CLOCK(_clock)
-
-#define MCFG_SOUND_REPLACE(_tag, _type, _clock) \
- MCFG_DEVICE_REPLACE(_tag, _type, _clock)
-
#define MCFG_SOUND_ROUTE(_output, _target, ...) \
dynamic_cast<device_sound_interface &>(*device).add_route(_output, _target, __VA_ARGS__);
+
#define MCFG_SOUND_ROUTES_RESET() \
dynamic_cast<device_sound_interface &>(*device).reset_routes();
diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h
index 9827c96900a..43e0b85472f 100644
--- a/src/emu/drawgfx.h
+++ b/src/emu/drawgfx.h
@@ -455,10 +455,10 @@ class gfxdecode_device : public device_t, public device_gfx_interface
{
public:
// construction/destruction
- gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
protected:
- virtual void device_start() override {};
+ virtual void device_start() override {}
};
GFXDECODE_EXTERN(empty);
diff --git a/src/emu/drivers/testcpu.cpp b/src/emu/drivers/testcpu.cpp
index b622528d02e..802c4f56b75 100644
--- a/src/emu/drivers/testcpu.cpp
+++ b/src/emu/drivers/testcpu.cpp
@@ -193,9 +193,9 @@ void testcpu_state::ppc_mem(address_map &map)
MACHINE_CONFIG_START(testcpu_state::testcpu)
// CPUs
- MCFG_CPU_ADD("maincpu", PPC603E, 66000000)
+ MCFG_DEVICE_ADD("maincpu", PPC603E, 66000000)
MCFG_PPC_BUS_FREQUENCY(66000000) // Multiplier 1, Bus = 66MHz, Core = 66MHz
- MCFG_CPU_PROGRAM_MAP(ppc_mem)
+ MCFG_DEVICE_PROGRAM_MAP(ppc_mem)
MACHINE_CONFIG_END
diff --git a/src/emu/mconfig.cpp b/src/emu/mconfig.cpp
index 546ce1c885f..7f142ab5958 100644
--- a/src/emu/mconfig.cpp
+++ b/src/emu/mconfig.cpp
@@ -187,7 +187,7 @@ device_t *machine_config::add_device(std::unique_ptr<device_t> &&device, device_
device_t *machine_config::device_add(const char *tag, device_type type, u32 clock)
{
std::pair<const char *, device_t *> const owner(resolve_owner(tag));
- return add_device(type(*this, owner.first, owner.second, clock), owner.second);
+ return add_device(type.create(*this, owner.first, owner.second, clock), owner.second);
}
@@ -216,7 +216,7 @@ device_t *machine_config::device_replace(const char *tag, device_type type, u32
remove_references(*old_device);
// allocate the new device and substitute it for the old one in the owner's list
- device_t *const new_device = &owner->subdevices().m_list.replace_and_remove(*type(*this, tag, owner, clock).release(), *old_device);
+ device_t *const new_device = &owner->subdevices().m_list.replace_and_remove(*type.create(*this, tag, owner, clock).release(), *old_device);
current_device_stack context(*this);
new_device->add_machine_configuration(*this);
return new_device;
diff --git a/src/emu/softlist_dev.h b/src/emu/softlist_dev.h
index 7f6649e1fb7..7921d751348 100644
--- a/src/emu/softlist_dev.h
+++ b/src/emu/softlist_dev.h
@@ -47,11 +47,11 @@ enum software_compatibility
downcast<software_list_device &>(*device).set_type(_list, _list_type);
#define MCFG_SOFTWARE_LIST_ADD( _tag, _list ) \
- MCFG_DEVICE_ADD( _tag, SOFTWARE_LIST, 0 ) \
+ MCFG_DEVICE_ADD( _tag, SOFTWARE_LIST ) \
MCFG_SOFTWARE_LIST_CONFIG(_list, SOFTWARE_LIST_ORIGINAL_SYSTEM)
#define MCFG_SOFTWARE_LIST_COMPATIBLE_ADD( _tag, _list ) \
- MCFG_DEVICE_ADD( _tag, SOFTWARE_LIST, 0 ) \
+ MCFG_DEVICE_ADD( _tag, SOFTWARE_LIST ) \
MCFG_SOFTWARE_LIST_CONFIG(_list, SOFTWARE_LIST_COMPATIBLE_SYSTEM)
#define MCFG_SOFTWARE_LIST_MODIFY( _tag, _list ) \
@@ -132,7 +132,7 @@ class software_list_device : public device_t
public:
// construction/destruction
- software_list_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ software_list_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
// inline configuration helpers
void set_type(const char *list, softlist_type list_type) { m_list_name.assign(list); m_list_type = list_type; }
diff --git a/src/emu/speaker.h b/src/emu/speaker.h
index 2280b883250..8d41342e01f 100644
--- a/src/emu/speaker.h
+++ b/src/emu/speaker.h
@@ -28,8 +28,8 @@ DECLARE_DEVICE_TYPE(SPEAKER, speaker_device)
// add/remove speakers
#define MCFG_SPEAKER_ADD(_tag, _x, _y, _z) \
- MCFG_DEVICE_ADD(_tag, SPEAKER, 0) \
- downcast<speaker_device &>(*device).set_position(_x, _y, _z);
+ MCFG_DEVICE_ADD(_tag, SPEAKER, _x, _y, _z)
+
#define MCFG_SPEAKER_STANDARD_MONO(_tag) \
MCFG_SPEAKER_ADD(_tag, 0.0, 0.0, 1.0)
@@ -49,7 +49,12 @@ class speaker_device : public device_t, public device_mixer_interface
{
public:
// construction/destruction
- speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, double x, double y, double z)
+ : speaker_device(mconfig, tag, owner, 0)
+ {
+ set_position(x, y, z);
+ }
+ speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
virtual ~speaker_device();
// inline configuration helpers
diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h
index c37cdd66be0..119319d32af 100644
--- a/src/emu/tilemap.h
+++ b/src/emu/tilemap.h
@@ -368,7 +368,7 @@ enum tilemap_standard_mapper
// primitives
#define MCFG_TILEMAP_ADD(_tag) \
- MCFG_DEVICE_ADD(_tag, TILEMAP, 0)
+ MCFG_DEVICE_ADD(_tag, TILEMAP)
#define MCFG_TILEMAP_GFXDECODE(_gfxtag) \
downcast<tilemap_device &>(*device).set_gfxdecode_tag(_gfxtag);
#define MCFG_TILEMAP_BYTES_PER_ENTRY(_bpe) \
@@ -718,7 +718,7 @@ class tilemap_device : public device_t,
{
public:
// construction/destruction
- tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
// configuration
void set_gfxdecode_tag(const char *tag) { m_gfxdecode.set_tag(tag); }