diff options
author | 2010-02-25 06:28:03 +0000 | |
---|---|---|
committer | 2010-02-25 06:28:03 +0000 | |
commit | cfa887f3de933df22134893751072819c7aa1e02 (patch) | |
tree | 7e048056ee2487e7a98d54eeb93a15f052a59746 /src/emu/mame.c | |
parent | cff01e5501239ea93293e26b28b04b915d4d0c1c (diff) |
Changed all driver_data structs into classes with a simple
constructor and a static allocation function.
Changed MDRV_DRIVER_DATA to reference driver_data::alloc
instead of just providing a size. This function is called
to allocate the driver data. This allows objects to be
embedded in the state data and be properly initialized.
Ideally, new driver_data constructors should perform
initialization actions in the constructor, but for now
most just use auto_alloc_clear() to blast everything to
zero.
Moved driver data allocation after device list construction
so that devices can be found when the driver data is
constructed.
Diffstat (limited to 'src/emu/mame.c')
-rw-r--r-- | src/emu/mame.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/emu/mame.c b/src/emu/mame.c index 9915dc9dcb0..d6c27f46a12 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -1303,13 +1303,13 @@ running_machine::running_machine(const game_driver *driver) basename = mame_strdup(driver->name); config = machine_config_alloc(driver->machine_config); - /* allocate the driver data */ - if (config->driver_data_size != 0) - driver_data = auto_alloc_array_clear(this, UINT8, config->driver_data_size); - /* attach this machine to all the devices in the configuration */ devicelist.import_config_list(config->devicelist, *this); + /* allocate the driver data (after devices) */ + if (config->driver_data_alloc != NULL) + driver_data = (*config->driver_data_alloc)(*this); + /* find devices */ firstcpu = cpu_first(this); primary_screen = video_screen_first(this); |