From 2896002f090d9e2d57b8eca46cccb8362b95459c Mon Sep 17 00:00:00 2001 From: molivier Date: Fri, 3 Dec 2004 08:32:08 +0000 Subject: [PATCH] - DP now defines MACOSX when relevant - added a "Mac OS X" string in Sys_Shared_EarlyInit - removed an unused "rcsid" string - fixed SDL audio on big endian systems - fixed SDL video initialization on Mac OS X git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4822 d7cf8633-e32d-0410-b094-e92efae38249 --- common.h | 8 +++++++- keys.c | 5 ----- snd_sdl.c | 2 +- sys_shared.c | 2 ++ vid_sdl.c | 6 ++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/common.h b/common.h index 9da99680..aa2d29d5 100644 --- a/common.h +++ b/common.h @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef COMMON_H #define COMMON_H + // MSVC has a different name for several standard functions #ifdef WIN32 # define snprintf _snprintf @@ -29,6 +30,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # define strncasecmp strnicmp #endif +// Create our own define for Mac OS X +#if defined(__APPLE__) && defined(__MACH__) +# define MACOSX +#endif + //============================================================================ @@ -229,7 +235,7 @@ char *SearchInfostring(const char *infostring, const char *key); // strlcat and strlcpy, from OpenBSD // Most (all?) BSDs already have them -#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__)) +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(MACOSX) # define HAVE_STRLCAT 1 # define HAVE_STRLCPY 1 #endif diff --git a/keys.c b/keys.c index dd9e182e..b12bd2c9 100644 --- a/keys.c +++ b/keys.c @@ -1,6 +1,4 @@ /* - $RCSfile$ - Copyright (C) 1996-1997 Id Software, Inc. This program is free software; you can redistribute it and/or @@ -20,10 +18,7 @@ Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307, USA - */ -static const char rcsid[] = - "$Id$"; #include "quakedef.h" #include diff --git a/snd_sdl.c b/snd_sdl.c index de0f3dc9..38fb2053 100644 --- a/snd_sdl.c +++ b/snd_sdl.c @@ -118,7 +118,7 @@ qboolean SNDDMA_Init(void) // Init the SDL Audio subsystem spec.callback = Buffer_Callback; spec.channels = shm->format.channels; - spec.format = AUDIO_S16LSB; + spec.format = AUDIO_S16SYS; spec.freq = shm->format.speed; spec.userdata = NULL; spec.samples = AUDIO_SDL_SAMPLES; diff --git a/sys_shared.c b/sys_shared.c index 9bebbde3..28529c59 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -48,6 +48,8 @@ void Sys_Shared_EarlyInit(void) os = "NetBSD"; #elif defined(__OpenBSD__) os = "OpenBSD"; +#elif defined(MACOSX) + os = "Mac OS X"; #else os = "Unknown"; #endif diff --git a/vid_sdl.c b/vid_sdl.c index ce9f0f6e..0961a199 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -378,7 +378,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) We cant switch from one OpenGL video mode to another. Thus we first switch to some stupid 2D mode and then back to OpenGL. */ +#ifndef MACOSX SDL_SetVideoMode( 0, 0, 0, 0 ); +#endif // SDL usually knows best drivername = NULL; @@ -387,9 +389,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) i = COM_CheckParm("-gl_driver"); if (i && i < com_argc - 1) drivername = com_argv[i + 1]; - if (SDL_GL_LoadLibrary(drivername)) + if (SDL_GL_LoadLibrary(drivername) < 0) { - Con_Printf("Unable to load GL driver \"%s\": ", drivername, SDL_GetError()); + Con_Printf("Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError()); return false; } -- 2.39.2