Remove unnecessary rigmarole around importing the script as a blob (#17642)
This commit is contained in:
parent
23170b82ec
commit
f2a86f34d1
|
@ -118,7 +118,7 @@ ifeq ($(HAVE_WASMFS), 1)
|
|||
endif
|
||||
|
||||
ifeq ($(PROXY_TO_PTHREAD),1)
|
||||
LIBS += -sUSE_ES6_IMPORT_META=0 -sENVIRONMENT=worker,web
|
||||
LIBS += -sENVIRONMENT=worker,web
|
||||
LIBS += -sPROXY_TO_PTHREAD -sOFFSCREENCANVAS_SUPPORT
|
||||
DEFINES += -DUSE_OFFSCREENCANVAS=1 -DPROXY_TO_PTHREAD=1
|
||||
else
|
||||
|
|
|
@ -461,6 +461,11 @@ static uint64_t frontend_emscripten_get_free_mem(void)
|
|||
}
|
||||
|
||||
void emscripten_bootup_mainloop(void *argptr) {
|
||||
if(retro_started) {
|
||||
/* A stale extra call to bootup_mainloop for some reason */
|
||||
RARCH_ERR("[Emscripten] unexpected second call to bootup_mainloop after rarch_main called\n");
|
||||
return;
|
||||
}
|
||||
if(filesystem_ready) {
|
||||
args_t *args = (args_t*)argptr;
|
||||
emscripten_cancel_main_loop();
|
||||
|
|
|
@ -216,24 +216,15 @@ $(function() {
|
|||
loadCore(core);
|
||||
});
|
||||
|
||||
async function downloadScript(src) {
|
||||
let resp = await fetch(src);
|
||||
let blob = await resp.blob();
|
||||
return blob;
|
||||
}
|
||||
|
||||
function loadCore(core) {
|
||||
// Make the core the selected core in the UI.
|
||||
var coreTitle = $('#core-selector a[data-core="' + core + '"]').addClass('active').text();
|
||||
$('#dropdownMenu1').text(coreTitle);
|
||||
downloadScript("./"+core+"_libretro.js").then(scriptBlob => {
|
||||
Module.mainScriptUrlOrBlob = scriptBlob;
|
||||
import(URL.createObjectURL(scriptBlob)).then(script => {
|
||||
script.default(Module).then(mod => {
|
||||
Module = mod;
|
||||
}).catch(err => { console.error("Couldn't instantiate module",err); throw err; });
|
||||
}).catch(err => { console.error("Couldn't load script",err); throw err; });
|
||||
});
|
||||
import("./"+core+"_libretro.js").then(script => {
|
||||
script.default(Module).then(mod => {
|
||||
Module = mod;
|
||||
}).catch(err => { console.error("Couldn't instantiate module",err); throw err; });
|
||||
}).catch(err => { console.error("Couldn't import module"); throw err; });
|
||||
}
|
||||
|
||||
const setupWorker = new Worker("libretro.worker.js");
|
||||
|
|
Loading…
Reference in New Issue