well, that causes mpu4 to take way too much memory to compile, the changes to device instantiation still apply (nw)

This commit is contained in:
Vas Crabb 2017-05-22 18:55:02 +10:00
parent f7180a9504
commit fa80bef249
3 changed files with 49 additions and 22 deletions

View File

@ -160,6 +160,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

View File

@ -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;

View File

@ -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, \