Disable TurboVeille screensaver if present SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Thu, 11 Jan 2007 20:33:13 +0000
branchSDL-1.2
changeset 3904d8371d2dc524
parent 3903 5baad3758427
child 3905 0e0883cb7137
Disable TurboVeille screensaver if present
src/video/xbios/SDL_xbios.c
src/video/xbios/SDL_xbios_tveille.c
src/video/xbios/SDL_xbios_tveille.h
     1.1 --- a/src/video/xbios/SDL_xbios.c	Thu Jan 04 19:52:12 2007 +0000
     1.2 +++ b/src/video/xbios/SDL_xbios.c	Thu Jan 11 20:33:13 2007 +0000
     1.3 @@ -49,6 +49,7 @@
     1.4  #include "SDL_xbios_blowup.h"
     1.5  #include "SDL_xbios_centscreen.h"
     1.6  #include "SDL_xbios_sb3.h"
     1.7 +#include "SDL_xbios_tveille.h"
     1.8  
     1.9  #define XBIOS_VID_DRIVER_NAME "xbios"
    1.10  
    1.11 @@ -464,6 +465,11 @@
    1.12  	SDL_AtariGL_InitPointers(this);
    1.13  #endif
    1.14  
    1.15 +	/* Disable screensavers */
    1.16 +	if (SDL_XBIOS_TveillePresent(this)) {
    1.17 +		SDL_XBIOS_TveilleDisable(this);
    1.18 +	}
    1.19 +
    1.20  	/* We're done! */
    1.21  	return(0);
    1.22  }
    1.23 @@ -928,6 +934,11 @@
    1.24  	}
    1.25  
    1.26  	this->screen->pixels = NULL;	
    1.27 +
    1.28 +	/* Restore screensavers */
    1.29 +	if (SDL_XBIOS_TveillePresent(this)) {
    1.30 +		SDL_XBIOS_TveilleRestore(this);
    1.31 +	}
    1.32  }
    1.33  
    1.34  #if SDL_VIDEO_OPENGL
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/video/xbios/SDL_xbios_tveille.c	Thu Jan 11 20:33:13 2007 +0000
     2.3 @@ -0,0 +1,52 @@
     2.4 +/*
     2.5 +    SDL - Simple DirectMedia Layer
     2.6 +    Copyright (C) 1997-2004 Sam Lantinga
     2.7 +
     2.8 +    This library is free software; you can redistribute it and/or
     2.9 +    modify it under the terms of the GNU Library General Public
    2.10 +    License as published by the Free Software Foundation; either
    2.11 +    version 2 of the License, or (at your option) any later version.
    2.12 +
    2.13 +    This library is distributed in the hope that it will be useful,
    2.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.16 +    Library General Public License for more details.
    2.17 +
    2.18 +    You should have received a copy of the GNU Library General Public
    2.19 +    License along with this library; if not, write to the Free
    2.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2.21 +
    2.22 +    Sam Lantinga
    2.23 +    slouken@libsdl.org
    2.24 +*/
    2.25 +#include "SDL_config.h"
    2.26 +
    2.27 +/*
    2.28 +	Turbo veille screensaver
    2.29 +
    2.30 +	Patrice Mandin
    2.31 +*/
    2.32 +
    2.33 +#include <mint/cookie.h>
    2.34 +
    2.35 +#include "SDL_xbios.h"
    2.36 +#include "SDL_xbios_tveille.h"
    2.37 +
    2.38 +static tveille_t *cookie_veil;
    2.39 +static int status;
    2.40 +
    2.41 +int SDL_XBIOS_TveillePresent(_THIS)
    2.42 +{
    2.43 +	return (Getcookie(C_VeiL, (unsigned long *)&cookie_veil) == C_FOUND);
    2.44 +}
    2.45 +
    2.46 +void SDL_XBIOS_TveilleDisable(_THIS)
    2.47 +{
    2.48 +	status = cookie_veil->enabled;
    2.49 +	cookie_veil->enabled = 0xff;
    2.50 +}
    2.51 +
    2.52 +void SDL_XBIOS_TveilleRestore(_THIS)
    2.53 +{
    2.54 +	cookie_veil->enabled = status;
    2.55 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/video/xbios/SDL_xbios_tveille.h	Thu Jan 11 20:33:13 2007 +0000
     3.3 @@ -0,0 +1,70 @@
     3.4 +/*
     3.5 +    SDL - Simple DirectMedia Layer
     3.6 +    Copyright (C) 1997-2004 Sam Lantinga
     3.7 +
     3.8 +    This library is free software; you can redistribute it and/or
     3.9 +    modify it under the terms of the GNU Library General Public
    3.10 +    License as published by the Free Software Foundation; either
    3.11 +    version 2 of the License, or (at your option) any later version.
    3.12 +
    3.13 +    This library is distributed in the hope that it will be useful,
    3.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 +    Library General Public License for more details.
    3.17 +
    3.18 +    You should have received a copy of the GNU Library General Public
    3.19 +    License along with this library; if not, write to the Free
    3.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    3.21 +
    3.22 +    Sam Lantinga
    3.23 +    slouken@libsdl.org
    3.24 +*/
    3.25 +#include "SDL_config.h"
    3.26 +
    3.27 +/*
    3.28 +	Turbo veille screensaver
    3.29 +
    3.30 +	Patrice Mandin
    3.31 +*/
    3.32 +
    3.33 +#ifndef _SDL_xbios_tveille_h
    3.34 +#define _SDL_xbios_tveille_h
    3.35 +
    3.36 +#include "SDL_xbios.h"
    3.37 +
    3.38 +/*--- Defines ---*/
    3.39 +
    3.40 +#ifndef C_VeiL
    3.41 +#define C_VeiL 0x5665694CL
    3.42 +#endif
    3.43 +
    3.44 +/*--- Structures ---*/
    3.45 +
    3.46 +typedef struct {
    3.47 +	unsigned long	version;
    3.48 +	void		(*prg_ptr)();
    3.49 +	void		(*kbd_ptr)();
    3.50 +	void		(*vbl_ptr)();
    3.51 +	unsigned long	vbl_count;
    3.52 +	void		(*oldkbd_ptr)();
    3.53 +	unsigned long	off_count;
    3.54 +	unsigned long	prg_size;
    3.55 +	unsigned long	dummy1[4];
    3.56 +	unsigned char	dummy2;
    3.57 +	unsigned char	status;
    3.58 +	unsigned short	freq;
    3.59 +	unsigned short	dummy3;
    3.60 +	unsigned char	clear_first;
    3.61 +	unsigned char	enabled;	/* 0=enabled, 0xff=disabled */
    3.62 +	unsigned char	serial_redir;
    3.63 +	unsigned char	dummy4;
    3.64 +	void		(*oldserial_ptr)();
    3.65 +} __attribute__((packed)) tveille_t;
    3.66 +
    3.67 +/*--- Functions prototypes ---*/
    3.68 +
    3.69 +int SDL_XBIOS_TveillePresent(_THIS);
    3.70 +void SDL_XBIOS_TveilleDisable(_THIS);
    3.71 +void SDL_XBIOS_TveilleEnable(_THIS);
    3.72 +
    3.73 +#endif /* _SDL_xbios_tveille_h */