From be899ba3af261fd6ea8e409005006fc01a772a95 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 24 Nov 2012 09:13:29 +0000 Subject: [PATCH] For novelty, add support for RENDERTYPE=SDL under Windows. This needs improvements to bring it up to par with winlayer, but it is functional. In particular, a good amount of code from winlayer could be used for both layers, including the profiling timers, the version printing code, and the hInstance and hModule sharing. Known problems: the mouse cursor is not trapped, and the game starts before the startup window shows options. git-svn-id: https://svn.eduke32.com/eduke32@3219 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile | 63 +++++++++------- polymer/eduke32/Makefile.common | 18 ++--- polymer/eduke32/Windows/lib/SDL_mixer.lib | Bin 0 -> 16784 bytes polymer/eduke32/build/Makefile | 14 ++-- polymer/eduke32/build/Makefile.shared | 67 +++++++++++------- polymer/eduke32/build/include/glbuild.h | 4 +- polymer/eduke32/build/include/sdl_inc.h | 6 +- polymer/eduke32/build/include/sdlayer.h | 8 +++ polymer/eduke32/build/src/glbuild.c | 22 +++--- polymer/eduke32/build/src/sdlayer.c | 18 ++++- polymer/eduke32/build/src/startwin.editor.c | 2 +- polymer/eduke32/source/game.c | 2 +- polymer/eduke32/source/jaudiolib/Makefile | 24 ++++--- .../eduke32/source/jaudiolib/src/driver_sdl.c | 6 +- .../eduke32/source/jaudiolib/src/drivers.c | 4 +- polymer/eduke32/source/jaudiolib/src/fx_man.c | 2 +- polymer/eduke32/source/sdlmusic.c | 2 + polymer/eduke32/source/sounds.c | 2 +- polymer/eduke32/source/sounds_mapster32.c | 2 +- polymer/eduke32/source/startwin.game.c | 7 +- polymer/eduke32/source/winbits.c | 6 +- 21 files changed, 174 insertions(+), 105 deletions(-) create mode 100644 polymer/eduke32/Windows/lib/SDL_mixer.lib diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 72c4432c4..187d42c62 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -47,6 +47,8 @@ OURLDFLAGS=$(OURCOMMONFLAGS) $(PRINTLDFLAGS) GAMELDFLAGS= EDITORLDFLAGS= +LIBS= + JAUDIOLIBDIR=$(SRC)/jaudiolib JAUDIOLIB=libjfaudiolib.a @@ -56,6 +58,10 @@ ENETLIB=libenet.a include $(EROOT)/Makefile.shared + +OURLIBS=$(LIBS) $(BASELIBS) $(BUILDLIBS) + + ifneq (0,$(USE_LIBVPX)) ifeq ($(PLATFORM),WINDOWS) LIBS+= -LWindows/lib @@ -253,35 +259,38 @@ ifeq ($(PLATFORM),DARWIN) endif ifeq ($(PLATFORM),WINDOWS) - OURCOMMONFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include + OURCOMMONFLAGS += -fno-pic -DUNDERSCORES OURASFLAGS+= -DUNDERSCORES -f win32 - LIBS += -L$(JAUDIOLIBDIR)/third-party/mingw32/lib -lvorbisfile -lvorbis -logg -lwsock32 -lws2_32 -lwinmm -ldsound - GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o + LIBS += -L$(JAUDIOLIBDIR)/third-party/mingw32/lib -lvorbisfile -lvorbis -logg -lwsock32 -lws2_32 -lwinmm + GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o EDITOROBJS+= $(OBJ)/buildres.$o JAUDIOLIB=libjfaudiolib_win32.a ENETLIB=libenet_win32.a -else -# -lGLU to build with gluBuild2DMipmaps - ifeq ($(RENDERTYPE),SDL) - ifeq (0,$(SDL_FRAMEWORK)) - ifneq ($(PLATFORM),WII) - OURCOMMONFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags)) - endif - LIBS+= -l$(SDLNAME)_mixer - else - OURCOMMONFLAGS += -DSDL_FRAMEWORK - endif - - ifeq (1,$(HAVE_GTK2)) - OURCOMMONFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) - GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o - EDITOROBJS+= $(OBJ)/editor_banner.$o - endif - - GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o - EDITOROBJS+= $(OBJ)/build_icon.$o + ifeq ($(RENDERTYPE),WIN) + OURCOMMONFLAGS += -I$(DXROOT)/include + LIBS+= -ldsound + GAMEOBJS+= $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o endif endif +# -lGLU to build with gluBuild2DMipmaps +ifeq ($(RENDERTYPE),SDL) + ifeq ($(PLATFORM),WINDOWS) + LIBS+= Windows/lib/SDL_mixer.lib + else + ifneq ($(PLATFORM),DARWIN) + LIBS+= -l$(SDLNAME)_mixer + endif + endif + + ifeq (1,$(HAVE_GTK2)) + OURCOMMONFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) + GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o + EDITOROBJS+= $(OBJ)/editor_banner.$o + endif + + GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o + EDITOROBJS+= $(OBJ)/build_icon.$o +endif OURCOMMONFLAGS+= $(BUILDCOMMONFLAGS) @@ -344,7 +353,7 @@ finish: $(EDUKE32): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) $(MISCGAMEDEPS) $(LINK_STATUS) - if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(GAMELDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi + if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(GAMELDFLAGS) $(OURLIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi ifeq (1,$(RELEASE)) ifeq (0,$(DEBUGANYWAY)) ifneq ($(PLATFORM),WII) @@ -358,9 +367,9 @@ ifeq ($(PLATFORM),DARWIN) cp -f "$(EDUKE32)" "EDuke32.app/Contents/MacOS/" endif -$(MAPSTER32): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) +$(MAPSTER32): $(EDITOROBJS) $(EOBJ)/$(ENGINELIB) $(EOBJ)/$(EDITORLIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(LINK_STATUS) - if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(EDITORLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi + if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(EDITORLDFLAGS) $(OURLIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi ifeq (1,$(RELEASE)) ifeq (0,$(DEBUGANYWAY)) ifneq ($(PLATFORM),WII) @@ -430,7 +439,7 @@ $(OBJ)/%.$o: $(SRC)/util/%.c ivfrate$(EXESUFFIX): $(OBJ)/ivfrate.$o $(ONESTEP_STATUS) - if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(LIBS); then $(ONESTEP_OK); else $(ONESTEP_FAILED); fi + if $(LINKER) -o $@ $^ $(OURLDFLAGS) $(OURLIBS); then $(ONESTEP_OK); else $(ONESTEP_FAILED); fi #### Lunatic diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index 14b40e255..f4fac47a3 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -217,10 +217,10 @@ ifeq ($(PLATFORM),WII) override USE_LIBVPX = 0 endif -LIBS=-lm +BASELIBS=-lm ifneq (0,$(USE_LIBVPX)) # On Windows, we link statically to libvpx - LIBS+= -lvpx + BASELIBS+= -lvpx endif @@ -268,15 +268,15 @@ else # endif endif ifeq ($(PLATFORM),LINUX) - LIBS+=-rdynamic + BASELIBS+=-rdynamic endif ifneq (0,$(MUDFLAP)) - LIBS+= -lmudflapth + BASELIBS+= -lmudflapth debug+= -fmudflapth endif ifneq (0,$(PROFILER)) # might need to be disabled for Darwin: - LIBS+= -lprofiler + BASELIBS+= -lprofiler debug+= -pg endif ifneq (0,$(KRANDDEBUG)) @@ -329,9 +329,9 @@ ifneq ($(LUNATIC),0) BASECOMMONFLAGS+= -I$(SRC)/lunatic -DLUNATIC ifeq ($(PLATFORM),WINDOWS) - LIBS+= -LWindows/lib -lluajit + BASELIBS+= -LWindows/lib -lluajit else - LIBS+= -lluajit-5.1 + BASELIBS+= -lluajit-5.1 endif endif @@ -359,11 +359,11 @@ ifneq (0,$(OSX_STARTUPWINDOW)) endif ifneq (0,$(EFENCE)) - LIBS+= -lefence + BASELIBS+= -lefence BASECOMMONFLAGS+= -DEFENCE endif ifneq (0,$(DMALLOC)) - LIBS+= -ldmalloc + BASELIBS+= -ldmalloc BASECOMMONFLAGS+= -DDMALLOC endif diff --git a/polymer/eduke32/Windows/lib/SDL_mixer.lib b/polymer/eduke32/Windows/lib/SDL_mixer.lib new file mode 100644 index 0000000000000000000000000000000000000000..f1cb0fc1b7185ff2c638afeb119905587f2336b5 GIT binary patch literal 16784 zcmd5@J8)D-7QF(D0rN9p%pU>b4?;*9N&F=cLM#Gg3FIm#!&vh`1H+6;(qIv-LkAn# ziOZ480UK=Mz~yq)x?F_Lmi1P7s~nK5%aH>|4oJM`_UnG#_kEffjo8|$I%?j%xBK+> zcHe%FJ!cCulT+tcooJQ6lU<#;?p#-I*C{FQ(2rd`z51VbRuR!BL_2$kc25zteonOK z_YiyU6Dd4L3hW!v_zo%1)}iqPDX@RD#z#mQFG3tZISM}^1rDMdg>R7phmL4`iWE4! zOk*A?d^QCDR6qT#)n85zlAt+he+WWQs8XA##cyzb9*(=)^osl(wIZa z_$9=J_lOjJKnnDu-xR(?3JkO|^7*URM{kbZ$`4*1zchAr^w!O>{P^HV{$Xi8n4x_B z#_f@jqzU~wvI#A24d1?T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{T>SDw(ut>f`qJaU4!Uf3lh8byZ_OPtZ1!c1XiVd$i0+I% zeJe)ouwe_|0yW9x8?z&VDb1M(@;b(>JLAN=4edHA*ow{04$ls7Ofsc4tns;@(K5cl zJ09`H-?NGSlP#{NH$9%Y-Q`@A7WzEN36~84ylhJ2^FO+rPq_=}h;gMgPV{S&J$cgb z**BS@_yx4ibGGcXZ06G&ent8U8M~5<{O+|$M&FLw?J&;8hy-mNBbW2+s5!$E`%+18 zNd9^lGki1OoA+2o`Qf;vY}mW_{ARDi$#1tMm3XSBbsoRjCz;X~Uc)WRdH7CQKKnXe zG-v^9&%<}x@VW2#Um@Qahfj4Te?ZVIpJyLB8|RC@Opv7Fsh&CGIfn+a literal 0 HcmV?d00001 diff --git a/polymer/eduke32/build/Makefile b/polymer/eduke32/build/Makefile index 16ddd0e93..f7538044a 100644 --- a/polymer/eduke32/build/Makefile +++ b/polymer/eduke32/build/Makefile @@ -98,7 +98,8 @@ ifeq (1,$(LUNATIC)) endif EDITOROBJS=$(OBJ)/build.$o \ - $(OBJ)/config.$o + $(OBJ)/config.$o \ + $(OBJ)/defs.$o # PLATFORM SPECIFIC SETTINGS @@ -118,8 +119,9 @@ ifeq ($(PLATFORM),BSD) OURCOMMONFLAGS+= -I/usr/X11R6/include endif ifeq ($(PLATFORM),WINDOWS) - OURCOMMONFLAGS+= -DUNDERSCORES -I$(DXROOT)/include # -I$(ENETROOT)/include + OURCOMMONFLAGS+= -DUNDERSCORES # -I$(ENETROOT)/include OURASFLAGS+= -DUNDERSCORES -f win32 + EDITOROBJS+= $(OBJ)/startwin.editor.$o endif ifeq ($(PLATFORM),BEOS) OURASFLAGS+= -f elf @@ -151,12 +153,6 @@ ifeq ($(RENDERTYPE),SDL) endif endif - ifeq (0,$(SDL_FRAMEWORK)) - OURCOMMONFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags)) - else - OURCOMMONFLAGS += -DSDL_FRAMEWORK - endif - ifeq (1,$(HAVE_GTK2)) OURCOMMONFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) ENGINEOBJS+= $(OBJ)/gtkbits.$o @@ -167,8 +163,8 @@ ifeq ($(RENDERTYPE),SDL) endif endif ifeq ($(RENDERTYPE),WIN) + OURCOMMONFLAGS+= -I$(DXROOT)/include ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o - EDITOROBJS+= $(OBJ)/startwin.editor.$o endif OURCOMMONFLAGS+= $(BUILDCOMMONFLAGS) diff --git a/polymer/eduke32/build/Makefile.shared b/polymer/eduke32/build/Makefile.shared index 5805812c5..b31c58f75 100644 --- a/polymer/eduke32/build/Makefile.shared +++ b/polymer/eduke32/build/Makefile.shared @@ -32,6 +32,7 @@ ifeq (4,$(GCC_MAJOR)) endif BUILDCOMMONFLAGS=$(ARCH) +BUILDLIBS= ifeq ($(PLATFORM),LINUX) STDCPPLIB:= @@ -48,7 +49,7 @@ ifeq ($(PLATFORM),LINUX) ifeq ($(findstring x86_64,$(shell uname -m)),x86_64) ifeq (1,$(BUILD32_ON_64)) # On my 64bit Gentoo these are the 32bit emulation libs - LIBS+= -m32 -L/emul/linux/x86/usr/lib + BUILDLIBS+= -m32 -L/emul/linux/x86/usr/lib BUILDCOMMONFLAGS+= -m32 # Override WITHOUT_GTK=0 GTKCOMPAT32=1 @@ -76,10 +77,12 @@ ifeq ($(PLATFORM),DARWIN) endif endif ifeq ($(PLATFORM),WINDOWS) - RENDERTYPE ?= WIN + RENDERTYPE?=WIN + WITHOUT_GTK?=1 + SDL_FRAMEWORK=1 BUILDCOMMONFLAGS+= -DHAVE_INTTYPES EXESUFFIX=.exe - LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 + BUILDLIBS+= -lmingwex -lwsock32 -lcomctl32 -lwinmm #-lshfolder #STDCPPLIB:=-lstdc++ endif @@ -102,7 +105,7 @@ ifeq ($(PLATFORM),SKYOS) BUILDCOMMONFLAGS+= -DUNDERSCORES SDLCONFIG= SDLCONFIG_COMMONFLAGS=-I/boot/programs/sdk/include/sdl - LIBS+= -lSDL -lnet + BUILDLIBS+= -lSDL -lnet endif ifeq ($(PLATFORM),WII) ifeq ($(strip $(DEVKITPPC)),) @@ -124,21 +127,21 @@ ifeq ($(PLATFORM),WII) -DGEKKO -DHAVE_INTTYPES -D__POWERPC__ \ -I$(LIBOGC_INC) -I$(LIBOGC_INC)/SDL -I$(PORTLIBS)/include SDLCONFIG= - LIBS+= -lSDL_mixer -lsmpeg -lSDL -laesnd + BUILDLIBS+= -lSDL_mixer -lsmpeg -lSDL -laesnd endif ifeq ($(PLATFORM),QNX) RENDERTYPE=SDL override USE_OPENGL=0 override NOASM=1 STDCPPLIB:=-lstdc++ - LIBS+= -lsocket + BUILDLIBS+= -lsocket endif ifeq ($(PLATFORM),SUNOS) RENDERTYPE=SDL override USE_OPENGL=0 override NOASM=1 STDCPPLIB:=-lstdc++ - LIBS+= -lsocket -lnsl + BUILDLIBS+= -lsocket -lnsl endif ifeq ($(PLATFORM),SYLLABLE) RENDERTYPE=SDL @@ -153,17 +156,31 @@ ifneq (0,$(CLANG)) endif ifeq ($(RENDERTYPE),SDL) + ifeq ($(SDL_FRAMEWORK),1) - LIBS += -Wl,-framework,SDL - SDLCONFIG_COMMONFLAGS+= -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers + SDLCONFIG_COMMONFLAGS += -DSDL_FRAMEWORK + endif + + ifneq ($(PLATFORM),WINDOWS) + ifeq ($(SDL_FRAMEWORK),1) + ifeq ($(PLATFORM),DARWIN) + SDLCONFIG_LIBS += -Wl,-framework,SDL + SDLCONFIG_COMMONFLAGS+= -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers + endif + else + ifneq ($(SDLCONFIG),) + SDLCONFIG_COMMONFLAGS+=$(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags)) + SDLCONFIG_LIBS+= $(shell $(SDLCONFIG) --libs) + endif + endif else - ifneq ($(SDLCONFIG),) - SDLCONFIG_LIBS+= $(shell $(SDLCONFIG) --libs) - LIBS+= $(SDLCONFIG_LIBS) - SDLCONFIG_COMMONFLAGS+=$(shell $(SDLCONFIG) --cflags) - endif + SDLCONFIG_COMMONFLAGS += -D_GNU_SOURCE=1 + SDLCONFIG_LIBS+= -lmingw32 -lSDLmain -lSDL endif + BUILDLIBS+= $(SDLCONFIG_LIBS) + BUILDCOMMONFLAGS+= $(SDLCONFIG_COMMONFLAGS) + ifeq (1,$(WITHOUT_GTK)) HAVE_GTK2=0 else @@ -174,9 +191,9 @@ ifeq ($(RENDERTYPE),SDL) # include cairo, so we need to filter out those -l switches in order to link ifneq ($(LINKED_GTK),0) ifeq ($(GTKCOMPAT32),1) - LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g') + BUILDLIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g') else - LIBS+= $(shell pkg-config --libs gtk+-2.0) + BUILDLIBS+= $(shell pkg-config --libs gtk+-2.0) endif endif else @@ -185,7 +202,7 @@ ifeq ($(RENDERTYPE),SDL) endif else ifeq ($(RENDERTYPE),WIN) - LIBS+= -mwindows -ldxguid + BUILDLIBS+= -L$(DXROOT)/lib -ldxguid endif endif @@ -223,40 +240,40 @@ endif ifneq ($(PLATFORM),WINDOWS) ifneq ($(PLATFORM),WII) - LIBS+= -ldl + BUILDLIBS+= -ldl endif - LIBS+= -pthread + BUILDLIBS+= -pthread endif ifeq ($(PLATFORM),WINDOWS) ifneq ($(USE_LIBPNG),0) # XXX: these assume that the compiler runs from build/. Ugh. - LIBS+= -L../Windows/lib -lpng_mini -lz_mini + BUILDLIBS+= -L../Windows/lib -lpng_mini -lz_mini BUILDCOMMONFLAGS+= -I../Windows/include endif else ifeq ($(PLATFORM),DARWIN) ifneq ($(USE_LIBPNG),0) BUILDCOMMONFLAGS+= -I/opt/local/include -I/sw/include -I/usr/local/include - LIBS+= -L/opt/local/lib -L/usr/local/lib -lpng # -lz + BUILDLIBS+= -L/opt/local/lib -L/usr/local/lib -lpng # -lz endif else ifneq ($(USE_LIBPNG),0) - LIBS+= -lpng -lz + BUILDLIBS+= -lpng -lz endif endif endif ifeq ($(PLATFORM),WINDOWS) - LIBS+= $(L_SSP) -Wl,--enable-auto-import - LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT) + BUILDLIBS+= $(L_SSP) -Wl,--enable-auto-import + BUILDLIBS+= -mwindows -lwsock32 -lws2_32 #-L$(ENETROOT) endif ifeq ($(PRETTY_OUTPUT),1) BUILD_SETTINGS_COMPILER = \033[1;36mcompiler: \033[0;36m\"$(COMPILER) $(OURCFLAGS)\" BUILD_SETTINGS_ASSEMBLER = \033[1;36massembler: \033[0;36m\"$(AS) $(OURASFLAGS)\" -BUILD_SETTINGS_LINKER = \033[1;36mlinker: \033[0;36m\"$(PRINTLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB)\" +BUILD_SETTINGS_LINKER = \033[1;36mlinker: \033[0;36m\"$(PRINTLDFLAGS) $(OURLIBS) $(STATICSTDCPP) $(STDCPPLIB)\" ifeq (0,$(NOASM)) BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_ASSEMBLER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n" else diff --git a/polymer/eduke32/build/include/glbuild.h b/polymer/eduke32/build/include/glbuild.h index fcca0c05d..4b4b1f1c1 100644 --- a/polymer/eduke32/build/include/glbuild.h +++ b/polymer/eduke32/build/include/glbuild.h @@ -4,7 +4,7 @@ #ifdef USE_OPENGL -#ifdef RENDERTYPEWIN +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include #endif @@ -541,7 +541,7 @@ extern bgluProjectProcPtr bgluProject; typedef GLint (APIENTRY * bgluUnProjectProcPtr)(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble* objX, GLdouble* objY, GLdouble* objZ); extern bgluUnProjectProcPtr bgluUnProject; -#ifdef RENDERTYPEWIN +#ifdef _WIN32 // Windows typedef HGLRC (WINAPI * bwglCreateContextProcPtr)(HDC); extern bwglCreateContextProcPtr bwglCreateContext; diff --git a/polymer/eduke32/build/include/sdl_inc.h b/polymer/eduke32/build/include/sdl_inc.h index 267703358..dc6c6e6d0 100644 --- a/polymer/eduke32/build/include/sdl_inc.h +++ b/polymer/eduke32/build/include/sdl_inc.h @@ -28,7 +28,11 @@ Minimum required SDL versions: #if defined(_NEED_SDLMIXER) # if defined(SDL_FRAMEWORK) -# include +# if defined(_WIN32) +# include +# else +# include +# endif # else # include "SDL_mixer.h" # endif diff --git a/polymer/eduke32/build/include/sdlayer.h b/polymer/eduke32/build/include/sdlayer.h index 5746c63ae..3048b59eb 100644 --- a/polymer/eduke32/build/include/sdlayer.h +++ b/polymer/eduke32/build/include/sdlayer.h @@ -9,6 +9,10 @@ #include "compat.h" #include "baselayer.h" +#ifdef _WIN32 +int32_t win_gethinstance(void); +#endif + struct sdlappicon { int32_t width,height; uint32_t *pixels; @@ -31,7 +35,11 @@ static inline void idle_waitevent(void) static inline void idle(void) { +#ifndef _WIN32 usleep(1000); +#else + Sleep(1); +#endif } #else diff --git a/polymer/eduke32/build/src/glbuild.c b/polymer/eduke32/build/src/glbuild.c index e13a963fd..eae7bbc3f 100644 --- a/polymer/eduke32/build/src/glbuild.c +++ b/polymer/eduke32/build/src/glbuild.c @@ -279,7 +279,7 @@ bgluProjectProcPtr bgluProject; bgluUnProjectProcPtr bgluUnProject; -#ifdef RENDERTYPEWIN +#ifdef _WIN32 // Windows bwglCreateContextProcPtr bwglCreateContext; bwglDeleteContextProcPtr bwglDeleteContext; @@ -331,7 +331,7 @@ int32_t loadgldriver(const char *driver) { int32_t err=0; -#ifdef RENDERTYPEWIN +#ifdef _WIN32 if (hGLDLL) return 0; #endif @@ -354,7 +354,7 @@ int32_t loadgldriver(const char *driver) #endif gldriver = Bstrdup(driver); -#ifdef RENDERTYPEWIN +#ifdef _WIN32 bwglCreateContext = (bwglCreateContextProcPtr) GETPROC("wglCreateContext"); bwglDeleteContext = (bwglDeleteContextProcPtr) GETPROC("wglDeleteContext"); bwglGetProcAddress = (bwglGetProcAddressProcPtr) GETPROC("wglGetProcAddress"); @@ -492,7 +492,7 @@ fail: int32_t loadglextensions(void) { int32_t err = 0; -#ifdef RENDERTYPEWIN +#ifdef _WIN32 if (!hGLDLL) return 0; #endif @@ -635,7 +635,7 @@ int32_t loadglextensions(void) bglDebugMessageCallbackARB = (bglDebugMessageCallbackARBProcPtr) GETPROCEXTSOFT("glDebugMessageCallbackARB"); #endif -#ifdef RENDERTYPEWIN +#ifdef _WIN32 bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) GETPROCEXTSOFT("wglSwapIntervalEXT"); bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) GETPROCEXTSOFT("wglCreateContextAttribsARB"); #endif @@ -646,14 +646,14 @@ int32_t unloadgldriver(void) { unloadglulibrary(); -#ifdef RENDERTYPEWIN +#ifdef _WIN32 if (!hGLDLL) return 0; #endif Bfree(gldriver); gldriver = NULL; -#ifdef RENDERTYPEWIN +#ifdef _WIN32 FreeLibrary(hGLDLL); hGLDLL = NULL; #endif @@ -897,7 +897,7 @@ int32_t unloadgldriver(void) bglGetActiveAttribARB = (bglGetActiveAttribARBProcPtr) NULL; bglGetAttribLocationARB = (bglGetAttribLocationARBProcPtr) NULL; -#ifdef RENDERTYPEWIN +#ifdef _WIN32 bwglCreateContext = (bwglCreateContextProcPtr) NULL; bwglDeleteContext = (bwglDeleteContextProcPtr) NULL; bwglGetProcAddress = (bwglGetProcAddressProcPtr) NULL; @@ -936,7 +936,7 @@ int32_t loadglulibrary(const char *driver) { int32_t err=0; -#ifdef RENDERTYPEWIN +#ifdef _WIN32 if (hGLUDLL) return 0; #endif @@ -988,14 +988,14 @@ fail: int32_t unloadglulibrary(void) { -#ifdef RENDERTYPEWIN +#ifdef _WIN32 if (!hGLUDLL) return 0; #endif Bfree(glulibrary); glulibrary = NULL; -#ifdef RENDERTYPEWIN +#ifdef _WIN32 FreeLibrary(hGLUDLL); hGLUDLL = NULL; #else diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 4302b73c3..7cbe8b872 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -39,7 +39,7 @@ #undef UNREFERENCED_PARAMETER #define UNREFERENCED_PARAMETER(x) x=x -# ifndef OSX_STARTUPWINDOW +# if !defined _WIN32 && !defined OSX_STARTUPWINDOW int32_t startwin_open(void) { return 0; } int32_t startwin_close(void) { return 0; } int32_t startwin_puts(const char *s) { UNREFERENCED_PARAMETER(s); return 0; } @@ -117,6 +117,16 @@ static mutex_t m_initprintf; // Joystick dead and saturation zones uint16_t *joydead, *joysatur; +#ifdef _WIN32 +// +// win_gethinstance() -- gets the application instance +// +int32_t win_gethinstance(void) +{ + return (int32_t)(HINSTANCE)GetModuleHandle(NULL); +} +#endif + int32_t wm_msgbox(char *name, char *fmt, ...) { char buf[2048]; @@ -257,7 +267,7 @@ void setvsync(int32_t sync) static void attach_debugger_here(void) {} /* XXX: libexecinfo could be used on systems without gnu libc. */ -#if defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__) && !defined(GEKKO) && !defined(__ANDROID__) +#if !defined _WIN32 && defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__) && !defined(GEKKO) && !defined(__ANDROID__) # define PRINTSTACKONSEGV 1 # include #endif @@ -462,7 +472,9 @@ void initprintf(const char *f, ...) if (flushlogwindow || Bstrlen(dabuf) > 768) { startwin_puts(dabuf); +#ifndef _WIN32 startwin_idle(NULL); +#endif Bmemset(dabuf, 0, sizeof(dabuf)); } mutex_unlock(&m_initprintf); @@ -2236,7 +2248,9 @@ int32_t handleevents(void) } } +#ifndef _WIN32 startwin_idle(NULL); +#endif #undef SetKey diff --git a/polymer/eduke32/build/src/startwin.editor.c b/polymer/eduke32/build/src/startwin.editor.c index 7067718a7..1bd2d20cf 100644 --- a/polymer/eduke32/build/src/startwin.editor.c +++ b/polymer/eduke32/build/src/startwin.editor.c @@ -1,4 +1,4 @@ -#ifndef RENDERTYPEWIN +#ifndef _WIN32 #error Only for Windows #endif diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index c39b0e665..a54ea439a 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -8737,7 +8737,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) i++; continue; } -#ifdef _WIN32 +#if defined _WIN32 && defined RENDERTYPEWIN if (!Bstrcasecmp(c+1,"nodinput")) { initprintf("DirectInput (joystick) support disabled\n"); diff --git a/polymer/eduke32/source/jaudiolib/Makefile b/polymer/eduke32/source/jaudiolib/Makefile index 3e9d36a8f..4d03a2780 100644 --- a/polymer/eduke32/source/jaudiolib/Makefile +++ b/polymer/eduke32/source/jaudiolib/Makefile @@ -29,10 +29,10 @@ OURCXXFLAGS=$(BASECXXFLAGS) PRINTLDFLAGS=$(BASELDFLAGS) OURASFLAGS=$(BASEASFLAGS) -ifeq ($(PLATFORM),DARWIN) - ifeq (1,$(SDL_FRAMEWORK)) +ifeq (1,$(SDL_FRAMEWORK)) + ifeq ($(PLATFORM),DARWIN) APPLE_INCLUDE_DIR:=../../Apple/include - OURCOMMONFLAGS += -DSDL_FRAMEWORK -I$(APPLE_INCLUDE_DIR) -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \ + OURCOMMONFLAGS += -I$(APPLE_INCLUDE_DIR) -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \ -I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers endif endif @@ -53,14 +53,22 @@ OBJECTS=$(OBJ)/drivers.o \ $(OBJ)/driver_nosound.o ifeq ($(PLATFORM),WINDOWS) - OURCOMMONFLAGS+= -I$(DXROOT)/include -Ithird-party/mingw32/include - OBJECTS+= $(OBJ)/driver_directsound.o + ifeq ($(RENDERTYPE),WIN) + OURCOMMONFLAGS+= -DHAVE_DS -I$(DXROOT)/include + OBJECTS+= $(OBJ)/driver_directsound.o + endif + + OURCOMMONFLAGS+= -Ithird-party/mingw32/include OBJNAME=libjfaudiolib_win32.a OBJ=obj_win -else - OURCOMMONFLAGS+= -DHAVE_SDL $(SDLCONFIG_COMMONFLAGS) +endif + +ifeq ($(RENDERTYPE),SDL) + OURCOMMONFLAGS+= -DHAVE_SDL ifneq ($(PLATFORM),DARWIN) - OURCOMMONFLAGS+=`pkg-config --cflags vorbis` + ifneq ($(PLATFORM),WINDOWS) + OURCOMMONFLAGS+=`pkg-config --cflags vorbis` + endif endif OBJECTS+= $(OBJ)/driver_sdl.o endif diff --git a/polymer/eduke32/source/jaudiolib/src/driver_sdl.c b/polymer/eduke32/source/jaudiolib/src/driver_sdl.c index 1d70ad120..be54c262c 100644 --- a/polymer/eduke32/source/jaudiolib/src/driver_sdl.c +++ b/polymer/eduke32/source/jaudiolib/src/driver_sdl.c @@ -25,7 +25,11 @@ #if defined(SDL_FRAMEWORK) # include -# include +# if defined(_WIN32) +# include +# else +# include +# endif # include #else # include "SDL.h" diff --git a/polymer/eduke32/source/jaudiolib/src/drivers.c b/polymer/eduke32/source/jaudiolib/src/drivers.c index 7b1e645b4..70465237d 100644 --- a/polymer/eduke32/source/jaudiolib/src/drivers.c +++ b/polymer/eduke32/source/jaudiolib/src/drivers.c @@ -31,7 +31,7 @@ # include "driver_sdl.h" #endif -#ifdef WIN32 +#ifdef HAVE_DS # include "driver_directsound.h" #endif @@ -79,7 +79,7 @@ static struct { #endif // Windows DirectSound - #ifdef WIN32 + #ifdef HAVE_DS { DirectSoundDrv_GetError, DirectSoundDrv_ErrorString, diff --git a/polymer/eduke32/source/jaudiolib/src/fx_man.c b/polymer/eduke32/source/jaudiolib/src/fx_man.c index f75cf0002..5022cef3b 100644 --- a/polymer/eduke32/source/jaudiolib/src/fx_man.c +++ b/polymer/eduke32/source/jaudiolib/src/fx_man.c @@ -134,7 +134,7 @@ int32_t FX_Init if (SoundCard == ASS_AutoDetect) { -#if defined WIN32 +#if defined HAVE_DS SoundCard = ASS_DirectSound; #elif defined HAVE_SDL SoundCard = ASS_SDL; diff --git a/polymer/eduke32/source/sdlmusic.c b/polymer/eduke32/source/sdlmusic.c index 6f1048e15..43c5b4d53 100644 --- a/polymer/eduke32/source/sdlmusic.c +++ b/polymer/eduke32/source/sdlmusic.c @@ -145,9 +145,11 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address) if (external_midi) { +#if defined FORK_EXEC_MIDI int32_t ws=1, numargs=0, pagesize=sysconf(_SC_PAGE_SIZE); char *c, *cmd; size_t sz; +#endif initprintf("Setting music command to \"%s\".\n", command); diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 0d4104632..111a1b9b8 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -56,7 +56,7 @@ void S_SoundStartup(void) fxdevicetype = ASS_AutoDetect; else return; -#ifdef WIN32 +#ifdef RENDERTYPEWIN initdata = (void *) win_gethwnd(); #endif diff --git a/polymer/eduke32/source/sounds_mapster32.c b/polymer/eduke32/source/sounds_mapster32.c index 2513f1da7..4285628e0 100644 --- a/polymer/eduke32/source/sounds_mapster32.c +++ b/polymer/eduke32/source/sounds_mapster32.c @@ -78,7 +78,7 @@ int32_t S_SoundStartup(void) fxdevicetype = ASS_AutoDetect; -#ifdef WIN32 +#ifdef RENDERTYPEWIN initdata = (void *) win_gethwnd(); #endif diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index 34c765f95..c469c40d4 100644 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //------------------------------------------------------------------------- -#ifndef RENDERTYPEWIN +#ifndef _WIN32 #error Only for Windows #endif @@ -225,8 +225,11 @@ static void PopulateForm(int32_t pgs) (void)ComboBox_ResetContent(hwnd); (void)ComboBox_SetCurSel(hwnd, 0); + j = 4; + +#ifdef RENDERTYPEWIN if (di_disabled) j = 2; - else j = 4; +#endif for (i=0; i #include +#ifdef RENDERTYPEWIN #include "winlayer.h" +#else +#include "sdlayer.h" +#endif int32_t G_GetVersionFromWebsite(char *buffer) {