Split the handling of audio based on RENDERTYPE into a new variable named MIXERTYPE, allowing Windows builds to use SDL for input and rendering (RENDERTYPE=SDL) while using DirectSound and Windows' MIDI interface (MIXERTYPE=WIN [current default]) so that EMIDI works.

git-svn-id: https://svn.eduke32.com/eduke32@4084 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2013-10-07 10:05:03 +00:00
parent d781c4ad94
commit db69800fd0
16 changed files with 106 additions and 31 deletions

View file

@ -267,14 +267,24 @@ ifeq ($(PLATFORM),WINDOWS)
EDITOROBJS+= $(OBJ)/buildres.$o EDITOROBJS+= $(OBJ)/buildres.$o
JAUDIOLIB=libjfaudiolib_win32.a JAUDIOLIB=libjfaudiolib_win32.a
ENETLIB=libenet_win32.a ENETLIB=libenet_win32.a
ifeq ($(RENDERTYPE),WIN)
OURCOMMONFLAGS += -I$(DXROOT) -I$(DXROOT)/include OURCOMMONFLAGS += -I$(DXROOT) -I$(DXROOT)/include
ifeq ($(MIXERTYPE),WIN)
LIBS+= -ldsound LIBS+= -ldsound
GAMEOBJS+= $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o GAMEOBJS+= $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o
endif endif
endif endif
# -lGLU to build with gluBuild2DMipmaps # -lGLU to build with gluBuild2DMipmaps
ifeq ($(RENDERTYPE),SDL) ifeq ($(RENDERTYPE),SDL)
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
EDITOROBJS+= $(OBJ)/build_icon.$o
endif
ifeq ($(MIXERTYPE),SDL)
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
ifeq ($(SDL_TARGET),1) ifeq ($(SDL_TARGET),1)
@ -289,14 +299,7 @@ ifeq ($(RENDERTYPE),SDL)
endif endif
endif endif
ifeq (1,$(HAVE_GTK2)) GAMEOBJS+= $(OBJ)/sdlmusic.$o
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 endif

View file

@ -114,7 +114,7 @@ ifeq ($(PLATFORM),BSD)
OURCOMMONFLAGS+= -I/usr/X11R6/include OURCOMMONFLAGS+= -I/usr/X11R6/include
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCOMMONFLAGS+= -DUNDERSCORES # -I$(ENETROOT)/include OURCOMMONFLAGS+= -DUNDERSCORES -I$(DXROOT) -I$(DXROOT)/include # -I$(ENETROOT)/include
OURASFLAGS+= -DUNDERSCORES -f win32 OURASFLAGS+= -DUNDERSCORES -f win32
ENGINEOBJS+= $(OBJ)/winbits.$o ENGINEOBJS+= $(OBJ)/winbits.$o
EDITOROBJS+= $(OBJ)/startwin.editor.$o EDITOROBJS+= $(OBJ)/startwin.editor.$o
@ -146,8 +146,7 @@ ifeq ($(RENDERTYPE),SDL)
endif endif
ifeq (1,$(SDL_FRAMEWORK)) ifeq (1,$(SDL_FRAMEWORK))
OURCOMMONFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \ OURCOMMONFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers
-I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
else else
OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
endif endif
@ -162,8 +161,14 @@ ifeq ($(RENDERTYPE),SDL)
EDITOROBJS+= $(OBJ)/startgtk.editor.$o EDITOROBJS+= $(OBJ)/startgtk.editor.$o
endif endif
endif endif
ifeq ($(MIXERTYPE),SDL)
ifeq ($(PLATFORM),DARWIN)
ifeq (1,$(SDL_FRAMEWORK))
OURCOMMONFLAGS += -I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
endif
endif
endif
ifeq ($(RENDERTYPE),WIN) ifeq ($(RENDERTYPE),WIN)
OURCOMMONFLAGS+= -I$(DXROOT) -I$(DXROOT)/include
ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o
endif endif

View file

