Skip to content

Commit

Permalink
Add Centscreen extended modes support
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed May 31, 2005
1 parent a9d3f68 commit 8c056b9
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 16 deletions.
7 changes: 3 additions & 4 deletions README.MiNT
Expand Up @@ -141,8 +141,8 @@ OpenGL:
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.
Expand All @@ -156,8 +156,7 @@ Xbios video:
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.

Expand Down
19 changes: 15 additions & 4 deletions src/video/xbios/SDL_xbios.c
Expand Up @@ -283,6 +283,7 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
/* 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:
Expand Down Expand Up @@ -411,14 +412,16 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
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;
}

Expand Down Expand Up @@ -680,7 +683,11 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current,
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;
}
Expand Down Expand Up @@ -892,7 +899,11 @@ static void XBIOS_VideoQuit(_THIS)
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);
}
Expand Down
3 changes: 3 additions & 0 deletions src/video/xbios/SDL_xbios.h
Expand Up @@ -70,6 +70,8 @@ struct SDL_PrivateVideoData {
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];
};
Expand Down Expand Up @@ -123,6 +125,7 @@ enum {
#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 ---*/

Expand Down
59 changes: 53 additions & 6 deletions src/video/xbios/SDL_xbios_centscreen.c
Expand Up @@ -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) {
Expand All @@ -44,10 +47,54 @@ void SDL_XBIOS_CentscreenInit(_THIS)
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);
}
4 changes: 3 additions & 1 deletion src/video/xbios/SDL_xbios_centscreen.h
Expand Up @@ -110,6 +110,8 @@ typedef struct {

/*--- 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 */
3 changes: 2 additions & 1 deletion src/video/xbios/SDL_xbios_sb3.c
Expand Up @@ -28,6 +28,8 @@

/*--- Includes ---*/

#include <stdlib.h>

#include "SDL_xbios.h"
#include "SDL_xbios_sb3.h"

Expand Down Expand Up @@ -63,7 +65,6 @@ int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn)

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 */
Expand Down

0 comments on commit 8c056b9

Please sign in to comment.