Update to 14.0-beta1
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
Module.arguments.push('-mnull', '-snull', '-vsdl:relative_mode');
|
||||
Module.arguments.push('-mnull', '-snull', '-vsdl');
|
||||
Module['websocket'] = { url: function(host, port, proto) {
|
||||
/* openttd.org hosts a WebSocket proxy for the content service. */
|
||||
if (host == "content.openttd.org" && port == 3978 && proto == "tcp") {
|
||||
return "wss://content.openttd.org/";
|
||||
return "wss://bananas-server.openttd.org/";
|
||||
}
|
||||
|
||||
/* Everything else just tries to make a default WebSocket connection.
|
||||
@@ -30,46 +30,47 @@ Module.preRun.push(function() {
|
||||
|
||||
Module.addRunDependency('syncfs');
|
||||
FS.syncfs(true, function (err) {
|
||||
/* FS.mkdir() tends to fail if parent folders do not exist. */
|
||||
if (!FS.analyzePath(content_download_dir).exists) {
|
||||
FS.mkdir(content_download_dir);
|
||||
}
|
||||
if (!FS.analyzePath(content_download_dir + '/baseset').exists) {
|
||||
FS.mkdir(content_download_dir + '/baseset');
|
||||
}
|
||||
|
||||
/* Check if the OpenGFX baseset is already downloaded. */
|
||||
if (!FS.analyzePath(content_download_dir + '/baseset/opengfx-0.6.0.tar').exists) {
|
||||
window.openttd_downloaded_opengfx = true;
|
||||
FS.createPreloadedFile(content_download_dir + '/baseset', 'opengfx-0.6.0.tar', 'https://installer.cdn.openttd.org/emscripten/opengfx-0.6.0.tar', true, true);
|
||||
} else {
|
||||
/* Fake dependency increase, so the counter is stable. */
|
||||
Module.addRunDependency('opengfx');
|
||||
Module.removeRunDependency('opengfx');
|
||||
}
|
||||
|
||||
Module.removeRunDependency('syncfs');
|
||||
});
|
||||
|
||||
window.openttd_syncfs_shown_warning = false;
|
||||
window.openttd_syncfs = function() {
|
||||
window.openttd_syncfs = function(callback) {
|
||||
/* Copy the virtual FS to the persistent storage. */
|
||||
FS.syncfs(false, function (err) { });
|
||||
FS.syncfs(false, function (err) {
|
||||
/* On first time, warn the user about the volatile behaviour of
|
||||
* persistent storage. */
|
||||
if (!window.openttd_syncfs_shown_warning) {
|
||||
window.openttd_syncfs_shown_warning = true;
|
||||
Module.onWarningFs();
|
||||
}
|
||||
|
||||
/* On first time, warn the user about the volatile behaviour of
|
||||
* persistent storage. */
|
||||
if (!window.openttd_syncfs_shown_warning) {
|
||||
window.openttd_syncfs_shown_warning = true;
|
||||
Module.onWarningFs();
|
||||
}
|
||||
if (callback) callback();
|
||||
});
|
||||
}
|
||||
|
||||
window.openttd_exit = function() {
|
||||
Module.onExit();
|
||||
window.openttd_syncfs(Module.onExit);
|
||||
}
|
||||
|
||||
window.openttd_abort = function() {
|
||||
Module.onAbort();
|
||||
window.openttd_syncfs(Module.onAbort);
|
||||
}
|
||||
|
||||
window.openttd_bootstrap = function(current, total) {
|
||||
Module.onBootstrap(current, total);
|
||||
}
|
||||
|
||||
window.openttd_bootstrap_failed = function() {
|
||||
Module.onBootstrapFailed();
|
||||
}
|
||||
|
||||
window.openttd_bootstrap_reload = function() {
|
||||
window.openttd_syncfs(function() {
|
||||
Module.onBootstrapReload();
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
window.openttd_server_list = function() {
|
||||
@@ -123,11 +124,3 @@ Module.preRun.push(function() {
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
Module.postRun.push(function() {
|
||||
/* Check if we downloaded OpenGFX; if so, sync the virtual FS back to the
|
||||
* IDBFS so OpenGFX is stored persistent. */
|
||||
if (window['openttd_downloaded_opengfx']) {
|
||||
FS.syncfs(false, function (err) { });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user