From b7c4a537cd133cb0d7f07e3e99ea0d8a27a0531a Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 21 Feb 2008 08:50:36 +0000 Subject: Most important thing to note about this change: ALL DRIVERS MUST NOW EXPLICITLY DECLARE THEIR SCREENS. Read on for more detail.... Added device tag as a parameter to the start function for devices. Updated MC6845 to accept this tag. Added new functions for iterating through the device list and counting devices of a given type. Updated search and iteration functions to accept DEVICE_TYPE_WILDCARD to work across all devices. Added new macro MDRV_DEVICE_CONFIG_DATA() which is used to set a single item in an inline data structure. Removed the per-screen palette_base. This was an idea that never really worked out, nor have we really needed it. Defined a new device type VIDEO_SCREEN. Currently this has no live functionality, but merely serves as a placeholder/identifier for video screens. Eventually some of the screen management code may move into the start/stop/reset functions. Changed MDRV_SCREEN_* macros to build up VIDEO_SCREEN devices rather than storing values in the screen[] array. Changed MDRV_SCREEN_ADD to specify a screen type (RASTER, VECTOR, LCD for the moment). Removed the older VIDEO_TYPE_RASTER and VIDEO_TYPE_VECTOR; this information is now determined by walking the screen list. Removed the screen[] array from machine_config. Modified all code referencing Machine->config->screen[] and changed it to iterate over the devices using the new video_screen_first() and video_screen_next() functions. (The next step will be to add video_* functions that accept a tag instead of screen index, and then move systems over to always referencing screens by tag instead of index.) Removed implicit screen #0. This means that ALL DRIVERS MUST EXPLICITLY DECLARE THEIR SCREENS. Updated all drivers to do so. While there, grouped all MDRV_SCREEN_* parameters together. Also removed unnecessary VIDEO_TYPE_RASTER and VIDEO_TYPE_VECTOR. Also removed VBLANK and bitmap format information from vector games. This was painful and very tedious. Changed game information to display info about all screens. --- src/emu/rendlay.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/emu/rendlay.c') diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index dda2b5e04ee..69572d99899 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -1346,18 +1346,22 @@ static void layout_element_draw_led16segsc(mame_bitmap *dest, const rectangle *b static int get_variable_value(const char *string, char **outputptr) { - int num, den, scrnum; + const device_config *device; + int num, den; char temp[100]; /* screen 0 parameters */ - for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) + for (device = video_screen_first(Machine->config); device != NULL; device = video_screen_next(device)) { + int scrnum = device_list_index(Machine->config->devicelist, VIDEO_SCREEN, device->tag); + const screen_config *scrconfig = device->inline_config; + /* native X aspect factor */ sprintf(temp, "~scr%dnativexaspect~", scrnum); if (!strncmp(string, temp, strlen(temp))) { - num = Machine->config->screen[scrnum].defstate.visarea.max_x + 1 - Machine->config->screen[scrnum].defstate.visarea.min_x; - den = Machine->config->screen[scrnum].defstate.visarea.max_y + 1 - Machine->config->screen[scrnum].defstate.visarea.min_y; + num = scrconfig->defstate.visarea.max_x + 1 - scrconfig->defstate.visarea.min_x; + den = scrconfig->defstate.visarea.max_y + 1 - scrconfig->defstate.visarea.min_y; reduce_fraction(&num, &den); *outputptr += sprintf(*outputptr, "%d", num); return strlen(temp); @@ -1367,8 +1371,8 @@ static int get_variable_value(const char *string, char **outputptr) sprintf(temp, "~scr%dnativeyaspect~", scrnum); if (!strncmp(string, temp, strlen(temp))) { - num = Machine->config->screen[scrnum].defstate.visarea.max_x + 1 - Machine->config->screen[scrnum].defstate.visarea.min_x; - den = Machine->config->screen[scrnum].defstate.visarea.max_y + 1 - Machine->config->screen[scrnum].defstate.visarea.min_y; + num = scrconfig->defstate.visarea.max_x + 1 - scrconfig->defstate.visarea.min_x; + den = scrconfig->defstate.visarea.max_y + 1 - scrconfig->defstate.visarea.min_y; reduce_fraction(&num, &den); *outputptr += sprintf(*outputptr, "%d", den); return strlen(temp); @@ -1378,7 +1382,7 @@ static int get_variable_value(const char *string, char **outputptr) sprintf(temp, "~scr%dwidth~", scrnum); if (!strncmp(string, temp, strlen(temp))) { - *outputptr += sprintf(*outputptr, "%d", Machine->config->screen[scrnum].defstate.visarea.max_x + 1 - Machine->config->screen[0].defstate.visarea.min_x); + *outputptr += sprintf(*outputptr, "%d", scrconfig->defstate.visarea.max_x + 1 - scrconfig->defstate.visarea.min_x); return strlen(temp); } @@ -1386,7 +1390,7 @@ static int get_variable_value(const char *string, char **outputptr) sprintf(temp, "~scr%dheight~", scrnum); if (!strncmp(string, temp, strlen(temp))) { - *outputptr += sprintf(*outputptr, "%d", Machine->config->screen[scrnum].defstate.visarea.max_y + 1 - Machine->config->screen[0].defstate.visarea.min_y); + *outputptr += sprintf(*outputptr, "%d", scrconfig->defstate.visarea.max_y + 1 - scrconfig->defstate.visarea.min_y); return strlen(temp); } } -- cgit v1.2.3-70-g09d2