Commit b8493a11 authored by Patrice Mandin's avatar Patrice Mandin

Pfiou, all of it to update, faster to rewrite from scratch?

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402100
parent c55e1b3f
...@@ -63,7 +63,10 @@ ...@@ -63,7 +63,10 @@
#endif #endif
/* Initialization/Query functions */ /* Initialization/Query functions */
static int XBIOS_VideoInit(_THIS, SDL_PixelFormat * vformat); static int XBIOS_VideoInit(_THIS);
static void XBIOS_VideoQuit(_THIS);
#if 0
static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat * format, static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat * format,
Uint32 flags); Uint32 flags);
static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface * current, static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface * current,
...@@ -71,7 +74,6 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface * current, ...@@ -71,7 +74,6 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface * current,
Uint32 flags); Uint32 flags);
static int XBIOS_SetColors(_THIS, int firstcolor, int ncolors, static int XBIOS_SetColors(_THIS, int firstcolor, int ncolors,
SDL_Color * colors); SDL_Color * colors);
static void XBIOS_VideoQuit(_THIS);
/* Hardware surface functions */ /* Hardware surface functions */
static int XBIOS_AllocHWSurface(_THIS, SDL_Surface * surface); static int XBIOS_AllocHWSurface(_THIS, SDL_Surface * surface);
...@@ -90,6 +92,7 @@ static void XBIOS_GL_SwapBuffers(_THIS); ...@@ -90,6 +92,7 @@ static void XBIOS_GL_SwapBuffers(_THIS);
static unsigned short TT_palette[256]; static unsigned short TT_palette[256];
static unsigned long F30_palette[256]; static unsigned long F30_palette[256];
#endif
/* Xbios driver bootstrap functions */ /* Xbios driver bootstrap functions */
...@@ -150,7 +153,7 @@ XBIOS_CreateDevice(int devindex) ...@@ -150,7 +153,7 @@ XBIOS_CreateDevice(int devindex)
SDL_VideoData *data; SDL_VideoData *data;
/* Initialize all variables that we clean on shutdown */ /* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice)); device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
if (device) { if (device) {
data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
} }
...@@ -166,28 +169,26 @@ XBIOS_CreateDevice(int devindex) ...@@ -166,28 +169,26 @@ XBIOS_CreateDevice(int devindex)
/* Video functions */ /* Video functions */
device->VideoInit = XBIOS_VideoInit; device->VideoInit = XBIOS_VideoInit;
device->VideoQuit = XBIOS_VideoQuit; device->VideoQuit = XBIOS_VideoQuit;
device->ListModes = XBIOS_ListModes;
device->SetVideoMode = XBIOS_SetVideoMode; /* Modes */
device->SetColors = XBIOS_SetColors; device->GetDisplayModes = NULL /*XBIOS_GetDisplayModes*/;
device->UpdateRects = NULL; device->SetDisplayMode = NULL /*XBIOS_SetDisplayMode*/;
device->AllocHWSurface = XBIOS_AllocHWSurface;
device->LockHWSurface = XBIOS_LockHWSurface; /* Events */
device->UnlockHWSurface = XBIOS_UnlockHWSurface; device->PumpEvents = SDL_Atari_PumpEvents;
device->FlipHWSurface = XBIOS_FlipHWSurface;
device->FreeHWSurface = XBIOS_FreeHWSurface;
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
/* OpenGL functions */ /* OpenGL functions */
device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary; device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary;
device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress; device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress;
device->GL_GetAttribute = SDL_AtariGL_GetAttribute; device->GL_CreateContext = NULL;
device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent; device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent;
device->GL_SwapBuffers = XBIOS_GL_SwapBuffers; device->GL_SetSwapInterval = NULL;
device->GL_GetSwapInterval = NULL;
device->GL_SwapWindow = XBIOS_GL_SwapBuffers;
device->GL_DeleteContext = NULL;
#endif #endif
/* Events */
device->PumpEvents = Atari_PumpEvents;
device->free = XBIOS_DeleteDevice; device->free = XBIOS_DeleteDevice;
return device; return device;
...@@ -198,6 +199,7 @@ VideoBootStrap XBIOS_bootstrap = { ...@@ -198,6 +199,7 @@ VideoBootStrap XBIOS_bootstrap = {
XBIOS_Available, XBIOS_CreateDevice XBIOS_Available, XBIOS_CreateDevice
}; };
#if 0
void void
SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height, SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height,
Uint16 depth, SDL_bool flags) Uint16 depth, SDL_bool flags)
...@@ -252,10 +254,14 @@ SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height, ...@@ -252,10 +254,14 @@ SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height,
XBIOS_modelist[curpos].depth = depth; XBIOS_modelist[curpos].depth = depth;
XBIOS_modelist[curpos].doubleline = flags; XBIOS_modelist[curpos].doubleline = flags;
} }
#endif
static int static int
XBIOS_VideoInit(_THIS, SDL_PixelFormat * vformat) XBIOS_VideoInit(_THIS)
{ {
XBIOS_InitModes(_this);
#if 0
int i, j8, j16; int i, j8, j16;
xbiosmode_t *current_mode; xbiosmode_t *current_mode;
unsigned long cookie_blow, cookie_scpn, cookie_cnts; unsigned long cookie_blow, cookie_scpn, cookie_cnts;
...@@ -480,10 +486,86 @@ XBIOS_VideoInit(_THIS, SDL_PixelFormat * vformat) ...@@ -480,10 +486,86 @@ XBIOS_VideoInit(_THIS, SDL_PixelFormat * vformat)
SDL_AtariGL_InitPointers(this); SDL_AtariGL_InitPointers(this);
#endif #endif
/* We're done! */ #endif
return (0); return (0);
} }
static void
XBIOS_VideoQuit(_THIS)
{
/* int i, j;*/
XBIOS_QuitModes(_this);
Atari_ShutdownEvents();
#if 0
/* Restore video mode and palette */
#ifndef DEBUG_VIDEO_XBIOS
switch (XBIOS_cvdo >> 16) {
case VDO_ST:
case VDO_STE:
Setscreen(-1, XBIOS_oldvbase, XBIOS_oldvmode);
if (XBIOS_oldnumcol) {
Setpalette(XBIOS_oldpalette);
}
break;
case VDO_TT:
Setscreen(-1, XBIOS_oldvbase, -1);
EsetShift(XBIOS_oldvmode);
if (XBIOS_oldnumcol) {
EsetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette);
}
break;
case VDO_F30:
Setscreen(-1, XBIOS_oldvbase, -1);
if (XBIOS_centscreen) {
SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode);
} else {
VsetMode(XBIOS_oldvmode);
}
if (XBIOS_oldnumcol) {
VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
}
break;
}
Vsync();
#endif
#if SDL_VIDEO_OPENGL
if (gl_active) {
SDL_AtariGL_Quit(this, SDL_TRUE);
}
#endif
if (XBIOS_oldpalette) {
SDL_free(XBIOS_oldpalette);
XBIOS_oldpalette = NULL;
}
XBIOS_FreeBuffers(this);
/* Free mode list */
for (j = 0; j < NUM_MODELISTS; j++) {
for (i = 0; i < SDL_NUMMODES; i++) {
if (SDL_modelist[j][i] != NULL) {
SDL_free(SDL_modelist[j][i]);
SDL_modelist[j][i] = NULL;
}
}
}
if (XBIOS_modelist) {
SDL_free(XBIOS_modelist);
XBIOS_nummodes = 0;
XBIOS_modelist = NULL;
}
this->screen->pixels = NULL;
#endif
}
#if 0
static SDL_Rect ** static SDL_Rect **
XBIOS_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags) XBIOS_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
{ {
...@@ -876,81 +958,13 @@ XBIOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors) ...@@ -876,81 +958,13 @@ XBIOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
return (1); return (1);
} }
#endif
/* Note: If we are terminated, this could be called in the middle of /* Note: If we are terminated, this could be called in the middle of
another SDL video routine -- notably UpdateRects. another SDL video routine -- notably UpdateRects.
*/ */
static void
XBIOS_VideoQuit(_THIS)
{
int i, j;
Atari_ShutdownEvents();
/* Restore video mode and palette */
#ifndef DEBUG_VIDEO_XBIOS
switch (XBIOS_cvdo >> 16) {
case VDO_ST:
case VDO_STE:
Setscreen(-1, XBIOS_oldvbase, XBIOS_oldvmode);
if (XBIOS_oldnumcol) {
Setpalette(XBIOS_oldpalette);
}
break;
case VDO_TT:
Setscreen(-1, XBIOS_oldvbase, -1);
EsetShift(XBIOS_oldvmode);
if (XBIOS_oldnumcol) {
EsetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette);
}
break;
case VDO_F30:
Setscreen(-1, XBIOS_oldvbase, -1);
if (XBIOS_centscreen) {
SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode);
} else {
VsetMode(XBIOS_oldvmode);
}
if (XBIOS_oldnumcol) {
VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
}
break;
}
Vsync();
#endif
#if SDL_VIDEO_OPENGL
if (gl_active) {
SDL_AtariGL_Quit(this, SDL_TRUE);
}
#endif
if (XBIOS_oldpalette) {
SDL_free(XBIOS_oldpalette);
XBIOS_oldpalette = NULL;
}
XBIOS_FreeBuffers(this);
/* Free mode list */
for (j = 0; j < NUM_MODELISTS; j++) {
for (i = 0; i < SDL_NUMMODES; i++) {
if (SDL_modelist[j][i] != NULL) {
SDL_free(SDL_modelist[j][i]);
SDL_modelist[j][i] = NULL;
}
}
}
if (XBIOS_modelist) {
SDL_free(XBIOS_modelist);
XBIOS_nummodes = 0;
XBIOS_modelist = NULL;
}
this->screen->pixels = NULL;
}
#if 0
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
static void static void
...@@ -961,5 +975,6 @@ XBIOS_GL_SwapBuffers(_THIS) ...@@ -961,5 +975,6 @@ XBIOS_GL_SwapBuffers(_THIS)
SDL_AtariGL_MakeCurrent(this); SDL_AtariGL_MakeCurrent(this);
} }
#endif
#endif #endif
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -46,7 +46,7 @@ typedef struct ...@@ -46,7 +46,7 @@ typedef struct
/* Private display data */ /* Private display data */
#define NUM_MODELISTS 2 /* 8 and 16 bits-per-pixel */ #define NUM_MODELISTS 2 /* 8 and 16 bits-per-pixel */
struct SDL_VideoData typedef struct SDL_VideoData
{ {
long cookie_vdo; long cookie_vdo;
int old_video_mode; /* Old video mode before entering SDL */ int old_video_mode; /* Old video mode before entering SDL */
......
...@@ -57,7 +57,7 @@ SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t * cookie_blow) ...@@ -57,7 +57,7 @@ SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t * cookie_blow)
|| ((blow_mode->monitor == MONITOR_RGB) || ((blow_mode->monitor == MONITOR_RGB)
&& (cookie_blow->montype == MONITOR_TV))) { && (cookie_blow->montype == MONITOR_TV))) {
/* we can use this extended mode */ /* we can use this extended mode */
SDL_XBIOS_AddMode(this, SDL_XBIOS_AddMode(_this,
num_mode == 3 ? BPS8 : BPS16, num_mode == 3 ? BPS8 : BPS16,
blow_mode->width + 1, blow_mode->width + 1,
blow_mode->height + 1, blow_mode->height + 1,
......
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