mame/src/emu/drivers/empty.c
Aaron Giles 066e54b69f 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\)
2010-09-02 07:57:50 +00:00

70 lines
1.3 KiB
C

/*************************************************************************
empty.c
Empty driver.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
**************************************************************************/
#include "emu.h"
#include "render.h"
#include "uimenu.h"
/*************************************
*
* Machine "start"
*
*************************************/
static MACHINE_START( empty )
{
/* force the UI to show the game select screen */
ui_menu_force_game_select(machine, render_container_get_ui());
}
/*************************************
*
* Machine drivers
*
*************************************/
static MACHINE_CONFIG_START( empty, driver_device )
MDRV_MACHINE_START(empty)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
MDRV_SCREEN_SIZE(640,480)
MDRV_SCREEN_VISIBLE_AREA(0,639, 0,479)
MDRV_SCREEN_REFRESH_RATE(30)
MACHINE_CONFIG_END
/*************************************
*
* ROM definitions
*
*************************************/
ROM_START( empty )
ROM_REGION( 0x10, "user1", 0 )
ROM_END
/*************************************
*
* Game drivers
*
*************************************/
GAME( 2007, empty, 0, empty, 0, 0, ROT0, "MAME", "No Driver Loaded", 0 )