try to catch exceptions in threads too, not just the main thread.
fix default settings to correctly use ` instead of ~ for toggleconsole. fix a couple of possible signed-where-unsigned-expected with quake2. fix possible q3 crash. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4649 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
952670bb3a
commit
d8704bb5e0
10 changed files with 73 additions and 23 deletions
|
@ -4696,7 +4696,7 @@ void CL_ExecInitialConfigs(char *resetcommand)
|
|||
Cbuf_AddText ("exec hexen.rc\n", RESTRICT_LOCAL);
|
||||
else
|
||||
{ //they didn't give us an rc file!
|
||||
Cbuf_AddText ("bind ~ toggleconsole\n", RESTRICT_LOCAL); //in case default.cfg does not exist. :(
|
||||
Cbuf_AddText ("bind ` toggleconsole\n", RESTRICT_LOCAL); //in case default.cfg does not exist. :(
|
||||
Cbuf_AddText ("exec default.cfg\n", RESTRICT_LOCAL);
|
||||
if (COM_FCheckExists ("config.cfg"))
|
||||
Cbuf_AddText ("exec config.cfg\n", RESTRICT_LOCAL);
|
||||
|
|
|
@ -4504,7 +4504,7 @@ void CLQ2_ParseMuzzleFlash (void)
|
|||
float volume;
|
||||
char soundname[64];
|
||||
|
||||
i = MSG_ReadShort ();
|
||||
i = (unsigned short)(short)MSG_ReadShort ();
|
||||
if (i < 1 || i >= Q2MAX_EDICTS)
|
||||
Host_Error ("CL_ParseMuzzleFlash: bad entity");
|
||||
|
||||
|
@ -4692,7 +4692,7 @@ void CLQ2_ParseMuzzleFlash2 (void)
|
|||
int ent;
|
||||
int flash_number;
|
||||
|
||||
ent = MSG_ReadShort ();
|
||||
ent = (unsigned short)(short)MSG_ReadShort ();
|
||||
if (ent < 1 || ent >= Q2MAX_EDICTS)
|
||||
Host_EndGame ("CL_ParseMuzzleFlash2: bad entity");
|
||||
|
||||
|
|
|
@ -511,11 +511,11 @@ CL_ParseEntityBits
|
|||
Returns the entity number and the header bits
|
||||
=================
|
||||
*/
|
||||
int bitcounts[32]; /// just for protocol profiling
|
||||
int CLQ2_ParseEntityBits (unsigned *bits)
|
||||
//static int bitcounts[32]; /// just for protocol profiling
|
||||
static int CLQ2_ParseEntityBits (unsigned int *bits)
|
||||
{
|
||||
unsigned b, total;
|
||||
int i;
|
||||
// int i;
|
||||
int number;
|
||||
|
||||
total = MSG_ReadByte ();
|
||||
|
@ -536,12 +536,12 @@ int CLQ2_ParseEntityBits (unsigned *bits)
|
|||
}
|
||||
|
||||
// count the bits for net profiling
|
||||
for (i=0 ; i<32 ; i++)
|
||||
/* for (i=0 ; i<32 ; i++)
|
||||
if (total&(1<<i))
|
||||
bitcounts[i]++;
|
||||
|
||||
*/
|
||||
if (total & Q2U_NUMBER16)
|
||||
number = MSG_ReadShort ();
|
||||
number = (unsigned short)MSG_ReadShort ();
|
||||
else
|
||||
number = MSG_ReadByte ();
|
||||
|
||||
|
@ -711,10 +711,10 @@ rest of the data stream.
|
|||
*/
|
||||
static void CLQ2_ParsePacketEntities (q2frame_t *oldframe, q2frame_t *newframe)
|
||||
{
|
||||
int newnum;
|
||||
int bits;
|
||||
unsigned int newnum;
|
||||
unsigned int bits;
|
||||
entity_state_t *oldstate=NULL;
|
||||
int oldindex, oldnum;
|
||||
unsigned int oldindex, oldnum;
|
||||
|
||||
cl.validsequence = cls.netchan.incoming_sequence;
|
||||
|
||||
|
@ -1409,6 +1409,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
// VectorCopy(cl.predicted_origin, ent.origin);
|
||||
// VectorCopy(cl.predicted_origin, ent.oldorigin);
|
||||
ent.flags |= RF_EXTERNALMODEL; // only draw from mirrors
|
||||
renderfx |= RF_EXTERNALMODEL;
|
||||
|
||||
if (effects & Q2EF_FLAG1)
|
||||
V_AddLight (ent.keynum, ent.origin, 225, 0.2, 0.05, 0.05);
|
||||
|
@ -1503,11 +1504,12 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
}
|
||||
// pmm
|
||||
ent.flags = renderfx;
|
||||
ent.shaderRGBAf[3] = 0.30;
|
||||
ent.shaderRGBAf[3] = 0.20;
|
||||
ent.shaderRGBAf[0] = (!!(renderfx & Q2RF_SHELL_RED));
|
||||
ent.shaderRGBAf[1] = (!!(renderfx & Q2RF_SHELL_GREEN));
|
||||
ent.shaderRGBAf[2] = (!!(renderfx & Q2RF_SHELL_BLUE));
|
||||
ent.forcedshader = R_RegisterCustom("q2/shell", SUF_NONE, Shader_DefaultSkinShell, NULL);
|
||||
ent.fatness = 2;
|
||||
V_AddEntity (&ent);
|
||||
}
|
||||
ent.forcedshader = NULL;
|
||||
|
|
|
@ -1251,7 +1251,8 @@ TRACE(("dbg: R_ApplyRenderer: starting on client state\n"));
|
|||
{
|
||||
CG_Stop();
|
||||
CG_Start();
|
||||
R_NewMap();
|
||||
if (cl.worldmodel)
|
||||
R_NewMap();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -289,10 +289,8 @@ int Sys_EnumerateFiles (const char *gpath, const char *match, int (QDECL *func)(
|
|||
#endif
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
#if 1//_MSC_VER >= 1300
|
||||
#define CATCHCRASH
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CLIENTONLY) && !defined(SERVERONLY)
|
||||
qboolean isDedicated = false;
|
||||
|
@ -561,6 +559,37 @@ DWORD CrashExceptionHandler (qboolean iswatchdog, DWORD exceptionCode, LPEXCEPTI
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
switch(exceptionCode)
|
||||
{
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||
case EXCEPTION_BREAKPOINT:
|
||||
case EXCEPTION_SINGLE_STEP:
|
||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||
case EXCEPTION_FLT_OVERFLOW:
|
||||
case EXCEPTION_FLT_STACK_CHECK:
|
||||
case EXCEPTION_FLT_UNDERFLOW:
|
||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||
case EXCEPTION_INT_OVERFLOW:
|
||||
case EXCEPTION_PRIV_INSTRUCTION:
|
||||
case EXCEPTION_IN_PAGE_ERROR:
|
||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
case EXCEPTION_INVALID_DISPOSITION:
|
||||
case EXCEPTION_GUARD_PAGE:
|
||||
case EXCEPTION_INVALID_HANDLE:
|
||||
// case EXCEPTION_POSSIBLE_DEADLOCK:
|
||||
break;
|
||||
default:
|
||||
//because windows is a steaming pile of shite, we have to ignore any software-generated exceptions, because most of them are not in fact fatal, *EVEN IF THEY CLAIM TO BE NON-CONTINUABLE*
|
||||
return exceptionCode;
|
||||
}
|
||||
|
||||
#ifdef PRINTGLARRAYS
|
||||
if (!iswatchdog && qrenderer == QR_OPENGL)
|
||||
DumpGLState();
|
||||
|
@ -778,12 +807,16 @@ DWORD CrashExceptionHandler (qboolean iswatchdog, DWORD exceptionCode, LPEXCEPTI
|
|||
//most compilers do not support __try. perhaps we should avoid its use entirely?
|
||||
LONG CALLBACK nonmsvc_CrashExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo)
|
||||
{
|
||||
DWORD foo = CrashExceptionHandler(false, ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo);
|
||||
|
||||
//we have no handler. thus we handle it by exiting.
|
||||
if (foo == EXCEPTION_EXECUTE_HANDLER)
|
||||
exit(1);
|
||||
DWORD foo = EXCEPTION_CONTINUE_SEARCH;
|
||||
//only bother with fatal non-continuable errors.
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
|
||||
{
|
||||
foo = CrashExceptionHandler(false, ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo);
|
||||
|
||||
//we have no handler. thus we handle it by exiting.
|
||||
if (foo == EXCEPTION_EXECUTE_HANDLER)
|
||||
exit(1);
|
||||
}
|
||||
return foo;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "quakedef.h"
|
||||
#ifndef SERVERONLY
|
||||
#include "gl_draw.h"
|
||||
#include "shader.h"
|
||||
|
||||
|
@ -273,3 +274,4 @@ rendererinfo_t headlessrenderer =
|
|||
Headless_BE_RenderToTextureUpdate2d,
|
||||
""
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "winquake.h"
|
||||
#include <conio.h>
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
#define CATCHCRASH
|
||||
LONG CALLBACK nonmsvc_CrashExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo);
|
||||
|
||||
#ifdef _MSC_VER //nt5
|
||||
PVOID WINAPI AddVectoredExceptionHandler(ULONG FirstHandler, PVECTORED_EXCEPTION_HANDLER VectoredHandler);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(WINRT) && defined(MULTITHREAD)
|
||||
#include <process.h>
|
||||
/* Thread creation calls */
|
||||
|
@ -75,6 +84,10 @@ void Sys_SetThreadName(unsigned int dwThreadID, char *threadName)
|
|||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef CATCHCRASH
|
||||
AddVectoredExceptionHandler(true, nonmsvc_CrashExceptionHandler);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10324,6 +10324,7 @@ void PR_DumpPlatform_f(void)
|
|||
|
||||
{"TRUE", "const float", ALL, NULL, 1},
|
||||
{"FALSE", "const float", ALL, "File not found...", 0},
|
||||
{"M_PI", "const float", ALL, "File not found...", M_PI},
|
||||
|
||||
{"MOVETYPE_NONE", "const float", QW|NQ|CS, NULL, MOVETYPE_NONE},
|
||||
{"MOVETYPE_WALK", "const float", QW|NQ|CS, NULL, MOVETYPE_WALK},
|
||||
|
|
|
@ -615,7 +615,6 @@ static q2trace_t VARGS SVQ2_Trace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_
|
|||
VectorCopy(tr.plane.normal, ret.plane.normal);
|
||||
ret.plane.dist = tr.plane.dist;
|
||||
ret.ent = tr.ent;
|
||||
// memcpy(&ret, &tr, sizeof(q2trace_t));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1884,7 +1884,6 @@ trace_t WorldQ2_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t
|
|||
|
||||
// clip to world
|
||||
w->worldmodel->funcs.NativeTrace(w->worldmodel, 0, 0, NULL, start, end, mins, maxs, hitcontentsmask, &clip.trace);
|
||||
// clip.trace = CM_BoxTrace(w->worldmodel, start, end, mins, maxs, hitcontentsmask);//SVQ2_ClipMoveToEntity ( ge->edicts, start, mins, maxs, end );
|
||||
clip.trace.ent = ge->edicts;
|
||||
|
||||
if (clip.trace.fraction == 0)
|
||||
|
|
Loading…
Reference in a new issue