DeSmuME: Fix fix-introduced bug

This commit is contained in:
octospacc 2023-01-19 13:38:06 +01:00
parent ba33a4e087
commit 332bca008c
1 changed files with 10 additions and 2 deletions

View File

@ -53,6 +53,15 @@ function $id(id) {
return document.getElementById(id);
}
// https://stackoverflow.com/a/48178043
function waitFor(condition, callback) {
if(!condition()) {
window.setTimeout(waitFor.bind(null, condition, callback), 100);
} else {
callback();
};
};
var optScaleMode = 0
var uiCurrentMode = 'welcome'
var plugins = {}
@ -1748,8 +1757,7 @@ const LoadRomFromUrl = _ => {
Req.open('GET', RomUrl, true);
Req.responseType = 'blob';
Req.onload = function() {
while (!EngineIsReady) {};
tryLoadROM(Req.response);
waitFor(() => (EngineIsReady == true), () => tryLoadROM(Req.response));
};
Req.send();
};