Skip to content

Commit

Permalink
Fixed running the export templates with newer emscripten versions.
Browse files Browse the repository at this point in the history
(cherry picked from commit 6f1d6cf)
  • Loading branch information
Relintai authored and akien-mga committed Dec 3, 2019
1 parent 89f26c9 commit 0587df4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
3 changes: 2 additions & 1 deletion misc/dist/html/fixed-size.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@

(function() {

const EXECUTABLE_NAME = '$GODOT_BASENAME';
const MAIN_PACK = '$GODOT_BASENAME.pck';
const DEBUG_ENABLED = $GODOT_DEBUG_ENABLED;
const INDETERMINATE_STATUS_STEP_MS = 100;
Expand Down Expand Up @@ -380,7 +381,7 @@
} else {
setStatusMode('indeterminate');
engine.setCanvas(canvas);
engine.startGame(MAIN_PACK).then(() => {
engine.startGame(EXECUTABLE_NAME, MAIN_PACK).then(() => {
setStatusMode('hidden');
initializing = false;
}, displayFailureNotice);
Expand Down
3 changes: 2 additions & 1 deletion misc/dist/html/full-size.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@

(function() {

const EXECUTABLE_NAME = '$GODOT_BASENAME';
const MAIN_PACK = '$GODOT_BASENAME.pck';
const INDETERMINATE_STATUS_STEP_MS = 100;

Expand Down Expand Up @@ -254,7 +255,7 @@
} else {
setStatusMode('indeterminate');
engine.setCanvas(canvas);
engine.startGame(MAIN_PACK).then(() => {
engine.startGame(EXECUTABLE_NAME, MAIN_PACK).then(() => {
setStatusMode('hidden');
initializing = false;
}, displayFailureNotice);
Expand Down
13 changes: 5 additions & 8 deletions platform/javascript/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
return new Promise(function(resolve, reject) {
rtenvProps.onRuntimeInitialized = resolve;
rtenvProps.onAbort = reject;
rtenvProps.thisProgram = executableName;
rtenvProps.engine.rtenv = Engine.RuntimeEnvironment(rtenvProps, LIBS);
});
}
Expand Down Expand Up @@ -130,13 +131,11 @@
);
};

this.startGame = function(mainPack) {
this.startGame = function(execName, mainPack) {

executableName = execName;
var mainArgs = [ '--main-pack', mainPack ];

executableName = getBaseName(mainPack);
var mainArgs = [];
if (!getPathLeaf(mainPack).endsWith('.pck')) {
mainArgs = ['--main-pack', getPathLeaf(mainPack)];
}
return Promise.all([
// Load from directory,
this.init(getBasePath(mainPack)),
Expand Down Expand Up @@ -187,8 +186,6 @@
this.rtenv.locale = this.rtenv.locale.split('.')[0];
this.rtenv.resizeCanvasOnStart = resizeCanvasOnStart;

this.rtenv.thisProgram = executableName || getBaseName(basePath);

preloadedFiles.forEach(function(file) {
var dir = LIBS.PATH.dirname(file.path);
try {
Expand Down

0 comments on commit 0587df4

Please sign in to comment.