mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 15:12:19 +00:00
8dadfb4878
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues). Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos. Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM). fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg). fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes. Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively. Web: Fix support for ogg vorbis. Add support for voip. Web: Added basic support for WebXR. QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set. QTV: add support for some eztv extensions. MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info. qwfwd: hack around a hack in qwfwd, allowing it to work again. recording: favour qwd in single player, instead of mvd. Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl. hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects. in_xflip: restored this setting. fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'. gl_overbright_models: Added cvar to match QS. netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets. Win: try a few other versions of xinput too. CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials. MenuQC: Added support for the skeletal objects API.
157 lines
4.6 KiB
JavaScript
157 lines
4.6 KiB
JavaScript
//Populate our filesystem from Module['files']
|
|
FTEH = {h: [],
|
|
f: {}};
|
|
FTE_SW=null;
|
|
|
|
if (!Module['canvas'])
|
|
{ //we need a canvas to throw our webgl crap at...
|
|
Module['canvas'] = document.getElementById('canvas');
|
|
if (!Module['canvas'])
|
|
{
|
|
console.log("No canvas element defined yet.");
|
|
Module.canvas = document.createElement("canvas");
|
|
Module.canvas.style.width="100%";
|
|
Module.canvas.style.height="100%";
|
|
document.body.appendChild(Module['canvas']);
|
|
}
|
|
}
|
|
|
|
Module['loadcachedfiles'] = function()
|
|
{ //recover any previously saved files they might have drag+dropped.
|
|
addRunDependency("loadcachedfiles");
|
|
try
|
|
{
|
|
caches.open('user').then((c)=>{Module['cache']=c;return c.keys();}).then((keys)=>{
|
|
const cache = Module['cache'];
|
|
for(var r of keys)
|
|
{
|
|
const idx = r.url.indexOf("/_/")
|
|
if (idx < 0)
|
|
continue; //wtf? that entry should not have been in this cache object.
|
|
const fn = r.url.substr(idx+3);
|
|
addRunDependency(fn);
|
|
const response = cache.match(r).then((response)=>{return response.arrayBuffer();}).then((buffer)=>{
|
|
let b = FTEH.h[_emscriptenfte_buf_createfromarraybuf(buffer)];
|
|
b.n = fn;
|
|
FTEH.f[b.n] = b;
|
|
}).finally(()=>{removeRunDependency(fn);});
|
|
}
|
|
}).finally(()=>{removeRunDependency("loadcachedfiles");});
|
|
}
|
|
catch(e)
|
|
{
|
|
removeRunDependency("loadcachedfiles");
|
|
}
|
|
};
|
|
|
|
Module['preRun'] = Module['loadcachedfiles'];
|
|
if (typeof Module['files'] !== "undefined" && Object.keys(Module['files']).length>0)
|
|
{
|
|
Module['preRun'] = function()
|
|
{
|
|
Module['loadcachedfiles']();
|
|
|
|
let files = Module['files'];
|
|
let names = Object.keys(files);
|
|
for (let i = 0; i < names.length; i++)
|
|
{
|
|
let ab = files[names[i]];
|
|
let n = names[i];
|
|
if (typeof ab == "string")
|
|
{ //if its a string, assume it to be a url of some kind for us to resolve.
|
|
addRunDependency(n);
|
|
|
|
let xhr = new XMLHttpRequest();
|
|
xhr.responseType = "arraybuffer";
|
|
xhr.open("GET", ab);
|
|
xhr.onload = function ()
|
|
{
|
|
if (this.status >= 200 && this.status < 300)
|
|
{
|
|
let b = FTEH.h[_emscriptenfte_buf_createfromarraybuf(this.response)];
|
|
b.n = n;
|
|
FTEH.f[b.n] = b;
|
|
removeRunDependency(n);
|
|
}
|
|
else
|
|
removeRunDependency(n);
|
|
};
|
|
xhr.onprogress = function(e)
|
|
{
|
|
if (Module['setStatus'])
|
|
Module['setStatus'](n + ' (' + e.loaded + '/' + e.total + ')');
|
|
};
|
|
xhr.onerror = function ()
|
|
{
|
|
removeRunDependency(n);
|
|
};
|
|
xhr.send();
|
|
}
|
|
else if (typeof ab.then == "function")
|
|
{ //a 'thenable' thing... assume it'll resolve into an arraybuffer.
|
|
addRunDependency(n);
|
|
ab.then(
|
|
value =>
|
|
{ //success
|
|
let b = FTEH.h[_emscriptenfte_buf_createfromarraybuf(value)];
|
|
b.n = n;
|
|
FTEH.f[b.n] = b;
|
|
removeRunDependency(n);
|
|
},
|
|
reason =>
|
|
{ //failure
|
|
console.log(reason);
|
|
removeRunDependency(n);
|
|
}
|
|
);
|
|
}
|
|
else
|
|
{ //otherwise assume array buffer.
|
|
let b = FTEH.h[_emscriptenfte_buf_createfromarraybuf(ab)];
|
|
b.n = n;
|
|
FTEH.f[b.n] = b;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (typeof man == "undefined")
|
|
{
|
|
var man = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
|
if (man.substr(-1) != '/')
|
|
man += ".fmf";
|
|
else
|
|
man += "index.fmf";
|
|
}
|
|
|
|
if (!Module['arguments']) //the html can be explicit about its args if it sets this to an empty array or w/e
|
|
{
|
|
Module['arguments'] = [];
|
|
|
|
if (window.location.hash != "")
|
|
man = window.location.hash.substring(1);
|
|
|
|
// use query string in URL as command line
|
|
const qstrings = decodeURIComponent(window.location.search.substring(1));
|
|
if (qstrings != "")
|
|
{
|
|
const qstring = qstrings.split(" ");
|
|
for (let i = 0; i < qstring.length; i++)
|
|
{
|
|
if (qstring[i] == '-manifest')
|
|
man = undefined; //don't do double manifest args...
|
|
if ((qstring[i] == '+sv_port_rtc' || qstring[i] == '+connect' || qstring[i] == '+join' || qstring[i] == '+observe' || qstring[i] == '+qtvplay') && i+1 < qstring.length)
|
|
{
|
|
Module['arguments'] = Module['arguments'].concat(qstring[i+0], qstring[i+1]);
|
|
i++;
|
|
}
|
|
else if (!document.referrer) //ignore args from referers in order to try to protect against dodgy srgs a little.
|
|
Module['arguments'] = Module['arguments'].concat(qstring[i]);
|
|
}
|
|
}
|
|
|
|
if (typeof man != "undefined")
|
|
Module['arguments'] = Module['arguments'].concat(['-manifest', man]);
|
|
|
|
//registerProtocolHandler needs to be able to pass it through to us... so only allow it if we're parsing args from the url.
|
|
Module['mayregisterscemes'] = true;
|
|
}
|