mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 16:46:16 +00:00
Prepare asyncify support
This commit is contained in:
@@ -103,7 +103,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
|||||||
-sMAXIMUM_MEMORY=4gb
|
-sMAXIMUM_MEMORY=4gb
|
||||||
#-sEXCEPTION_CATCHING_ALLOWED=[..]
|
#-sEXCEPTION_CATCHING_ALLOWED=[..]
|
||||||
-sEXIT_RUNTIME
|
-sEXIT_RUNTIME
|
||||||
#-sASYNCIFY
|
-sASYNCIFY
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MOMO_EMSCRIPTEN_SUPPORT_NODEJS)
|
if(MOMO_EMSCRIPTEN_SUPPORT_NODEJS)
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ function logLine(text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function notifyExit(code) {
|
||||||
|
flushLines();
|
||||||
|
postMessage({ message: "end", data: code });
|
||||||
|
self.close();
|
||||||
|
}
|
||||||
|
|
||||||
function runEmulation(filesystem, file, options) {
|
function runEmulation(filesystem, file, options) {
|
||||||
globalThis.Module = {
|
globalThis.Module = {
|
||||||
arguments: [...options, "-e", "./root", file],
|
arguments: [...options, "-e", "./root", file],
|
||||||
@@ -46,12 +52,10 @@ function runEmulation(filesystem, file, options) {
|
|||||||
},
|
},
|
||||||
print: logLine,
|
print: logLine,
|
||||||
printErr: logLine,
|
printErr: logLine,
|
||||||
postRun: () => {
|
onAbort: () => notifyExit(null),
|
||||||
flushLines();
|
onExit: notifyExit,
|
||||||
postMessage({ message: "end", data: null });
|
postRun: flushLines,
|
||||||
self.close();
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
importScripts("./analyzer.js?1");
|
importScripts("./analyzer.js");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user