summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author MooglyGuy <MooglyGuy@users.noreply.github.com>2018-05-13 15:22:22 +0200
committer Olivier Galibert <galibert@pobox.com>2018-05-13 22:22:22 +0900
commit5cc2319a2e286735981cb62781e65169ff936a52 (patch)
tree9465116c1856e052635215df0b98e400cc8bd020 /src/emu
parent49803e7418beefbd912d0090884063422888891d (diff)
Removed DRIVER_INIT-related macros, made driver init entry in GAME/COMP/CONS explicit. (#3565)
* -Removed DRIVER_INIT macros in favor of explicitly-named member functions, nw * -Removed DRIVER_INIT_related macros. Made init_ prefix on driver initializers explicit. Renamed init_0 to empty_init. Fixed up GAME/COMP/CONS macro spacing. [Ryan Holtz] * Missed some files, nw * Fix compile, (nw)
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/driver.cpp29
-rw-r--r--src/emu/driver.h10
-rw-r--r--src/emu/drivers/empty.cpp2
-rw-r--r--src/emu/gamedrv.h16
4 files changed, 37 insertions, 20 deletions
diff --git a/src/emu/driver.cpp b/src/emu/driver.cpp
index 6481b2e98a1..415872d4989 100644
--- a/src/emu/driver.cpp
+++ b/src/emu/driver.cpp
@@ -22,10 +22,10 @@
//-------------------------------------------------
driver_device::driver_device(const machine_config &mconfig, device_type type, const char *tag)
- : device_t(mconfig, type, tag, nullptr, 0),
- m_system(nullptr),
- m_flip_screen_x(0),
- m_flip_screen_y(0)
+ : device_t(mconfig, type, tag, nullptr, 0)
+ , m_system(nullptr)
+ , m_flip_screen_x(0)
+ , m_flip_screen_y(0)
{
}
@@ -75,6 +75,27 @@ void driver_device::static_set_callback(device_t &device, callback_type type, dr
//-------------------------------------------------
+// empty_init - default implementation which
+// calls driver init
+//-------------------------------------------------
+
+void driver_device::empty_init()
+{
+ driver_init();
+}
+
+
+//-------------------------------------------------
+// driver_init - default implementation which
+// does nothing
+//-------------------------------------------------
+
+void driver_device::driver_init()
+{
+}
+
+
+//-------------------------------------------------
// driver_start - default implementation which
// does nothing
//-------------------------------------------------
diff --git a/src/emu/driver.h b/src/emu/driver.h
index d4216325ce7..5711012188e 100644
--- a/src/emu/driver.h
+++ b/src/emu/driver.h
@@ -121,8 +121,8 @@ public:
void set_game_driver(const game_driver &game);
static void static_set_callback(device_t &device, callback_type type, driver_callback_delegate callback);
- // dummy driver_init callbacks
- void init_0() { }
+ // dummy driver_init callback
+ void empty_init();
// memory helpers
address_space &generic_space() const { return machine().dummy_space(); }
@@ -161,6 +161,8 @@ public:
// generic input port helpers
DECLARE_CUSTOM_INPUT_MEMBER( custom_port_read );
+ virtual void driver_init();
+
protected:
// helpers called at startup
virtual void driver_start();
@@ -194,8 +196,8 @@ private:
void updateflip();
// internal state
- const game_driver * m_system; // pointer to the game driver
- driver_callback_delegate m_callbacks[CB_COUNT]; // start/reset callbacks
+ const game_driver *m_system; // pointer to the game driver
+ driver_callback_delegate m_callbacks[CB_COUNT]; // start/reset callbacks
// generic video
u8 m_flip_screen_x;
diff --git a/src/emu/drivers/empty.cpp b/src/emu/drivers/empty.cpp
index f99f4c7096a..3a139a9f12d 100644
--- a/src/emu/drivers/empty.cpp
+++ b/src/emu/drivers/empty.cpp
@@ -69,4 +69,4 @@ ROM_END
// GAME DRIVERS
//**************************************************************************
-GAME( 2007, ___empty, 0, ___empty, 0, empty_state, 0, ROT0, "MAME", "No Driver Loaded", MACHINE_NO_SOUND_HW )
+GAME( 2007, ___empty, 0, ___empty, 0, empty_state, empty_init, ROT0, "MAME", "No Driver Loaded", MACHINE_NO_SOUND_HW )
diff --git a/src/emu/gamedrv.h b/src/emu/gamedrv.h
index 2acafd7ca6c..58edbac3e02 100644
--- a/src/emu/gamedrv.h
+++ b/src/emu/gamedrv.h
@@ -144,12 +144,6 @@ public:
// MACROS
//**************************************************************************
-// wrappers for the DRIVER_INIT callback
-#define DRIVER_INIT_NAME(name) init_##name
-#define DECLARE_DRIVER_INIT(name) void DRIVER_INIT_NAME(name)() ATTR_COLD
-#define DRIVER_INIT_MEMBER(cls, name) void cls::DRIVER_INIT_NAME(name)()
-#define DRIVER_INIT_CALL(name) DRIVER_INIT_NAME(name)()
-
// wrappers for declaring and defining game drivers
#define GAME_NAME(name) driver_##name
#define GAME_TRAITS_NAME(name) driver_##name##traits
@@ -181,7 +175,7 @@ extern game_driver const GAME_NAME(NAME) \
COMPANY, \
[] (machine_config &config, device_t &owner) { downcast<CLASS &>(owner).MACHINE(config); }, \
INPUT_PORTS_NAME(INPUT), \
- [] (device_t &owner) { downcast<CLASS &>(owner).init_##INIT(); }, \
+ [] (device_t &owner) { downcast<CLASS &>(owner).INIT(); }, \
ROM_NAME(NAME), \
nullptr, \
nullptr, \
@@ -200,7 +194,7 @@ extern game_driver const GAME_NAME(NAME) \
COMPANY, \
[] (machine_config &config, device_t &owner) { downcast<CLASS &>(owner).MACHINE(config); }, \
INPUT_PORTS_NAME(INPUT), \
- [] (device_t &owner) { downcast<CLASS &>(owner).init_##INIT(); }, \
+ [] (device_t &owner) { downcast<CLASS &>(owner).INIT(); }, \
ROM_NAME(NAME), \
nullptr, \
&LAYOUT, \
@@ -220,7 +214,7 @@ extern game_driver const GAME_NAME(NAME) \
COMPANY, \
[] (machine_config &config, device_t &owner) { downcast<CLASS &>(owner).MACHINE(config); }, \
INPUT_PORTS_NAME(INPUT), \
- [] (device_t &owner) { downcast<CLASS &>(owner).init_##INIT(); }, \
+ [] (device_t &owner) { downcast<CLASS &>(owner).INIT(); }, \
ROM_NAME(NAME), \
#COMPAT, \
nullptr, \
@@ -239,7 +233,7 @@ extern game_driver const GAME_NAME(NAME) \
COMPANY, \
[] (machine_config &config, device_t &owner) { downcast<CLASS &>(owner).MACHINE(config); }, \
INPUT_PORTS_NAME(INPUT), \
- [] (device_t &owner) { downcast<CLASS &>(owner).init_##INIT(); }, \
+ [] (device_t &owner) { downcast<CLASS &>(owner).INIT(); }, \
ROM_NAME(NAME), \
#COMPAT, \
nullptr, \
@@ -258,7 +252,7 @@ extern game_driver const GAME_NAME(NAME) \
COMPANY, \
[] (machine_config &config, device_t &owner) { downcast<CLASS &>(owner).MACHINE(config); }, \
INPUT_PORTS_NAME(INPUT), \
- [] (device_t &owner) { downcast<CLASS &>(owner).init_##INIT(); }, \
+ [] (device_t &owner) { downcast<CLASS &>(owner).INIT(); }, \
ROM_NAME(NAME), \
#COMPAT, \
nullptr, \