Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
authorPatrice Mandin <patmandin@gmail.com>
Sat, 07 Feb 2004 11:25:56 +0000
changeset 801 ff1058d642dc
parent 800 60a4293ffea9
child 802 3c609d54f100
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
src/video/xbios/SDL_xbios.c
--- a/src/video/xbios/SDL_xbios.c	Fri Feb 06 22:53:32 2004 +0000
+++ b/src/video/xbios/SDL_xbios.c	Sat Feb 07 11:25:56 2004 +0000
@@ -93,21 +93,21 @@
 static int xbiosnummodes_f30rvb=16;
 static xbiosmode_t xbiosmodelist_f30rvb[]={
 	{BPS16|COL80|OVERSCAN|VERTFLAG,768,480,16,SDL_FALSE},
+	{BPS16|OVERSCAN|VERTFLAG,384,480,16,SDL_FALSE},
+	{BPS16|COL80|VERTFLAG,640,400,16,SDL_FALSE},
+	{BPS16|VERTFLAG,320,400,16,SDL_FALSE},
 	{BPS16|COL80|OVERSCAN,768,240,16,SDL_FALSE},
-	{BPS16|COL80|VERTFLAG,640,400,16,SDL_FALSE},
+	{BPS16|OVERSCAN,384,240,16,SDL_FALSE},
 	{BPS16|COL80,640,200,16,SDL_FALSE},
-	{BPS16|OVERSCAN|VERTFLAG,384,480,16,SDL_FALSE},
-	{BPS16|OVERSCAN,384,240,16,SDL_FALSE},
-	{BPS16|VERTFLAG,320,400,16,SDL_FALSE},
 	{BPS16,320,200,16,SDL_FALSE},
 
 	{BPS8|COL80|OVERSCAN|VERTFLAG,768,480,8,SDL_FALSE},
+	{BPS8|OVERSCAN|VERTFLAG,384,480,8,SDL_FALSE},
+	{BPS8|COL80|VERTFLAG,640,400,8,SDL_FALSE},
+	{BPS8|VERTFLAG,320,400,8,SDL_FALSE},
 	{BPS8|COL80|OVERSCAN,768,240,8,SDL_FALSE},
-	{BPS8|COL80|VERTFLAG,640,400,8,SDL_FALSE},
+	{BPS8|OVERSCAN,384,240,8,SDL_FALSE},
 	{BPS8|COL80,640,200,8,SDL_FALSE},
-	{BPS8|OVERSCAN|VERTFLAG,384,480,8,SDL_FALSE},
-	{BPS8|OVERSCAN,384,240,8,SDL_FALSE},
-	{BPS8|VERTFLAG,320,400,8,SDL_FALSE},
 	{BPS8,320,200,8,SDL_FALSE}
 };
 
@@ -118,8 +118,8 @@
 	{BPS16|VERTFLAG,320,240,16,SDL_FALSE},
 
 	{BPS8|COL80,640,480,8,SDL_FALSE},	
+	{BPS8,320,480,8,SDL_FALSE},
 	{BPS8|COL80|VERTFLAG,640,240,8,SDL_FALSE},
-	{BPS8,320,480,8,SDL_FALSE},
 	{BPS8|VERTFLAG,320,240,8,SDL_FALSE}
 };
 
@@ -437,8 +437,13 @@
 	/* Free current buffers */
 	XBIOS_FreeBuffers(this);
 
+	/* Limit bpp */
+	if (bpp>16) {
+		bpp = 16;
+	}
+	bpp >>= 4;
+
 	/* Search if the mode exists (width, height, bpp) */
-	bpp >>= 4;
 	for ( mode=0; SDL_modelist[bpp][mode]; ++mode ) {
 		if ( (SDL_modelist[bpp][mode]->w == width) &&
 		     (SDL_modelist[bpp][mode]->h == height) ) {
@@ -785,6 +790,7 @@
 	Atari_ShutdownEvents();
 
 	/* Restore video mode and palette */
+#ifndef DEBUG_VIDEO_XBIOS
 	switch(XBIOS_cvdo >> 16) {
 		case VDO_ST:
 		case VDO_STE:
@@ -809,6 +815,7 @@
 			break;
 	}
 	Vsync();
+#endif
 
 	if (XBIOS_oldpalette) {
 		free(XBIOS_oldpalette);