Fix DirectSound in MSVC builds and remove the dependency on the DirectX SDK

git-svn-id: https://svn.eduke32.com/eduke32@3330 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-12-29 05:22:39 +00:00
parent d970283582
commit 0ae2d9ad60
4 changed files with 29 additions and 22 deletions

View file

@ -31,7 +31,6 @@ EDITORLIB=build.lib
# the WDK allows us to link against msvcrt.dll instead of msvcrxxx.dll # the WDK allows us to link against msvcrt.dll instead of msvcrxxx.dll
# this path should match build\Makefile.msvc # this path should match build\Makefile.msvc
# WDKROOT="H:\WinDDK\7600.16385.1" # WDKROOT="H:\WinDDK\7600.16385.1"
DXROOT="C:\SDKs\Microsoft DirectX SDK (February 2010)"
VORBISSDK="C:\SDKs\oggvorbis-win32sdk-1.0.1" VORBISSDK="C:\SDKs\oggvorbis-win32sdk-1.0.1"
!ifdef DEBUG !ifdef DEBUG
@ -57,10 +56,10 @@ MT=mt
CFLAGS= /MT /J /nologo $(flags_cl) \ CFLAGS= /MT /J /nologo $(flags_cl) \
/I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include \ /I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include \
/W2 $(ENGINEOPTS) \ /W2 $(ENGINEOPTS) \
/I$(DXROOT)\include /I$(VORBISSDK)\include /DRENDERTYPEWIN=1 /I$(VORBISSDK)\include /DRENDERTYPEWIN=1
LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib dxguid.lib comctl32.lib \ LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib \
vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib advapi32.lib vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib advapi32.lib
LIBS=/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /NODEFAULTLIB:libcmt.lib \ LIBS=/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /NODEFAULTLIB:libcmt.lib \
/NODEFAULTLIB:libcmtd.lib $(LIBS) /NODEFAULTLIB:libcmtd.lib $(LIBS)
@ -161,11 +160,11 @@ EDITOROBJS=$(OBJ)\astub.$o \
all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX)
eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)\$(ENGINELIB) $(JAUDIOLIBDIR)\$(JAUDIOLIB) $(ENETDIR)\$(ENETLIB) eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)\$(ENGINELIB) $(JAUDIOLIBDIR)\$(JAUDIOLIB) $(ENETDIR)\$(ENETLIB)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib$(DXLIB) /LIBPATH:$(VORBISSDK)\lib $(flags_link) /MAP $** $(LIBS) $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(VORBISSDK)\lib $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $(RSRC)$(WINLIB)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest $(MT) -manifest $(RSRC)$(WINLIB)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest
mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)\$(ENGINELIB) $(EOBJ)\$(EDITORLIB) $(JAUDIOLIBDIR)\$(JAUDIOLIB) mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)\$(ENGINELIB) $(EOBJ)\$(EDITORLIB) $(JAUDIOLIBDIR)\$(JAUDIOLIB)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib$(DXLIB) /LIBPATH:$(VORBISSDK)\lib $(flags_link) /MAP $** $(LIBS) $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(VORBISSDK)\lib $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $(RSRC)$(WINLIB)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest $(MT) -manifest $(RSRC)$(WINLIB)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest
!include Makefile.deps !include Makefile.deps

View file

@ -28,6 +28,10 @@
# define bREFIID & # define bREFIID &
#endif #endif
#ifdef _MSC_VER
#include <InitGuid.h>
#endif
#include <windows.h> #include <windows.h>
#include <ddraw.h> #include <ddraw.h>
#include <dinput.h> #include <dinput.h>

View file

