mirror of
https://github.com/holub/mame
synced 2025-05-04 21:43:05 +03:00
- the public screen_state is made to only contain items that are currently accessed by drivers
- populating screen_state is moved from mame.c to video.c - defstate is gone -- the default screen parameters live in screen_config directly
This commit is contained in:
parent
9ad9532722
commit
d0f5196025
@ -96,7 +96,18 @@ static void configure_rgb_shadows(running_machine *machine, int mode, float fact
|
||||
|
||||
void palette_init(running_machine *machine)
|
||||
{
|
||||
int format;
|
||||
palette_private *palette = auto_malloc(sizeof(*palette));
|
||||
const device_config *device = video_screen_first(machine->config);
|
||||
|
||||
/* get the format from the first screen, or use BITMAP_FORMAT_INVALID, if screenless */
|
||||
if (device != NULL)
|
||||
{
|
||||
screen_config *config = device->inline_config;
|
||||
format = config->format;
|
||||
}
|
||||
else
|
||||
format = BITMAP_FORMAT_INVALID;
|
||||
|
||||
/* request cleanup */
|
||||
machine->palette_data = palette;
|
||||
@ -104,10 +115,10 @@ void palette_init(running_machine *machine)
|
||||
|
||||
/* reset all our data */
|
||||
memset(palette, 0, sizeof(*palette));
|
||||
palette->format = machine->screen[0].format;
|
||||
palette->format = format;
|
||||
|
||||
/* determine the color mode */
|
||||
switch (palette->format)
|
||||
switch (format)
|
||||
{
|
||||
case BITMAP_FORMAT_INDEXED16:
|
||||
case BITMAP_FORMAT_RGB15:
|
||||
|
@ -730,30 +730,29 @@ static void print_game_display(FILE *out, const game_driver *game, const machine
|
||||
/* output width and height only for games that are not vector */
|
||||
if (scrconfig->type != SCREEN_TYPE_VECTOR)
|
||||
{
|
||||
int dx = scrconfig->defstate.visarea.max_x - scrconfig->defstate.visarea.min_x + 1;
|
||||
int dy = scrconfig->defstate.visarea.max_y - scrconfig->defstate.visarea.min_y + 1;
|
||||
int dx = scrconfig->visarea.max_x - scrconfig->visarea.min_x + 1;
|
||||
int dy = scrconfig->visarea.max_y - scrconfig->visarea.min_y + 1;
|
||||
|
||||
fprintf(out, " width=\"%d\"", dx);
|
||||
fprintf(out, " height=\"%d\"", dy);
|
||||
}
|
||||
|
||||
/* output refresh rate */
|
||||
fprintf(out, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(scrconfig->defstate.refresh));
|
||||
fprintf(out, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(scrconfig->refresh));
|
||||
|
||||
/* output raw video parameters only for games that are not vector */
|
||||
/* and had raw parameters specified */
|
||||
if ((scrconfig->type != SCREEN_TYPE_VECTOR) && !scrconfig->defstate.oldstyle_vblank_supplied)
|
||||
if ((scrconfig->type != SCREEN_TYPE_VECTOR) && !scrconfig->oldstyle_vblank_supplied)
|
||||
{
|
||||
int pixclock = scrconfig->defstate.width * scrconfig->defstate.height
|
||||
* ATTOSECONDS_TO_HZ(scrconfig->defstate.refresh);
|
||||
int pixclock = scrconfig->width * scrconfig->height * ATTOSECONDS_TO_HZ(scrconfig->refresh);
|
||||
|
||||
fprintf(out, " pixclock=\"%d\"", pixclock);
|
||||
fprintf(out, " htotal=\"%d\"", scrconfig->defstate.width);
|
||||
fprintf(out, " hbend=\"%d\"", scrconfig->defstate.visarea.min_x);
|
||||
fprintf(out, " hbstart=\"%d\"", scrconfig->defstate.visarea.max_x+1);
|
||||
fprintf(out, " vtotal=\"%d\"", scrconfig->defstate.height);
|
||||
fprintf(out, " vbend=\"%d\"", scrconfig->defstate.visarea.min_y);
|
||||
fprintf(out, " vbstart=\"%d\"", scrconfig->defstate.visarea.max_y+1);
|
||||
fprintf(out, " htotal=\"%d\"", scrconfig->width);
|
||||
fprintf(out, " hbend=\"%d\"", scrconfig->visarea.min_x);
|
||||
fprintf(out, " hbstart=\"%d\"", scrconfig->visarea.max_x+1);
|
||||
fprintf(out, " vtotal=\"%d\"", scrconfig->height);
|
||||
fprintf(out, " vbend=\"%d\"", scrconfig->visarea.min_y);
|
||||
fprintf(out, " vbstart=\"%d\"", scrconfig->visarea.max_y+1);
|
||||
}
|
||||
fprintf(out, " />\n");
|
||||
}
|
||||
|
@ -2904,11 +2904,7 @@ profiler_mark(PROFILER_INPUT);
|
||||
portinfo->vblank = 0;
|
||||
for (bitnum = 0, info = &portinfo->bit[0]; bitnum < MAX_BITS_PER_PORT && info->port; bitnum++, info++)
|
||||
if (info->port->type == IPT_VBLANK)
|
||||
{
|
||||
portinfo->vblank ^= info->port->mask;
|
||||
if (machine->screen[0].vblank == 0)
|
||||
logerror("Warning: you are using IPT_VBLANK with vblank_time = 0. You need to increase vblank_time for IPT_VBLANK to work.\n");
|
||||
}
|
||||
|
||||
/* now loop back and modify based on the inputs */
|
||||
portinfo->digital = 0;
|
||||
|
@ -1451,18 +1451,10 @@ error:
|
||||
|
||||
static void prepare_machine(running_machine *machine)
|
||||
{
|
||||
const device_config *device;
|
||||
|
||||
/* reset most portions of the machine */
|
||||
|
||||
/* video-related information */
|
||||
/* graphics layout */
|
||||
memset(machine->gfx, 0, sizeof(machine->gfx));
|
||||
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;
|
||||
machine->screen[scrnum] = scrconfig->defstate;
|
||||
}
|
||||
|
||||
/* palette-related information */
|
||||
machine->pens = NULL;
|
||||
|
@ -378,37 +378,37 @@ union _machine_config_token
|
||||
MDRV_DEVICE_MODIFY(_tag, VIDEO_SCREEN)
|
||||
|
||||
#define MDRV_SCREEN_FORMAT(_format) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.format, _format)
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, format, _format)
|
||||
|
||||
#define MDRV_SCREEN_TYPE(_type) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, type, SCREEN_TYPE_##_type)
|
||||
|
||||
#define MDRV_SCREEN_RAW_PARAMS(_pixclock, _htotal, _hbend, _hbstart, _vtotal, _vbend, _vbstart) \
|
||||
MDRV_DEVICE_CONFIG_DATA64(screen_config, defstate.refresh, HZ_TO_ATTOSECONDS(_pixclock) * (_htotal) * (_vtotal)) \
|
||||
MDRV_DEVICE_CONFIG_DATA64(screen_config, defstate.vblank, ((HZ_TO_ATTOSECONDS(_pixclock) * (_htotal) * (_vtotal)) / (_vtotal)) * ((_vtotal) - ((_vbstart) - (_vbend)))) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.width, _htotal) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.height, _vtotal) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.visarea.min_x, _hbend) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.visarea.max_x, (_hbstart) - 1) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.visarea.min_y, _vbend) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.visarea.max_y, (_vbstart) - 1)
|
||||
MDRV_DEVICE_CONFIG_DATA64(screen_config, refresh, HZ_TO_ATTOSECONDS(_pixclock) * (_htotal) * (_vtotal)) \
|
||||
MDRV_DEVICE_CONFIG_DATA64(screen_config, vblank, ((HZ_TO_ATTOSECONDS(_pixclock) * (_htotal) * (_vtotal)) / (_vtotal)) * ((_vtotal) - ((_vbstart) - (_vbend)))) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, width, _htotal) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, height, _vtotal) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, visarea.min_x, _hbend) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, visarea.max_x, (_hbstart) - 1) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, visarea.min_y, _vbend) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, visarea.max_y, (_vbstart) - 1)
|
||||
|
||||
#define MDRV_SCREEN_REFRESH_RATE(_rate) \
|
||||
MDRV_DEVICE_CONFIG_DATA64(screen_config, defstate.refresh, HZ_TO_ATTOSECONDS(_rate))
|
||||
MDRV_DEVICE_CONFIG_DATA64(screen_config, refresh, HZ_TO_ATTOSECONDS(_rate))
|
||||
|
||||
#define MDRV_SCREEN_VBLANK_TIME(_time) \
|
||||
MDRV_DEVICE_CONFIG_DATA64(screen_config, defstate.vblank, _time) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.oldstyle_vblank_supplied, TRUE)
|
||||
MDRV_DEVICE_CONFIG_DATA64(screen_config, vblank, _time) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, oldstyle_vblank_supplied, TRUE)
|
||||
|
||||
#define MDRV_SCREEN_SIZE(_width, _height) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.width, _width) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.height, _height)
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, width, _width) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, height, _height)
|
||||
|
||||
#define MDRV_SCREEN_VISIBLE_AREA(_minx, _maxx, _miny, _maxy) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.visarea.min_x, _minx) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.visarea.max_x, _maxx) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.visarea.min_y, _miny) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, defstate.visarea.max_y, _maxy)
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, visarea.min_x, _minx) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, visarea.max_x, _maxx) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, visarea.min_y, _miny) \
|
||||
MDRV_DEVICE_CONFIG_DATA32(screen_config, visarea.max_y, _maxy)
|
||||
|
||||
#define MDRV_SCREEN_DEFAULT_POSITION(_xscale, _xoffs, _yscale, _yoffs) \
|
||||
MDRV_DEVICE_CONFIG_DATAFP32(screen_config, xoffset, _xoffs, 24) \
|
||||
|
@ -1379,7 +1379,7 @@ void render_target_get_minimum_size(render_target *target, INT32 *minwidth, INT3
|
||||
else if (Machine->screen[item->index].visarea.max_x > Machine->screen[item->index].visarea.min_x)
|
||||
visarea = &Machine->screen[item->index].visarea;
|
||||
else
|
||||
visarea = &scrconfig->defstate.visarea;
|
||||
visarea = &scrconfig->visarea;
|
||||
|
||||
/* apply target orientation to the bounds */
|
||||
bounds = item->bounds;
|
||||
|
@ -1361,8 +1361,8 @@ static int get_variable_value(const char *string, char **outputptr)
|
||||
sprintf(temp, "~scr%dnativexaspect~", scrnum);
|
||||
if (!strncmp(string, temp, strlen(temp)))
|
||||
{
|
||||
num = scrconfig->defstate.visarea.max_x + 1 - scrconfig->defstate.visarea.min_x;
|
||||
den = scrconfig->defstate.visarea.max_y + 1 - scrconfig->defstate.visarea.min_y;
|
||||
num = scrconfig->visarea.max_x + 1 - scrconfig->visarea.min_x;
|
||||
den = scrconfig->visarea.max_y + 1 - scrconfig->visarea.min_y;
|
||||
reduce_fraction(&num, &den);
|
||||
*outputptr += sprintf(*outputptr, "%d", num);
|
||||
return strlen(temp);
|
||||
@ -1372,8 +1372,8 @@ static int get_variable_value(const char *string, char **outputptr)
|
||||
sprintf(temp, "~scr%dnativeyaspect~", scrnum);
|
||||
if (!strncmp(string, temp, strlen(temp)))
|
||||
{
|
||||
num = scrconfig->defstate.visarea.max_x + 1 - scrconfig->defstate.visarea.min_x;
|
||||
den = scrconfig->defstate.visarea.max_y + 1 - scrconfig->defstate.visarea.min_y;
|
||||
num = scrconfig->visarea.max_x + 1 - scrconfig->visarea.min_x;
|
||||
den = scrconfig->visarea.max_y + 1 - scrconfig->visarea.min_y;
|
||||
reduce_fraction(&num, &den);
|
||||
*outputptr += sprintf(*outputptr, "%d", den);
|
||||
return strlen(temp);
|
||||
@ -1383,7 +1383,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", scrconfig->defstate.visarea.max_x + 1 - scrconfig->defstate.visarea.min_x);
|
||||
*outputptr += sprintf(*outputptr, "%d", scrconfig->visarea.max_x + 1 - scrconfig->visarea.min_x);
|
||||
return strlen(temp);
|
||||
}
|
||||
|
||||
@ -1391,7 +1391,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", scrconfig->defstate.visarea.max_y + 1 - scrconfig->defstate.visarea.min_y);
|
||||
*outputptr += sprintf(*outputptr, "%d", scrconfig->visarea.max_y + 1 - scrconfig->visarea.min_y);
|
||||
return strlen(temp);
|
||||
}
|
||||
}
|
||||
|
@ -1736,7 +1736,7 @@ static INT32 slider_overclock(running_machine *machine, INT32 newval, char *buff
|
||||
static INT32 slider_refresh(running_machine *machine, INT32 newval, char *buffer, int arg)
|
||||
{
|
||||
const screen_config *scrconfig = device_list_find_by_index(Machine->config->devicelist, VIDEO_SCREEN, arg)->inline_config;
|
||||
double defrefresh = ATTOSECONDS_TO_HZ(scrconfig->defstate.refresh);
|
||||
double defrefresh = ATTOSECONDS_TO_HZ(scrconfig->refresh);
|
||||
double refresh;
|
||||
|
||||
if (buffer != NULL)
|
||||
|
@ -830,7 +830,7 @@ static int validate_display(int drivnum, const machine_config *config)
|
||||
const screen_config *scrconfig = device->inline_config;
|
||||
|
||||
/* sanity check dimensions */
|
||||
if ((scrconfig->defstate.width <= 0) || (scrconfig->defstate.height <= 0))
|
||||
if ((scrconfig->width <= 0) || (scrconfig->height <= 0))
|
||||
{
|
||||
mame_printf_error("%s: %s screen \"%s\" has invalid display dimensions\n", driver->source_file, driver->name, device->tag);
|
||||
error = TRUE;
|
||||
@ -839,29 +839,29 @@ static int validate_display(int drivnum, const machine_config *config)
|
||||
/* sanity check display area */
|
||||
if (scrconfig->type != SCREEN_TYPE_VECTOR)
|
||||
{
|
||||
if ((scrconfig->defstate.visarea.max_x < scrconfig->defstate.visarea.min_x)
|
||||
|| (scrconfig->defstate.visarea.max_y < scrconfig->defstate.visarea.min_y)
|
||||
|| (scrconfig->defstate.visarea.max_x >= scrconfig->defstate.width)
|
||||
|| (scrconfig->defstate.visarea.max_y >= scrconfig->defstate.height))
|
||||
if ((scrconfig->visarea.max_x < scrconfig->visarea.min_x) ||
|
||||
(scrconfig->visarea.max_y < scrconfig->visarea.min_y) ||
|
||||
(scrconfig->visarea.max_x >= scrconfig->width) ||
|
||||
(scrconfig->visarea.max_y >= scrconfig->height))
|
||||
{
|
||||
mame_printf_error("%s: %s screen \"%s\" has an invalid display area\n", driver->source_file, driver->name, device->tag);
|
||||
error = TRUE;
|
||||
}
|
||||
|
||||
/* sanity check screen formats */
|
||||
if (scrconfig->defstate.format != BITMAP_FORMAT_INDEXED16 &&
|
||||
scrconfig->defstate.format != BITMAP_FORMAT_RGB15 &&
|
||||
scrconfig->defstate.format != BITMAP_FORMAT_RGB32)
|
||||
if (scrconfig->format != BITMAP_FORMAT_INDEXED16 &&
|
||||
scrconfig->format != BITMAP_FORMAT_RGB15 &&
|
||||
scrconfig->format != BITMAP_FORMAT_RGB32)
|
||||
{
|
||||
mame_printf_error("%s: %s screen \"%s\" has unsupported format\n", driver->source_file, driver->name, device->tag);
|
||||
error = TRUE;
|
||||
}
|
||||
if (scrconfig->defstate.format == BITMAP_FORMAT_INDEXED16)
|
||||
if (scrconfig->format == BITMAP_FORMAT_INDEXED16)
|
||||
palette_modes = TRUE;
|
||||
}
|
||||
|
||||
/* check for zero frame rate */
|
||||
if (scrconfig->defstate.refresh == 0)
|
||||
if (scrconfig->refresh == 0)
|
||||
{
|
||||
mame_printf_error("%s: %s screen \"%s\" has a zero refresh rate\n", driver->source_file, driver->name, device->tag);
|
||||
error = TRUE;
|
||||
|
@ -57,15 +57,16 @@ struct _internal_screen_state
|
||||
bitmap_t * bitmap[2]; /* 2x bitmaps for rendering */
|
||||
UINT8 curbitmap; /* current bitmap index */
|
||||
UINT8 curtexture; /* current texture index */
|
||||
bitmap_format format; /* format of bitmap for this screen */
|
||||
bitmap_format texture_format; /* texture format of bitmap for this screen */
|
||||
UINT8 changed; /* has this bitmap changed? */
|
||||
INT32 last_partial_scan; /* scanline of last partial update */
|
||||
UINT8 vblank_state; /* 1 = in VBLANK region, 0 = outside */
|
||||
|
||||
/* screen timing */
|
||||
attoseconds_t scantime; /* attoseconds per scanline */
|
||||
attoseconds_t pixeltime; /* attoseconds per pixel */
|
||||
attoseconds_t vblank_period; /* attoseconds per VBLANK period */
|
||||
attotime vblank_time; /* time of last VBLANK start */
|
||||
UINT8 vblank_state; /* 1 = in VBLANK region, 0 = outside */
|
||||
emu_timer * vblank_begin_timer; /* timer to signal VBLANK start */
|
||||
emu_timer * vblank_end_timer; /* timer to signal VBLANK end */
|
||||
emu_timer * scanline0_timer; /* scanline 0 timer */
|
||||
@ -312,17 +313,20 @@ void video_init(running_machine *machine)
|
||||
/* request a callback upon exiting */
|
||||
add_exit_callback(machine, video_exit);
|
||||
|
||||
/* configure all of the screens */
|
||||
for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device))
|
||||
{
|
||||
char unique_tag[40];
|
||||
|
||||
int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, device->tag);
|
||||
|
||||
render_container *container = render_container_get_screen(scrnum);
|
||||
screen_config *config = device->inline_config;
|
||||
screen_state *state = &machine->screen[scrnum];
|
||||
|
||||
/* allocate the private state */
|
||||
/* allocate the private state and hook it up to the public structure */
|
||||
internal_screen_state *internal_state = auto_malloc(sizeof(*internal_state));
|
||||
memset(internal_state, 0, sizeof(*internal_state));
|
||||
state->private_data = internal_state;
|
||||
|
||||
/* allocate the VBLANK timers */
|
||||
internal_state->vblank_begin_timer = timer_alloc(vblank_begin_callback, state);
|
||||
@ -335,11 +339,9 @@ void video_init(running_machine *machine)
|
||||
internal_state->scrnum = scrnum;
|
||||
internal_state->device = device;
|
||||
|
||||
/* hook up our private state structure */
|
||||
state->private_data = internal_state;
|
||||
|
||||
/* configure the screen with the default parameters */
|
||||
video_screen_configure(scrnum, state->width, state->height, &state->visarea, state->refresh);
|
||||
state->format = config->format;
|
||||
video_screen_configure(scrnum, config->width, config->height, &config->visarea, config->refresh);
|
||||
|
||||
/* configure the default cliparea */
|
||||
if (config->xoffset != 0)
|
||||
@ -362,9 +364,12 @@ void video_init(running_machine *machine)
|
||||
}
|
||||
|
||||
/* register for save states */
|
||||
state_save_register_item("video", scrnum, internal_state->vblank_time.seconds);
|
||||
state_save_register_item("video", scrnum, internal_state->vblank_time.attoseconds);
|
||||
state_save_register_item("video", scrnum, internal_state->frame_number);
|
||||
assert(strlen(device->tag) < 30);
|
||||
state_save_combine_module_and_tag(unique_tag, "video_screen", device->tag);
|
||||
|
||||
state_save_register_item(unique_tag, 0, internal_state->vblank_time.seconds);
|
||||
state_save_register_item(unique_tag, 0, internal_state->vblank_time.attoseconds);
|
||||
state_save_register_item(unique_tag, 0, internal_state->frame_number);
|
||||
}
|
||||
|
||||
/* create spriteram buffers if necessary */
|
||||
@ -717,13 +722,12 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle *
|
||||
curwidth = MAX(width, curwidth);
|
||||
curheight = MAX(height, curheight);
|
||||
|
||||
/* choose the texture format */
|
||||
/* convert the screen format to a texture format */
|
||||
/* choose the texture format - convert the screen format to a texture format */
|
||||
switch (screen_format)
|
||||
{
|
||||
case BITMAP_FORMAT_INDEXED16: internal_state->format = TEXFORMAT_PALETTE16; break;
|
||||
case BITMAP_FORMAT_RGB15: internal_state->format = TEXFORMAT_RGB15; break;
|
||||
case BITMAP_FORMAT_RGB32: internal_state->format = TEXFORMAT_RGB32; break;
|
||||
case BITMAP_FORMAT_INDEXED16: internal_state->texture_format = TEXFORMAT_PALETTE16; break;
|
||||
case BITMAP_FORMAT_RGB15: internal_state->texture_format = TEXFORMAT_RGB15; break;
|
||||
case BITMAP_FORMAT_RGB32: internal_state->texture_format = TEXFORMAT_RGB32; break;
|
||||
default: fatalerror("Invalid bitmap format!"); break;
|
||||
}
|
||||
|
||||
@ -735,9 +739,9 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle *
|
||||
|
||||
/* allocate textures */
|
||||
internal_state->texture[0] = render_texture_alloc(NULL, NULL);
|
||||
render_texture_set_bitmap(internal_state->texture[0], internal_state->bitmap[0], visarea, 0, internal_state->format);
|
||||
render_texture_set_bitmap(internal_state->texture[0], internal_state->bitmap[0], visarea, 0, internal_state->texture_format);
|
||||
internal_state->texture[1] = render_texture_alloc(NULL, NULL);
|
||||
render_texture_set_bitmap(internal_state->texture[1], internal_state->bitmap[1], visarea, 0, internal_state->format);
|
||||
render_texture_set_bitmap(internal_state->texture[1], internal_state->bitmap[1], visarea, 0, internal_state->texture_format);
|
||||
}
|
||||
}
|
||||
|
||||
@ -751,6 +755,13 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle *
|
||||
internal_state->scantime = refresh / height;
|
||||
internal_state->pixeltime = refresh / (height * width);
|
||||
|
||||
/* if there has been no VBLANK time specified in the MACHINE_DRIVER, compute it now
|
||||
from the visible area, otherwise just used the supplied value */
|
||||
if ((scrconfig->vblank == 0) && !scrconfig->oldstyle_vblank_supplied)
|
||||
internal_state->vblank_period = (state->refresh / state->height) * (state->height - (state->visarea.max_y + 1 - state->visarea.min_y));
|
||||
else
|
||||
internal_state->vblank_period = scrconfig->vblank;
|
||||
|
||||
/* adjust speed if necessary */
|
||||
if (global.refresh_speed)
|
||||
{
|
||||
@ -1239,7 +1250,6 @@ DEVICE_GET_INFO( video_screen )
|
||||
static TIMER_CALLBACK( vblank_begin_callback )
|
||||
{
|
||||
int i;
|
||||
attoseconds_t vblank_period;
|
||||
screen_state *state = ptr;
|
||||
internal_screen_state *internal_state = (internal_screen_state *)state->private_data;
|
||||
|
||||
@ -1262,16 +1272,9 @@ static TIMER_CALLBACK( vblank_begin_callback )
|
||||
if (!(machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) && (internal_state->scrnum == 0))
|
||||
video_frame_update(machine, FALSE);
|
||||
|
||||
/* if there has been no VBLANK time specified in the MACHINE_DRIVER, compute it now
|
||||
from the visible area, otherwise just used the supplied value */
|
||||
if ((state->vblank == 0) && !state->oldstyle_vblank_supplied)
|
||||
vblank_period = (state->refresh / state->height) * (state->height - (state->visarea.max_y + 1 - state->visarea.min_y));
|
||||
else
|
||||
vblank_period = state->vblank;
|
||||
|
||||
/* reset the timers */
|
||||
timer_adjust_oneshot(internal_state->vblank_begin_timer, attotime_make(0, state->refresh), 0);
|
||||
timer_adjust_oneshot(internal_state->vblank_end_timer, attotime_make(0, vblank_period), 0);
|
||||
timer_adjust_oneshot(internal_state->vblank_end_timer, attotime_make(0, internal_state->vblank_period), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1453,7 +1456,7 @@ static int finish_screen_updates(running_machine *machine)
|
||||
rectangle fixedvis = machine->screen[scrnum].visarea;
|
||||
fixedvis.max_x++;
|
||||
fixedvis.max_y++;
|
||||
render_texture_set_bitmap(internal_state->texture[internal_state->curbitmap], bitmap, &fixedvis, 0, internal_state->format);
|
||||
render_texture_set_bitmap(internal_state->texture[internal_state->curbitmap], bitmap, &fixedvis, 0, internal_state->texture_format);
|
||||
internal_state->curtexture = internal_state->curbitmap;
|
||||
internal_state->curbitmap = 1 - internal_state->curbitmap;
|
||||
}
|
||||
|
@ -64,12 +64,10 @@ enum
|
||||
typedef struct _screen_state screen_state;
|
||||
struct _screen_state
|
||||
{
|
||||
int width, height; /* total width/height (HTOTAL, VTOTAL) */
|
||||
rectangle visarea; /* visible area (HBLANK end/start, VBLANK end/start) */
|
||||
UINT8 oldstyle_vblank_supplied; /* MDRV_SCREEN_VBLANK_TIME macro used */
|
||||
attoseconds_t refresh; /* refresh period */
|
||||
attoseconds_t vblank; /* duration of a VBLANK */
|
||||
bitmap_format format; /* bitmap format */
|
||||
int width, height; /* current total width/height (HTOTAL, VTOTAL) */
|
||||
rectangle visarea; /* current visible area (HBLANK end/start, VBLANK end/start) */
|
||||
attoseconds_t refresh; /* current refresh period */
|
||||
bitmap_format format; /* bitmap format (a copy of screen_config) */
|
||||
void * private_data; /* pointer to the private data structure */
|
||||
};
|
||||
|
||||
@ -83,7 +81,12 @@ typedef struct _screen_config screen_config;
|
||||
struct _screen_config
|
||||
{
|
||||
int type; /* type of screen */
|
||||
screen_state defstate; /* default state */
|
||||
int width, height; /* default total width/height (HTOTAL, VTOTAL) */
|
||||
rectangle visarea; /* default visible area (HBLANK end/start, VBLANK end/start) */
|
||||
UINT8 oldstyle_vblank_supplied; /* MDRV_SCREEN_VBLANK_TIME macro used */
|
||||
attoseconds_t refresh; /* default refresh period */
|
||||
attoseconds_t vblank; /* duration of a VBLANK */
|
||||
bitmap_format format; /* bitmap format */
|
||||
float xoffset, yoffset; /* default X/Y offsets */
|
||||
float xscale, yscale; /* default X/Y scale factor */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user