Merge pull request #12853 from nbarkhina/master

Fixed web player bug with filesystem and runtime
This commit is contained in:
Autechre 2021-08-23 11:00:10 +02:00 committed by GitHub
commit f2d574fd87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@
*/
var BrowserFS = BrowserFS;
var afs;
var initializationCount = 0;
function cleanupStorage()
{
@ -42,7 +43,7 @@ function idbfsInit()
afs = new BrowserFS.FileSystem.InMemory();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
setupFileSystem("browser");
preLoadingComplete();
appInitialized();
}
else
{
@ -54,7 +55,7 @@ function idbfsInit()
afs = new BrowserFS.FileSystem.InMemory();
console.log("WEBPLAYER: error: " + e + " falling back to in-memory filesystem");
setupFileSystem("browser");
preLoadingComplete();
appInitialized();
}
else
{
@ -74,9 +75,20 @@ function idbfsSyncComplete()
console.log("WEBPLAYER: idbfs setup successful");
setupFileSystem("browser");
preLoadingComplete();
appInitialized();
}
function appInitialized()
{
/* Need to wait for both the file system and the wasm runtime
to complete before enabling the Run button. */
initializationCount++;
if (initializationCount == 2)
{
preLoadingComplete();
}
}
function preLoadingComplete()
{
/* Make the Preview image clickable to start RetroArch. */
@ -184,6 +196,10 @@ var Module =
arguments: ["-v", "--menu"],
preRun: [],
postRun: [],
onRuntimeInitialized: function()
{
appInitialized();
},
print: function(text)
{
console.log(text);