@ -56,6 +56,7 @@ BUILDLIBDIRS=
ifeq ($(SUBPLATFORM),LINUX) ifeq ($(SUBPLATFORM),LINUX)
RENDERTYPE=SDL RENDERTYPE=SDL
MIXERTYPE=SDL
BUILDCOMMONFLAGS+= -DHAVE_INTTYPES BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
GTKCOMPAT32=0 GTKCOMPAT32=0
SDL_FRAMEWORK=0 SDL_FRAMEWORK=0
@ -88,6 +89,7 @@ ifeq ($(SUBPLATFORM),LINUX)
endif endif
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
RENDERTYPE = SDL RENDERTYPE = SDL
MIXERTYPE = SDL
STDCPPLIB:=-lstdc++ STDCPPLIB:=-lstdc++
BUILDCOMMONFLAGS += -DHAVE_INTTYPES BUILDCOMMONFLAGS += -DHAVE_INTTYPES
GTKCOMPAT32 = 0 GTKCOMPAT32 = 0
@ -105,6 +107,13 @@ ifeq ($(PLATFORM),DARWIN)
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
RENDERTYPE?=WIN RENDERTYPE?=WIN
MIXERTYPE?=WIN
ifneq ($(RENDERTYPE),SDL)
ifeq ($(MIXERTYPE),SDL)
MIXERTYPE:=WIN
endif
endif
WITHOUT_GTK?=1 WITHOUT_GTK?=1
SDL_FRAMEWORK=1 SDL_FRAMEWORK=1
BUILDCOMMONFLAGS+= -DHAVE_INTTYPES BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
@ -121,6 +130,7 @@ ifeq ($(PLATFORM),WINDOWS)
endif endif
ifeq ($(PLATFORM),BSD) ifeq ($(PLATFORM),BSD)
RENDERTYPE=SDL RENDERTYPE=SDL
MIXERTYPE=SDL
BUILDCOMMONFLAGS+= -DHAVE_INTTYPES BUILDCOMMONFLAGS+= -DHAVE_INTTYPES
ifneq ($(findstring i386,$(SYSARCH)),i386) ifneq ($(findstring i386,$(SYSARCH)),i386)
override NOASM=1 override NOASM=1
@ -129,10 +139,12 @@ ifeq ($(PLATFORM),BSD)
endif endif
ifeq ($(PLATFORM),BEOS) ifeq ($(PLATFORM),BEOS)
RENDERTYPE=SDL RENDERTYPE=SDL
MIXERTYPE=SDL
STDCPPLIB:=-lstdc++ STDCPPLIB:=-lstdc++
endif endif
ifeq ($(PLATFORM),SKYOS) ifeq ($(PLATFORM),SKYOS)
RENDERTYPE=SDL RENDERTYPE=SDL
MIXERTYPE=SDL
EXESUFFIX=.app EXESUFFIX=.app
override NOASM=1 override NOASM=1
BUILDCOMMONFLAGS+= -DUNDERSCORES -I/boot/programs/sdk/include/sdl BUILDCOMMONFLAGS+= -DUNDERSCORES -I/boot/programs/sdk/include/sdl
@ -141,6 +153,7 @@ ifeq ($(PLATFORM),SKYOS)
endif endif
ifeq ($(PLATFORM),WII) ifeq ($(PLATFORM),WII)
RENDERTYPE=SDL RENDERTYPE=SDL
MIXERTYPE=SDL
EXESUFFIX=.elf EXESUFFIX=.elf
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
@ -155,6 +168,7 @@ ifeq ($(PLATFORM),WII)
endif endif
ifeq ($(PLATFORM),QNX) ifeq ($(PLATFORM),QNX)
RENDERTYPE=SDL RENDERTYPE=SDL
MIXERTYPE=SDL
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
STDCPPLIB:=-lstdc++ STDCPPLIB:=-lstdc++
@ -162,6 +176,7 @@ ifeq ($(PLATFORM),QNX)
endif endif
ifeq ($(PLATFORM),SUNOS) ifeq ($(PLATFORM),SUNOS)
RENDERTYPE=SDL RENDERTYPE=SDL
MIXERTYPE=SDL
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
STDCPPLIB:=-lstdc++ STDCPPLIB:=-lstdc++
@ -169,6 +184,7 @@ ifeq ($(PLATFORM),SUNOS)
endif endif
ifeq ($(PLATFORM),SYLLABLE) ifeq ($(PLATFORM),SYLLABLE)
RENDERTYPE=SDL RENDERTYPE=SDL
MIXERTYPE=SDL
override USE_OPENGL=0 override USE_OPENGL=0
override NOASM=1 override NOASM=1
endif endif
@ -232,14 +248,20 @@ ifeq ($(RENDERTYPE),SDL)
HAVE_GTK2=0 HAVE_GTK2=0
endif endif
endif endif
else endif
ifeq ($(RENDERTYPE),WIN) ifeq ($(RENDERTYPE),WIN)
BUILDLIBS+= -ldxguid BUILDLIBS+= -ldxguid
endif endif
ifeq ($(PLATFORM),WINDOWS)
ifeq ($(MIXERTYPE),WIN)
ifeq ($(RENDERTYPE),SDL)
BUILDLIBS+= -ldxguid_sdl
endif
endif
endif endif
BUILDCOMMONFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 -DMIXERTYPE$(MIXERTYPE)=1 $(W_STRICT_OVERFLOW)
BUILDCOMMONFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 $(W_STRICT_OVERFLOW)
ifneq (0,$(USE_OPENGL)) ifneq (0,$(USE_OPENGL))
BUILDCOMMONFLAGS+= -DUSE_OPENGL BUILDCOMMONFLAGS+= -DUSE_OPENGL

