diff src/video/xbios/SDL_xbios_blowup.c @ 1042:0e7218843cfb

Dynamically create list of video modes, easier to add new ones
author Patrice Mandin <patmandin@gmail.com>
date Mon, 07 Mar 2005 10:00:58 +0000
parents c6ed27c7d47d
children d910939febfa
line wrap: on
line diff
--- a/src/video/xbios/SDL_xbios_blowup.c	Wed Mar 02 17:17:26 2005 +0000
+++ b/src/video/xbios/SDL_xbios_blowup.c	Mon Mar 07 10:00:58 2005 +0000
@@ -26,68 +26,44 @@
 	Patrice Mandin
 */
 
+#include <mint/falcon.h>
+
 #include "SDL_xbios.h"
 #include "SDL_xbios_blowup.h"
 
 void SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t *cookie_blow)
 {
-	int i, num_mode, bank, keep_old;
-	xbiosmode_t *current_mode;
+	int i, num_mode, bank;
 	blow_mode_t *blow_mode;
 
-	current_mode = XBIOS_modelist;
+	/* Add bit 15 for old modes */
 	for (i=0;i<XBIOS_nummodes;i++) {
-		keep_old=1;	/* use default mode */
-		blow_mode = NULL;
-		switch (current_mode->depth) {
-			case 1:
-				num_mode=0;
-				break;
-			case 2:
-				num_mode=1;
-				break;
-			case 4:
-				num_mode=2;
-				break;
-			case 8:
-				num_mode=3;
-				break;
-			case 16:
-				num_mode=4;
-				break;
-			default:
-				num_mode=-1;
-				break;
-		}
+		XBIOS_modelist[i].number |= 1<<15;
+	}
+
+	/* Add Blowup modes for 8 and 16 bpp */
+	for (num_mode=3; num_mode<5; num_mode++) {
+		bank = cookie_blow->num_mode[num_mode];
+		blow_mode = &(cookie_blow->blowup_modes[num_mode+(bank*5)]);
 
-		/* Check which bank of modes to use */
-		if (num_mode>=0) {
-			bank = cookie_blow->num_mode[num_mode];
-			blow_mode = &(cookie_blow->blowup_modes[num_mode+(bank*5)]);
-	
-			/* Check extended mode enabled */
-			if (blow_mode->enabled == 0) {
-				/* Check monitor needed for this mode */
-				if ((blow_mode->monitor == cookie_blow->montype)
-					|| ((blow_mode->monitor == MONITOR_TV)
-						&& (cookie_blow->montype == MONITOR_RGB))
-					|| ((blow_mode->monitor == MONITOR_RGB)
-						&& (cookie_blow->montype == MONITOR_TV)))
-				{
-					keep_old = 0; /* we can use this extended mode */
-				}
+		/* Check extended mode enabled */
+		if (blow_mode->enabled == 0) {
+			/* Check monitor needed for this mode */
+			if ((blow_mode->monitor == cookie_blow->montype)
+				|| ((blow_mode->monitor == MONITOR_TV)
+					&& (cookie_blow->montype == MONITOR_RGB))
+				|| ((blow_mode->monitor == MONITOR_RGB)
+					&& (cookie_blow->montype == MONITOR_TV)))
+			{
+				/* we can use this extended mode */
+				SDL_XBIOS_AddMode(this,
+					num_mode == 3 ? BPS8 : BPS16,
+					blow_mode->width + 1,
+					blow_mode->height + 1,
+					num_mode == 3 ? 8 : 16,
+					SDL_FALSE
+				);
 			}
 		}
-
-		if (keep_old) {
-			/* disable blowup for this mode */
-			current_mode->number |= (1<<15);	
-		} else {
-			/* Update mode size */
-			current_mode->width = blow_mode->width +1;
-			current_mode->height = blow_mode->height +1;
-		}
-
-		current_mode++;
 	}
 }