add new maps, persistent storage, music toggle button

This commit is contained in:
2026-11-21 14:56:05 +03:00
parent bc7b137adb
commit 5b473d15f2
24 changed files with 2142 additions and 9 deletions

View File

@@ -62,6 +62,34 @@
canvas: document.getElementById('canvas'),
print: console.log.bind(console),
printErr: console.error.bind(console),
// Delay main() until IndexedDB-backed storage has been restored.
noInitialRun: true,
preRun: [function () {
try {
Module.FS.mkdirTree('/persist');
Module.FS.mount(Module.IDBFS, {}, '/persist');
Module.__cpStorageMounted = true;
} catch (e) {
console.error('Catch-Phase: persistent storage unavailable', e);
}
}],
onRuntimeInitialized: function () {
const start = () => Module.callMain();
if (!Module.__cpStorageMounted) {
start();
return;
}
try {
Module.FS.syncfs(true, function (err) {
if (err) console.error('Catch-Phase: failed to load persistent storage', err);
start();
});
} catch (e) {
console.error('Catch-Phase: failed to sync persistent storage', e);
start();
}
},
};
addEventListener('load', () => Module.canvas.focus());
</script>