summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/vcs_ctrl
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-05-07 23:18:47 +1000
committer Vas Crabb <vas@vastheman.com>2017-05-14 21:44:11 +1000
commit0f0d39ef81562c75e79176dd3bebb1e491ca39d5 (patch)
tree201cee7fdf55ee800f83859a92efd2cfe66cf2b3 /src/devices/bus/vcs_ctrl
parente6c4be2b4d71c7a6c95be0bae111eb416ff0f9e7 (diff)
Move static data out of devices into the device types. This is a significant change, so please pay attention.
The core changes are: * Short name, full name and source file are no longer members of device_t, they are part of the device type * MACHINE_COFIG_START no longer needs a driver class * MACHINE_CONFIG_DERIVED_CLASS is no longer necessary * Specify the state class you want in the GAME/COMP/CONS line * The compiler will work out the base class where the driver init member is declared * There is one static device type object per driver rather than one per machine configuration Use DECLARE_DEVICE_TYPE or DECLARE_DEVICE_TYPE_NS to declare device type. * DECLARE_DEVICE_TYPE forward-declares teh device type and class, and declares extern object finders. * DECLARE_DEVICE_TYPE_NS is for devices classes in namespaces - it doesn't forward-declare the device type. Use DEFINE_DEVICE_TYPE or DEFINE_DEVICE_TYPE_NS to define device types. * These macros declare storage for the static data, and instantiate the device type and device finder templates. The rest of the changes are mostly just moving stuff out of headers that shouldn't be there, renaming stuff for consistency, and scoping stuff down where appropriate. Things I've actually messed with substantially: * More descriptive names for a lot of devices * Untangled the fantasy sound from the driver state, which necessitates breaking up sound/flip writes * Changed DECO BSMT2000 ready callback into a device delegate * Untangled Microprose 3D noise from driver state * Used object finders for CoCo multipak, KC85 D002, and Irem sound subdevices * Started to get TI-99 stuff out of the TI-990 directory and arrange bus devices properly * Started to break out common parts of Samsung ARM SoC devices * Turned some of FM, SID, SCSP DSP, EPIC12 and Voodoo cores into something resmbling C++ * Tried to make Z180 table allocation/setup a bit safer * Converted generic keyboard/terminal to not use WRITE8 - space/offset aren't relevant * Dynamically allocate generic terminal buffer so derived devices (e.g. teleprinter) can specify size * Imporved encapsulation of Z80DART channels * Refactored the SPC7110 bit table generator loop to make it more readable * Added wrappers for SNES PPU operations so members can be made protected * Factored out some boilerplate for YM chips with PSG * toaplan2 gfx * stic/intv resolution * Video System video * Out Run/Y-board sprite alignment * GIC video hookup * Amstrad CPC ROM box members * IQ151 ROM cart region * MSX cart IRQ callback resolution time * SMS passthrough control devices starting subslots I've smoke-tested several drivers, but I've probably missed something. Things I've missed will likely blow up spectacularly with failure to bind errors and the like. Let me know if there's more subtle breakage (could have happened in FM or Voodoo). And can everyone please, please try to keep stuff clean. In particular, please stop polluting the global namespace. Keep things out of headers that don't need to be there, and use things that can be scoped down rather than macros. It feels like an uphill battle trying to get this stuff under control while more of it's added.
Diffstat (limited to 'src/devices/bus/vcs_ctrl')
-rw-r--r--src/devices/bus/vcs_ctrl/ctrl.cpp4
-rw-r--r--src/devices/bus/vcs_ctrl/ctrl.h15
-rw-r--r--src/devices/bus/vcs_ctrl/joybooster.cpp4
-rw-r--r--src/devices/bus/vcs_ctrl/joybooster.h11
-rw-r--r--src/devices/bus/vcs_ctrl/joystick.cpp4
-rw-r--r--src/devices/bus/vcs_ctrl/joystick.h10
-rw-r--r--src/devices/bus/vcs_ctrl/keypad.cpp7
-rw-r--r--src/devices/bus/vcs_ctrl/keypad.h11
-rw-r--r--src/devices/bus/vcs_ctrl/lightpen.cpp4
-rw-r--r--src/devices/bus/vcs_ctrl/lightpen.h11
-rw-r--r--src/devices/bus/vcs_ctrl/paddles.cpp4
-rw-r--r--src/devices/bus/vcs_ctrl/paddles.h11
-rw-r--r--src/devices/bus/vcs_ctrl/wheel.cpp4
-rw-r--r--src/devices/bus/vcs_ctrl/wheel.h11
14 files changed, 52 insertions, 59 deletions
diff --git a/src/devices/bus/vcs_ctrl/ctrl.cpp b/src/devices/bus/vcs_ctrl/ctrl.cpp
index f68088de7bf..f25ef4f6545 100644
--- a/src/devices/bus/vcs_ctrl/ctrl.cpp
+++ b/src/devices/bus/vcs_ctrl/ctrl.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITION
//**************************************************************************
-const device_type VCS_CONTROL_PORT = device_creator<vcs_control_port_device>;
+DEFINE_DEVICE_TYPE(VCS_CONTROL_PORT, vcs_control_port_device, "vcs_control_port", "Atari VCS controller port")
@@ -44,7 +44,7 @@ device_vcs_control_port_interface::device_vcs_control_port_interface(const machi
//-------------------------------------------------
vcs_control_port_device::vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, VCS_CONTROL_PORT, "Atari VCS control port", tag, owner, clock, "vcs_control_port", __FILE__),
+ device_t(mconfig, VCS_CONTROL_PORT, tag, owner, clock),
device_slot_interface(mconfig, *this), m_device(nullptr),
m_write_trigger(*this)
{
diff --git a/src/devices/bus/vcs_ctrl/ctrl.h b/src/devices/bus/vcs_ctrl/ctrl.h
index 4d0de4e3972..bc018839989 100644
--- a/src/devices/bus/vcs_ctrl/ctrl.h
+++ b/src/devices/bus/vcs_ctrl/ctrl.h
@@ -9,10 +9,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_CVS_CTRL_CTRL_H
+#define MAME_BUS_CVS_CTRL_CTRL_H
-#ifndef __VCS_CONTROL_PORT__
-#define __VCS_CONTROL_PORT__
+#pragma once
@@ -68,10 +68,9 @@ class vcs_control_port_device : public device_t,
public:
// construction/destruction
vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual ~vcs_control_port_device() { }
// static configuration helpers
- template<class _Object> static devcb_base &set_trigger_wr_callback(device_t &device, _Object object) { return downcast<vcs_control_port_device &>(device).m_write_trigger.set_callback(object); }
+ template <class Object> static devcb_base &set_trigger_wr_callback(device_t &device, Object &&cb) { return downcast<vcs_control_port_device &>(device).m_write_trigger.set_callback(std::forward<Object>(cb)); }
// computer interface
@@ -113,10 +112,8 @@ private:
// device type definition
-extern const device_type VCS_CONTROL_PORT;
+DECLARE_DEVICE_TYPE(VCS_CONTROL_PORT, vcs_control_port_device)
SLOT_INTERFACE_EXTERN( vcs_control_port_devices );
-
-
-#endif
+#endif // MAME_BUS_CVS_CTRL_CTRL_H
diff --git a/src/devices/bus/vcs_ctrl/joybooster.cpp b/src/devices/bus/vcs_ctrl/joybooster.cpp
index 8a731cc0ef1..9ea3b813ac1 100644
--- a/src/devices/bus/vcs_ctrl/joybooster.cpp
+++ b/src/devices/bus/vcs_ctrl/joybooster.cpp
@@ -16,7 +16,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type VCS_JOYSTICK_BOOSTER = device_creator<vcs_joystick_booster_device>;
+DEFINE_DEVICE_TYPE(VCS_JOYSTICK_BOOSTER, vcs_joystick_booster_device, "vcs_joystick_booster", "Atari / CBM Digital joystick with Boostergrip")
static INPUT_PORTS_START( vcs_joystick_booster )
@@ -58,7 +58,7 @@ ioport_constructor vcs_joystick_booster_device::device_input_ports() const
//-------------------------------------------------
vcs_joystick_booster_device::vcs_joystick_booster_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, VCS_JOYSTICK_BOOSTER, "Atari / CBM Digital joystick with Boostergrip", tag, owner, clock, "vcs_joystick_booster", __FILE__),
+ device_t(mconfig, VCS_JOYSTICK_BOOSTER, tag, owner, clock),
device_vcs_control_port_interface(mconfig, *this),
m_joy(*this, "JOY"),
m_potx(*this, "POTX"),
diff --git a/src/devices/bus/vcs_ctrl/joybooster.h b/src/devices/bus/vcs_ctrl/joybooster.h
index bc5ecbda1c2..8b3cf922a1b 100644
--- a/src/devices/bus/vcs_ctrl/joybooster.h
+++ b/src/devices/bus/vcs_ctrl/joybooster.h
@@ -7,10 +7,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_VCS_CTRL_JOYBOOSTER_H
+#define MAME_BUS_VCS_CTRL_JOYBOOSTER_H
-#ifndef __VCS_JOYSTICKBOOSTER__
-#define __VCS_JOYSTICKBOOSTER__
+#pragma once
#include "ctrl.h"
@@ -52,7 +52,6 @@ private:
// device type definition
-extern const device_type VCS_JOYSTICK_BOOSTER;
-
+DECLARE_DEVICE_TYPE(VCS_JOYSTICK_BOOSTER, vcs_joystick_booster_device)
-#endif
+#endif // MAME_BUS_VCS_CTRL_JOYBOOSTER_H
diff --git a/src/devices/bus/vcs_ctrl/joystick.cpp b/src/devices/bus/vcs_ctrl/joystick.cpp
index 87ae2f72aa6..c911f435a0c 100644
--- a/src/devices/bus/vcs_ctrl/joystick.cpp
+++ b/src/devices/bus/vcs_ctrl/joystick.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type VCS_JOYSTICK = device_creator<vcs_joystick_device>;
+DEFINE_DEVICE_TYPE(VCS_JOYSTICK, vcs_joystick_device, "vcs_joystick", "Atari / CBM Digital joystick")
static INPUT_PORTS_START( vcs_joystick )
@@ -49,7 +49,7 @@ ioport_constructor vcs_joystick_device::device_input_ports() const
//-------------------------------------------------
vcs_joystick_device::vcs_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, VCS_JOYSTICK, "Atari / CBM Digital joystick", tag, owner, clock, "vcs_joystick", __FILE__),
+ device_t(mconfig, VCS_JOYSTICK, tag, owner, clock),
device_vcs_control_port_interface(mconfig, *this),
m_joy(*this, "JOY")
{
diff --git a/src/devices/bus/vcs_ctrl/joystick.h b/src/devices/bus/vcs_ctrl/joystick.h
index 1f7663cd3b5..dcae27d2965 100644
--- a/src/devices/bus/vcs_ctrl/joystick.h
+++ b/src/devices/bus/vcs_ctrl/joystick.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_VCS_CTRL_JOYSTICK_H
+#define MAME_BUS_VCS_CTRL_JOYSTICK_H
-#ifndef __VCS_JOYSTICK__
-#define __VCS_JOYSTICK__
+#pragma once
#include "ctrl.h"
@@ -44,7 +44,7 @@ private:
// device type definition
-extern const device_type VCS_JOYSTICK;
+DECLARE_DEVICE_TYPE(VCS_JOYSTICK, vcs_joystick_device)
-#endif
+#endif // MAME_BUS_VCS_CTRL_JOYSTICK_H
diff --git a/src/devices/bus/vcs_ctrl/keypad.cpp b/src/devices/bus/vcs_ctrl/keypad.cpp
index 7c8b0f0104a..97a43253c08 100644
--- a/src/devices/bus/vcs_ctrl/keypad.cpp
+++ b/src/devices/bus/vcs_ctrl/keypad.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type VCS_KEYPAD = device_creator<vcs_keypad_device>;
+DEFINE_DEVICE_TYPE(VCS_KEYPAD, vcs_keypad_device, "vcs_keypad", "Atari / CBM Keypad")
static INPUT_PORTS_START( vcs_keypad )
@@ -55,9 +55,10 @@ ioport_constructor vcs_keypad_device::device_input_ports() const
//-------------------------------------------------
vcs_keypad_device::vcs_keypad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, VCS_KEYPAD, "Atari / CBM Keypad", tag, owner, clock, "vcs_keypad", __FILE__),
+ device_t(mconfig, VCS_KEYPAD, tag, owner, clock),
device_vcs_control_port_interface(mconfig, *this),
- m_keypad(*this, "KEYPAD"), m_column(0)
+ m_keypad(*this, "KEYPAD"),
+ m_column(0)
{
}
diff --git a/src/devices/bus/vcs_ctrl/keypad.h b/src/devices/bus/vcs_ctrl/keypad.h
index 71ad42999cc..37733cc135c 100644
--- a/src/devices/bus/vcs_ctrl/keypad.h
+++ b/src/devices/bus/vcs_ctrl/keypad.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_VCS_CTRL_KEYPAD_H
+#define MAME_BUS_VCS_CTRL_KEYPAD_H
-#ifndef __VCS_KEYPAD__
-#define __VCS_KEYPAD__
+#pragma once
#include "ctrl.h"
@@ -52,7 +52,6 @@ private:
// device type definition
-extern const device_type VCS_KEYPAD;
-
+DECLARE_DEVICE_TYPE(VCS_KEYPAD, vcs_keypad_device)
-#endif
+#endif // MAME_BUS_VCS_CTRL_KEYPAD_H
diff --git a/src/devices/bus/vcs_ctrl/lightpen.cpp b/src/devices/bus/vcs_ctrl/lightpen.cpp
index fe129a9fe5c..6f67d4bd901 100644
--- a/src/devices/bus/vcs_ctrl/lightpen.cpp
+++ b/src/devices/bus/vcs_ctrl/lightpen.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type VCS_LIGHTPEN = device_creator<vcs_lightpen_device>;
+DEFINE_DEVICE_TYPE(VCS_LIGHTPEN, vcs_lightpen_device, "vcs_lightpen", "Atari / CBM Light Pen")
INPUT_CHANGED_MEMBER( vcs_lightpen_device::trigger )
@@ -58,7 +58,7 @@ ioport_constructor vcs_lightpen_device::device_input_ports() const
//-------------------------------------------------
vcs_lightpen_device::vcs_lightpen_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, VCS_LIGHTPEN, "Atari / CBM Light Pen", tag, owner, clock, "vcs_lightpen", __FILE__),
+ device_t(mconfig, VCS_LIGHTPEN, tag, owner, clock),
device_vcs_control_port_interface(mconfig, *this),
m_joy(*this, "JOY"),
m_lightx(*this, "LIGHTX"),
diff --git a/src/devices/bus/vcs_ctrl/lightpen.h b/src/devices/bus/vcs_ctrl/lightpen.h
index 5c2a132ea4e..f0b2805bdd6 100644
--- a/src/devices/bus/vcs_ctrl/lightpen.h
+++ b/src/devices/bus/vcs_ctrl/lightpen.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_VCS_CTRL_LIGHTPEN_H
+#define MAME_BUS_VCS_CTRL_LIGHTPEN_H
-#ifndef __VCS_LIGHTPEN__
-#define __VCS_LIGHTPEN__
+#pragma once
#include "ctrl.h"
@@ -48,7 +48,6 @@ private:
// device type definition
-extern const device_type VCS_LIGHTPEN;
-
+DECLARE_DEVICE_TYPE(VCS_LIGHTPEN, vcs_lightpen_device)
-#endif
+#endif // MAME_BUS_VCS_CTRL_LIGHTPEN_H
diff --git a/src/devices/bus/vcs_ctrl/paddles.cpp b/src/devices/bus/vcs_ctrl/paddles.cpp
index 17ee8c854eb..09e7a0d26a5 100644
--- a/src/devices/bus/vcs_ctrl/paddles.cpp
+++ b/src/devices/bus/vcs_ctrl/paddles.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type VCS_PADDLES = device_creator<vcs_paddles_device>;
+DEFINE_DEVICE_TYPE(VCS_PADDLES, vcs_paddles_device, "vcs_paddles", "Atari / CBM Dual paddles")
static INPUT_PORTS_START( vcs_paddles )
@@ -52,7 +52,7 @@ ioport_constructor vcs_paddles_device::device_input_ports() const
//-------------------------------------------------
vcs_paddles_device::vcs_paddles_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, VCS_PADDLES, "Atari / CBM Digital paddles", tag, owner, clock, "vcs_paddles", __FILE__),
+ device_t(mconfig, VCS_PADDLES, tag, owner, clock),
device_vcs_control_port_interface(mconfig, *this),
m_joy(*this, "JOY"),
m_potx(*this, "POTX"),
diff --git a/src/devices/bus/vcs_ctrl/paddles.h b/src/devices/bus/vcs_ctrl/paddles.h
index c6b4b2db1ce..e88084066ee 100644
--- a/src/devices/bus/vcs_ctrl/paddles.h
+++ b/src/devices/bus/vcs_ctrl/paddles.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_VCS_CTRL_PADDLES_H
+#define MAME_BUS_VCS_CTRL_PADDLES_H
-#ifndef __VCS_PADDLES__
-#define __VCS_PADDLES__
+#pragma once
#include "ctrl.h"
@@ -51,7 +51,6 @@ private:
// device type definition
-extern const device_type VCS_PADDLES;
-
+DECLARE_DEVICE_TYPE(VCS_PADDLES, vcs_paddles_device)
-#endif
+#endif // MAME_BUS_VCS_CTRL_PADDLES_H
diff --git a/src/devices/bus/vcs_ctrl/wheel.cpp b/src/devices/bus/vcs_ctrl/wheel.cpp
index 2bff2cb5698..76e86530cf8 100644
--- a/src/devices/bus/vcs_ctrl/wheel.cpp
+++ b/src/devices/bus/vcs_ctrl/wheel.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type VCS_WHEEL = device_creator<vcs_wheel_device>;
+DEFINE_DEVICE_TYPE(VCS_WHEEL, vcs_wheel_device, "vcs_wheel", "Atari / CBM Driving Wheel")
static INPUT_PORTS_START( vcs_wheel )
@@ -48,7 +48,7 @@ ioport_constructor vcs_wheel_device::device_input_ports() const
//-------------------------------------------------
vcs_wheel_device::vcs_wheel_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, VCS_WHEEL, "Atari / CBM Driving Wheel", tag, owner, clock, "vcs_wheel", __FILE__),
+ device_t(mconfig, VCS_WHEEL, tag, owner, clock),
device_vcs_control_port_interface(mconfig, *this),
m_joy(*this, "JOY"),
m_wheel(*this, "WHEEL")
diff --git a/src/devices/bus/vcs_ctrl/wheel.h b/src/devices/bus/vcs_ctrl/wheel.h
index 91b0c836929..369afe7c614 100644
--- a/src/devices/bus/vcs_ctrl/wheel.h
+++ b/src/devices/bus/vcs_ctrl/wheel.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_VCS_CTRL_WHEEL_H
+#define MAME_BUS_VCS_CTRL_WHEEL_H
-#ifndef __VCS_WHEEL__
-#define __VCS_WHEEL__
+#pragma once
#include "ctrl.h"
@@ -45,7 +45,6 @@ private:
// device type definition
-extern const device_type VCS_WHEEL;
-
+DECLARE_DEVICE_TYPE(VCS_WHEEL, vcs_wheel_device)
-#endif
+#endif // MAME_BUS_VCS_CTRL_WHEEL_H