Mercurial > sdl-ios-xcode
changeset 1064:fba6b67b4d60
Add Centscreen extended modes support
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Tue, 31 May 2005 12:31:11 +0000 |
parents | 0fb50bfaea7f |
children | 5d9947da7510 |
files | README.MiNT src/video/xbios/SDL_xbios.c src/video/xbios/SDL_xbios.h src/video/xbios/SDL_xbios_centscreen.c src/video/xbios/SDL_xbios_centscreen.h src/video/xbios/SDL_xbios_sb3.c |
diffstat | 6 files changed, 79 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/README.MiNT Fri May 20 20:37:28 2005 +0000 +++ b/README.MiNT Tue May 31 12:31:11 2005 +0000 @@ -141,8 +141,8 @@ parameters, in the standard one, it has 6 double parameters. If you want to compile testdyngl, or any other SDL program that loads its OpenGL library, you must change the glOrtho() prototype used in this program. In - osmesa.ldg, you can retrieve a glOrtho() with double parameters, by searching - for the function "glOrtho6d". + osmesa.ldg, you can retrieve a glOrtho() with double parameters, by + searching for the function "glOrtho6d". Xbios video: Video chip is detected using the _VDO cookie. @@ -156,8 +156,7 @@ 320x480x8 and 320x240x8 (software double-lined mode). Falcon: All modes supported by the current monitor (RVB or VGA). - BlowUp extended modes, ScreenBlaster 3 current mode, Centscreen current - mode. + BlowUp and Centscreen extended modes, ScreenBlaster 3 current mode. Clones and any machine with monochrome monitor: Not supported.
--- a/src/video/xbios/SDL_xbios.c Fri May 20 20:37:28 2005 +0000 +++ b/src/video/xbios/SDL_xbios.c Tue May 31 12:31:11 2005 +0000 @@ -283,6 +283,7 @@ /* and save current screen status (palette, screen address, video mode) */ XBIOS_nummodes = 0; XBIOS_modelist = NULL; + XBIOS_centscreen = SDL_FALSE; switch (XBIOS_cvdo >>16) { case VDO_ST: @@ -411,14 +412,16 @@ current_mode++; } - /* Initialize BlowUp or SB3 stuff if present */ + /* Initialize BlowUp/SB3/Centscreen stuff if present */ if (Getcookie(C_BLOW, &cookie_blow) == C_FOUND) { SDL_XBIOS_BlowupInit(this, (blow_cookie_t *)cookie_blow); } else if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) { SDL_XBIOS_SB3Init(this, (scpn_cookie_t *)cookie_scpn); } else if (Getcookie(C_CNTS, &cookie_cnts) == C_FOUND) { - SDL_XBIOS_CentscreenInit(this); + XBIOS_oldvmode = SDL_XBIOS_CentscreenInit(this); + XBIOS_centscreen = SDL_TRUE; } + break; } @@ -680,7 +683,11 @@ break; case VDO_F30: #ifndef DEBUG_VIDEO_XBIOS - Vsetmode(new_video_mode->number); + if (XBIOS_centscreen) { + SDL_XBIOS_CentscreenSetmode(this, width, height, new_depth); + } else { + Vsetmode(new_video_mode->number); + } #endif break; } @@ -892,7 +899,11 @@ break; case VDO_F30: Setscreen(-1, XBIOS_oldvbase, -1); - Vsetmode(XBIOS_oldvmode); + if (XBIOS_centscreen) { + SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode); + } else { + Vsetmode(XBIOS_oldvmode); + } if (XBIOS_oldnumcol) { VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); }
--- a/src/video/xbios/SDL_xbios.h Fri May 20 20:37:28 2005 +0000 +++ b/src/video/xbios/SDL_xbios.h Tue May 31 12:31:11 2005 +0000 @@ -70,6 +70,8 @@ int pitch; /* Destination line width for C2P */ int width, height; /* Screen size for centered C2P */ + SDL_bool centscreen; /* Centscreen extension present ? */ + SDL_Rect *SDL_modelist[NUM_MODELISTS][SDL_NUMMODES+1]; xbiosmode_t *videomodes[NUM_MODELISTS][SDL_NUMMODES+1]; }; @@ -123,6 +125,7 @@ #define XBIOS_pitch (this->hidden->pitch) #define XBIOS_width (this->hidden->width) #define XBIOS_height (this->hidden->height) +#define XBIOS_centscreen (this->hidden->centscreen) /*--- Functions prototypes ---*/
--- a/src/video/xbios/SDL_xbios_centscreen.c Fri May 20 20:37:28 2005 +0000 +++ b/src/video/xbios/SDL_xbios_centscreen.c Tue May 31 12:31:11 2005 +0000 @@ -27,15 +27,18 @@ */ #include <stdlib.h> +#include <string.h> #include <mint/falcon.h> #include "SDL_xbios.h" #include "SDL_xbios_centscreen.h" -void SDL_XBIOS_CentscreenInit(_THIS) +int SDL_XBIOS_CentscreenInit(_THIS) { - centscreen_mode_t curmode; + centscreen_mode_t curmode, listedmode; + unsigned long result; + int cur_handle; /* Current Centscreen mode handle */ /* Reset current mode list */ if (XBIOS_modelist) { @@ -44,10 +47,54 @@ XBIOS_modelist = NULL; } - /* Add current active mode */ + /* Add Centscreen modes */ Vread(&curmode); + cur_handle = curmode.handle; + curmode.mode = curmode.physx = curmode.physy = curmode.plan = + curmode.logx = curmode.logy = -1; - SDL_XBIOS_AddMode(this, -1, curmode.physx, curmode.physy, curmode.plan, - SDL_FALSE - ); + result = Vfirst(&curmode, &listedmode); + if (result==0) { + while (result==0) { + /* Don't add modes with virtual screen */ + if ((listedmode.mode & CSCREEN_VIRTUAL)==0) { + /* Don't add modes with bpp<8 */ + if (listedmode.plan>=8) { + SDL_XBIOS_AddMode(this, listedmode.mode, listedmode.physx, + listedmode.physy, listedmode.plan, SDL_FALSE + ); + } + } + memcpy(&curmode, &listedmode, sizeof(centscreen_mode_t)); + curmode.mode = curmode.physx = curmode.physy = curmode.plan = + curmode.logx = curmode.logy = -1; + result = Vnext(&curmode, &listedmode); + } + } else { + fprintf(stderr, "No suitable Centscreen modes\n"); + } + + return cur_handle; } + +void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes) +{ + centscreen_mode_t newmode, curmode; + + newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1; + newmode.physx = width; + newmode.physy = height; + newmode.plan = planes; + Vwrite(0, &newmode, &curmode); +} + +void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle) +{ + centscreen_mode_t newmode, curmode; + + /* Restore old video mode */ + newmode.handle = prev_handle; + newmode.mode = newmode.physx = newmode.physy = newmode.plan = + newmode.logx = newmode.logy = -1; + Vwrite(0, &newmode, &curmode); +}
--- a/src/video/xbios/SDL_xbios_centscreen.h Fri May 20 20:37:28 2005 +0000 +++ b/src/video/xbios/SDL_xbios_centscreen.h Tue May 31 12:31:11 2005 +0000 @@ -110,6 +110,8 @@ /*--- Functions prototypes ---*/ -void SDL_XBIOS_CentscreenInit(_THIS); +int SDL_XBIOS_CentscreenInit(_THIS); +void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes); +void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle); #endif /* _SDL_xbios_centscreen_h */
--- a/src/video/xbios/SDL_xbios_sb3.c Fri May 20 20:37:28 2005 +0000 +++ b/src/video/xbios/SDL_xbios_sb3.c Tue May 31 12:31:11 2005 +0000 @@ -28,6 +28,8 @@ /*--- Includes ---*/ +#include <stdlib.h> + #include "SDL_xbios.h" #include "SDL_xbios_sb3.h" @@ -63,7 +65,6 @@ void SDL_XBIOS_SB3Init(_THIS, scpn_cookie_t *cookie_scpn) { - xbiosmode_t *current_mode; scpn_screeninfo_t *scrinfo; /* SB3 prevent changing video modes, we can only use current one */