1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

Expose Emscripten libs to engine.js discreetly

(cherry picked from commit 63c7fc6358)
This commit is contained in:
Leon Krause
2018-03-27 09:06:19 +02:00
committed by Hein-Pieter van Braam
parent 71885e5ae4
commit 0f6626977b
3 changed files with 6 additions and 4 deletions

View File

@@ -116,7 +116,6 @@ def configure(env):
env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1']) env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1'])
env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1']) env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1'])
env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS="[\'FS\']"'])
env.Append(LINKFLAGS=['-s', 'INVOKE_RUN=0']) env.Append(LINKFLAGS=['-s', 'INVOKE_RUN=0'])
env.Append(LINKFLAGS=['-s', 'NO_EXIT_RUNTIME=1']) env.Append(LINKFLAGS=['-s', 'NO_EXIT_RUNTIME=1'])

View File

@@ -1,3 +1,4 @@
exposedLibs['FS'] = FS;
return Module; return Module;
}, },
}; };
@@ -31,6 +32,8 @@
this.rtenv = null; this.rtenv = null;
var LIBS = {};
var initPromise = null; var initPromise = null;
var unloadAfterInit = true; var unloadAfterInit = true;
@@ -80,7 +83,7 @@
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
rtenvProps.onRuntimeInitialized = resolve; rtenvProps.onRuntimeInitialized = resolve;
rtenvProps.onAbort = reject; rtenvProps.onAbort = reject;
rtenvProps.engine.rtenv = Engine.RuntimeEnvironment(rtenvProps); rtenvProps.engine.rtenv = Engine.RuntimeEnvironment(rtenvProps, LIBS);
}); });
} }
@@ -175,7 +178,7 @@
this.rtenv.thisProgram = executableName || getBaseName(basePath); this.rtenv.thisProgram = executableName || getBaseName(basePath);
preloadedFiles.forEach(function(file) { preloadedFiles.forEach(function(file) {
this.rtenv.FS.createDataFile('/', file.name, new Uint8Array(file.buffer), true, true, true); LIBS.FS.createDataFile('/', file.name, new Uint8Array(file.buffer), true, true, true);
}, this); }, this);
preloadedFiles = null; preloadedFiles = null;

View File

@@ -1,2 +1,2 @@
var Engine = { var Engine = {
RuntimeEnvironment: function(Module) { RuntimeEnvironment: function(Module, exposedLibs) {