Commit bb02e319 authored by Patrice Mandin's avatar Patrice Mandin

Add Centscreen extended modes support

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401065
parent b9094f71
...@@ -141,8 +141,8 @@ OpenGL: ...@@ -141,8 +141,8 @@ OpenGL:
parameters, in the standard one, it has 6 double parameters. If you want 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 to compile testdyngl, or any other SDL program that loads its OpenGL
library, you must change the glOrtho() prototype used in this program. In library, you must change the glOrtho() prototype used in this program. In
osmesa.ldg, you can retrieve a glOrtho() with double parameters, by searching osmesa.ldg, you can retrieve a glOrtho() with double parameters, by
for the function "glOrtho6d". searching for the function "glOrtho6d".
Xbios video: Xbios video:
Video chip is detected using the _VDO cookie. Video chip is detected using the _VDO cookie.
...@@ -156,8 +156,7 @@ Xbios video: ...@@ -156,8 +156,7 @@ Xbios video:
320x480x8 and 320x240x8 (software double-lined mode). 320x480x8 and 320x240x8 (software double-lined mode).
Falcon: Falcon:
All modes supported by the current monitor (RVB or VGA). All modes supported by the current monitor (RVB or VGA).
BlowUp extended modes, ScreenBlaster 3 current mode, Centscreen current BlowUp and Centscreen extended modes, ScreenBlaster 3 current mode.
mode.
Clones and any machine with monochrome monitor: Clones and any machine with monochrome monitor:
Not supported. Not supported.
......
...@@ -283,6 +283,7 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -283,6 +283,7 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
/* and save current screen status (palette, screen address, video mode) */ /* and save current screen status (palette, screen address, video mode) */
XBIOS_nummodes = 0; XBIOS_nummodes = 0;
XBIOS_modelist = NULL; XBIOS_modelist = NULL;
XBIOS_centscreen = SDL_FALSE;
switch (XBIOS_cvdo >>16) { switch (XBIOS_cvdo >>16) {
case VDO_ST: case VDO_ST:
...@@ -411,14 +412,16 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -411,14 +412,16 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
current_mode++; current_mode++;
} }
/* Initialize BlowUp or SB3 stuff if present */ /* Initialize BlowUp/SB3/Centscreen stuff if present */
if (Getcookie(C_BLOW, &cookie_blow) == C_FOUND) { if (Getcookie(C_BLOW, &cookie_blow) == C_FOUND) {
SDL_XBIOS_BlowupInit(this, (blow_cookie_t *)cookie_blow); SDL_XBIOS_BlowupInit(this, (blow_cookie_t *)cookie_blow);
} else if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) { } else if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) {
SDL_XBIOS_SB3Init(this, (scpn_cookie_t *)cookie_scpn); SDL_XBIOS_SB3Init(this, (scpn_cookie_t *)cookie_scpn);
} else if (Getcookie(C_CNTS, &cookie_cnts) == C_FOUND) { } else if (Getcookie(C_CNTS, &cookie_cnts) == C_FOUND) {
SDL_XBIOS_CentscreenInit(this); XBIOS_oldvmode = SDL_XBIOS_CentscreenInit(this);
XBIOS_centscreen = SDL_TRUE;
} }
break; break;
} }
...@@ -680,7 +683,11 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -680,7 +683,11 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current,
break; break;
case VDO_F30: case VDO_F30:
#ifndef DEBUG_VIDEO_XBIOS #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 #endif
break; break;
} }
...@@ -892,7 +899,11 @@ static void XBIOS_VideoQuit(_THIS) ...@@ -892,7 +899,11 @@ static void XBIOS_VideoQuit(_THIS)
break; break;
case VDO_F30: case VDO_F30:
Setscreen(-1, XBIOS_oldvbase, -1); Setscreen(-1, XBIOS_oldvbase, -1);
Vsetmode(XBIOS_oldvmode); if (XBIOS_centscreen) {
SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode);
} else {
Vsetmode(XBIOS_oldvmode);
}
if (XBIOS_oldnumcol) { if (XBIOS_oldnumcol) {
VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
} }
......
...@@ -70,6 +70,8 @@ struct SDL_PrivateVideoData { ...@@ -70,6 +70,8 @@ struct SDL_PrivateVideoData {
int pitch; /* Destination line width for C2P */ int pitch; /* Destination line width for C2P */
int width, height; /* Screen size for centered C2P */ int width, height; /* Screen size for centered C2P */
SDL_bool centscreen; /* Centscreen extension present ? */
SDL_Rect *SDL_modelist[NUM_MODELISTS][SDL_NUMMODES+1]; SDL_Rect *SDL_modelist[NUM_MODELISTS][SDL_NUMMODES+1];
xbiosmode_t *videomodes[NUM_MODELISTS][SDL_NUMMODES+1]; xbiosmode_t *videomodes[NUM_MODELISTS][SDL_NUMMODES+1];
}; };
...@@ -123,6 +125,7 @@ enum { ...@@ -123,6 +125,7 @@ enum {
#define XBIOS_pitch (this->hidden->pitch) #define XBIOS_pitch (this->hidden->pitch)
#define XBIOS_width (this->hidden->width) #define XBIOS_width (this->hidden->width)
#define XBIOS_height (this->hidden->height) #define XBIOS_height (this->hidden->height)
#define XBIOS_centscreen (this->hidden->centscreen)
/*--- Functions prototypes ---*/ /*--- Functions prototypes ---*/
......
...@@ -27,15 +27,18 @@ ...@@ -27,15 +27,18 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <mint/falcon.h> #include <mint/falcon.h>
#include "SDL_xbios.h" #include "SDL_xbios.h"
#include "SDL_xbios_centscreen.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 */ /* Reset current mode list */
if (XBIOS_modelist) { if (XBIOS_modelist) {
...@@ -44,10 +47,54 @@ void SDL_XBIOS_CentscreenInit(_THIS) ...@@ -44,10 +47,54 @@ void SDL_XBIOS_CentscreenInit(_THIS)
XBIOS_modelist = NULL; XBIOS_modelist = NULL;
} }
/* Add current active mode */ /* Add Centscreen modes */
Vread(&curmode); 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, result = Vfirst(&curmode, &listedmode);
SDL_FALSE 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);
} }
...@@ -110,6 +110,8 @@ typedef struct { ...@@ -110,6 +110,8 @@ typedef struct {
/*--- Functions prototypes ---*/ /*--- 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 */ #endif /* _SDL_xbios_centscreen_h */
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
/*--- Includes ---*/ /*--- Includes ---*/
#include <stdlib.h>
#include "SDL_xbios.h" #include "SDL_xbios.h"
#include "SDL_xbios_sb3.h" #include "SDL_xbios_sb3.h"
...@@ -63,7 +65,6 @@ int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn) ...@@ -63,7 +65,6 @@ int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn)
void SDL_XBIOS_SB3Init(_THIS, scpn_cookie_t *cookie_scpn) void SDL_XBIOS_SB3Init(_THIS, scpn_cookie_t *cookie_scpn)
{ {
xbiosmode_t *current_mode;
scpn_screeninfo_t *scrinfo; scpn_screeninfo_t *scrinfo;
/* SB3 prevent changing video modes, we can only use current one */ /* SB3 prevent changing video modes, we can only use current one */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment