summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/device.h
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2012-05-03 09:00:08 +0000
committer Aaron Giles <aaron@aarongiles.com>2012-05-03 09:00:08 +0000
commit2a88e54278acc526c11dba7961204f234f1f6e05 (patch)
tree1d78e932e47bb535e7e56ddac05232cdf551c3a1 /src/emu/device.h
parent605a48921b48e0127ff0330f1e895dcf16d084fb (diff)
ioport.c C++ conversion. Mostly internal changes, with no
intended differences from previous behavior. For drivers, the main change is that input_port_read() no longer exists. Instead, the port must be fetched from the appropriate device, and then read() is called. For member functions, this is actually simpler/cleaner: value = ioport("tag")->read() For legacy functions which have a driver_data state, it goes: value = state->ioport("tag")->read() For other legacy functions, they need to fetch the root device: value = machine.root_device().ioport("tag")->read() The other big change for drivers is that IPT_VBLANK is gone. Instead, it has been replaced by a device line callback on the screen device. There's a new macro PORT_VBLANK("tag") which automatically points things to the right spot. Here's a set of imperfect search & replace strings to convert the input_port_read calls and fix up IPT_VBLANK: input_port_read( *\( *)(machine\(\)) *, *([^)]+ *\)) ioport\1\3->read\(\) input_port_read( *\( *)(.*machine[()]*) *, *([^)]+ *\)) \2\.root_device\(\)\.ioport\1\3->read\(\) (state = .*driver_data[^}]+)space->machine\(\)\.root_device\(\)\. \1state-> (state = .*driver_data[^}]+)device->machine\(\)\.root_device\(\)\. \1state-> input_port_read_safe( *\( *)(machine\(\)) *, *([^,]+), *([^)]+\)) ioport\1\3->read_safe\(\4\) IPT_VBLANK( *\)) IPT_CUSTOM\1 PORT_VBLANK("screen")
Diffstat (limited to 'src/emu/device.h')
-rw-r--r--src/emu/device.h38
1 files changed, 4 insertions, 34 deletions
diff --git a/src/emu/device.h b/src/emu/device.h
index 2ca4343b989..a1a4cafec77 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -95,7 +95,7 @@ class validity_checker;
struct rom_entry;
class machine_config;
class emu_timer;
-typedef struct _input_device_default input_device_default;
+struct input_device_default;
@@ -188,7 +188,7 @@ public:
memory_region *memregion(const char *tag) const;
memory_share *memshare(const char *tag) const;
memory_bank *membank(const char *tag) const;
- input_port_config *ioport(const char *tag) const;
+ ioport_port *ioport(const char *tag) const;
device_t *subdevice(const char *tag) const;
device_t *siblingdevice(const char *tag) const;
template<class _DeviceClass> inline _DeviceClass *subdevice(const char *tag) const { return downcast<_DeviceClass *>(subdevice(tag)); }
@@ -506,12 +506,12 @@ public:
// device finder template
template<bool _Required>
-class device_t::ioport_finder : public device_t::object_finder_base<input_port_config>
+class device_t::ioport_finder : public device_t::object_finder_base<ioport_port>
{
public:
// construction/destruction
ioport_finder(device_t &base, const char *tag)
- : object_finder_base<input_port_config>(base, tag) { }
+ : object_finder_base<ioport_port>(base, tag) { }
// finder
virtual bool findit()
@@ -927,36 +927,6 @@ private:
};
-// ======================> device_delegate
-
-// device_delegate is a delegate that wraps with a device tag and can be easily
-// late bound without replicating logic everywhere
-template<typename _Signature>
-class device_delegate : public delegate<_Signature>
-{
- typedef delegate<_Signature> basetype;
-
-public:
- // provide same set of constructors as the base class, with additional device name
- // parameter
- device_delegate() : basetype(), m_device_name(NULL) { }
- device_delegate(const basetype &src) : basetype(src), m_device_name(src.m_device_name) { }
- device_delegate(const basetype &src, delegate_late_bind &object) : basetype(src, object), m_device_name(src.m_device_name) { }
- template<class _FunctionClass> device_delegate(typename basetype::template traits<_FunctionClass>::member_func_type funcptr, const char *name, const char *devname) : basetype(funcptr, name, (_FunctionClass *)0), m_device_name(devname) { }
- template<class _FunctionClass> device_delegate(typename basetype::template traits<_FunctionClass>::member_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)0), m_device_name(devname) { }
- device_delegate(typename basetype::template traits<device_t>::static_func_type funcptr, const char *name) : basetype(funcptr, name, (device_t *)0), m_device_name(NULL) { }
- device_delegate(typename basetype::template traits<device_t>::static_ref_func_type funcptr, const char *name) : basetype(funcptr, name, (device_t *)0), m_device_name(NULL) { }
- device_delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; m_device_name = src.m_device_name; return *this; }
-
- // perform the binding
- void bind_relative_to(device_t &search_root);
-
-private:
- // internal state
- const char *m_device_name;
-};
-
-
//**************************************************************************
// INLINE FUNCTIONS