Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
a415efa4
Unverified
Commit
a415efa4
authored
May 10, 2018
by
Rémi Verschelde
Committed by
GitHub
May 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18765 from eska014/enginejs-extalt
Facilitate using non-default filename extensions in HTML5 platform
parents
2766050c
96f907c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
default.html
misc/dist/html/default.html
+2
-2
engine.js
platform/javascript/engine.js
+15
-2
No files found.
misc/dist/html/default.html
View file @
a415efa4
...
...
@@ -229,7 +229,7 @@ $GODOT_HEAD_INCLUDE
(
function
()
{
const
BASENAME
=
'$GODOT_BASENAME
'
;
const
MAIN_PACK
=
'$GODOT_BASENAME.pck
'
;
const
DEBUG_ENABLED
=
$GODOT_DEBUG_ENABLED
;
const
INDETERMINATE_STATUS_STEP_MS
=
100
;
...
...
@@ -380,7 +380,7 @@ $GODOT_HEAD_INCLUDE
}
else
{
setStatusMode
(
'indeterminate'
);
engine
.
setCanvas
(
canvas
);
engine
.
startGame
(
BASENAME
+
'.pck'
).
then
(()
=>
{
engine
.
startGame
(
MAIN_PACK
).
then
(()
=>
{
setStatusMode
(
'hidden'
);
initializing
=
false
;
},
displayFailureNotice
);
...
...
platform/javascript/engine.js
View file @
a415efa4
...
...
@@ -10,6 +10,7 @@
var
DOWNLOAD_ATTEMPTS_MAX
=
4
;
var
basePath
=
null
;
var
wasmFilenameExtensionOverride
=
null
;
var
engineLoadPromise
=
null
;
var
loadingFiles
=
{};
...
...
@@ -129,13 +130,17 @@
this
.
startGame
=
function
(
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
)),
// ...but write to root where the engine expects it.
this
.
preloadFile
(
mainPack
,
getPathLeaf
(
mainPack
))
]).
then
(
Function
.
prototype
.
apply
.
bind
(
synchronousStart
,
this
,
[]
)
Function
.
prototype
.
apply
.
bind
(
synchronousStart
,
this
,
mainArgs
)
);
};
...
...
@@ -303,6 +308,14 @@
return
!!
testContext
;
};
Engine
.
setWebAssemblyFilenameExtension
=
function
(
override
)
{
if
(
String
(
override
).
length
===
0
)
{
throw
new
Error
(
'Invalid WebAssembly filename extension override'
);
}
wasmFilenameExtensionOverride
=
String
(
override
);
}
Engine
.
load
=
function
(
newBasePath
)
{
if
(
newBasePath
!==
undefined
)
basePath
=
getBasePath
(
newBasePath
);
...
...
@@ -310,7 +323,7 @@
if
(
typeof
WebAssembly
!==
'object'
)
return
Promise
.
reject
(
new
Error
(
"Browser doesn't support WebAssembly"
));
// TODO cache/retrieve module to/from idb
engineLoadPromise
=
loadPromise
(
basePath
+
'.
wasm'
).
then
(
function
(
xhr
)
{
engineLoadPromise
=
loadPromise
(
basePath
+
'.
'
+
(
wasmFilenameExtensionOverride
||
'wasm'
)
).
then
(
function
(
xhr
)
{
return
xhr
.
response
;
});
engineLoadPromise
=
engineLoadPromise
.
catch
(
function
(
err
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment