Fix some updater issues.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6168 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2ed9c6a968
commit
578d12f254
8 changed files with 187 additions and 17 deletions
|
@ -241,6 +241,7 @@ static struct pm_source_s
|
|||
#define SRCFL_ENABLED (1u<<6) //source was explicitly enabled.
|
||||
#define SRCFL_PROMPTED (1u<<7) //source was explicitly enabled.
|
||||
#define SRCFL_ONCE (1u<<8) //autoupdates are disabled, but the user is viewing packages anyway. enabled via a prompt.
|
||||
#define SRCFL_UNSAFE (1u<<9) //ignore signing requirements.
|
||||
unsigned int flags;
|
||||
struct dl_download *curdl; //the download context
|
||||
|
||||
|
@ -532,6 +533,10 @@ static void PM_ValidatePackage(package_t *p)
|
|||
if (!(p->flags & (DPF_NATIVE|DPF_CACHED)))
|
||||
Con_Printf("WARNING: %s (%s) no longer exists\n", p->name, n);
|
||||
}
|
||||
|
||||
//if no files were present, unmark it.
|
||||
if (!(p->flags & (DPF_NATIVE|DPF_CACHED)))
|
||||
p->flags &= ~DPF_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -981,6 +986,7 @@ static void PM_AddSubListModule(void *module, plugupdatesourcefuncs_t *funcs, co
|
|||
Z_Free(pm_source[i].prefix);
|
||||
pm_source[i].prefix = Z_StrDup(prefix);
|
||||
}
|
||||
pm_source[i].flags |= flags & SRCFL_UNSAFE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1395,7 +1401,7 @@ static qboolean PM_ParsePackageList(const char *f, unsigned int parseflags, cons
|
|||
if (!f)
|
||||
return forcewrite;
|
||||
|
||||
source.validated = (parseflags & DPF_ENABLED)?VH_CORRECT/*FIXME*/:VH_UNSUPPORTED;
|
||||
source.validated = (parseflags & (DPF_ENABLED|DPF_SIGNATUREACCEPTED))?VH_CORRECT/*FIXME*/:VH_UNSUPPORTED;
|
||||
Q_strncpyz(source.gamedir, FS_GetGamedir(false), sizeof(source.gamedir));
|
||||
|
||||
if (url)
|
||||
|
@ -2004,6 +2010,7 @@ static void PM_PreparePackageList(void)
|
|||
//figure out what we've previously installed.
|
||||
if (fs_manifest && !loadedinstalled)
|
||||
{
|
||||
int parm;
|
||||
qofs_t sz = 0;
|
||||
char *f = FS_MallocFile(INSTALLEDFILES, FS_ROOT, &sz);
|
||||
loadedinstalled = true;
|
||||
|
@ -2013,8 +2020,20 @@ static void PM_PreparePackageList(void)
|
|||
PM_WriteInstalledPackages();
|
||||
BZ_Free(f);
|
||||
}
|
||||
//make sure our sources are okay.
|
||||
if (fs_manifest && fs_manifest->downloadsurl && *fs_manifest->downloadsurl)
|
||||
|
||||
parm = COM_CheckParm ("-updatesrc");
|
||||
if (parm)
|
||||
{
|
||||
unsigned int fl = SRCFL_USER;
|
||||
if (COM_CheckParm ("-unsafe"))
|
||||
fl |= SRCFL_UNSAFE;
|
||||
do
|
||||
{
|
||||
PM_AddSubList(com_argv[parm+1], NULL, fl); //enable it by default. functionality is kinda broken otherwise.
|
||||
parm = COM_CheckNextParm ("-updatesrc", parm);
|
||||
} while (parm && parm < com_argc-1);
|
||||
}
|
||||
else if (fs_manifest && fs_manifest->downloadsurl && *fs_manifest->downloadsurl)
|
||||
{
|
||||
unsigned int fl = SRCFL_MANIFEST;
|
||||
char *s = fs_manifest->downloadsurl;
|
||||
|
@ -2022,7 +2041,7 @@ static void PM_PreparePackageList(void)
|
|||
fl |= SRCFL_DISABLED; //don't trust it, don't even prompt.
|
||||
|
||||
while ((s = COM_Parse(s)))
|
||||
PM_AddSubList(com_token, NULL, SRCFL_MANIFEST); //enable it by default. functionality is kinda broken otherwise.
|
||||
PM_AddSubList(com_token, NULL, fl); //enable it by default. functionality is kinda broken otherwise.
|
||||
}
|
||||
|
||||
#ifdef PLUGINS
|
||||
|
@ -2160,7 +2179,7 @@ static package_t *PM_FindExactPackage(const char *packagename, const char *arch,
|
|||
if (*version == '<' && strcmp(p->version, version+1)>=0)
|
||||
continue;
|
||||
}
|
||||
if (!r || strcmp(r->version, p->version)>0)
|
||||
if (!r || strcmp(p->version, r->version)>0)
|
||||
r = p;
|
||||
}
|
||||
}
|
||||
|
@ -2662,7 +2681,10 @@ static void PM_ListDownloaded(struct dl_download *dl)
|
|||
if (f)
|
||||
{
|
||||
pm_source[listidx].status = SRCSTAT_OBTAINED;
|
||||
PM_ParsePackageList(f, 0, dl->url, pm_source[listidx].prefix);
|
||||
if (pm_source[listidx].flags & SRCFL_UNSAFE)
|
||||
PM_ParsePackageList(f, DPF_SIGNATUREACCEPTED, dl->url, pm_source[listidx].prefix);
|
||||
else
|
||||
PM_ParsePackageList(f, 0, dl->url, pm_source[listidx].prefix);
|
||||
PM_ResortPackages();
|
||||
}
|
||||
else if (dl->replycode == HTTP_DNSFAILURE)
|
||||
|
@ -3669,7 +3691,7 @@ static void QDECL HashFile_Flush (struct vfsfile_s *file)
|
|||
}
|
||||
static qboolean QDECL HashFile_Close (struct vfsfile_s *file)
|
||||
{
|
||||
qbyte digest[256];
|
||||
qbyte digest[DIGEST_MAXSIZE];
|
||||
hashfile_t *f = (hashfile_t*)file;
|
||||
if (!VFS_CLOSE(f->f))
|
||||
f->fail = true; //something went wrong.
|
||||
|
@ -3685,14 +3707,23 @@ static qboolean QDECL HashFile_Close (struct vfsfile_s *file)
|
|||
}
|
||||
else if (memcmp(digest, f->need, f->hashfunc->digestsize))
|
||||
{
|
||||
qbyte base64[512];
|
||||
qbyte base64[(DIGEST_MAXSIZE*2)+16];
|
||||
Con_Printf("Invalid hash for downloaded file %s, try again later?\n", f->fname);
|
||||
|
||||
Base64_EncodeBlock(digest, f->hashfunc->digestsize, base64, sizeof(base64)-1);
|
||||
base64[sizeof(base64)-1] = 0;
|
||||
Con_Printf("%s vs", base64);
|
||||
Base64_EncodeBlock(f->need, f->hashfunc->digestsize, base64, sizeof(base64)-1);
|
||||
Con_Printf("%s\n", base64);
|
||||
if (f->hashfunc == &hash_sha1)
|
||||
{
|
||||
base64[Base16_EncodeBlock(digest, f->hashfunc->digestsize, base64, sizeof(base64)-1)] = 0;
|
||||
Con_Printf("%s vs ", base64);
|
||||
base64[Base16_EncodeBlock(f->need, f->hashfunc->digestsize, base64, sizeof(base64)-1)] = 0;
|
||||
Con_Printf("%s\n", base64);
|
||||
}
|
||||
else
|
||||
{
|
||||
base64[Base64_EncodeBlock(digest, f->hashfunc->digestsize, base64, sizeof(base64)-1)] = 0;
|
||||
Con_Printf("%s vs ", base64);
|
||||
base64[Base64_EncodeBlock(f->need, f->hashfunc->digestsize, base64, sizeof(base64)-1)] = 0;
|
||||
Con_Printf("%s\n", base64);
|
||||
}
|
||||
f->fail = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1199,6 +1199,93 @@ static void COM_Locate_f (void)
|
|||
Con_Printf("Not found\n");
|
||||
}
|
||||
|
||||
static void COM_CalcHash_Thread(void *ctx, void *fname, size_t a, size_t b)
|
||||
{
|
||||
int h;
|
||||
struct
|
||||
{
|
||||
const char *name;
|
||||
hashfunc_t *hash;
|
||||
void *ctx;
|
||||
} hashes[] =
|
||||
{
|
||||
// {"crc16", &hash_crc16},
|
||||
{"sha1", &hash_sha1},
|
||||
#if defined(HAVE_SERVER) || defined(HAVE_CLIENT)
|
||||
// {"sha224", &hash_sha224},
|
||||
{"sha256", &hash_sha256},
|
||||
// {"sha384", &hash_sha384},
|
||||
// {"sha512", &hash_sha512},
|
||||
#endif
|
||||
};
|
||||
qbyte digest[DIGEST_MAXSIZE];
|
||||
qbyte digesttext[DIGEST_MAXSIZE*2+1];
|
||||
qbyte block[65536];
|
||||
int csize;
|
||||
quint64_t fsize = 0;
|
||||
quint64_t tsize = 0;
|
||||
unsigned int pct, opct=~0;
|
||||
vfsfile_t *f = FS_OpenVFS(fname, "rb", FS_GAME);
|
||||
|
||||
if (f)
|
||||
{
|
||||
tsize = VFS_GETLEN(f);
|
||||
Con_Printf("%s: Processing...\r", (char*)fname);
|
||||
|
||||
for (h = 0; h < countof(hashes); h++)
|
||||
{
|
||||
hashes[h].ctx = Z_Malloc(hashes[h].hash->contextsize);
|
||||
hashes[h].hash->init(hashes[h].ctx);
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
csize = VFS_READ(f, block, sizeof(block));
|
||||
if (csize <= 0)
|
||||
break;
|
||||
fsize += csize;
|
||||
for (h = 0; h < countof(hashes); h++)
|
||||
{
|
||||
hashes[h].hash->process(hashes[h].ctx, block, csize);
|
||||
}
|
||||
pct = (100*fsize)/tsize;
|
||||
if (pct != opct)
|
||||
{
|
||||
Con_Printf("%s: %i%%...\r", (char*)fname, pct);
|
||||
opct = pct;
|
||||
}
|
||||
}
|
||||
|
||||
VFS_CLOSE(f);
|
||||
|
||||
Con_Printf("%s: ", (char*)fname);
|
||||
if (fsize > 1024*1024*1024*(quint64_t)16)
|
||||
Con_Printf("%g GB\n", fsize/(1024.0*1024*1024));
|
||||
else if (fsize > 1024*1024*16)
|
||||
Con_Printf("%g MB\n", fsize/(1024.0*1024));
|
||||
else if (fsize > 1024*16)
|
||||
Con_Printf("%g KB\n", fsize/(1024.0));
|
||||
else
|
||||
Con_Printf("%u bytes\n", (unsigned)fsize);
|
||||
for (h = 0; h < countof(hashes); h++)
|
||||
{
|
||||
hashes[h].hash->terminate(digest, hashes[h].ctx);
|
||||
Z_Free(hashes[h].ctx);
|
||||
|
||||
digesttext[Base16_EncodeBlock(digest, hashes[h].hash->digestsize, digesttext, sizeof(digesttext)-1)] = 0;
|
||||
Con_Printf(" %s: %s\n", hashes[h].name, digesttext);
|
||||
}
|
||||
}
|
||||
Z_Free(fname);
|
||||
}
|
||||
static void COM_CalcHash_f(void)
|
||||
{
|
||||
if (Cmd_Argc() != 2)
|
||||
Con_Printf("%s <FILENAME>: computes various hashes of the specified file\n", Cmd_Argv(0));
|
||||
else
|
||||
COM_AddWork(WG_LOADER, COM_CalcHash_Thread, NULL, Z_StrDup(Cmd_Argv(1)), 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
COM_WriteFile
|
||||
|
@ -7269,6 +7356,8 @@ void COM_InitFilesystem (void)
|
|||
Cmd_AddCommandAD("flocate", COM_Locate_f, FS_ArbitraryFile_c, "Searches for a named file, and displays where it can be found in the OS's filesystem"); //prints the pak or whatever where this file can be found.
|
||||
Cmd_AddCommandAD("which", COM_Locate_f, FS_ArbitraryFile_c, "Searches for a named file, and displays where it can be found in the OS's filesystem"); //prints the pak or whatever where this file can be found.
|
||||
|
||||
Cmd_AddCommandAD("fs_hash", COM_CalcHash_f, FS_ArbitraryFile_c, "Computes a hash of the specified file.");
|
||||
|
||||
|
||||
//
|
||||
// -basedir <path>
|
||||
|
|
|
@ -154,7 +154,9 @@ static int (VARGS *qgnutls_credentials_set)(gnutls_session_t, gnutls_credentials
|
|||
static int (VARGS *qgnutls_init)(gnutls_session_t * session, gnutls_connection_end_t con_end);
|
||||
static void (VARGS *qgnutls_deinit)(gnutls_session_t session);
|
||||
static int (VARGS *qgnutls_set_default_priority)(gnutls_session_t session);
|
||||
#ifdef HAVE_DTLS
|
||||
static int (VARGS *qgnutls_set_default_priority_append)(gnutls_session_t session, const char *add_prio, const char **err_pos, unsigned flags);
|
||||
#endif
|
||||
|
||||
static int (VARGS *qgnutls_certificate_allocate_credentials)(gnutls_certificate_credentials_t *sc);
|
||||
static int (VARGS *qgnutls_anon_allocate_client_credentials)(gnutls_anon_client_credentials_t *sc);
|
||||
|
@ -232,6 +234,13 @@ static int (VARGS *qgnutls_certificate_set_x509_key_mem)(gnutls_certificate_cre
|
|||
static int (VARGS *qgnutls_certificate_get_x509_key)(gnutls_certificate_credentials_t res, unsigned index, gnutls_x509_privkey_t *key);
|
||||
static void (VARGS *qgnutls_certificate_free_credentials)(gnutls_certificate_credentials_t sc);
|
||||
|
||||
#ifdef GNUTLS_DYNAMIC
|
||||
static int VARGS fallback_gnutls_set_default_priority_append(gnutls_session_t session, const char *add_prio, const char **err_pos, unsigned flags)
|
||||
{
|
||||
return qgnutls_set_default_priority(session);
|
||||
}
|
||||
#endif
|
||||
|
||||
static qboolean Init_GNUTLS(void)
|
||||
{
|
||||
#ifdef GNUTLS_HAVE_SYSTEMTRUST
|
||||
|
@ -351,7 +360,6 @@ static qboolean Init_GNUTLS(void)
|
|||
{(void**)&qgnutls_init, "gnutls_init"},
|
||||
{(void**)&qgnutls_deinit, "gnutls_deinit"},
|
||||
{(void**)&qgnutls_set_default_priority, "gnutls_set_default_priority"},
|
||||
{(void**)&qgnutls_set_default_priority_append, "gnutls_set_default_priority_append"},
|
||||
{(void**)&qgnutls_certificate_allocate_credentials, "gnutls_certificate_allocate_credentials"},
|
||||
{(void**)&qgnutls_anon_allocate_client_credentials, "gnutls_anon_allocate_client_credentials"},
|
||||
{(void**)&qgnutls_global_init, "gnutls_global_init"},
|
||||
|
@ -441,6 +449,10 @@ static qboolean Init_GNUTLS(void)
|
|||
#endif
|
||||
if (!hmod)
|
||||
return false;
|
||||
|
||||
qgnutls_set_default_priority_append = Sys_GetAddressForName(hmod, "gnutls_set_default_priority_append");
|
||||
if (!qgnutls_set_default_priority_append)
|
||||
qgnutls_set_default_priority_append = fallback_gnutls_set_default_priority_append;
|
||||
#else
|
||||
#define GNUTLS_FUNC(name) q##name = name;
|
||||
#define GNUTLS_FUNCPTR(name) q##name = &name;
|
||||
|
|
|
@ -23,7 +23,7 @@ This file came to FTE via EzQuake.
|
|||
typedef struct
|
||||
{
|
||||
unsigned int state[5];
|
||||
size_t count[2];
|
||||
unsigned int count[2];
|
||||
unsigned char buffer[64];
|
||||
} SHA1_CTX;
|
||||
#define SHA1_DIGEST_SIZE 20
|
||||
|
|
|
@ -5713,7 +5713,7 @@ void Mod_LoadSpriteFrameShader(model_t *spr, int frame, int subframe, mspritefra
|
|||
{
|
||||
int i;
|
||||
/*
|
||||
A quick note on tenebrae and sprites: In tenebrae, sprites are always lit, unless the light_lev field is set (which makes it fullbright).
|
||||
A quick note on tenebrae and sprites: In tenebrae, sprites are always additive, unless the light_lev field is set (which makes it fullbright).
|
||||
While its generally preferable and more consistent to assume lit sprites, this is incompatible with vanilla quake and thus unacceptable to us, but you can set the mod_assumelitsprites cvar if you want it.
|
||||
So for better compatibility, we have a whitelist of 'well-known' sprites that tenebrae uses in this way, which we do lighting on.
|
||||
You should still be able to use EF_FULLBRIGHT on these, but light_lev is an imprecise setting and will result in issues. Just be specific about fullbright or additive.
|
||||
|
|
|
@ -11924,7 +11924,7 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
{"addwantedhostcachekey",PF_Fixme, 0, 0, 0, 623, "void(string key)"},
|
||||
{"getextresponse", PF_Fixme, 0, 0, 0, 624, "string()"},
|
||||
{"netaddress_resolve",PF_netaddress_resolve,0, 0, 0, 625, "string(string dnsname, optional float defport)"},
|
||||
{"getgamedirinfo", PF_Fixme, 0, 0, 0, 626, "string(float n, float prop)"},
|
||||
{"getgamedirinfo", PF_Fixme, 0, 0, 0, 626, D("string(float n, float prop)", "Queries properties about an indexed gamedir (or -1 for the current gamedir). Returns null strings when out of bounds. Use the GDDI_* constants for the prop arg.")},
|
||||
{"getpackagemanagerinfo",PF_Fixme, 0, 0, 0, 0, D("string(int n, int prop)", "Queries information about a package from the engine's package manager subsystem. Actions can be taken via the pkg console command.")},
|
||||
{"sprintf", PF_sprintf, 0, 0, 0, 627, D("string(string fmt, ...)", "'prints' to a formatted temp-string. Mostly acts as in C, however %d assumes floats (fteqcc has arg checking. Use it.).\ntype conversions: l=arg is an int, h=arg is a float, and will work as a prefix for any float or int representation.\nfloat representations: d=decimal, e,E=exponent-notation, f,F=floating-point notation, g,G=terse float, c=char code, x,X=hex\nother representations: i=int, s=string, S=quoted and marked-up string, v=vector, p=pointer\nso %ld will accept an int arg, while %hi will expect a float arg.\nentities, fields, and functions will generally need to be printed as ints with %i.")},
|
||||
{"getsurfacenumtriangles",PF_getsurfacenumtriangles,0,0,0, 628, "float(entity e, float s)"},
|
||||
|
|
32
fte.m4
32
fte.m4
|
@ -95,6 +95,15 @@ define(`WINPLUG',`category "Plugins"
|
|||
FILE(fteplug_$1_x64.REVISION.dll)
|
||||
URL(win64/fteplug_$1_x64.dll)
|
||||
}')dnl
|
||||
define(`WIN64PLUG',`category "Plugins"
|
||||
ver "REVISION"
|
||||
gamedir ""
|
||||
license "GPLv2"
|
||||
{
|
||||
arch "win_x64"
|
||||
FILE(fteplug_$1_x64.REVISION.dll)
|
||||
URL(win64/fteplug_$1_x64.dll)
|
||||
}')dnl
|
||||
define(`LINPLUG',`{
|
||||
arch "linux_amd64"
|
||||
FILE(fteplug_$1_amd64.REVISION,.so)
|
||||
|
@ -132,6 +141,7 @@ TEST()dnl
|
|||
title "IRC Plugin"
|
||||
replace "IRC Plugin"
|
||||
desc "Allows you to converse on IRC servers in-game."
|
||||
desc "Requires manual configuration."
|
||||
TEST()dnl
|
||||
}
|
||||
{
|
||||
|
@ -140,6 +150,28 @@ TEST()dnl
|
|||
LINPLUG(xmpp)
|
||||
title "XMPP Plugin"
|
||||
desc "Allows you to converse on XMPP servers. This also includes a method for NAT holepunching between contacts."
|
||||
desc "Requires manual configuration."
|
||||
TEST()dnl
|
||||
}
|
||||
{
|
||||
package "fteplug_openssl"
|
||||
WINPLUG(openssl)
|
||||
license "GPLv3" //Apache2+GPLv2=GPLv3
|
||||
title "OpenSSL Plugin"
|
||||
author "Spike"
|
||||
desc "Provides TLS and DTLS support, instead of using Microsoft's probably-outdated libraries."
|
||||
desc "Required for fully functional DTLS support on windows."
|
||||
desc "Connecting to QEx servers requires additional setup."
|
||||
TEST()dnl
|
||||
}
|
||||
{
|
||||
package "fteplug_hl2"
|
||||
WINPLUG(hl2)
|
||||
LINPLUG(hl2)
|
||||
title "HalfLife2 Formats Plugin"
|
||||
desc "Provides support for HalfLife2 bsp and texture formats."
|
||||
desc "Some related games may work, but this is not guarenteed."
|
||||
desc "Requires mod support for full functionality."
|
||||
TEST()dnl
|
||||
}
|
||||
HIDE(`
|
||||
|
|
|
@ -889,6 +889,12 @@ static void QDECL QI_Tick(double realtime, double gametime)
|
|||
if (dlcontext == -1)
|
||||
{
|
||||
QI_RefreshMapList(false);
|
||||
|
||||
if (packagemanager)
|
||||
{
|
||||
VFS_CLOSE(packagemanager);
|
||||
packagemanager = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
archive = false;
|
||||
|
|
Loading…
Reference in a new issue