From c0167628f29a4df4bee052bd3d787d659a197217 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 8 Apr 2013 11:27:39 +0000 Subject: [PATCH] fix a mutex deadlock due to my dsound change. allow the webgl port to directly accept an ip, making up the tcp:// and port part automagically. fix sdl dependencies slightly. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4305 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/botlib/q_shared.h | 16 +- engine/client/r_2d.c | 2 +- engine/client/snd_directx.c | 20 +- engine/client/snd_dma.c | 8 - engine/client/valid.c | 2 + engine/common/net_wins.c | 10 +- engine/common/sys_win_threads.c | 12 + engine/dotnet2005/ftequake.sln | 3 - engine/dotnet2005/ftequake_SDL.vcproj | 1190 ++++++++++++------------- 9 files changed, 634 insertions(+), 629 deletions(-) diff --git a/engine/botlib/q_shared.h b/engine/botlib/q_shared.h index 7c1af62df..a076fa3c4 100644 --- a/engine/botlib/q_shared.h +++ b/engine/botlib/q_shared.h @@ -564,29 +564,29 @@ void ClearBounds( vec3_t mins, vec3_t maxs ); void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs ); #if !defined( Q3_VM ) || ( defined( Q3_VM ) && defined( __Q3_VM_MATH ) ) -static ID_INLINE int VectorCompare( const vec3_t v1, const vec3_t v2 ) { +ID_INLINE int VectorCompare( const vec3_t v1, const vec3_t v2 ) { if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) { return 0; } return 1; } -static ID_INLINE vec_t VectorLength( const vec3_t v ) { +ID_INLINE vec_t VectorLength( const vec3_t v ) { return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); } -static ID_INLINE vec_t VectorLengthSquared( const vec3_t v ) { +ID_INLINE vec_t VectorLengthSquared( const vec3_t v ) { return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); } -static ID_INLINE vec_t Distance( const vec3_t p1, const vec3_t p2 ) { +ID_INLINE vec_t Distance( const vec3_t p1, const vec3_t p2 ) { vec3_t v; VectorSubtract (p2, p1, v); return VectorLength( v ); } -static ID_INLINE vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) { +ID_INLINE vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) { vec3_t v; VectorSubtract (p2, p1, v); @@ -595,7 +595,7 @@ static ID_INLINE vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) { // fast vector normalize routine that does not check to make sure // that length != 0, nor does it return length, uses rsqrt approximation -static ID_INLINE void VectorNormalizeFast( vec3_t v ) +ID_INLINE void VectorNormalizeFast( vec3_t v ) { float ilength; @@ -606,13 +606,13 @@ static ID_INLINE void VectorNormalizeFast( vec3_t v ) v[2] *= ilength; } -static ID_INLINE void VectorInverse( vec3_t v ){ +ID_INLINE void VectorInverse( vec3_t v ){ v[0] = -v[0]; v[1] = -v[1]; v[2] = -v[2]; } -static ID_INLINE void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) { +ID_INLINE void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) { cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; diff --git a/engine/client/r_2d.c b/engine/client/r_2d.c index 4ab74092a..947448ec1 100644 --- a/engine/client/r_2d.c +++ b/engine/client/r_2d.c @@ -595,7 +595,7 @@ void R2D_Font_Callback(struct cvar_s *var, char *oldvalue) if (qrenderer == QR_NONE) return; -#ifdef _WIN32 +#if defined(_WIN32) && !defined(_SDL) if (!strcmp(var->string, "?")) { BOOL (APIENTRY *pChooseFontA)(LPCHOOSEFONTA) = NULL; diff --git a/engine/client/snd_directx.c b/engine/client/snd_directx.c index e1c0bb932..572332efb 100644 --- a/engine/client/snd_directx.c +++ b/engine/client/snd_directx.c @@ -190,19 +190,17 @@ static void DSOUND_Shutdown (soundcardinfo_t *sc) DSOUND_Shutdown_Internal(sc); } - -const char *dsndcard; GUID FAR *dsndguid; int dsnd_guids; -int aimedforguid; static BOOL (CALLBACK DSEnumCallback)(GUID FAR *guid, LPCSTR str1, LPCSTR str2, LPVOID parm) { + soundcardinfo_t *sc = parm; if (guid == NULL) return TRUE; - if (aimedforguid == dsnd_guids) + if (sc->audio_fd == dsnd_guids) { - dsndcard = str1; + Q_strncpyz(sc->name, str1, sizeof(sc->name)); dsndguid = guid; } dsnd_guids++; @@ -626,17 +624,13 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum) dsnd_guids=0; dsndguid=NULL; - dsndcard="DirectSound"; if (pDirectSoundEnumerate) - pDirectSoundEnumerate(&DSEnumCallback, NULL); + pDirectSoundEnumerate(&DSEnumCallback, sc); if (!snd_usemultipledevices.ival) //if only one device, ALWAYS use the default. dsndguid=NULL; - aimedforguid++; - - if (!dsndguid) //no more... - if (aimedforguid != 1) //not the first device. - return SND_NOMORE; + if (!dsndguid && sc->audio_fd != 0) //no more... + return SND_NOMORE; sc->handle = Z_Malloc(sizeof(dshandle_t)); dh = sc->handle; @@ -680,7 +674,6 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum) // } } } - Q_strncpyz(sc->name, dsndcard, sizeof(sc->name)); dscaps.dwSize = sizeof(dscaps); @@ -696,6 +689,7 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum) return SND_ERROR; } + SendMessage(mainwindow, WM_USER, 0, 0); if (DS_OK != dh->pDS->lpVtbl->SetCooperativeLevel (dh->pDS, mainwindow, DSSCL_EXCLUSIVE)) { Con_SafePrintf ("Set coop level failed\n"); diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 067d1807b..0ef8759b4 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -1189,10 +1189,6 @@ void S_Init (void) void S_ShutdownCard(soundcardinfo_t *sc) { soundcardinfo_t *prev; -#if defined(_WIN32) && defined(AVAIL_DSOUND) - extern int aimedforguid; - aimedforguid = 0; -#endif if (sndcardinfo == sc) sndcardinfo = sc->next; @@ -1211,10 +1207,6 @@ void S_ShutdownCard(soundcardinfo_t *sc) void S_Shutdown(void) { soundcardinfo_t *sc, *next; -#if defined(_WIN32) && defined(AVAIL_DSOUND) - extern int aimedforguid; - aimedforguid = 0; -#endif for (sc = sndcardinfo; sc; sc=next) { diff --git a/engine/client/valid.c b/engine/client/valid.c index e5ad13280..66641ff48 100644 --- a/engine/client/valid.c +++ b/engine/client/valid.c @@ -413,6 +413,7 @@ rulesetrule_t rulesetrules_nqr[] = { {"ruleset_allow_fbmodels", "0"}, {"r_vertexlight", "0"}, {"v_projectionmode", "0"}, + {"sbar_teamstatus", "0"}, {NULL} }; @@ -420,6 +421,7 @@ static ruleset_t rulesets[] = { {"strict", rulesetrules_strict}, {"nqr", rulesetrules_nqr}, + //{"eql", rulesetrules_nqr}, {NULL} }; diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 957570db3..7b63d7ef8 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -951,7 +951,7 @@ qboolean NET_StringToAdr (const char *s, int defaultport, netadr_t *a) { //make sure that the rest of the address is a valid ip address (4 or 6) - if (!NET_StringToSockaddr (s+6, 0, &sadr, NULL, NULL)) + if (!NET_StringToSockaddr (s+6, defaultport, &sadr, NULL, NULL)) { a->type = NA_INVALID; return false; @@ -1016,6 +1016,14 @@ qboolean NET_StringToAdr (const char *s, int defaultport, netadr_t *a) SockadrToNetadr (&sadr, a); +#if !defined(HAVE_PACKET) && defined(HAVE_TCP) + //bump over protocols that cannot work in the first place. + if (a->type == NA_IP) + a->type = NA_TCP; + if (a->type == NA_IPV6) + a->type = NA_TCPV6; +#endif + return true; } diff --git a/engine/common/sys_win_threads.c b/engine/common/sys_win_threads.c index f74052e0e..afda8c44e 100644 --- a/engine/common/sys_win_threads.c +++ b/engine/common/sys_win_threads.c @@ -216,6 +216,7 @@ qboolean Sys_ConditionWait(void *condv) { condvar_t *cv = (condvar_t *)condv; qboolean success; + DWORD status; // increase count for non-signaled waiting threads EnterCriticalSection(&cv->countlock); @@ -225,7 +226,18 @@ qboolean Sys_ConditionWait(void *condv) LeaveCriticalSection(&cv->mainlock); // unlock as per condition variable definition // wait on a signal +#if 0 success = (WaitForSingleObject(cv->wait_sem, INFINITE) != WAIT_FAILED); +#else + do + { + MSG msg; + while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) + DispatchMessage (&msg); + status = MsgWaitForMultipleObjects(1, &cv->wait_sem, FALSE, INFINITE, QS_SENDMESSAGE|QS_POSTMESSAGE); + } while (status == (WAIT_OBJECT_0+1)); + success = status != WAIT_FAILED; +#endif // update waiting count and alert signaling thread that we're done to avoid the deadlock condition EnterCriticalSection(&cv->countlock); diff --git a/engine/dotnet2005/ftequake.sln b/engine/dotnet2005/ftequake.sln index f2cd1f6cc..86e0cd500 100644 --- a/engine/dotnet2005/ftequake.sln +++ b/engine/dotnet2005/ftequake.sln @@ -411,7 +411,6 @@ Global {32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release|Win32.Build.0 = Release|Win32 {32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release|x64.ActiveCfg = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|Win32.ActiveCfg = Debug|Win32 - {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|Win32.Build.0 = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|x64.ActiveCfg = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|Win32.ActiveCfg = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|Win32.Build.0 = Release|Win32 @@ -424,7 +423,6 @@ Global {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|Win32.ActiveCfg = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|x64.ActiveCfg = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|Win32.ActiveCfg = Release|Win32 - {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|Win32.Build.0 = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|x64.ActiveCfg = Release|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|Win32.ActiveCfg = Debug|Win32 {4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|x64.ActiveCfg = Debug|Win32 @@ -458,7 +456,6 @@ Global {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLDebug|Win32.Build.0 = Debug|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLDebug|x64.ActiveCfg = Debug|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLRelease|Win32.ActiveCfg = Release|Win32 - {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLRelease|Win32.Build.0 = Release|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.GLRelease|x64.ActiveCfg = Release|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.MDebug|Win32.ActiveCfg = Debug|Win32 {9767E236-8454-44E9-8999-CD5BDAFBE9BA}.MDebug|Win32.Build.0 = Debug|Win32 diff --git a/engine/dotnet2005/ftequake_SDL.vcproj b/engine/dotnet2005/ftequake_SDL.vcproj index 10620da5d..6b65732c0 100644 --- a/engine/dotnet2005/ftequake_SDL.vcproj +++ b/engine/dotnet2005/ftequake_SDL.vcproj @@ -694,7 +694,7 @@ /> @@ -2301,7 +2300,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2713,7 +2862,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -2917,7 +3065,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -3121,7 +3268,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -3325,7 +3471,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -3529,7 +3674,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -3733,7 +3877,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -3937,7 +4080,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -4141,7 +4283,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -4345,7 +4486,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -4549,7 +4689,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -4753,7 +4892,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -4957,7 +5095,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> + + @@ -5161,7 +5302,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -5363,7 +5503,7 @@ > - - - @@ -5527,7 +5659,7 @@ > - - - @@ -5691,7 +5815,7 @@ > - - - @@ -5857,7 +5973,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -6061,7 +6176,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -6266,7 +6380,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories="../libs/sdl/include," PreprocessorDefinitions="" - PrecompiledHeaderThrough="qwsvdef.h" + PrecompiledHeaderThrough="quakedef.h" /> @@ -12017,6 +12130,10 @@ /> + + @@ -13741,139 +13858,6 @@ Name="VCCLCompilerTool" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -