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
JAUDIOLIB=libjfaudiolib_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
GAMEOBJS+= $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o
endif
endif
# -lGLU to build with gluBuild2DMipmaps
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)
OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
ifeq ($(SDL_TARGET),1)
@ -289,14 +299,7 @@ ifeq ($(RENDERTYPE),SDL)
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
GAMEOBJS+= $(OBJ)/sdlmusic.$o
endif

View file

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

View file

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

View file

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

View file

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

View file

@ -117,6 +117,35 @@ uint16_t *joydead, *joysatur;
#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
//
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 $^
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 $^
@echo move the created libraries to the lib dir.
@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
ar -r libdxguid.a dxguid.o
ranlib libdxguid.a

View file

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

View file

@ -1,5 +1,7 @@
#define DIRECTINPUT_VERSION 0x0700
#include <dinput.h>
/* This is a replacement for Microsofts dxguid.lib. */
/* This is a replacement for Microsoft's dxguid.lib. */
#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}}

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
ifeq ($(PLATFORM),WINDOWS)
ifeq ($(RENDERTYPE),WIN)
ifeq ($(MIXERTYPE),WIN)
OURCOMMONFLAGS+= -DHAVE_DS -I$(DXROOT) -I$(DXROOT)/include
OBJECTS+= $(OBJ)/driver_directsound.o
endif
@ -63,7 +63,7 @@ ifeq ($(PLATFORM),WINDOWS)
OBJ=obj_win
endif
ifeq ($(RENDERTYPE),SDL)
ifeq ($(MIXERTYPE),SDL)
OURCOMMONFLAGS+= -DHAVE_SDL
ifeq ($(PLATFORM),WINDOWS)
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 "demo.h"
#ifdef RENDERTYPEWIN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#ifdef LUNATIC
# include "lunatic_game.h"
#endif

View file

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

View file

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