summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/backfire.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-09-02 07:57:50 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-09-02 07:57:50 +0000
commit066e54b69fd68b249402febcf17b4b0bc7c4f79a (patch)
tree3d524fc945e393c18de5beaa555dd14c8a0d107e /src/mame/drivers/backfire.c
parent1d194df33ab9ed333921bba2621ebd12b60927ed (diff)
Changed driver_data objects to be devices. Replaced the driver_data_t
class with a new driver_device class, which is the base class for all driver_data objects now. The new driver devices are added as the first device in the device list, with a tag of "root"; all other devices are now owned by the driver device. Moved core callbacks (machine_start/_reset, sound_start/_reset, video_start/_reset/_eof/_update, and palette_init) into device configuration parameters on these new devices. The driver_device base class overrides device_start(), ensures all other devices have been started, and then calls, in order, the following overridable methods: find_devices() - new, used to locate devices prior to DRIVER_INIT DRIVER_INIT function from the game driver palette_init() - by default calls the MDRV_PALETTE_INIT function driver_start() - new machine_start() - by default calls the MDRV_MACHINE_START function sound_start() - by default calls the MDRV_SOUND_START function video_start() - by default calls the MDRV_VIDEO_START function Similarly, the driver_device class overrides device_reset() and then calls these methods in order: driver_reset() - new machine_reset() - by default calls the MDRV_MACHINE_RESET function sound_reset() - by default calls the MDRV_SOUND_RESET function video_reset() - by default calls the MDRV_VIDEO_RESET function To accommodate these changes, initialization order is slightly altered from before. The tilemap, video, sound, and debug systems are now initialized prior to the devices' start. And the user callbacks for DRIVER_INIT, PALETTE_INIT, MACHINE_START, SOUND_START, and VIDEO_START are all called back-to-back. The net effect should be similar, however. Added methods (optional_device and required_device) to the new driver_device class to find devices, intended to be used from the find_devices() callback. See harddriv.h and beathead.h for examples of usage. Changed device_t::subtag to only prepend a prefix if the device is not the 'root' device, in order to keep compatibility with existing tag searching. Changed device startup to actively reorder devices when they report missing dependencies. This ensures that the reset functions get called in the same order that the start functions did. Bulk updated drivers as follows: First removed the old static alloc function from the driver_data_t: S: [ \t]*static driver_device \*alloc *\( *running_machine *\&machine *\) *\{ *return auto_alloc_clear *\( *\&machine *, *[a-zA-Z0-9_]+_state *\( *machine *\) *\); *\}[\r\n]* R: Then switched from driver_data_t to driver_device: S: driver_data_t R: driver_device Then changed the constructors to pass the correct parameters: S: ([a-zA-Z0-9_]+)_state *\( *running_machine *\&machine *\)([\r\n\t ]+): *driver_device *\( *machine *\) R: \1_state\(running_machine \&machine, const driver_device_config_base \&config\)\2: driver_device\(machine, config\)
Diffstat (limited to 'src/mame/drivers/backfire.c')
-rw-r--r--src/mame/drivers/backfire.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c
index 461697bbc71..96ab9cecb52 100644
--- a/src/mame/drivers/backfire.c
+++ b/src/mame/drivers/backfire.c
@@ -20,13 +20,11 @@
#include "video/deco16ic.h"
#include "rendlay.h"
-class backfire_state : public driver_data_t
+class backfire_state : public driver_device
{
public:
- static driver_data_t *alloc(running_machine &machine) { return auto_alloc_clear(&machine, backfire_state(machine)); }
-
- backfire_state(running_machine &machine)
- : driver_data_t(machine) { }
+ backfire_state(running_machine &machine, const driver_device_config_base &config)
+ : driver_device(machine, config) { }
/* memory pointers */
UINT16 * pf1_rowscroll;