Compiles in cygwin's mingw environment: make FTE_TARGET=win32

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2399 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-10-05 21:59:43 +00:00
parent 742c8df40b
commit b4cb2a66b6
5 changed files with 34 additions and 10 deletions

View file

@ -367,6 +367,15 @@ SV_CFLAGS=$(SERVER_ONLY_CFLAGS)
#specific targets override those defaults as needed. #specific targets override those defaults as needed.
ifeq ($(FTE_TARGET),win32) ifeq ($(FTE_TARGET),win32)
#cygwin's gcc requires an extra command to use mingw instead of cygwin (default paths, etc).
ifneq ($(shell $(CC) -v 2>&1 | grep cygwin),)
W32_CFLAGS=-mno-cygwin
endif
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) $(W32_CFLAGS)
LIBS_DIR = $(BASE_DIR)/libs LIBS_DIR = $(BASE_DIR)/libs
SV_EXE_NAME=../fteqwsv.exe SV_EXE_NAME=../fteqwsv.exe
SV_LDFLAGS=libs/zlib.lib -lwsock32 SV_LDFLAGS=libs/zlib.lib -lwsock32
@ -381,7 +390,7 @@ endif
GL_EXE_NAME=../fteglqw.exe GL_EXE_NAME=../fteglqw.exe
GLCL_EXE_NAME=../fteglqwcl.exe GLCL_EXE_NAME=../fteglqwcl.exe
GL_LDFLAGS=$(GLLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32 GL_LDFLAGS=$(GLLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32
GL_CFLAGS=$(GLCFLAGS) GL_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS)
GLB_DIR=gl_mgw GLB_DIR=gl_mgw
GLCL_DIR=glcl_mgw GLCL_DIR=glcl_mgw
@ -393,7 +402,7 @@ endif
SW_EXE_NAME=../fteswqw.exe SW_EXE_NAME=../fteswqw.exe
SWCL_EXE_NAME=../fteswqwcl.exe SWCL_EXE_NAME=../fteswqwcl.exe
SW_LDFLAGS=$(SWLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32 SW_LDFLAGS=$(SWLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32
SW_CFLAGS=$(SWCFLAGS) SW_CFLAGS=$(SWCFLAGS) $(W32_CFLAGS)
SWB_DIR=sw_mgw SWB_DIR=sw_mgw
SWCL_DIR=swcl_mgw SWCL_DIR=swcl_mgw
@ -405,7 +414,7 @@ endif
M_EXE_NAME=../fteqw.exe M_EXE_NAME=../fteqw.exe
MCL_EXE_NAME=../fteqwcl.exe MCL_EXE_NAME=../fteqwcl.exe
M_LDFLAGS=$(GLLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32 M_LDFLAGS=$(GLLDFLAGS) -ldxguid -lwsock32 -lwinmm -lgdi32 -lole32
M_CFLAGS=$(SWCFLAGS) $(GLCFLAGS) M_CFLAGS=$(SWCFLAGS) $(GLCFLAGS) $(W32_CFLAGS)
MB_DIR=m_mgw MB_DIR=m_mgw
MCL_DIR=mcl_mgw MCL_DIR=mcl_mgw

View file

@ -1754,12 +1754,12 @@ int MP_TranslateDPtoFTECodes(int code)
void MP_Keydown(int key) void MP_Keydown(int key)
{ {
extern qboolean keydown[K_MAX];
if (setjmp(mp_abort)) if (setjmp(mp_abort))
return; return;
if (key == 'c') if (key == 'c')
{ {
extern int keydown[];
if (keydown[K_CTRL]) if (keydown[K_CTRL])
{ {
MP_Shutdown(); MP_Shutdown();
@ -1768,7 +1768,6 @@ void MP_Keydown(int key)
} }
if (key == K_ESCAPE) if (key == K_ESCAPE)
{ {
extern qboolean keydown[K_MAX];
if (keydown[K_SHIFT]) if (keydown[K_SHIFT])
{ {
Con_ToggleConsole_f(); Con_ToggleConsole_f();

View file

@ -199,9 +199,13 @@ int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...);
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr); int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
#endif #endif
#ifdef _MSC_VER
//these are provided so we don't use them
//but mingw has some defines elsewhere and makes gcc moan
#define _vsnprintf unsafe_vsnprintf #define _vsnprintf unsafe_vsnprintf
#define _snprintf unsafe_snprintf #define _snprintf unsafe_snprintf
#endif #endif
#endif
//============================================================================= //=============================================================================

View file

@ -30,7 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define iDirectSoundEnumerate(a,b,c) pDirectSoundEnumerate(a,b) #define iDirectSoundEnumerate(a,b,c) pDirectSoundEnumerate(a,b)
HRESULT (WINAPI *pDirectSoundCreate)(GUID FAR *lpGUID, LPDIRECTSOUND FAR *lplpDS, IUnknown FAR *pUnkOuter); HRESULT (WINAPI *pDirectSoundCreate)(GUID FAR *lpGUID, LPDIRECTSOUND FAR *lplpDS, IUnknown FAR *pUnkOuter);
#if defined(VOICECHAT) && !defined(__MINGW32__)
HRESULT (WINAPI *pDirectSoundCaptureCreate)(GUID FAR *lpGUID, LPDIRECTSOUNDCAPTURE FAR *lplpDS, IUnknown FAR *pUnkOuter); HRESULT (WINAPI *pDirectSoundCaptureCreate)(GUID FAR *lpGUID, LPDIRECTSOUNDCAPTURE FAR *lplpDS, IUnknown FAR *pUnkOuter);
#endif
HRESULT (WINAPI *pDirectSoundEnumerate)(LPDSENUMCALLBACKA lpCallback, LPVOID lpContext ); HRESULT (WINAPI *pDirectSoundEnumerate)(LPDSENUMCALLBACKA lpCallback, LPVOID lpContext );
// 64K is > 1 second at 16-bit, 22050 Hz // 64K is > 1 second at 16-bit, 22050 Hz
@ -122,12 +124,12 @@ static void DSOUND_Shutdown (soundcardinfo_t *sc)
if (!dh) if (!dh)
return; return;
sc->handle = NULL; sc->handle = NULL;
#ifdef _IKsPropertySet_
if (dh->EaxKsPropertiesSet) if (dh->EaxKsPropertiesSet)
{ {
IKsPropertySet_Release(dh->EaxKsPropertiesSet); IKsPropertySet_Release(dh->EaxKsPropertiesSet);
} }
#endif
if (dh->pDSBuf) if (dh->pDSBuf)
{ {
dh->pDSBuf->lpVtbl->Stop(dh->pDSBuf); dh->pDSBuf->lpVtbl->Stop(dh->pDSBuf);
@ -149,7 +151,9 @@ static void DSOUND_Shutdown (soundcardinfo_t *sc)
dh->pDS = NULL; dh->pDS = NULL;
dh->pDSBuf = NULL; dh->pDSBuf = NULL;
dh->pDSPBuf = NULL; dh->pDSPBuf = NULL;
#ifdef _IKsPropertySet_
dh->EaxKsPropertiesSet = NULL; dh->EaxKsPropertiesSet = NULL;
#endif
Z_Free(dh); Z_Free(dh);
} }
@ -601,6 +605,7 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
dh = sc->handle; dh = sc->handle;
//EAX attempt //EAX attempt
#ifndef MINIMAL #ifndef MINIMAL
#ifdef _IKsPropertySet_
dh->pDS = NULL; dh->pDS = NULL;
if (snd_eax.value) if (snd_eax.value)
{ {
@ -612,6 +617,7 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
} }
if (!dh->pDS) if (!dh->pDS)
#endif
#endif #endif
{ {
while ((hresult = iDirectSoundCreate(dsndguid, &dh->pDS, NULL)) != DS_OK) while ((hresult = iDirectSoundCreate(dsndguid, &dh->pDS, NULL)) != DS_OK)
@ -667,11 +673,13 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
dsbuf.dwBufferBytes = 0; dsbuf.dwBufferBytes = 0;
dsbuf.lpwfxFormat = NULL; dsbuf.lpwfxFormat = NULL;
#ifdef DSBCAPS_GLOBALFOCUS
if (snd_inactive.value) if (snd_inactive.value)
{ {
dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS; dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS;
sc->inactive_sound = true; sc->inactive_sound = true;
} }
#endif
memset(&dsbcaps, 0, sizeof(dsbcaps)); memset(&dsbcaps, 0, sizeof(dsbcaps));
dsbcaps.dwSize = sizeof(dsbcaps); dsbcaps.dwSize = sizeof(dsbcaps);
@ -704,11 +712,13 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
memset (&dsbuf, 0, sizeof(dsbuf)); memset (&dsbuf, 0, sizeof(dsbuf));
dsbuf.dwSize = sizeof(DSBUFFERDESC); dsbuf.dwSize = sizeof(DSBUFFERDESC);
dsbuf.dwFlags = DSBCAPS_CTRLFREQUENCY|DSBCAPS_LOCSOFTWARE; //dmw 29 may, 2003 removed locsoftware dsbuf.dwFlags = DSBCAPS_CTRLFREQUENCY|DSBCAPS_LOCSOFTWARE; //dmw 29 may, 2003 removed locsoftware
#ifdef DSBCAPS_GLOBALFOCUS
if (snd_inactive.value) if (snd_inactive.value)
{ {
dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS; dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS;
sc->inactive_sound = true; sc->inactive_sound = true;
} }
#endif
dsbuf.dwBufferBytes = sc->sn.samples / format.Format.nChannels; dsbuf.dwBufferBytes = sc->sn.samples / format.Format.nChannels;
if (!dsbuf.dwBufferBytes) if (!dsbuf.dwBufferBytes)
{ {
@ -867,7 +877,7 @@ int (*pDSOUND_InitCard) (soundcardinfo_t *sc, int cardnum) = &DSOUND_InitCard;
#if defined(VOICECHAT) && !defined(NODIRECTX) #if defined(VOICECHAT) && !defined(NODIRECTX) && !defined(__MINGW32__)

View file

@ -1854,6 +1854,7 @@ qboolean Sys_PathProtection(char *pattern)
return true; return true;
} }
#ifdef AVAIL_ZLIB
typedef struct { typedef struct {
unsigned char ident1; unsigned char ident1;
unsigned char ident2; unsigned char ident2;
@ -2003,6 +2004,7 @@ vfsfile_t *FS_DecompressGZip(vfsfile_t *infile, gzheader_t *header)
return temp; return temp;
} }
#endif
vfsfile_t *VFS_Filter(char *filename, vfsfile_t *handle) vfsfile_t *VFS_Filter(char *filename, vfsfile_t *handle)
{ {
@ -2010,8 +2012,8 @@ vfsfile_t *VFS_Filter(char *filename, vfsfile_t *handle)
if (!handle || handle->WriteBytes || handle->seekingisabadplan) //only on readonly files if (!handle || handle->WriteBytes || handle->seekingisabadplan) //only on readonly files
return handle; return handle;
// ext = COM_FileExtension (filename); // ext = COM_FileExtension (filename);
#ifdef AVAIL_ZLIB
// if (!stricmp(ext, ".gz")) // if (!stricmp(ext, ".gz"))
{ {
gzheader_t gzh; gzheader_t gzh;
@ -2024,7 +2026,7 @@ vfsfile_t *VFS_Filter(char *filename, vfsfile_t *handle)
} }
VFS_SEEK(handle, 0); VFS_SEEK(handle, 0);
} }
#endif
return handle; return handle;
} }