@ -18,15 +18,14 @@ flags_lib=/LTCG
CC=cl CC=cl
LINK=link /opt:ref /nologo LINK=link /opt:ref /nologo
DXROOT=C:\SDKs\Microsoft DirectX SDK (April 2010)
VORBISSDK=C:\SDKs\oggvorbis-win32sdk-1.0.1 VORBISSDK=C:\SDKs\oggvorbis-win32sdk-1.0.1
CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(SRC) /I"$(VORBISSDK)\include" /I"$(DXROOT)\include" CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(SRC) /I"$(VORBISSDK)\include"
!ifdef DEBUG !ifdef DEBUG
CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS
!endif !endif
CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /D "_CRT_SECURE_NO_DEPRECATE" /W2 /DHAVE_VORBIS /Iinclude/msvc /DWIN32 CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /D "_CRT_SECURE_NO_DEPRECATE" /W2 /DHAVE_VORBIS /Iinclude/msvc /DWIN32 /DHAVE_DS
OBJECTS=$(OBJ)\drivers.o \ OBJECTS=$(OBJ)\drivers.o \
$(OBJ)\fx_man.o \ $(OBJ)\fx_man.o \
@ -43,7 +42,7 @@ OBJECTS=$(OBJ)\drivers.o \
jfaudiolib: $(JFAUDIOLIB) jfaudiolib: $(JFAUDIOLIB)
$(JFAUDIOLIB): $(OBJECTS) $(JFAUDIOLIB): $(OBJECTS)
lib $(flags_lib) /out:$@ /nologo $** lib $(flags_lib) /out:$@ /nologo $**
clean: clean:
-del /Q $(OBJ)\* $(JFAUDIOLIB) -del /Q $(OBJ)\* $(JFAUDIOLIB)

View file

@ -25,6 +25,11 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define DIRECTSOUND_VERSION 0x0700 #define DIRECTSOUND_VERSION 0x0700
#define CINTERFACE #define CINTERFACE
#ifdef _MSC_VER
#include <InitGuid.h>
#endif
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
#include <dsound.h> #include <dsound.h>
@ -58,19 +63,19 @@ static int32_t ErrorCode = DSErr_Ok;
static int32_t Initialised = 0; static int32_t Initialised = 0;
static int32_t Playing = 0; static int32_t Playing = 0;
static char *MixBuffer = 0; static char *MixBuffer = NULL;
static int32_t MixBufferSize = 0; static int32_t MixBufferSize = 0;
static int32_t MixBufferCount = 0; static int32_t MixBufferCount = 0;
static int32_t MixBufferCurrent = 0; static int32_t MixBufferCurrent = 0;
static int32_t MixBufferUsed = 0; static int32_t MixBufferUsed = 0;
static void ( *MixCallBack )( void ) = 0; static void ( *MixCallBack )( void ) = NULL;
static LPDIRECTSOUND lpds = 0; static LPDIRECTSOUND lpds = NULL;
static LPDIRECTSOUNDBUFFER lpdsbprimary = 0, lpdsbsec = 0; static LPDIRECTSOUNDBUFFER lpdsbprimary = NULL, lpdsbsec = NULL;
static LPDIRECTSOUNDNOTIFY lpdsnotify = 0; static LPDIRECTSOUNDNOTIFY lpdsnotify = NULL;
static DSBPOSITIONNOTIFY notifyPositions[3] = { { 0,0 }, { 0,0 }, { 0,0 } }; static DSBPOSITIONNOTIFY notifyPositions[3] = { { 0,0 }, { 0,0 }, { 0,0 } };
static HANDLE mixThread = 0; static HANDLE mixThread = NULL;
static HANDLE mutex = 0; static HANDLE mutex = NULL;
static void FillBufferPortion(char * ptr, int32_t remaining) static void FillBufferPortion(char * ptr, int32_t remaining)
@ -292,11 +297,11 @@ static void TeardownDSound(HRESULT err)
notifyPositions[0].hEventNotify = notifyPositions[0].hEventNotify =
notifyPositions[1].hEventNotify = notifyPositions[1].hEventNotify =
notifyPositions[2].hEventNotify = 0; notifyPositions[2].hEventNotify = 0;
mutex = 0; mutex = NULL;
lpdsnotify = 0; lpdsnotify = NULL;
lpdsbsec = 0; lpdsbsec = NULL;
lpdsbprimary = 0; lpdsbprimary = NULL;
lpds = 0; lpds = NULL;
} }
int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata) int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata)