mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-18 19:23:56 +00:00
Fix loading analyzer and bust caches
This commit is contained in:
@@ -14,6 +14,7 @@ onmessage = async (event) => {
|
||||
payload.options,
|
||||
payload.persist,
|
||||
payload.wasm64,
|
||||
payload.cacheBuster,
|
||||
);
|
||||
break;
|
||||
case "event":
|
||||
@@ -70,12 +71,19 @@ function getMessageFromQueue() {
|
||||
return msgQueue.shift();
|
||||
}
|
||||
|
||||
function runEmulation(file, options, persist, wasm64) {
|
||||
function runEmulation(file, options, persist, wasm64, cacheBuster) {
|
||||
const mainArguments = [...options, "-e", "./root", file];
|
||||
|
||||
globalThis.Module = {
|
||||
arguments: mainArguments,
|
||||
noInitialRun: true,
|
||||
locateFile: (path, scriptDirectory) => {
|
||||
console.log(path);
|
||||
console.log(scriptDirectory);
|
||||
|
||||
const bitness = wasm64 ? "64" : "32";
|
||||
return `${scriptDirectory}${bitness}/${path}?${cacheBuster}`;
|
||||
},
|
||||
onRuntimeInitialized: function () {
|
||||
FS.mkdir("/root");
|
||||
FS.mount(IDBFS, {}, "/root");
|
||||
@@ -93,8 +101,8 @@ function runEmulation(file, options, persist, wasm64) {
|
||||
};
|
||||
|
||||
if (wasm64) {
|
||||
importScripts("./64/analyzer.js");
|
||||
importScripts("./64/analyzer.js?" + cacheBuster);
|
||||
} else {
|
||||
importScripts("./32/analyzer.js");
|
||||
importScripts("./32/analyzer.js?" + cacheBuster);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,11 @@ export class Emulator {
|
||||
this.terminateReject = reject;
|
||||
});
|
||||
|
||||
const cacheBuster = import.meta.env.VITE_BUILD_TIME || Date.now();
|
||||
|
||||
this.worker = new Worker(
|
||||
/*new URL('./emulator-worker.js', import.meta.url)*/ "./emulator-worker.js",
|
||||
/*new URL('./emulator-worker.js', import.meta.url)*/ "./emulator-worker.js?" +
|
||||
cacheBuster,
|
||||
);
|
||||
|
||||
this.worker.onerror = this._onError.bind(this);
|
||||
@@ -93,6 +96,7 @@ export class Emulator {
|
||||
options: translateSettings(settings),
|
||||
persist: settings.persist,
|
||||
wasm64: settings.wasm64,
|
||||
cacheBuster: import.meta.env.VITE_BUILD_TIME || Date.now(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,7 +98,9 @@ export class Playground extends React.Component<
|
||||
application: undefined,
|
||||
allowWasm64: false,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount(): void {
|
||||
memory64().then((allowWasm64) => {
|
||||
this.setState({ allowWasm64 });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user