Added initial support for TV output modes
authorSam Lantinga <slouken@libsdl.org>
Wed, 01 Aug 2001 05:01:08 +0000
changeset 1350bfcf0d2b874
parent 134 f1550e1c4916
child 136 717f739d6ec1
Added initial support for TV output modes
src/video/ps2gs/SDL_gsvideo.c
     1.1 --- a/src/video/ps2gs/SDL_gsvideo.c	Wed Aug 01 03:23:40 2001 +0000
     1.2 +++ b/src/video/ps2gs/SDL_gsvideo.c	Wed Aug 01 05:01:08 2001 +0000
     1.3 @@ -261,11 +261,13 @@
     1.4  		SDL_SetError("Couldn't get console pixel format");
     1.5  		return(-1);
     1.6  	}
     1.7 +#if 0
     1.8  	if ( vinfo.mode != PS2_GS_VESA ) {
     1.9  		GS_VideoQuit(this);
    1.10  		SDL_SetError("Console must be in VESA video mode");
    1.11  		return(-1);
    1.12  	}
    1.13 +#endif
    1.14  	switch (vinfo.psm) {
    1.15  	    /* Supported pixel formats */
    1.16  	    case PS2_GS_PSMCT32:
    1.17 @@ -306,30 +308,42 @@
    1.18  
    1.19  static SDL_Rect **GS_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
    1.20  {
    1.21 -	static SDL_Rect GS_mode_list[] = {
    1.22 +	static SDL_Rect GS_tvout_mode;
    1.23 +	static SDL_Rect *GS_tvout_modes[] = {
    1.24 +		&GS_tvout_mode,
    1.25 +		NULL
    1.26 +	};
    1.27 +	static SDL_Rect GS_vesa_mode_list[] = {
    1.28  		{ 0, 0, 1280, 1024 },
    1.29  		{ 0, 0, 1024, 768 },
    1.30  		{ 0, 0, 800, 600 },
    1.31  		{ 0, 0, 640, 480 }
    1.32  	};
    1.33 -	static SDL_Rect *GS_modes[] = {
    1.34 -		&GS_mode_list[0],
    1.35 -		&GS_mode_list[1],
    1.36 -		&GS_mode_list[2],
    1.37 -		&GS_mode_list[3],
    1.38 +	static SDL_Rect *GS_vesa_modes[] = {
    1.39 +		&GS_vesa_mode_list[0],
    1.40 +		&GS_vesa_mode_list[1],
    1.41 +		&GS_vesa_mode_list[2],
    1.42 +		&GS_vesa_mode_list[3],
    1.43  		NULL
    1.44  	};
    1.45 -	SDL_Rect **modes;
    1.46 +	SDL_Rect **modes = NULL;
    1.47  
    1.48 -	switch (format->BitsPerPixel) {
    1.49 -	    case 16:
    1.50 -	    case 24:
    1.51 -	    case 32:
    1.52 -		modes = GS_modes;
    1.53 -		break;
    1.54 -	    default:
    1.55 -		modes = NULL;
    1.56 -		break;
    1.57 +	if ( saved_vinfo.mode == PS2_GS_VESA ) {
    1.58 +		switch (format->BitsPerPixel) {
    1.59 +		    case 16:
    1.60 +		    case 24:
    1.61 +		    case 32:
    1.62 +			modes = GS_vesa_modes;
    1.63 +			break;
    1.64 +		    default:
    1.65 +			break;
    1.66 +		}
    1.67 +	} else {
    1.68 +		if ( GS_formatmap[format->BitsPerPixel/8] == saved_vinfo.psm ) {
    1.69 +			GS_tvout_mode.w = saved_vinfo.w;
    1.70 +			GS_tvout_mode.h = saved_vinfo.h;
    1.71 +			modes = GS_tvout_modes;
    1.72 +		}
    1.73  	}
    1.74  	return(modes);
    1.75  }