diff options
Diffstat (limited to 'code/sys')
| -rw-r--r-- | code/sys/sys_local.h | 1 | ||||
| -rw-r--r-- | code/sys/sys_main.c | 10 | ||||
| -rw-r--r-- | code/sys/sys_unix.c | 19 | ||||
| -rw-r--r-- | code/sys/sys_win32.c | 46 | 
4 files changed, 63 insertions, 13 deletions
| diff --git a/code/sys/sys_local.h b/code/sys/sys_local.h index 97a9ad6..353d360 100644 --- a/code/sys/sys_local.h +++ b/code/sys/sys_local.h @@ -47,6 +47,7 @@ unsigned int CON_LogRead( char *out, unsigned int outSize );  char *Sys_StripAppBundle( char *pwd );  #endif +void Sys_GLimpInit( void );  void Sys_PlatformInit( void );  void Sys_SigHandler( int signal );  void Sys_ErrorDialog( const char *error ); diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c index bad8772..483d3f8 100644 --- a/code/sys/sys_main.c +++ b/code/sys/sys_main.c @@ -551,16 +551,6 @@ int main( int argc, char **argv )  	CON_Init( ); -#ifndef _WIN32 -	// Windows doesn't have these signals -	// see CON_CtrlHandler() in con_win32.c -	signal( SIGHUP, Sys_SigHandler ); -	signal( SIGQUIT, Sys_SigHandler ); -	signal( SIGTRAP, Sys_SigHandler ); -	signal( SIGIOT, Sys_SigHandler ); -	signal( SIGBUS, Sys_SigHandler ); -#endif -  	signal( SIGILL, Sys_SigHandler );  	signal( SIGFPE, Sys_SigHandler );  	signal( SIGSEGV, Sys_SigHandler ); diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index 13ded33..21d0b57 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  #include "../qcommon/qcommon.h"  #include "sys_local.h" +#include <signal.h>  #include <sys/types.h>  #include <sys/stat.h>  #include <errno.h> @@ -514,6 +515,18 @@ void Sys_ErrorDialog( const char *error )  /*  ============== +Sys_GLimpInit + +Unix specific GL implementation initialisation +============== +*/ +void Sys_GLimpInit( void ) +{ +	// NOP +} + +/* +==============  Sys_PlatformInit  Unix specific initialisation @@ -521,5 +534,9 @@ Unix specific initialisation  */  void Sys_PlatformInit( void )  { -	// NOP +	signal( SIGHUP, Sys_SigHandler ); +	signal( SIGQUIT, Sys_SigHandler ); +	signal( SIGTRAP, Sys_SigHandler ); +	signal( SIGIOT, Sys_SigHandler ); +	signal( SIGBUS, Sys_SigHandler );  } diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index 79998dc..eeee856 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -577,6 +577,40 @@ void Sys_ErrorDialog( const char *error )  	}  } +#ifndef DEDICATED +static qboolean SDL_VIDEODRIVER_externallySet = qfalse; +#endif + +/* +============== +Sys_GLimpInit + +Windows specific GL implementation initialisation +============== +*/ +void Sys_GLimpInit( void ) +{ +#ifndef DEDICATED +	if( !SDL_VIDEODRIVER_externallySet ) +	{ +		// It's a little bit weird having in_mouse control the +		// video driver, but from ioq3's point of view they're +		// virtually the same except for the mouse input anyway +		if( Cvar_VariableIntegerValue( "in_mouse" ) == -1 ) +		{ +			// Use the windib SDL backend, which is closest to +			// the behaviour of idq3 with in_mouse set to -1 +			_putenv( "SDL_VIDEODRIVER=windib" ); +		} +		else +		{ +			// Use the DirectX SDL backend +			_putenv( "SDL_VIDEODRIVER=directx" ); +		} +	} +#endif +} +  /*  ==============  Sys_PlatformInit @@ -587,7 +621,15 @@ Windows specific initialisation  void Sys_PlatformInit( void )  {  #ifndef DEDICATED -	// Force the DirectX SDL backend to be used -	_putenv( "SDL_VIDEODRIVER=directx" ); +	const char *SDL_VIDEODRIVER = getenv( "SDL_VIDEODRIVER" ); + +	if( SDL_VIDEODRIVER ) +	{ +		Com_Printf( "SDL_VIDEODRIVER is externally set to \"%s\", " +				"in_mouse -1 will have no effect\n", SDL_VIDEODRIVER ); +		SDL_VIDEODRIVER_externallySet = qtrue; +	} +	else +		SDL_VIDEODRIVER_externallySet = qfalse;  #endif  } | 