View file

@ -10,8 +10,10 @@
#if defined(SDL_FRAMEWORK) #if defined(SDL_FRAMEWORK)
# if (SDL_TARGET == 2) # if (SDL_TARGET == 2)
# include <SDL2/SDL.h> # include <SDL2/SDL.h>
# include <SDL2/SDL_syswm.h>
# else # else
# include <SDL/SDL.h> # include <SDL/SDL.h>
# include <SDL/SDL_syswm.h>
# endif # endif
#else #else
# include "SDL.h" # include "SDL.h"

View file

@ -10,6 +10,7 @@
#include "baselayer.h" #include "baselayer.h"
#ifdef _WIN32 #ifdef _WIN32
HWND win_gethwnd(void);
HINSTANCE win_gethinstance(void); HINSTANCE win_gethinstance(void);
#endif #endif

View file

@ -117,6 +117,35 @@ uint16_t *joydead, *joysatur;
#ifdef _WIN32 #ifdef _WIN32
// //
// win_gethwnd() -- gets the window handle
//
HWND win_gethwnd(void)
{
struct SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
#if SDL_MAJOR_VERSION==1
if (SDL_GetWMInfo(&wmInfo) != 1)
#else
if (SDL_GetWindowWMInfo(sdl_window, &wmInfo) != SDL_TRUE)
#endif
{
initprintf("win_gethwnd: SDL_GetWindowWMInfo() failed: %s\n", SDL_GetError());
return 0;
}
#if SDL_MAJOR_VERSION==1
return wmInfo.window;
#else
if (wmInfo.subsystem == SDL_SYSWM_WINDOWS)
return wmInfo.info.win.window;
#endif
initprintf("win_gethwnd: Unknown WM subsystem?!\n");
return 0;
}
//
// win_gethinstance() -- gets the application instance // win_gethinstance() -- gets the application instance
// //
HINSTANCE win_gethinstance(void) HINSTANCE win_gethinstance(void)

View file

