Better driver failure behavior.

This commit is contained in:
Brandon Wright 2018-10-15 14:54:36 -05:00
parent 34268314c4
commit 02ce1fcb35
2 changed files with 15 additions and 12 deletions

View File

@ -1708,7 +1708,6 @@ S9xInitDriver (void)
{
if (gui_config->hw_accel > 0)
{
driver->deinit ();
delete driver;
gui_config->hw_accel = HWA_NONE;

View File

@ -243,15 +243,6 @@ S9xXVDisplayDriver::init (void)
GdkScreen *screen;
GdkWindow *root;
buffer[0] = malloc (image_padded_size);
buffer[1] = malloc (scaled_padded_size);
padded_buffer[0] = (void *) (((uint8 *) buffer[0]) + image_padded_offset);
padded_buffer[1] = (void *) (((uint8 *) buffer[1]) + scaled_padded_offset);
memset (buffer[0], 0, image_padded_size);
memset (buffer[1], 0, scaled_padded_size);
/* Setup XV */
gtk_widget_realize (drawing_area);
@ -310,7 +301,7 @@ S9xXVDisplayDriver::init (void)
}
/* Try to find an RGB format */
format = FOURCC_YUY2;
format = -1;
bpp = 100;
formats = XvListImageFormats (display,
@ -350,12 +341,13 @@ S9xXVDisplayDriver::init (void)
}
}
if (format == FOURCC_YUY2)
if (format == -1)
{
for (int i = 0; i < num_formats; i++)
{
if (formats[i].id == FOURCC_YUY2)
{
format = formats[i].id;
depth = formats[i].depth;
if (formats[i].byte_order == LSBFirst)
@ -380,6 +372,9 @@ S9xXVDisplayDriver::init (void)
free (formats);
if (format == -1)
return -1;
/* Build a table for yuv conversion */
if (format == FOURCC_YUY2)
{
@ -459,6 +454,15 @@ S9xXVDisplayDriver::init (void)
desired_width = scaled_max_width;
desired_height = scaled_max_width;
buffer[0] = malloc (image_padded_size);
buffer[1] = malloc (scaled_padded_size);
padded_buffer[0] = (void *) (((uint8 *) buffer[0]) + image_padded_offset);
padded_buffer[1] = (void *) (((uint8 *) buffer[1]) + scaled_padded_offset);
memset (buffer[0], 0, image_padded_size);
memset (buffer[1], 0, scaled_padded_size);
clear_buffers ();
/* Give Snes9x core a pointer to draw on */