Fix a stupid bug with allow_download cvar.

Fix recursive errors from Sys_Error on worker threads.
Fix shader parsing on worker thread with hlmdl.



git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5431 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-03-12 06:41:52 +00:00
parent 5e7688a590
commit f38a6264b8
12 changed files with 24 additions and 14 deletions

View file

@ -346,6 +346,7 @@ void Sys_Error (const char *error, ...)
va_start (argptr, error);
vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr);
COM_WorkerAbort(string);
if (!*string)
strcpy(string, "no error");

View file

@ -422,6 +422,9 @@ void Sys_Error (const char *error, ...)
va_start (argptr,error);
vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr);
COM_WorkerAbort(string);
fprintf(stderr, "Error: %s\n", string);
Host_Shutdown ();

View file

@ -38,6 +38,7 @@ void Sys_Error (const char *error, ...)
va_start (argptr,error);
vsnprintf (string, sizeof (string), error, argptr);
va_end (argptr);
COM_WorkerAbort(string);
fprintf(stderr, "Error: %s\n", string);
Sys_Printf ("Quake Error: %s\n", string);

View file

@ -35,6 +35,8 @@ unsigned int Sys_Milliseconds (void)
NORETURN void VARGS Sys_Error (const char *error, ...)
{
COM_WorkerAbort(error);
//FIXME: panic! everyone panic!
//you might want to figure out some way to display the message...
for(;;)

View file

@ -336,18 +336,13 @@ qboolean QDECL Mod_LoadHLModel (model_t *mod, void *buffer, size_t fsize)
shader = HLSHADER_CHROME;
else
shader = "";
shaders[i].shader = R_RegisterShader(shaders[i].name, SUF_NONE, shader);
shaders[i].shader->defaulttextures->base = Image_GetTexture(shaders[i].name, "", IF_NOALPHA, (qbyte *) texheader + tex[i].offset, (qbyte *) texheader + tex[i].w * tex[i].h + tex[i].offset, tex[i].w, tex[i].h, TF_8PAL24);
shaders[i].shader->width = tex[i].w;
shaders[i].shader->height = tex[i].h;
}
else
{
memset(&shaders[i].defaulttex, 0, sizeof(shaders[i].defaulttex));
shaders[i].defaulttex.base = Image_GetTexture(shaders[i].name, "", IF_NOALPHA, (qbyte *) texheader + tex[i].offset, (qbyte *) texheader + tex[i].w * tex[i].h + tex[i].offset, tex[i].w, tex[i].h, TF_8PAL24);
shaders[i].w = tex[i].w;
shaders[i].h = tex[i].h;
shaders[i].defaultshadertext = shader;
}
shaders[i].defaultshadertext = NULL;
memset(&shaders[i].defaulttex, 0, sizeof(shaders[i].defaulttex));
shaders[i].defaulttex.base = Image_GetTexture(shaders[i].name, "", IF_NOALPHA, (qbyte *) texheader + tex[i].offset, (qbyte *) texheader + tex[i].w * tex[i].h + tex[i].offset, tex[i].w, tex[i].h, TF_8PAL24);
shaders[i].w = tex[i].w;
shaders[i].h = tex[i].h;
}
model->numskinrefs = texheader->skinrefs;
@ -1320,7 +1315,10 @@ static void R_HalfLife_WalkMeshes(entity_t *rent, batch_t *b, batch_t **batches)
if (!s->shader)
{
s->shader = R_RegisterSkin(s->name, rent->model->name);
if (s->defaultshadertext)
s->shader = R_RegisterShader(s->name, SUF_NONE, s->defaultshadertext);
else
s->shader = R_RegisterSkin(s->name, rent->model->name);
R_BuildDefaultTexnums(&s->defaulttex, s->shader, 0);
}
b->skin = NULL;

View file

@ -291,6 +291,7 @@ typedef struct //this is stored as the cache. an hlmodel_t is generated when dra
struct hlmodelshaders_s
{
char name[MAX_QPATH];
char *defaultshadertext;
texnums_t defaulttex;
shader_t *shader;
int w, h;

View file

@ -283,7 +283,7 @@ void COM_EnumerateFiles (const char *match, int (*func)(const char *, qofs_t, ti
HANDLE r;
WIN32_FIND_DATAA fd;
char apath[MAX_OSPATH];
char file[MAX_OSPATH];
char file[MAX_OSPATH+MAX_PATH];
char *s;
int go;
strcpy(apath, match);

View file

@ -212,6 +212,7 @@ NORETURN void VARGS Sys_Error (const char *error, ...)
va_start (argptr, error);
vsnprintf (string, sizeof(string)-1, error, argptr);
va_end (argptr);
COM_WorkerAbort(string);
Sys_Printf("Sys_Error: %s", string);
exit(1);

View file

@ -81,7 +81,7 @@ extern cvar_t password;
#endif
cvar_t spectator_password = CVARF("spectator_password", "", CVAR_NOUNSAFEEXPAND); // password for entering as a sepctator
cvar_t allow_download = CVARAD("allow_download", /*q3*/"sv_allowDownload", "1", "If 1, permits downloading. Set to 0 to unconditionally block *ALL* downloads.");
cvar_t allow_download = CVARAD("allow_download", "1", /*q3*/"sv_allowDownload", "If 1, permits downloading. Set to 0 to unconditionally block *ALL* downloads.");
cvar_t allow_download_skins = CVARD("allow_download_skins", "1", "0 blocks downloading of any file in the skins/ directory");
cvar_t allow_download_models = CVARD("allow_download_models", "1", "0 blocks downloading of any file in the progs/ or models/ directory");
cvar_t allow_download_sounds = CVARD("allow_download_sounds", "1", "0 blocks downloading of any file in the sound/ directory");

View file

@ -190,6 +190,7 @@ void Sys_Error (const char *error, ...)
va_start (argptr,error);
vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr);
COM_WorkerAbort(string);
printf ("Fatal error: %s\n",string);
tcsetattr(STDIN_FILENO, TCSADRAIN, &orig);

View file

@ -770,6 +770,7 @@ void Sys_Error (const char *error, ...)
va_start (argptr,error);
vsnprintf (text,sizeof(text)-1, error,argptr);
va_end (argptr);
COM_WorkerAbort(text);
// MessageBox(NULL, text, "Error", 0 /* MB_OK */ );

View file

@ -24,6 +24,7 @@ void Sys_Error (const char *error, ...)
va_start (argptr,error);
vsnprintf (string, sizeof (string), error, argptr);
va_end (argptr);
COM_WorkerAbort(string);
Sys_Printf("Error: %s\n", string);
Con_Print ("Quake Error: ");