Fix up the emscripten target a little.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5906 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
ac427ff76c
commit
0b0d6c3df7
6 changed files with 32 additions and 20 deletions
|
@ -1727,7 +1727,7 @@ ifeq ($(FTE_TARGET),web)
|
||||||
JSLIBS=--js-library web/ftejslib.js
|
JSLIBS=--js-library web/ftejslib.js
|
||||||
EMCC_CFLAGS= -DFTE_TARGET_WEB
|
EMCC_CFLAGS= -DFTE_TARGET_WEB
|
||||||
EMCC_LDFLAGS=$(EMCC_CFLAGS) $(JSLIBS) $(WEB_PREJS)
|
EMCC_LDFLAGS=$(EMCC_CFLAGS) $(JSLIBS) $(WEB_PREJS)
|
||||||
EMCC_CFLAGS+= -s BINARYEN_TRAP_MODE='clamp' #fix bigfloat->int rounding crashes
|
# EMCC_CFLAGS+= -s BINARYEN_TRAP_MODE='clamp' #fix bigfloat->int rounding crashes
|
||||||
EMCC_CFLAGS+= -s LEGACY_GL_EMULATION=0 #simplify the opengl wrappers.
|
EMCC_CFLAGS+= -s LEGACY_GL_EMULATION=0 #simplify the opengl wrappers.
|
||||||
EMCC_CFLAGS+= -s NO_FILESYSTEM=1 #we have our own.
|
EMCC_CFLAGS+= -s NO_FILESYSTEM=1 #we have our own.
|
||||||
EMCC_LDFLAGS+=-s ERROR_ON_UNDEFINED_SYMBOLS=1 #fairly obvious. no runtime errors please.
|
EMCC_LDFLAGS+=-s ERROR_ON_UNDEFINED_SYMBOLS=1 #fairly obvious. no runtime errors please.
|
||||||
|
@ -1736,8 +1736,8 @@ ifeq ($(FTE_TARGET),web)
|
||||||
RELEASE_LDFLAGS=-O3 -s TOTAL_MEMORY=$(ASMJS_MEMORY) $(EMCC_LDFLAGS)
|
RELEASE_LDFLAGS=-O3 -s TOTAL_MEMORY=$(ASMJS_MEMORY) $(EMCC_LDFLAGS)
|
||||||
# RELEASE_LDFLAGS=-O1 -s TOTAL_MEMORY=$(WEB_MEMORY) $(EMCC_LDFLAGS)
|
# RELEASE_LDFLAGS=-O1 -s TOTAL_MEMORY=$(WEB_MEMORY) $(EMCC_LDFLAGS)
|
||||||
DEBUG_LDFLAGS=-O0 -g4 -s TOTAL_MEMORY=$(WEB_MEMORY) $(EMCC_LDFLAGS) -s SAFE_HEAP=1 -s ALIASING_FUNCTION_POINTERS=0 -s ASSERTIONS=2
|
DEBUG_LDFLAGS=-O0 -g4 -s TOTAL_MEMORY=$(WEB_MEMORY) $(EMCC_LDFLAGS) -s SAFE_HEAP=1 -s ALIASING_FUNCTION_POINTERS=0 -s ASSERTIONS=2
|
||||||
CC?=emcc
|
CC=emcc
|
||||||
CXX?=emcc
|
CXX=em++
|
||||||
#BASELDFLAGS=
|
#BASELDFLAGS=
|
||||||
PRECOMPHEADERS=
|
PRECOMPHEADERS=
|
||||||
|
|
||||||
|
|
|
@ -2616,7 +2616,6 @@ static void PM_WriteInstalledPackages(void)
|
||||||
COM_QuotedKeyVal("title", p->title, buf, sizeof(buf));
|
COM_QuotedKeyVal("title", p->title, buf, sizeof(buf));
|
||||||
if (*p->version)
|
if (*p->version)
|
||||||
COM_QuotedKeyVal("ver", p->version, buf, sizeof(buf));
|
COM_QuotedKeyVal("ver", p->version, buf, sizeof(buf));
|
||||||
//if (*p->gamedir)
|
|
||||||
COM_QuotedKeyVal("gamedir", p->gamedir, buf, sizeof(buf));
|
COM_QuotedKeyVal("gamedir", p->gamedir, buf, sizeof(buf));
|
||||||
if (p->qhash)
|
if (p->qhash)
|
||||||
COM_QuotedKeyVal("qhash", p->qhash, buf, sizeof(buf));
|
COM_QuotedKeyVal("qhash", p->qhash, buf, sizeof(buf));
|
||||||
|
|
|
@ -308,8 +308,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#undef RUNTIMELIGHTING //too slow anyway
|
#undef RUNTIMELIGHTING //too slow anyway
|
||||||
#undef Q2CLIENT
|
#undef Q2CLIENT
|
||||||
#undef Q2SERVER //requires a dll anyway.
|
#undef Q2SERVER //requires a dll anyway.
|
||||||
#undef Q3CLIENT
|
// #undef Q3CLIENT
|
||||||
#undef Q3SERVER //trying to trim memory use
|
// #undef Q3SERVER //trying to trim memory use
|
||||||
// #undef Q2BSPS //emscripten can't cope with bss, leading to increased download time. too lazy to fix.
|
// #undef Q2BSPS //emscripten can't cope with bss, leading to increased download time. too lazy to fix.
|
||||||
// #undef Q3BSPS //emscripten can't cope with bss, leading to increased download time. too lazy to fix.
|
// #undef Q3BSPS //emscripten can't cope with bss, leading to increased download time. too lazy to fix.
|
||||||
#undef TERRAIN
|
#undef TERRAIN
|
||||||
|
|
|
@ -788,6 +788,7 @@ struct decompressstate
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(AVAIL_ZLIB) || defined(AVAIL_BZLIB)
|
#if defined(AVAIL_ZLIB) || defined(AVAIL_BZLIB)
|
||||||
|
#define DO_ZIP_DECOMPRESS
|
||||||
|
|
||||||
#ifdef ZIPCRYPT
|
#ifdef ZIPCRYPT
|
||||||
#define CRC32(c, b) ((*(st->crctable+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
|
#define CRC32(c, b) ((*(st->crctable+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
|
||||||
|
@ -1187,11 +1188,6 @@ static vfsfile_t *FSZIP_Decompress_ToTempFile(struct decompressstate *decompress
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
vfsfile_t *FSZIP_Decompress_ToTempFile(struct decompressstate *decompress)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//an open vfsfile_t
|
//an open vfsfile_t
|
||||||
|
@ -1202,7 +1198,9 @@ typedef struct {
|
||||||
|
|
||||||
//in case we're forced away.
|
//in case we're forced away.
|
||||||
zipfile_t *parent;
|
zipfile_t *parent;
|
||||||
|
#ifdef DO_ZIP_DECOMPRESS
|
||||||
struct decompressstate *decompress;
|
struct decompressstate *decompress;
|
||||||
|
#endif
|
||||||
qofs_t pos;
|
qofs_t pos;
|
||||||
qofs_t length; //try and optimise some things
|
qofs_t length; //try and optimise some things
|
||||||
// int index;
|
// int index;
|
||||||
|
@ -1217,11 +1215,14 @@ static int QDECL VFSZIP_ReadBytes (struct vfsfile_s *file, void *buffer, int byt
|
||||||
if (vfsz->defer)
|
if (vfsz->defer)
|
||||||
return VFS_READ(vfsz->defer, buffer, bytestoread);
|
return VFS_READ(vfsz->defer, buffer, bytestoread);
|
||||||
|
|
||||||
|
#ifdef DO_ZIP_DECOMPRESS
|
||||||
if (vfsz->decompress)
|
if (vfsz->decompress)
|
||||||
{
|
{
|
||||||
read = vfsz->decompress->Read(vfsz->decompress, buffer, bytestoread);
|
read = vfsz->decompress->Read(vfsz->decompress, buffer, bytestoread);
|
||||||
}
|
}
|
||||||
else if (Sys_LockMutex(vfsz->parent->mutex))
|
else
|
||||||
|
#endif
|
||||||
|
if (Sys_LockMutex(vfsz->parent->mutex))
|
||||||
{
|
{
|
||||||
VFS_SEEK(vfsz->parent->raw, vfsz->pos+vfsz->startpos);
|
VFS_SEEK(vfsz->parent->raw, vfsz->pos+vfsz->startpos);
|
||||||
if (vfsz->pos + bytestoread > vfsz->length)
|
if (vfsz->pos + bytestoread > vfsz->length)
|
||||||
|
@ -1245,6 +1246,7 @@ static qboolean QDECL VFSZIP_Seek (struct vfsfile_s *file, qofs_t pos)
|
||||||
if (vfsz->defer)
|
if (vfsz->defer)
|
||||||
return VFS_SEEK(vfsz->defer, pos);
|
return VFS_SEEK(vfsz->defer, pos);
|
||||||
|
|
||||||
|
#ifdef DO_ZIP_DECOMPRESS
|
||||||
//This is *really* inefficient
|
//This is *really* inefficient
|
||||||
if (vfsz->decompress)
|
if (vfsz->decompress)
|
||||||
{ //if they're going to seek on a file in a zip, let's just copy it out
|
{ //if they're going to seek on a file in a zip, let's just copy it out
|
||||||
|
@ -1261,6 +1263,7 @@ static qboolean QDECL VFSZIP_Seek (struct vfsfile_s *file, qofs_t pos)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pos > vfsz->length)
|
if (pos > vfsz->length)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1289,8 +1292,10 @@ static qboolean QDECL VFSZIP_Close (struct vfsfile_s *file)
|
||||||
if (vfsz->defer)
|
if (vfsz->defer)
|
||||||
VFS_CLOSE(vfsz->defer);
|
VFS_CLOSE(vfsz->defer);
|
||||||
|
|
||||||
|
#ifdef DO_ZIP_DECOMPRESS
|
||||||
if (vfsz->decompress)
|
if (vfsz->decompress)
|
||||||
vfsz->decompress->Destroy(vfsz->decompress);
|
vfsz->decompress->Destroy(vfsz->decompress);
|
||||||
|
#endif
|
||||||
|
|
||||||
FSZIP_ClosePath(&vfsz->parent->pub);
|
FSZIP_ClosePath(&vfsz->parent->pub);
|
||||||
Z_Free(vfsz);
|
Z_Free(vfsz);
|
||||||
|
@ -1419,8 +1424,10 @@ static vfsfile_t *QDECL FSZIP_OpenVFS(searchpathfuncs_t *handle, flocation_t *lo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef DO_ZIP_DECOMPRESS
|
||||||
if (vfsz->decompress)
|
if (vfsz->decompress)
|
||||||
vfsz->decompress->Destroy(vfsz->decompress);
|
vfsz->decompress->Destroy(vfsz->decompress);
|
||||||
|
#endif
|
||||||
Z_Free(vfsz);
|
Z_Free(vfsz);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,7 @@ ftecrypto_t *cryptolib[cryptolib_count] =
|
||||||
&crypto_gnutls,
|
&crypto_gnutls,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
#if defined(HAVE_SSL)
|
||||||
static void NET_TLS_Provider_Changed(struct cvar_s *var, char *oldvalue)
|
static void NET_TLS_Provider_Changed(struct cvar_s *var, char *oldvalue)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -245,6 +246,7 @@ static void NET_TLS_Provider_Changed(struct cvar_s *var, char *oldvalue)
|
||||||
Con_Printf("\n");
|
Con_Printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
qboolean NET_RegisterCrypto(void *module, ftecrypto_t *driver)
|
qboolean NET_RegisterCrypto(void *module, ftecrypto_t *driver)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -253,7 +255,9 @@ qboolean NET_RegisterCrypto(void *module, ftecrypto_t *driver)
|
||||||
for (i = 0; i < cryptolib_count; i++)
|
for (i = 0; i < cryptolib_count; i++)
|
||||||
if (cryptolibmodule[i] == module)
|
if (cryptolibmodule[i] == module)
|
||||||
cryptolibmodule[i] = NULL, cryptolib[i] = NULL;
|
cryptolibmodule[i] = NULL, cryptolib[i] = NULL;
|
||||||
|
#if defined(HAVE_SSL)
|
||||||
Cvar_ForceCallback(&tls_provider);
|
Cvar_ForceCallback(&tls_provider);
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -262,7 +266,9 @@ qboolean NET_RegisterCrypto(void *module, ftecrypto_t *driver)
|
||||||
if (!cryptolib[i])
|
if (!cryptolib[i])
|
||||||
{
|
{
|
||||||
cryptolibmodule[i] = module, cryptolib[i] = driver;
|
cryptolibmodule[i] = module, cryptolib[i] = driver;
|
||||||
|
#if defined(HAVE_SSL)
|
||||||
Cvar_ForceCallback(&tls_provider);
|
Cvar_ForceCallback(&tls_provider);
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -2296,10 +2302,10 @@ qboolean NET_IsLoopBackAddress (netadr_t *adr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_SSL
|
|
||||||
void *Auth_GetKnownCertificate(const char *certname, size_t *size)
|
void *Auth_GetKnownCertificate(const char *certname, size_t *size)
|
||||||
{ //our 'code signing' certs
|
{ //our 'code signing' certs
|
||||||
//we only allow packages to be installed into the root dir (or with dll/so/exe extensions) when their signature is signed by one of these certificates
|
//we only allow packages to be installed into the root dir (or with dll/so/exe extensions) when their signature is signed by one of these certificates
|
||||||
|
#ifdef HAVE_SSL
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -2339,8 +2345,10 @@ void *Auth_GetKnownCertificate(const char *certname, size_t *size)
|
||||||
return certs[i].cert;
|
return certs[i].cert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SSL
|
||||||
void *TLS_GetKnownCertificate(const char *certname, size_t *size)
|
void *TLS_GetKnownCertificate(const char *certname, size_t *size)
|
||||||
{
|
{
|
||||||
//Note: This is XORed because of shitty scanners flagging binaries through false positive, flagging the sites that they were downloaded from, flagging binaries that contain references to those sites, and flagging any site that contains binaries.
|
//Note: This is XORed because of shitty scanners flagging binaries through false positive, flagging the sites that they were downloaded from, flagging binaries that contain references to those sites, and flagging any site that contains binaries.
|
||||||
|
@ -3779,11 +3787,9 @@ static qboolean FTENET_Datagram_ChangeLocalAddress(struct ftenet_generic_connect
|
||||||
//doesn't match how its currently bound, so I guess we need to rebind then.
|
//doesn't match how its currently bound, so I guess we need to rebind then.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void FTENET_Datagram_Close(ftenet_generic_connection_t *con)
|
static void FTENET_Datagram_Close(ftenet_generic_connection_t *con)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PACKET
|
|
||||||
if (con->thesocket != INVALID_SOCKET)
|
if (con->thesocket != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
|
@ -3791,9 +3797,9 @@ static void FTENET_Datagram_Close(ftenet_generic_connection_t *con)
|
||||||
#endif
|
#endif
|
||||||
closesocket(con->thesocket);
|
closesocket(con->thesocket);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
Z_Free(con);
|
Z_Free(con);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
static void FTENET_Datagram_Polled(epollctx_t *ctx, unsigned int events)
|
static void FTENET_Datagram_Polled(epollctx_t *ctx, unsigned int events)
|
||||||
|
|
|
@ -195,9 +195,9 @@ typedef enum {
|
||||||
BM_PREMUL/*ONE ONE_MINUS_SRC_ALPHA*/,
|
BM_PREMUL/*ONE ONE_MINUS_SRC_ALPHA*/,
|
||||||
BM_RTSMOKE /*special shader generation that causes these particles to be lit up by nearby rtlights, instead of just being fullbright junk*/
|
BM_RTSMOKE /*special shader generation that causes these particles to be lit up by nearby rtlights, instead of just being fullbright junk*/
|
||||||
} blendmode_t;
|
} blendmode_t;
|
||||||
#define frandom() (rand()*(1.0f/RAND_MAX))
|
#define frandom() (rand()*(1.0f/(float)RAND_MAX))
|
||||||
#define crandom() (rand()*(2.0f/RAND_MAX)-1.0f)
|
#define crandom() (rand()*(2.0f/(float)RAND_MAX)-1.0f)
|
||||||
#define hrandom() (rand()*(1.0f/RAND_MAX)-0.5f)
|
#define hrandom() (rand()*(1.0f/(float)RAND_MAX)-0.5f)
|
||||||
|
|
||||||
#define P_INVALID -1
|
#define P_INVALID -1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue