Add support for Mac OS X

These are the code changes and Makefile changes necessary to build and
run Yamagi Quake II on Max OS X. OS X 10.6 or higher is required, older
version may work but we cannot guarantee it. The documentation will be
added in another commit. This patch was contributed by W. Beser, I made
only some small cosmetical changes.
This commit is contained in:
Yamagi Burmeister 2012-09-14 11:21:02 +02:00
parent dd6ed24104
commit ba10009aa5
14 changed files with 160 additions and 23 deletions

110
Makefile
View file

@ -34,18 +34,18 @@ WITH_OGG:=yes
# Enables the optional OpenAL sound system. # Enables the optional OpenAL sound system.
# To use it your system needs libopenal.so.1 # To use it your system needs libopenal.so.1
# or openal32.dll (we recommend openal-soft) # or openal32.dll (we recommend openal-soft)
# installed # installed
WITH_OPENAL:=yes WITH_OPENAL:=yes
# Enables retexturing support. Adds # Enables retexturing support. Adds
# a dependency to libjpeg # a dependency to libjpeg
WITH_RETEXTURING:=yes WITH_RETEXTURING:=yes
# Set the gamma via X11 and not via SDL. This works # Set the gamma via X11 and not via SDL. This works
# around problems in some SDL version. Adds dependencies # around problems in some SDL version. Adds dependencies
# to pkg-config, libX11 and libXxf86vm. Unsupported on # to pkg-config, libX11 and libXxf86vm. Unsupported on
# Windows. # Windows and OS X.
WITH_X11GAMMA:=no WITH_X11GAMMA:=no
# Enables opening of ZIP files (also known as .pk3 paks). # Enables opening of ZIP files (also known as .pk3 paks).
@ -55,11 +55,25 @@ WITH_ZIP:=yes
# Enable systemwide installation of game assets # Enable systemwide installation of game assets
WITH_SYSTEMWIDE:=no WITH_SYSTEMWIDE:=no
# This will set the default SYSTEMDIR, a non-empty string # This will set the default SYSTEMDIR, a non-empty string
# would actually be used. On Windows normals slashes (/) # would actually be used. On Windows normals slashes (/)
# instead of backslashed (\) should be used! # instead of backslashed (\) should be used!
WITH_SYSTEMDIR:= WITH_SYSTEMDIR:=
# This will set the architectures of the OSX-binaries.
# You have to make sure your libs/frameworks supports
# these architectures to build an universal ppc-compatible
# one would add -arch ppc for example, but I did not tested
# it!
OSX_ARCH := -arch i386 -arch x86_64
# This will set the build options to create an MacOS .app-bundle.
# The app-bundle itself will not be created, but the runtime paths
# will be set to expect the linked Frameworks in *.app/Contents/
# Frameworks and the game-data will be expected in # *.app/
# Contents/Resources
OSX_APP := no
# ====================================================== # # ====================================================== #
# !!! DO NOT ALTER ANYTHING BELOW THIS LINE !!! # # !!! DO NOT ALTER ANYTHING BELOW THIS LINE !!! #
# ====================================================== # # ====================================================== #
@ -75,8 +89,8 @@ endif
ifeq ($(OSTYPE), Windows) ifeq ($(OSTYPE), Windows)
# At this time only i386 is supported on Windows # At this time only i386 is supported on Windows
# (amd64 works, but building an 64 bit executable # (amd64 works, but building an 64 bit executable
# is not that easy. Especially SDL and OpenAL are # is not that easy. Especially SDL and OpenAL are
# somewhat problematic) # somewhat problematic)
ARCH := i386 ARCH := i386
else else
# Some platforms call it "amd64" and some "x86_64" # Some platforms call it "amd64" and some "x86_64"
@ -106,9 +120,16 @@ endif
# CHANGE THIS, since it's our only chance to debug this # CHANGE THIS, since it's our only chance to debug this
# crap when random crashes happen! # crap when random crashes happen!
# #
# -MMD to generate header dependencies. # -MMD to generate header dependencies. (They cannot be
# generated if building universal binaries on OSX)
ifeq ($(OSTYPE), Darwin)
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
-Wall -pipe -g
CFLAGS += $(OSX_ARCH)
else
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \ CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
-Wall -pipe -g -MMD -Wall -pipe -g -MMD
endif
# ---------- # ----------
@ -124,18 +145,24 @@ endif
# Extra CFLAGS for SDL # Extra CFLAGS for SDL
ifneq ($(OSTYPE), Windows) ifneq ($(OSTYPE), Windows)
SDLCFLAGS := $(shell sdl-config --cflags) ifeq ($(OSTYPE), Darwin)
SDLCFLAGS :=
else
SDLCFLAGS := $(shell sdl-config --cflags)
endif
endif endif
# ---------- # ----------
# Extra CFLAGS for X11 # Extra CFLAGS for X11
ifneq ($(OSTYPE), Windows) ifneq ($(OSTYPE), Windows)
ifneq ($(OSTYPE), Darwin)
ifeq ($(WITH_X11GAMMA),yes) ifeq ($(WITH_X11GAMMA),yes)
X11CFLAGS := $(shell pkg-config x11 --cflags) X11CFLAGS := $(shell pkg-config x11 --cflags)
X11CFLAGS += $(shell pkg-config xxf86vm --cflags) X11CFLAGS += $(shell pkg-config xxf86vm --cflags)
endif endif
endif endif
endif
# ---------- # ----------
@ -146,6 +173,8 @@ else ifeq ($(OSTYPE),FreeBSD)
INCLUDE := -I/usr/local/include INCLUDE := -I/usr/local/include
else ifeq ($(OSTYPE),OpenBSD) else ifeq ($(OSTYPE),OpenBSD)
INCLUDE := -I/usr/local/include INCLUDE := -I/usr/local/include
else ifeq ($(OSTYPE),Darwin)
INCLUDE :=
endif endif
# ---------- # ----------
@ -159,6 +188,8 @@ else ifeq ($(OSTYPE),OpenBSD)
LDFLAGS := -L/usr/local/lib -lm LDFLAGS := -L/usr/local/lib -lm
else ifeq ($(OSTYPE),Windows) else ifeq ($(OSTYPE),Windows)
LDFLAGS := -lws2_32 -lwinmm LDFLAGS := -lws2_32 -lwinmm
else ifeq ($(OSTYPE), Darwin)
LDFLAGS := $(OSX_ARCH) -lm
endif endif
# ---------- # ----------
@ -166,6 +197,8 @@ endif
# Extra LDFLAGS for SDL # Extra LDFLAGS for SDL
ifeq ($(OSTYPE), Windows) ifeq ($(OSTYPE), Windows)
SDLLDFLAGS := -lSDL SDLLDFLAGS := -lSDL
else ifeq ($(OSTYPE), Darwin)
SDLLDFLAGS := -framework SDL -framework OpenGL -framework Cocoa
else else
SDLLDFLAGS := $(shell sdl-config --libs) SDLLDFLAGS := $(shell sdl-config --libs)
endif endif
@ -174,11 +207,13 @@ endif
# Extra LDFLAGS for X11 # Extra LDFLAGS for X11
ifneq ($(OSTYPE), Windows) ifneq ($(OSTYPE), Windows)
ifneq ($(OSTYPE), Darwin)
ifeq ($(WITH_X11GAMMA),yes) ifeq ($(WITH_X11GAMMA),yes)
X11LDFLAGS := $(shell pkg-config x11 --libs) X11LDFLAGS := $(shell pkg-config x11 --libs)
X11LDFLAGS += $(shell pkg-config xxf86vm --libs) X11LDFLAGS += $(shell pkg-config xxf86vm --libs)
endif endif
endif endif
endif
# ---------- # ----------
@ -218,7 +253,7 @@ endif
ifeq ($(OSTYPE), Windows) ifeq ($(OSTYPE), Windows)
clean: clean:
@echo "===> CLEAN" @echo "===> CLEAN"
@-rmdir /S /Q release build @-rmdir /S /Q release build
else else
clean: clean:
@echo "===> CLEAN" @echo "===> CLEAN"
@ -269,18 +304,32 @@ build/client/%.o: %.c
${Q}mkdir -p $(@D) ${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $< ${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
ifeq ($(OSTYPE), Darwin)
build/client/%.o : %.m
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) $(OSX_ARCH) $(USE_APP_RESOURCES) -x objective-c -c $< -o $@
endif
ifeq ($(WITH_CDA),yes) ifeq ($(WITH_CDA),yes)
release/quake2 : CFLAGS += -DCDA release/quake2 : CFLAGS += -DCDA
endif endif
ifeq ($(WITH_OGG),yes) ifeq ($(WITH_OGG),yes)
release/quake2 : CFLAGS += -DOGG release/quake2 : CFLAGS += -DOGG
ifeq ($(OSTYPE), Darwin)
release/quake2 : LDFLAGS += -framework Vorbis -framework Ogg
else
release/quake2 : LDFLAGS += -lvorbis -lvorbisfile -logg release/quake2 : LDFLAGS += -lvorbis -lvorbisfile -logg
endif endif
endif
ifeq ($(WITH_OPENAL),yes) ifeq ($(WITH_OPENAL),yes)
ifeq ($(OSTYPE), OpenBSD) ifeq ($(OSTYPE), OpenBSD)
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so"' release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so"'
else ifeq ($(OSTYPE), Darwin)
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"/System/Library/Frameworks/OpenAL.framework/OpenAL"'
release/quake2 : LDFLAGS += -framework OpenAL
else else
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"' release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"'
endif endif
@ -291,7 +340,14 @@ release/quake2 : CFLAGS += -DZIP -DNOUNCRYPT
release/quake2 : LDFLAGS += -lz release/quake2 : LDFLAGS += -lz
endif endif
endif endif
ifeq ($(OSTYPE), Darwin)
ifeq ($(OSX_APP), yes)
release/quake2 : USE_APP_RESOURCES = -DUSE_APP_RESOURCES
release/quake2 : LDFLAGS += -Xlinker -rpath -Xlinker @loader_path/../Frameworks
endif
endif
# ---------- # ----------
# The server # The server
@ -310,7 +366,7 @@ release/q2ded.exe : CFLAGS += -DDEDICATED_ONLY
release/q2ded.exe : LDFLAGS += -lz release/q2ded.exe : LDFLAGS += -lz
ifeq ($(WITH_ZIP),yes) ifeq ($(WITH_ZIP),yes)
release/q2ded.exe : CFLAGS += -DZIP -DNOUNCRYPT release/q2ded.exe : CFLAGS += -DZIP -DNOUNCRYPT
release/q2ded.exe : LDFLAGS += -lz release/q2ded.exe : LDFLAGS += -lz
endif endif
else else
@ -322,10 +378,9 @@ server:
build/server/%.o: %.c build/server/%.o: %.c
@echo "===> CC $<" @echo "===> CC $<"
${Q}mkdir -p $(@D) ${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< ${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/q2ded : CFLAGS += -DDEDICATED_ONLY release/q2ded : CFLAGS += -DDEDICATED_ONLY
release/q2ded : LDFLAGS += -lz
ifeq ($(WITH_ZIP),yes) ifeq ($(WITH_ZIP),yes)
release/q2ded : CFLAGS += -DZIP -DNOUNCRYPT release/q2ded : CFLAGS += -DZIP -DNOUNCRYPT
@ -372,11 +427,16 @@ release/ref_gl.so : CFLAGS += -DX11GAMMA
endif endif
ifeq ($(WITH_RETEXTURING),yes) ifeq ($(WITH_RETEXTURING),yes)
release/ref_gl.so : CFLAGS += -DRETEXTURE release/ref_gl.so : CFLAGS += -DRETEXTURE
release/ref_gl.so : LDFLAGS += -ljpeg ifeq ($(OSTYPE), Darwin)
release/ref_gl.so : LDFLAGS += -framework libjpeg
else
release/ref_gl.so : LDFLAGS += -ljpeg
endif
endif endif
endif endif
# ---------- # ----------
# The baseq2 game # The baseq2 game
@ -406,7 +466,7 @@ build/baseq2/%.o: %.c
release/baseq2/game.so : CFLAGS += -fPIC release/baseq2/game.so : CFLAGS += -fPIC
release/baseq2/game.so : LDFLAGS += -shared release/baseq2/game.so : LDFLAGS += -shared
endif endif
# ---------- # ----------
# Used by the game # Used by the game
@ -539,6 +599,10 @@ CLIENT_OBJS_ += \
src/backends/unix/system.o src/backends/unix/system.o
endif endif
ifeq ($(OSTYPE), Darwin)
CLIENT_OBJS_ += src/backends/sdl_osx/SDLMain.o
endif
# ---------- # ----------
# Used by the server # Used by the server
@ -577,7 +641,7 @@ ifeq ($(OSTYPE), Windows)
SERVER_OBJS_ += \ SERVER_OBJS_ += \
src/backends/windows/mem.o \ src/backends/windows/mem.o \
src/backends/windows/network.o \ src/backends/windows/network.o \
src/backends/windows/system.o src/backends/windows/system.o
else else
SERVER_OBJS_ += \ SERVER_OBJS_ += \
src/backends/unix/hunk.o \ src/backends/unix/hunk.o \
@ -658,7 +722,7 @@ release/quake2 : $(CLIENT_OBJS)
@echo "===> LD $@" @echo "===> LD $@"
${Q}$(CC) $(CLIENT_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@ ${Q}$(CC) $(CLIENT_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
endif endif
# release/q2ded # release/q2ded
ifeq ($(OSTYPE), Windows) ifeq ($(OSTYPE), Windows)
release/q2ded.exe : $(SERVER_OBJS) icon release/q2ded.exe : $(SERVER_OBJS) icon
@ -675,12 +739,16 @@ ifeq ($(OSTYPE), Windows)
release/ref_gl.dll : $(OPENGL_OBJS) release/ref_gl.dll : $(OPENGL_OBJS)
@echo "===> LD $@" @echo "===> LD $@"
${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@ ${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
else ifeq ($(OSTYPE), Darwin)
release/ref_gl.so : $(OPENGL_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
else else
release/ref_gl.so : $(OPENGL_OBJS) release/ref_gl.so : $(OPENGL_OBJS)
@echo "===> LD $@" @echo "===> LD $@"
${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) $(X11LDFLAGS) -o $@ ${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) $(X11LDFLAGS) -o $@
endif endif
# release/baseq2/game.so # release/baseq2/game.so
ifeq ($(OSTYPE), Windows) ifeq ($(OSTYPE), Windows)
release/baseq2/game.dll : $(GAME_OBJS) release/baseq2/game.dll : $(GAME_OBJS)
@ -691,5 +759,5 @@ release/baseq2/game.so : $(GAME_OBJS)
@echo "===> LD $@" @echo "===> LD $@"
${Q}$(CC) $(GAME_OBJS) $(LDFLAGS) -o $@ ${Q}$(CC) $(GAME_OBJS) $(LDFLAGS) -o $@
endif endif
# ---------- # ----------

View file

@ -31,8 +31,12 @@
#ifndef _QAL_API_H_ #ifndef _QAL_API_H_
#define _QAL_API_H_ #define _QAL_API_H_
#if defined (__APPLE__)
#include <OpenAL/al.h>
#else
#include <AL/al.h> #include <AL/al.h>
#include <AL/efx.h> #include <AL/efx.h>
#endif
/* Function pointers used to tie /* Function pointers used to tie
* the qal API to the OpenAL API */ * the qal API to the OpenAL API */
@ -109,10 +113,12 @@ extern LPALDOPPLERFACTOR qalDopplerFactor;
extern LPALDOPPLERVELOCITY qalDopplerVelocity; extern LPALDOPPLERVELOCITY qalDopplerVelocity;
extern LPALSPEEDOFSOUND qalSpeedOfSound; extern LPALSPEEDOFSOUND qalSpeedOfSound;
extern LPALDISTANCEMODEL qalDistanceModel; extern LPALDISTANCEMODEL qalDistanceModel;
#if !defined (__APPLE__)
extern LPALGENFILTERS qalGenFilters; extern LPALGENFILTERS qalGenFilters;
extern LPALFILTERI qalFilteri; extern LPALFILTERI qalFilteri;
extern LPALFILTERF qalFilterf; extern LPALFILTERF qalFilterf;
extern LPALDELETEFILTERS qalDeleteFilters; extern LPALDELETEFILTERS qalDeleteFilters;
#endif
/* /*
* Gives information over the OpenAL * Gives information over the OpenAL

View file

@ -31,7 +31,11 @@
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h> #include <GL/gl.h>
#endif
#ifndef APIENTRY #ifndef APIENTRY
#define APIENTRY #define APIENTRY

View file

@ -32,9 +32,14 @@
#ifdef USE_OPENAL #ifdef USE_OPENAL
#if defined (__APPLE__)
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h> #include <AL/al.h>
#include <AL/alc.h> #include <AL/alc.h>
#include <AL/alext.h> #include <AL/alext.h>
#endif
#include "../../common/header/common.h" #include "../../common/header/common.h"
#include "header/qal.h" #include "header/qal.h"
@ -142,10 +147,12 @@ LPALDOPPLERFACTOR qalDopplerFactor;
LPALDOPPLERVELOCITY qalDopplerVelocity; LPALDOPPLERVELOCITY qalDopplerVelocity;
LPALSPEEDOFSOUND qalSpeedOfSound; LPALSPEEDOFSOUND qalSpeedOfSound;
LPALDISTANCEMODEL qalDistanceModel; LPALDISTANCEMODEL qalDistanceModel;
#if !defined (__APPLE__)
LPALGENFILTERS qalGenFilters; LPALGENFILTERS qalGenFilters;
LPALFILTERI qalFilteri; LPALFILTERI qalFilteri;
LPALFILTERF qalFilterf; LPALFILTERF qalFilterf;
LPALDELETEFILTERS qalDeleteFilters; LPALDELETEFILTERS qalDeleteFilters;
#endif
/* /*
* Gives information over the OpenAL * Gives information over the OpenAL
@ -316,10 +323,12 @@ QAL_Shutdown()
qalDopplerVelocity = NULL; qalDopplerVelocity = NULL;
qalSpeedOfSound = NULL; qalSpeedOfSound = NULL;
qalDistanceModel = NULL; qalDistanceModel = NULL;
#if !defined (__APPLE__)
qalGenFilters = NULL; qalGenFilters = NULL;
qalFilteri = NULL; qalFilteri = NULL;
qalFilterf = NULL; qalFilterf = NULL;
qalDeleteFilters = NULL; qalDeleteFilters = NULL;
#endif
/* Unload the shared lib */ /* Unload the shared lib */
Sys_FreeLibrary(handle); Sys_FreeLibrary(handle);
@ -445,10 +454,12 @@ QAL_Init()
qalDopplerVelocity = Sys_GetProcAddress(handle, "alDopplerVelocity"); qalDopplerVelocity = Sys_GetProcAddress(handle, "alDopplerVelocity");
qalSpeedOfSound = Sys_GetProcAddress(handle, "alSpeedOfSound"); qalSpeedOfSound = Sys_GetProcAddress(handle, "alSpeedOfSound");
qalDistanceModel = Sys_GetProcAddress(handle, "alDistanceModel"); qalDistanceModel = Sys_GetProcAddress(handle, "alDistanceModel");
#if !defined (__APPLE__)
qalGenFilters = Sys_GetProcAddress(handle, "alGenFilters"); qalGenFilters = Sys_GetProcAddress(handle, "alGenFilters");
qalFilteri = Sys_GetProcAddress(handle, "alFilteri"); qalFilteri = Sys_GetProcAddress(handle, "alFilteri");
qalFilterf = Sys_GetProcAddress(handle, "alFilterf"); qalFilterf = Sys_GetProcAddress(handle, "alFilterf");
qalDeleteFilters = Sys_GetProcAddress(handle, "alDeleteFilters"); qalDeleteFilters = Sys_GetProcAddress(handle, "alDeleteFilters");
#endif
/* Open the OpenAL device */ /* Open the OpenAL device */
Com_Printf("...opening OpenAL device:"); Com_Printf("...opening OpenAL device:");

View file

@ -31,6 +31,8 @@
#ifdef _WIN32 #ifdef _WIN32
#include "SDL/SDL.h" #include "SDL/SDL.h"
#elif defined(__APPLE__)
#include <SDL/SDL.h>
#else #else
#include "SDL.h" #include "SDL.h"
#endif #endif

View file

@ -31,6 +31,8 @@
#ifdef _WIN32 #ifdef _WIN32
#include <SDL/SDL.h> #include <SDL/SDL.h>
#elif defined(__APPLE__)
#include <SDL/SDL.h>
#else #else
#include <SDL.h> #include <SDL.h>
#endif #endif

View file

@ -27,10 +27,16 @@
#include "../../refresh/header/local.h" #include "../../refresh/header/local.h"
#include "../generic/header/glwindow.h" #include "../generic/header/glwindow.h"
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h> #include <GL/gl.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
#include <SDL/SDL.h> #include <SDL/SDL.h>
#elif defined(__APPLE__)
#include <SDL/SDL.h>
#else #else
#include <SDL.h> #include <SDL.h>
#endif #endif

View file

@ -32,6 +32,8 @@
#ifdef _WIN32 #ifdef _WIN32
#include <SDL/SDL.h> #include <SDL/SDL.h>
#elif defined(__APPLE__)
#include <SDL/SDL.h>
#else #else
#include <SDL.h> #include <SDL.h>
#endif #endif
@ -122,6 +124,8 @@ SNDDMA_Init(void)
s_sdldriver = (Cvar_Get("s_sdldriver", "dsound", CVAR_ARCHIVE)); s_sdldriver = (Cvar_Get("s_sdldriver", "dsound", CVAR_ARCHIVE));
#elif __linux__ #elif __linux__
s_sdldriver = (Cvar_Get("s_sdldriver", "alsa", CVAR_ARCHIVE)); s_sdldriver = (Cvar_Get("s_sdldriver", "alsa", CVAR_ARCHIVE));
#elif __APPLE__
s_sdldriver = (Cvar_Get("s_sdldriver", "CoreAudio", CVAR_ARCHIVE));
#else #else
s_sdldriver = (Cvar_Get("s_sdldriver", "dsp", CVAR_ARCHIVE)); s_sdldriver = (Cvar_Get("s_sdldriver", "dsp", CVAR_ARCHIVE));
#endif #endif

View file

@ -41,6 +41,11 @@
#define MAP_ANONYMOUS MAP_ANON #define MAP_ANONYMOUS MAP_ANON
#endif #endif
#if defined(__APPLE__)
#include <sys/types.h>
#define MAP_ANONYMOUS MAP_ANON
#endif
byte *membase; byte *membase;
int maxhunksize; int maxhunksize;
int curhunksize; int curhunksize;

View file

@ -34,6 +34,10 @@
#include "../../common/header/common.h" #include "../../common/header/common.h"
#include "header/unix.h" #include "header/unix.h"
#if defined(__APPLE__) && !defined(DEDICATED_ONLY)
#include <SDL/SDL.h>
#endif
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {

View file

@ -74,6 +74,9 @@ AL_InitStreamSource()
static void static void
AL_InitUnderwaterFilter() AL_InitUnderwaterFilter()
{ {
#if defined (__APPLE__)
return;
#else
/* Generate a filter */ /* Generate a filter */
qalGenFilters(1, &underwaterFilter); qalGenFilters(1, &underwaterFilter);
@ -95,6 +98,7 @@ AL_InitUnderwaterFilter()
/* The effect */ /* The effect */
qalFilterf(underwaterFilter, AL_LOWPASS_GAIN, 1.5); qalFilterf(underwaterFilter, AL_LOWPASS_GAIN, 1.5);
qalFilterf(underwaterFilter, AL_LOWPASS_GAINHF, 0.25); qalFilterf(underwaterFilter, AL_LOWPASS_GAINHF, 0.25);
#endif
} }
qboolean qboolean
@ -166,8 +170,9 @@ AL_Shutdown(void)
S_AL_StreamDie(); S_AL_StreamDie();
qalDeleteSources(1, &streamSource); qalDeleteSources(1, &streamSource);
#if !defined (__APPLE__)
qalDeleteFilters(1, &underwaterFilter); qalDeleteFilters(1, &underwaterFilter);
#endif
if (s_numchannels) if (s_numchannels)
{ {
/* delete source names */ /* delete source names */
@ -537,7 +542,9 @@ AL_Underwater()
/* Apply to all sources */ /* Apply to all sources */
for (i = 0; i < s_numchannels; i++) for (i = 0; i < s_numchannels; i++)
{ {
#if !defined (__APPLE__)
qalSourcei(s_srcnums[i], AL_DIRECT_FILTER, underwaterFilter); qalSourcei(s_srcnums[i], AL_DIRECT_FILTER, underwaterFilter);
#endif
} }
} }
@ -554,7 +561,9 @@ AL_Overwater()
/* Apply to all sources */ /* Apply to all sources */
for (i = 0; i < s_numchannels; i++) for (i = 0; i < s_numchannels; i++)
{ {
#if !defined (__APPLE__)
qalSourcei(s_srcnums[i], AL_DIRECT_FILTER, 0); qalSourcei(s_srcnums[i], AL_DIRECT_FILTER, 0);
#endif
} }
} }

View file

@ -45,6 +45,8 @@
#define BUILDSTRING "OpenBSD" #define BUILDSTRING "OpenBSD"
#elif defined _WIN32 #elif defined _WIN32
#define BUILDSTRING "Windows" #define BUILDSTRING "Windows"
#elif defined __APPLE__
#define BUILDSTRING "MacOS X"
#else #else
#define BUILDSTRING "Unknown" #define BUILDSTRING "Unknown"
#endif #endif
@ -69,6 +71,8 @@
#define LIBGL "opengl32.dll" #define LIBGL "opengl32.dll"
#elif defined __OpenBSD__ #elif defined __OpenBSD__
#define LIBGL "libGL.so" #define LIBGL "libGL.so"
#elif defined __APPLE__
#define LIBGL "/System/Library/Frameworks/OpenGL.framework/OpenGL"
#else #else
#define LIBGL "libGL.so.1" #define LIBGL "libGL.so.1"
#endif #endif

View file

@ -36,8 +36,15 @@
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
typedef unsigned char byte;
#if defined(__APPLE__)
#include <stdbool.h>
typedef bool qboolean;
#else
typedef enum {false, true} qboolean; typedef enum {false, true} qboolean;
#endif
typedef unsigned char byte;
#ifndef NULL #ifndef NULL
#define NULL ((void *)0) #define NULL ((void *)0)

View file

@ -30,7 +30,12 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h> #include <GL/gl.h>
#endif
#include "../../client/header/ref.h" #include "../../client/header/ref.h"
#include "../../backends/generic/header/qgl.h" #include "../../backends/generic/header/qgl.h"