@ -13,17 +13,22 @@ lib%.a: %.def
all : libdsound.a libdxguid.a all : libdsound.a libdxguid.a libdxguid_sdl.a
@ls -l $^ @ls -l $^
full : libd3d8.a libd3dx8d.a libd3dxof.a libddraw.a libdinput.a libdinput8.a libdplayx.a \ full : libd3d8.a libd3dx8d.a libd3dxof.a libddraw.a libdinput.a libdinput8.a libdplayx.a \
libdpnaddr.a libdpnet.a libdpnlobby.a libdpvoice.a libdsound.a libdsetup.a libdxguid.a libdpnaddr.a libdpnet.a libdpnlobby.a libdpvoice.a libdsetup.a \
libdsound.a libdxguid.a libdxguid_sdl.a
@ls -l $^ @ls -l $^
@echo move the created libraries to the lib dir. @echo move the created libraries to the lib dir.
@echo happy coding !! @echo happy coding !!
libdxguid_sdl.a : dxguid_sdl.o
ar -r libdxguid_sdl.a dxguid_sdl.o
ranlib libdxguid_sdl.a
libdxguid.a : dxguid.o libdxguid.a : dxguid.o
ar -r libdxguid.a dxguid.o ar -r libdxguid.a dxguid.o
ranlib libdxguid.a ranlib libdxguid.a

View file

@ -1,3 +1,5 @@
#define DIRECTINPUT_VERSION 0x0700
#include <dinput.h> #include <dinput.h>
/* This is a replacement for parts of dinput.lib. */ /* This is a replacement for parts of dinput.lib. */

View file

@ -1,5 +1,7 @@
#define DIRECTINPUT_VERSION 0x0700
#include <dinput.h> #include <dinput.h>
/* This is a replacement for Microsofts dxguid.lib. */ /* This is a replacement for Microsoft's dxguid.lib. */
#undef DEFINE_GUID #undef DEFINE_GUID
#define DEFINE_GUID(n,a,b,c,d,e,f,g,h,i,j,k) const GUID n = {a,b,c,{d,e,f,g,h,i,j,k}} #define DEFINE_GUID(n,a,b,c,d,e,f,g,h,i,j,k) const GUID n = {a,b,c,{d,e,f,g,h,i,j,k}}

View file

@ -0,0 +1,9 @@
#define DIRECTINPUT_VERSION 0x0700
#include <dinput.h>
#undef DEFINE_GUID
#define DEFINE_GUID(n,a,b,c,d,e,f,g,h,i,j,k) const GUID n = {a,b,c,{d,e,f,g,h,i,j,k}}
/* dsound.h */
DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);

View file

@ -53,7 +53,7 @@ ifeq ($(PLATFORM),DARWIN)
endif endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
ifeq ($(RENDERTYPE),WIN) ifeq ($(MIXERTYPE),WIN)
OURCOMMONFLAGS+= -DHAVE_DS -I$(DXROOT) -I$(DXROOT)/include OURCOMMONFLAGS+= -DHAVE_DS -I$(DXROOT) -I$(DXROOT)/include
OBJECTS+= $(OBJ)/driver_directsound.o OBJECTS+= $(OBJ)/driver_directsound.o
endif endif
@ -63,7 +63,7 @@ ifeq ($(PLATFORM),WINDOWS)
OBJ=obj_win OBJ=obj_win
endif endif
ifeq ($(RENDERTYPE),SDL) ifeq ($(MIXERTYPE),SDL)
OURCOMMONFLAGS+= -DHAVE_SDL OURCOMMONFLAGS+= -DHAVE_SDL
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL

View file

@ -32,11 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "menus.h" #include "menus.h"
#include "demo.h" #include "demo.h"
#ifdef RENDERTYPEWIN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#ifdef LUNATIC #ifdef LUNATIC
# include "lunatic_game.h" # include "lunatic_game.h"
#endif #endif

View file

@ -56,7 +56,7 @@ void S_SoundStartup(void)
fxdevicetype = ASS_AutoDetect; fxdevicetype = ASS_AutoDetect;
else return; else return;
#ifdef RENDERTYPEWIN #ifdef MIXERTYPEWIN
initdata = (void *) win_gethwnd(); // used for DirectSound initdata = (void *) win_gethwnd(); // used for DirectSound
#endif #endif

View file

@ -79,7 +79,7 @@ int32_t S_SoundStartup(void)
fxdevicetype = ASS_AutoDetect; fxdevicetype = ASS_AutoDetect;
#ifdef RENDERTYPEWIN #ifdef MIXERTYPEWIN
initdata = (void *) win_gethwnd(); // used for DirectSound initdata = (void *) win_gethwnd(); // used for DirectSound
#endif #endif