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
This commit is contained in:
hendricks266 2012-11-24 09:13:29 +00:00
parent 1f0693eca4
commit be899ba3af
21 changed files with 174 additions and 105 deletions

View file

@ -47,6 +47,8 @@ OURLDFLAGS=$(OURCOMMONFLAGS) $(PRINTLDFLAGS)
GAMELDFLAGS= GAMELDFLAGS=
EDITORLDFLAGS= EDITORLDFLAGS=
LIBS=
JAUDIOLIBDIR=$(SRC)/jaudiolib JAUDIOLIBDIR=$(SRC)/jaudiolib
JAUDIOLIB=libjfaudiolib.a JAUDIOLIB=libjfaudiolib.a
@ -56,6 +58,10 @@ ENETLIB=libenet.a
include $(EROOT)/Makefile.shared include $(EROOT)/Makefile.shared
OURLIBS=$(LIBS) $(BASELIBS) $(BUILDLIBS)
ifneq (0,$(USE_LIBVPX)) ifneq (0,$(USE_LIBVPX))
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
LIBS+= -LWindows/lib LIBS+= -LWindows/lib
@ -253,23 +259,27 @@ ifeq ($(PLATFORM),DARWIN)
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCOMMONFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include OURCOMMONFLAGS += -fno-pic -DUNDERSCORES
OURASFLAGS+= -DUNDERSCORES -f win32 OURASFLAGS+= -DUNDERSCORES -f win32
LIBS += -L$(JAUDIOLIBDIR)/third-party/mingw32/lib -lvorbisfile -lvorbis -logg -lwsock32 -lws2_32 -lwinmm -ldsound 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 $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o
EDITOROBJS+= $(OBJ)/buildres.$o EDITOROBJS+= $(OBJ)/buildres.$o
JAUDIOLIB=libjfaudiolib_win32.a JAUDIOLIB=libjfaudiolib_win32.a
ENETLIB=libenet_win32.a ENETLIB=libenet_win32.a
else ifeq ($(RENDERTYPE),WIN)
# -lGLU to build with gluBuild2DMipmaps OURCOMMONFLAGS += -I$(DXROOT)/include
ifeq ($(RENDERTYPE),SDL) LIBS+= -ldsound
ifeq (0,$(SDL_FRAMEWORK)) GAMEOBJS+= $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o
ifneq ($(PLATFORM),WII)
OURCOMMONFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
endif endif
LIBS+= -l$(SDLNAME)_mixer endif
# -lGLU to build with gluBuild2DMipmaps
ifeq ($(RENDERTYPE),SDL)
ifeq ($(PLATFORM),WINDOWS)
LIBS+= Windows/lib/SDL_mixer.lib
else else
OURCOMMONFLAGS += -DSDL_FRAMEWORK ifneq ($(PLATFORM),DARWIN)
LIBS+= -l$(SDLNAME)_mixer
endif
endif endif
ifeq (1,$(HAVE_GTK2)) ifeq (1,$(HAVE_GTK2))
@ -280,7 +290,6 @@ else
GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o
EDITOROBJS+= $(OBJ)/build_icon.$o EDITOROBJS+= $(OBJ)/build_icon.$o
endif
endif endif
@ -344,7 +353,7 @@ finish:
$(EDUKE32): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) $(MISCGAMEDEPS) $(EDUKE32): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) $(MISCGAMEDEPS)
$(LINK_STATUS) $(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 (1,$(RELEASE))
ifeq (0,$(DEBUGANYWAY)) ifeq (0,$(DEBUGANYWAY))
ifneq ($(PLATFORM),WII) ifneq ($(PLATFORM),WII)
@ -358,9 +367,9 @@ ifeq ($(PLATFORM),DARWIN)
cp -f "$(EDUKE32)" "EDuke32.app/Contents/MacOS/" cp -f "$(EDUKE32)" "EDuke32.app/Contents/MacOS/"
endif endif
$(MAPSTER32): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(MAPSTER32): $(EDITOROBJS) $(EOBJ)/$(ENGINELIB) $(EOBJ)/$(EDITORLIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB)
$(LINK_STATUS) $(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 (1,$(RELEASE))
ifeq (0,$(DEBUGANYWAY)) ifeq (0,$(DEBUGANYWAY))
ifneq ($(PLATFORM),WII) ifneq ($(PLATFORM),WII)
@ -430,7 +439,7 @@ $(OBJ)/%.$o: $(SRC)/util/%.c
ivfrate$(EXESUFFIX): $(OBJ)/ivfrate.$o ivfrate$(EXESUFFIX): $(OBJ)/ivfrate.$o
$(ONESTEP_STATUS) $(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 #### Lunatic

View file

@ -217,10 +217,10 @@ ifeq ($(PLATFORM),WII)
override USE_LIBVPX = 0 override USE_LIBVPX = 0
endif endif
LIBS=-lm BASELIBS=-lm
ifneq (0,$(USE_LIBVPX)) ifneq (0,$(USE_LIBVPX))
# On Windows, we link statically to libvpx # On Windows, we link statically to libvpx
LIBS+= -lvpx BASELIBS+= -lvpx
endif endif
@ -268,15 +268,15 @@ else
# endif # endif
endif endif
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
LIBS+=-rdynamic BASELIBS+=-rdynamic
endif endif
ifneq (0,$(MUDFLAP)) ifneq (0,$(MUDFLAP))
LIBS+= -lmudflapth BASELIBS+= -lmudflapth
debug+= -fmudflapth debug+= -fmudflapth
endif endif
ifneq (0,$(PROFILER)) ifneq (0,$(PROFILER))
# might need to be disabled for Darwin: # might need to be disabled for Darwin:
LIBS+= -lprofiler BASELIBS+= -lprofiler
debug+= -pg debug+= -pg
endif endif
ifneq (0,$(KRANDDEBUG)) ifneq (0,$(KRANDDEBUG))
@ -329,9 +329,9 @@ ifneq ($(LUNATIC),0)
BASECOMMONFLAGS+= -I$(SRC)/lunatic -DLUNATIC BASECOMMONFLAGS+= -I$(SRC)/lunatic -DLUNATIC
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
LIBS+= -LWindows/lib -lluajit BASELIBS+= -LWindows/lib -lluajit
else else
LIBS+= -lluajit-5.1 BASELIBS+= -lluajit-5.1
endif endif
endif endif
@ -359,11 +359,11 @@ ifneq (0,$(OSX_STARTUPWINDOW))
endif endif
ifneq (0,$(EFENCE)) ifneq (0,$(EFENCE))
LIBS+= -lefence BASELIBS+= -lefence
BASECOMMONFLAGS+= -DEFENCE BASECOMMONFLAGS+= -DEFENCE
endif endif
ifneq (0,$(DMALLOC)) ifneq (0,$(DMALLOC))
LIBS+= -ldmalloc BASELIBS+= -ldmalloc
BASECOMMONFLAGS+= -DDMALLOC BASECOMMONFLAGS+= -DDMALLOC
endif endif

Binary file not shown.

View file

@ -98,7 +98,8 @@ ifeq (1,$(LUNATIC))
endif endif
EDITOROBJS=$(OBJ)/build.$o \ EDITOROBJS=$(OBJ)/build.$o \
$(OBJ)/config.$o $(OBJ)/config.$o \
$(OBJ)/defs.$o
# PLATFORM SPECIFIC SETTINGS # PLATFORM SPECIFIC SETTINGS
@ -118,8 +119,9 @@ ifeq ($(PLATFORM),BSD)
OURCOMMONFLAGS+= -I/usr/X11R6/include OURCOMMONFLAGS+= -I/usr/X11R6/include
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCOMMONFLAGS+= -DUNDERSCORES -I$(DXROOT)/include # -I$(ENETROOT)/include OURCOMMONFLAGS+= -DUNDERSCORES # -I$(ENETROOT)/include
OURASFLAGS+= -DUNDERSCORES -f win32 OURASFLAGS+= -DUNDERSCORES -f win32
EDITOROBJS+= $(OBJ)/startwin.editor.$o
endif endif
ifeq ($(PLATFORM),BEOS) ifeq ($(PLATFORM),BEOS)
OURASFLAGS+= -f elf OURASFLAGS+= -f elf
@ -151,12 +153,6 @@ ifeq ($(RENDERTYPE),SDL)
endif endif
endif endif
ifeq (0,$(SDL_FRAMEWORK))
OURCOMMONFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
else
OURCOMMONFLAGS += -DSDL_FRAMEWORK
endif
ifeq (1,$(HAVE_GTK2)) ifeq (1,$(HAVE_GTK2))
OURCOMMONFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) OURCOMMONFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)/gtkbits.$o ENGINEOBJS+= $(OBJ)/gtkbits.$o
@ -167,8 +163,8 @@ ifeq ($(RENDERTYPE),SDL)
endif endif
endif endif
ifeq ($(RENDERTYPE),WIN) ifeq ($(RENDERTYPE),WIN)
OURCOMMONFLAGS+= -I$(DXROOT)/include
ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o
EDITOROBJS+= $(OBJ)/startwin.editor.$o
endif endif
OURCOMMONFLAGS+= $(BUILDCOMMONFLAGS) OURCOMMONFLAGS+= $(BUILDCOMMONFLAGS)

View file

@ -32,6 +32,7 @@ ifeq (4,$(GCC_MAJOR))
endif endif
BUILDCOMMONFLAGS=$(ARCH) BUILDCOMMONFLAGS=$(ARCH)
BUILDLIBS=
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
STDCPPLIB:= STDCPPLIB:=
@ -48,7 +49,7 @@ ifeq ($(PLATFORM),LINUX)
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64) ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
ifeq (1,$(BUILD32_ON_64)) ifeq (1,$(BUILD32_ON_64))
# On my 64bit Gentoo these are the 32bit emulation libs # 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 BUILDCOMMONFLAGS+= -m32
# Override WITHOUT_GTK=0 # Override WITHOUT_GTK=0
GTKCOMPAT32=1 GTKCOMPAT32=1
@ -76,10 +77,12 @@ ifeq ($(PLATFORM),DARWIN)
endif endif
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
RENDERTYPE ?= WIN RENDERTYPE?=WIN
WITHOUT_GTK?=1
SDL_FRAMEWORK=1
BUILDCOMMONFLAGS+= -DHAVE_INTTYPES BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
EXESUFFIX=.exe EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 BUILDLIBS+= -lmingwex -lwsock32 -lcomctl32 -lwinmm
#-lshfolder #-lshfolder
#STDCPPLIB:=-lstdc++ #STDCPPLIB:=-lstdc++
endif endif
@ -102,7 +105,7 @@ ifeq ($(PLATFORM),SKYOS)
BUILDCOMMONFLAGS+= -DUNDERSCORES BUILDCOMMONFLAGS+= -DUNDERSCORES
SDLCONFIG= SDLCONFIG=
SDLCONFIG_COMMONFLAGS=-I/boot/programs/sdk/include/sdl SDLCONFIG_COMMONFLAGS=-I/boot/programs/sdk/include/sdl
LIBS+= -lSDL -lnet BUILDLIBS+= -lSDL -lnet
endif endif
ifeq ($(PLATFORM),WII) ifeq ($(PLATFORM),WII)
ifeq ($(strip $(DEVKITPPC)),) ifeq ($(strip $(DEVKITPPC)),)
@ -124,21 +127,21 @@ ifeq ($(PLATFORM),WII)
-DGEKKO -DHAVE_INTTYPES -D__POWERPC__ \ -DGEKKO -DHAVE_INTTYPES -D__POWERPC__ \
-I$(LIBOGC_INC) -I$(LIBOGC_INC)/SDL -I$(PORTLIBS)/include -I$(LIBOGC_INC) -I$(LIBOGC_INC)/SDL -I$(PORTLIBS)/include
SDLCONFIG= SDLCONFIG=
LIBS+= -lSDL_mixer -lsmpeg -lSDL -laesnd BUILDLIBS+= -lSDL_mixer -lsmpeg -lSDL -laesnd
endif endif
ifeq ($(PLATFORM),QNX) ifeq ($(PLATFORM),QNX)
RENDERTYPE=SDL RENDERTYPE=SDL
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
STDCPPLIB:=-lstdc++ STDCPPLIB:=-lstdc++
LIBS+= -lsocket BUILDLIBS+= -lsocket
endif endif
ifeq ($(PLATFORM),SUNOS) ifeq ($(PLATFORM),SUNOS)
RENDERTYPE=SDL RENDERTYPE=SDL
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
STDCPPLIB:=-lstdc++ STDCPPLIB:=-lstdc++
LIBS+= -lsocket -lnsl BUILDLIBS+= -lsocket -lnsl
endif endif
ifeq ($(PLATFORM),SYLLABLE) ifeq ($(PLATFORM),SYLLABLE)
RENDERTYPE=SDL RENDERTYPE=SDL
@ -153,16 +156,30 @@ ifneq (0,$(CLANG))
endif endif
ifeq ($(RENDERTYPE),SDL) ifeq ($(RENDERTYPE),SDL)
ifeq ($(SDL_FRAMEWORK),1) ifeq ($(SDL_FRAMEWORK),1)
LIBS += -Wl,-framework,SDL 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 SDLCONFIG_COMMONFLAGS+= -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers
endif
else else
ifneq ($(SDLCONFIG),) ifneq ($(SDLCONFIG),)
SDLCONFIG_COMMONFLAGS+=$(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
SDLCONFIG_LIBS+= $(shell $(SDLCONFIG) --libs) SDLCONFIG_LIBS+= $(shell $(SDLCONFIG) --libs)
LIBS+= $(SDLCONFIG_LIBS)
SDLCONFIG_COMMONFLAGS+=$(shell $(SDLCONFIG) --cflags)
endif endif
endif endif
else
SDLCONFIG_COMMONFLAGS += -D_GNU_SOURCE=1
SDLCONFIG_LIBS+= -lmingw32 -lSDLmain -lSDL
endif
BUILDLIBS+= $(SDLCONFIG_LIBS)
BUILDCOMMONFLAGS+= $(SDLCONFIG_COMMONFLAGS)
ifeq (1,$(WITHOUT_GTK)) ifeq (1,$(WITHOUT_GTK))
HAVE_GTK2=0 HAVE_GTK2=0
@ -174,9 +191,9 @@ ifeq ($(RENDERTYPE),SDL)
# include cairo, so we need to filter out those -l switches in order to link # include cairo, so we need to filter out those -l switches in order to link
ifneq ($(LINKED_GTK),0) ifneq ($(LINKED_GTK),0)
ifeq ($(GTKCOMPAT32),1) 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 else
LIBS+= $(shell pkg-config --libs gtk+-2.0) BUILDLIBS+= $(shell pkg-config --libs gtk+-2.0)
endif endif
endif endif
else else
@ -185,7 +202,7 @@ ifeq ($(RENDERTYPE),SDL)
endif endif
else else
ifeq ($(RENDERTYPE),WIN) ifeq ($(RENDERTYPE),WIN)
LIBS+= -mwindows -ldxguid BUILDLIBS+= -L$(DXROOT)/lib -ldxguid
endif endif
endif endif
@ -223,40 +240,40 @@ endif
ifneq ($(PLATFORM),WINDOWS) ifneq ($(PLATFORM),WINDOWS)
ifneq ($(PLATFORM),WII) ifneq ($(PLATFORM),WII)
LIBS+= -ldl BUILDLIBS+= -ldl
endif endif
LIBS+= -pthread BUILDLIBS+= -pthread
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
ifneq ($(USE_LIBPNG),0) ifneq ($(USE_LIBPNG),0)
# XXX: these assume that the compiler runs from build/. Ugh. # 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 BUILDCOMMONFLAGS+= -I../Windows/include
endif endif
else else
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
ifneq ($(USE_LIBPNG),0) ifneq ($(USE_LIBPNG),0)
BUILDCOMMONFLAGS+= -I/opt/local/include -I/sw/include -I/usr/local/include 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 endif
else else
ifneq ($(USE_LIBPNG),0) ifneq ($(USE_LIBPNG),0)
LIBS+= -lpng -lz BUILDLIBS+= -lpng -lz
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
LIBS+= $(L_SSP) -Wl,--enable-auto-import BUILDLIBS+= $(L_SSP) -Wl,--enable-auto-import
LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT) BUILDLIBS+= -mwindows -lwsock32 -lws2_32 #-L$(ENETROOT)
endif endif
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
BUILD_SETTINGS_COMPILER = \033[1;36mcompiler: \033[0;36m\"$(COMPILER) $(OURCFLAGS)\" BUILD_SETTINGS_COMPILER = \033[1;36mcompiler: \033[0;36m\"$(COMPILER) $(OURCFLAGS)\"
BUILD_SETTINGS_ASSEMBLER = \033[1;36massembler: \033[0;36m\"$(AS) $(OURASFLAGS)\" 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)) ifeq (0,$(NOASM))
BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_ASSEMBLER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n" BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_ASSEMBLER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n"
else else

View file

@ -4,7 +4,7 @@
#ifdef USE_OPENGL #ifdef USE_OPENGL
#ifdef RENDERTYPEWIN #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#endif #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); 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; extern bgluUnProjectProcPtr bgluUnProject;
#ifdef RENDERTYPEWIN #ifdef _WIN32
// Windows // Windows
typedef HGLRC (WINAPI * bwglCreateContextProcPtr)(HDC); typedef HGLRC (WINAPI * bwglCreateContextProcPtr)(HDC);
extern bwglCreateContextProcPtr bwglCreateContext; extern bwglCreateContextProcPtr bwglCreateContext;

View file

@ -28,7 +28,11 @@ Minimum required SDL versions:
#if defined(_NEED_SDLMIXER) #if defined(_NEED_SDLMIXER)
# if defined(SDL_FRAMEWORK) # if defined(SDL_FRAMEWORK)
# if defined(_WIN32)
# include <SDL/SDL_mixer.h>
# else
# include <SDL_mixer/SDL_mixer.h> # include <SDL_mixer/SDL_mixer.h>
# endif
# else # else
# include "SDL_mixer.h" # include "SDL_mixer.h"
# endif # endif

View file

@ -9,6 +9,10 @@
#include "compat.h" #include "compat.h"
#include "baselayer.h" #include "baselayer.h"
#ifdef _WIN32
int32_t win_gethinstance(void);
#endif
struct sdlappicon { struct sdlappicon {
int32_t width,height; int32_t width,height;
uint32_t *pixels; uint32_t *pixels;
@ -31,7 +35,11 @@ static inline void idle_waitevent(void)
static inline void idle(void) static inline void idle(void)
{ {
#ifndef _WIN32
usleep(1000); usleep(1000);
#else
Sleep(1);
#endif
} }
#else #else

View file

@ -279,7 +279,7 @@ bgluProjectProcPtr bgluProject;
bgluUnProjectProcPtr bgluUnProject; bgluUnProjectProcPtr bgluUnProject;
#ifdef RENDERTYPEWIN #ifdef _WIN32
// Windows // Windows
bwglCreateContextProcPtr bwglCreateContext; bwglCreateContextProcPtr bwglCreateContext;
bwglDeleteContextProcPtr bwglDeleteContext; bwglDeleteContextProcPtr bwglDeleteContext;
@ -331,7 +331,7 @@ int32_t loadgldriver(const char *driver)
{ {
int32_t err=0; int32_t err=0;
#ifdef RENDERTYPEWIN #ifdef _WIN32
if (hGLDLL) return 0; if (hGLDLL) return 0;
#endif #endif
@ -354,7 +354,7 @@ int32_t loadgldriver(const char *driver)
#endif #endif
gldriver = Bstrdup(driver); gldriver = Bstrdup(driver);
#ifdef RENDERTYPEWIN #ifdef _WIN32
bwglCreateContext = (bwglCreateContextProcPtr) GETPROC("wglCreateContext"); bwglCreateContext = (bwglCreateContextProcPtr) GETPROC("wglCreateContext");
bwglDeleteContext = (bwglDeleteContextProcPtr) GETPROC("wglDeleteContext"); bwglDeleteContext = (bwglDeleteContextProcPtr) GETPROC("wglDeleteContext");
bwglGetProcAddress = (bwglGetProcAddressProcPtr) GETPROC("wglGetProcAddress"); bwglGetProcAddress = (bwglGetProcAddressProcPtr) GETPROC("wglGetProcAddress");
@ -492,7 +492,7 @@ fail:
int32_t loadglextensions(void) int32_t loadglextensions(void)
{ {
int32_t err = 0; int32_t err = 0;
#ifdef RENDERTYPEWIN #ifdef _WIN32
if (!hGLDLL) return 0; if (!hGLDLL) return 0;
#endif #endif
@ -635,7 +635,7 @@ int32_t loadglextensions(void)
bglDebugMessageCallbackARB = (bglDebugMessageCallbackARBProcPtr) GETPROCEXTSOFT("glDebugMessageCallbackARB"); bglDebugMessageCallbackARB = (bglDebugMessageCallbackARBProcPtr) GETPROCEXTSOFT("glDebugMessageCallbackARB");
#endif #endif
#ifdef RENDERTYPEWIN #ifdef _WIN32
bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) GETPROCEXTSOFT("wglSwapIntervalEXT"); bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) GETPROCEXTSOFT("wglSwapIntervalEXT");
bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) GETPROCEXTSOFT("wglCreateContextAttribsARB"); bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) GETPROCEXTSOFT("wglCreateContextAttribsARB");
#endif #endif
@ -646,14 +646,14 @@ int32_t unloadgldriver(void)
{ {
unloadglulibrary(); unloadglulibrary();
#ifdef RENDERTYPEWIN #ifdef _WIN32
if (!hGLDLL) return 0; if (!hGLDLL) return 0;
#endif #endif
Bfree(gldriver); Bfree(gldriver);
gldriver = NULL; gldriver = NULL;
#ifdef RENDERTYPEWIN #ifdef _WIN32
FreeLibrary(hGLDLL); FreeLibrary(hGLDLL);
hGLDLL = NULL; hGLDLL = NULL;
#endif #endif
@ -897,7 +897,7 @@ int32_t unloadgldriver(void)
bglGetActiveAttribARB = (bglGetActiveAttribARBProcPtr) NULL; bglGetActiveAttribARB = (bglGetActiveAttribARBProcPtr) NULL;
bglGetAttribLocationARB = (bglGetAttribLocationARBProcPtr) NULL; bglGetAttribLocationARB = (bglGetAttribLocationARBProcPtr) NULL;
#ifdef RENDERTYPEWIN #ifdef _WIN32
bwglCreateContext = (bwglCreateContextProcPtr) NULL; bwglCreateContext = (bwglCreateContextProcPtr) NULL;
bwglDeleteContext = (bwglDeleteContextProcPtr) NULL; bwglDeleteContext = (bwglDeleteContextProcPtr) NULL;
bwglGetProcAddress = (bwglGetProcAddressProcPtr) NULL; bwglGetProcAddress = (bwglGetProcAddressProcPtr) NULL;
@ -936,7 +936,7 @@ int32_t loadglulibrary(const char *driver)
{ {
int32_t err=0; int32_t err=0;
#ifdef RENDERTYPEWIN #ifdef _WIN32
if (hGLUDLL) return 0; if (hGLUDLL) return 0;
#endif #endif
@ -988,14 +988,14 @@ fail:
int32_t unloadglulibrary(void) int32_t unloadglulibrary(void)
{ {
#ifdef RENDERTYPEWIN #ifdef _WIN32
if (!hGLUDLL) return 0; if (!hGLUDLL) return 0;
#endif #endif
Bfree(glulibrary); Bfree(glulibrary);
glulibrary = NULL; glulibrary = NULL;
#ifdef RENDERTYPEWIN #ifdef _WIN32
FreeLibrary(hGLUDLL); FreeLibrary(hGLUDLL);
hGLUDLL = NULL; hGLUDLL = NULL;
#else #else

View file

@ -39,7 +39,7 @@
#undef UNREFERENCED_PARAMETER #undef UNREFERENCED_PARAMETER
#define UNREFERENCED_PARAMETER(x) x=x #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_open(void) { return 0; }
int32_t startwin_close(void) { return 0; } int32_t startwin_close(void) { return 0; }
int32_t startwin_puts(const char *s) { UNREFERENCED_PARAMETER(s); 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 // Joystick dead and saturation zones
uint16_t *joydead, *joysatur; 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, ...) int32_t wm_msgbox(char *name, char *fmt, ...)
{ {
char buf[2048]; char buf[2048];
@ -257,7 +267,7 @@ void setvsync(int32_t sync)
static void attach_debugger_here(void) {} static void attach_debugger_here(void) {}
/* XXX: libexecinfo could be used on systems without gnu libc. */ /* 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 # define PRINTSTACKONSEGV 1
# include <execinfo.h> # include <execinfo.h>
#endif #endif
@ -462,7 +472,9 @@ void initprintf(const char *f, ...)
if (flushlogwindow || Bstrlen(dabuf) > 768) if (flushlogwindow || Bstrlen(dabuf) > 768)
{ {
startwin_puts(dabuf); startwin_puts(dabuf);
#ifndef _WIN32
startwin_idle(NULL); startwin_idle(NULL);
#endif
Bmemset(dabuf, 0, sizeof(dabuf)); Bmemset(dabuf, 0, sizeof(dabuf));
} }
mutex_unlock(&m_initprintf); mutex_unlock(&m_initprintf);
@ -2236,7 +2248,9 @@ int32_t handleevents(void)
} }
} }
#ifndef _WIN32
startwin_idle(NULL); startwin_idle(NULL);
#endif
#undef SetKey #undef SetKey

View file

@ -1,4 +1,4 @@
#ifndef RENDERTYPEWIN #ifndef _WIN32
#error Only for Windows #error Only for Windows
#endif #endif

View file

@ -8737,7 +8737,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
i++; i++;
continue; continue;
} }
#ifdef _WIN32 #if defined _WIN32 && defined RENDERTYPEWIN
if (!Bstrcasecmp(c+1,"nodinput")) if (!Bstrcasecmp(c+1,"nodinput"))
{ {
initprintf("DirectInput (joystick) support disabled\n"); initprintf("DirectInput (joystick) support disabled\n");

View file

@ -29,10 +29,10 @@ OURCXXFLAGS=$(BASECXXFLAGS)
PRINTLDFLAGS=$(BASELDFLAGS) PRINTLDFLAGS=$(BASELDFLAGS)
OURASFLAGS=$(BASEASFLAGS) OURASFLAGS=$(BASEASFLAGS)
ifeq ($(PLATFORM),DARWIN) ifeq (1,$(SDL_FRAMEWORK))
ifeq (1,$(SDL_FRAMEWORK)) ifeq ($(PLATFORM),DARWIN)
APPLE_INCLUDE_DIR:=../../Apple/include 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 -I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
endif endif
endif endif
@ -53,15 +53,23 @@ OBJECTS=$(OBJ)/drivers.o \
$(OBJ)/driver_nosound.o $(OBJ)/driver_nosound.o
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCOMMONFLAGS+= -I$(DXROOT)/include -Ithird-party/mingw32/include ifeq ($(RENDERTYPE),WIN)
OURCOMMONFLAGS+= -DHAVE_DS -I$(DXROOT)/include
OBJECTS+= $(OBJ)/driver_directsound.o OBJECTS+= $(OBJ)/driver_directsound.o
endif
OURCOMMONFLAGS+= -Ithird-party/mingw32/include
OBJNAME=libjfaudiolib_win32.a OBJNAME=libjfaudiolib_win32.a
OBJ=obj_win OBJ=obj_win
else endif
OURCOMMONFLAGS+= -DHAVE_SDL $(SDLCONFIG_COMMONFLAGS)
ifeq ($(RENDERTYPE),SDL)
OURCOMMONFLAGS+= -DHAVE_SDL
ifneq ($(PLATFORM),DARWIN) ifneq ($(PLATFORM),DARWIN)
ifneq ($(PLATFORM),WINDOWS)
OURCOMMONFLAGS+=`pkg-config --cflags vorbis` OURCOMMONFLAGS+=`pkg-config --cflags vorbis`
endif endif
endif
OBJECTS+= $(OBJ)/driver_sdl.o OBJECTS+= $(OBJ)/driver_sdl.o
endif endif

View file

@ -25,7 +25,11 @@
#if defined(SDL_FRAMEWORK) #if defined(SDL_FRAMEWORK)
# include <SDL/SDL.h> # include <SDL/SDL.h>
# if defined(_WIN32)
# include <SDL/SDL_mixer.h>
# else
# include <SDL_mixer/SDL_mixer.h> # include <SDL_mixer/SDL_mixer.h>
# endif
# include <SDL/SDL_thread.h> # include <SDL/SDL_thread.h>
#else #else
# include "SDL.h" # include "SDL.h"

View file

@ -31,7 +31,7 @@
# include "driver_sdl.h" # include "driver_sdl.h"
#endif #endif
#ifdef WIN32 #ifdef HAVE_DS
# include "driver_directsound.h" # include "driver_directsound.h"
#endif #endif
@ -79,7 +79,7 @@ static struct {
#endif #endif
// Windows DirectSound // Windows DirectSound
#ifdef WIN32 #ifdef HAVE_DS
{ {
DirectSoundDrv_GetError, DirectSoundDrv_GetError,
DirectSoundDrv_ErrorString, DirectSoundDrv_ErrorString,

View file

@ -134,7 +134,7 @@ int32_t FX_Init
if (SoundCard == ASS_AutoDetect) if (SoundCard == ASS_AutoDetect)
{ {
#if defined WIN32 #if defined HAVE_DS
SoundCard = ASS_DirectSound; SoundCard = ASS_DirectSound;
#elif defined HAVE_SDL #elif defined HAVE_SDL
SoundCard = ASS_SDL; SoundCard = ASS_SDL;

View file

@ -145,9 +145,11 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address)
if (external_midi) if (external_midi)
{ {
#if defined FORK_EXEC_MIDI
int32_t ws=1, numargs=0, pagesize=sysconf(_SC_PAGE_SIZE); int32_t ws=1, numargs=0, pagesize=sysconf(_SC_PAGE_SIZE);
char *c, *cmd; char *c, *cmd;
size_t sz; size_t sz;
#endif
initprintf("Setting music command to \"%s\".\n", command); initprintf("Setting music command to \"%s\".\n", command);

View file

@ -56,7 +56,7 @@ void S_SoundStartup(void)
fxdevicetype = ASS_AutoDetect; fxdevicetype = ASS_AutoDetect;
else return; else return;
#ifdef WIN32 #ifdef RENDERTYPEWIN
initdata = (void *) win_gethwnd(); initdata = (void *) win_gethwnd();
#endif #endif

View file

@ -78,7 +78,7 @@ int32_t S_SoundStartup(void)
fxdevicetype = ASS_AutoDetect; fxdevicetype = ASS_AutoDetect;
#ifdef WIN32 #ifdef RENDERTYPEWIN
initdata = (void *) win_gethwnd(); initdata = (void *) win_gethwnd();
#endif #endif

View file

@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#ifndef RENDERTYPEWIN #ifndef _WIN32
#error Only for Windows #error Only for Windows
#endif #endif
@ -225,8 +225,11 @@ static void PopulateForm(int32_t pgs)
(void)ComboBox_ResetContent(hwnd); (void)ComboBox_ResetContent(hwnd);
(void)ComboBox_SetCurSel(hwnd, 0); (void)ComboBox_SetCurSel(hwnd, 0);
j = 4;
#ifdef RENDERTYPEWIN
if (di_disabled) j = 2; if (di_disabled) j = 2;
else j = 4; #endif
for (i=0; i<j; i++) for (i=0; i<j; i++)
{ {

View file

@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#ifdef RENDERTYPEWIN #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include "compat.h" #include "compat.h"
@ -32,7 +32,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#ifdef RENDERTYPEWIN
#include "winlayer.h" #include "winlayer.h"
#else
#include "sdlayer.h"
#endif
int32_t G_GetVersionFromWebsite(char *buffer) int32_t G_GetVersionFromWebsite(char *buffer)
{ {