diff options
author | Vas Crabb <vas@vastheman.com> | 2017-05-22 18:55:02 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2017-05-22 18:55:02 +1000 |
commit | fa80bef249997659ae4341463fdb85f2a43b230a (patch) | |
tree | ec99a8c51a65e241649c86a30221af0c1d4c5a15 | |
parent | f7180a9504fa1ac39cb6c5f2af45f56c70a5bd77 (diff) |
well, that causes mpu4 to take way too much memory to compile, the changes to device instantiation still apply (nw)
-rw-r--r-- | src/emu/driver.cpp | 21 | ||||
-rw-r--r-- | src/emu/driver.h | 2 | ||||
-rw-r--r-- | src/emu/gamedrv.h | 48 |
3 files changed, 49 insertions, 22 deletions
diff --git a/src/emu/driver.cpp b/src/emu/driver.cpp index 846f48c26ef..ceed36bd493 100644 --- a/src/emu/driver.cpp +++ b/src/emu/driver.cpp @@ -161,6 +161,27 @@ const tiny_rom_entry *driver_device::device_rom_region() const //------------------------------------------------- +// device_add_mconfig - add machine configuration +//------------------------------------------------- + +void driver_device::device_add_mconfig(machine_config &config) +{ + m_system->machine_config(config, this, nullptr); +} + + +//------------------------------------------------- +// device_input_ports - return a pointer to the +// game's input ports +//------------------------------------------------- + +ioport_constructor driver_device::device_input_ports() const +{ + return m_system->ipt; +} + + +//------------------------------------------------- // device_start - device override which calls // the various helpers //------------------------------------------------- diff --git a/src/emu/driver.h b/src/emu/driver.h index fb5000751a1..f1cd8c56268 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -197,6 +197,8 @@ protected: // device-level overrides virtual const tiny_rom_entry *device_rom_region() const override; + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; virtual void device_start() override; virtual void device_reset_after_children() override; diff --git a/src/emu/gamedrv.h b/src/emu/gamedrv.h index 41009260801..b501960859a 100644 --- a/src/emu/gamedrv.h +++ b/src/emu/gamedrv.h @@ -95,6 +95,8 @@ public: const char * parent; // if this is a clone, the name of the parent const char * year; // year the game was released const char * manufacturer; // manufacturer of the game + machine_config_constructor machine_config; // machine driver tokens + ioport_constructor ipt; // pointer to constructor for input ports driver_init_helper const & driver_init; // DRIVER_INIT callback const tiny_rom_entry * rom; // pointer to list of ROMs for the game const char * compatible_with; @@ -116,34 +118,28 @@ public: // wrappers for declaring and defining game drivers #define GAME_NAME(name) driver_##name -#define GAME_TRAITS_NAME(name) driver_##name##_device +#define GAME_TRAITS_NAME(name) driver_##name##traits #define GAME_EXTERN(name) extern game_driver const GAME_NAME(name) // static game traits -#define GAME_DRIVER_TRAITS(NAME, FULLNAME, MACHINE, INPUT, CLASS) \ +#define GAME_DRIVER_TRAITS(NAME, FULLNAME) \ namespace { \ - class GAME_TRAITS_NAME(NAME) : public CLASS \ - { \ - public: \ - static constexpr char const shortname[] = #NAME, fullname[] = FULLNAME, source[] = __FILE__; \ - GAME_TRAITS_NAME(NAME)(const machine_config &mconfig, device_type type, const char *tag) : CLASS(mconfig, type, tag) { } \ - protected: \ - virtual void device_add_mconfig(machine_config &config) override { MACHINE_CONFIG_NAME(MACHINE)(config, this, nullptr); } \ - virtual ioport_constructor device_input_ports() const override { return INPUT_PORTS_NAME(INPUT); } \ - }; \ + struct GAME_TRAITS_NAME(NAME) { static constexpr char const shortname[] = #NAME, fullname[] = FULLNAME, source[] = __FILE__; }; \ constexpr char const GAME_TRAITS_NAME(NAME)::shortname[], GAME_TRAITS_NAME(NAME)::fullname[], GAME_TRAITS_NAME(NAME)::source[]; \ } -#define GAME_DRIVER_TYPE(NAME) driver_device_creator<GAME_TRAITS_NAME(NAME), (GAME_TRAITS_NAME(NAME)::shortname), (GAME_TRAITS_NAME(NAME)::fullname), (GAME_TRAITS_NAME(NAME)::source)> +#define GAME_DRIVER_TYPE(NAME, CLASS) driver_device_creator<CLASS, (GAME_TRAITS_NAME(NAME)::shortname), (GAME_TRAITS_NAME(NAME)::fullname), (GAME_TRAITS_NAME(NAME)::source)> // standard GAME() macro #define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,CLASS,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \ -GAME_DRIVER_TRAITS(NAME, FULLNAME, MACHINE, INPUT, CLASS) \ +GAME_DRIVER_TRAITS(NAME,FULLNAME) \ extern game_driver const GAME_NAME(NAME) \ { \ - GAME_DRIVER_TYPE(NAME), \ + GAME_DRIVER_TYPE(NAME, CLASS), \ #PARENT, \ #YEAR, \ COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ game_driver::make_driver_init(&CLASS::init_##INIT), \ ROM_NAME(NAME), \ nullptr, \ @@ -154,13 +150,15 @@ extern game_driver const GAME_NAME(NAME) \ // standard macro with additional layout #define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,CLASS,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \ -GAME_DRIVER_TRAITS(NAME, FULLNAME, MACHINE, INPUT, CLASS) \ +GAME_DRIVER_TRAITS(NAME,FULLNAME) \ extern game_driver const GAME_NAME(NAME) \ { \ - GAME_DRIVER_TYPE(NAME), \ + GAME_DRIVER_TYPE(NAME, CLASS), \ #PARENT, \ #YEAR, \ COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ game_driver::make_driver_init(&CLASS::init_##INIT), \ ROM_NAME(NAME), \ nullptr, \ @@ -172,13 +170,15 @@ extern game_driver const GAME_NAME(NAME) \ // standard console definition macro #define CONS(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ -GAME_DRIVER_TRAITS(NAME, FULLNAME, MACHINE, INPUT, CLASS) \ +GAME_DRIVER_TRAITS(NAME,FULLNAME) \ extern game_driver const GAME_NAME(NAME) \ { \ - GAME_DRIVER_TYPE(NAME), \ + GAME_DRIVER_TYPE(NAME, CLASS), \ #PARENT, \ #YEAR, \ COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ game_driver::make_driver_init(&CLASS::init_##INIT), \ ROM_NAME(NAME), \ #COMPAT, \ @@ -189,13 +189,15 @@ extern game_driver const GAME_NAME(NAME) \ // standard computer definition macro #define COMP(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ -GAME_DRIVER_TRAITS(NAME, FULLNAME, MACHINE, INPUT, CLASS) \ +GAME_DRIVER_TRAITS(NAME,FULLNAME) \ extern game_driver const GAME_NAME(NAME) \ { \ - GAME_DRIVER_TYPE(NAME), \ + GAME_DRIVER_TYPE(NAME, CLASS), \ #PARENT, \ #YEAR, \ COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ game_driver::make_driver_init(&CLASS::init_##INIT), \ ROM_NAME(NAME), \ #COMPAT, \ @@ -206,13 +208,15 @@ extern game_driver const GAME_NAME(NAME) \ // standard system definition macro #define SYST(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ -GAME_DRIVER_TRAITS(NAME, FULLNAME, MACHINE, INPUT, CLASS) \ +GAME_DRIVER_TRAITS(NAME,FULLNAME) \ extern game_driver const GAME_NAME(NAME) \ { \ - GAME_DRIVER_TYPE(NAME), \ + GAME_DRIVER_TYPE(NAME, CLASS), \ #PARENT, \ #YEAR, \ COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ game_driver::make_driver_init(&CLASS::init_##INIT), \ ROM_NAME(NAME), \ #COMPAT, \ |