fixed alpine linux

This commit is contained in:
Boof 2023-09-12 12:58:17 +02:00 committed by GitHub
parent 872f323226
commit eb0fd2632a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,19 +1,94 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <title>Save and restore</title>
<head> <script src="../build/libv86.js"></script>
<meta charset="UTF-8"> <script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> "use strict";
<title>Document</title>
<script src="libv86.js"></script>
<script src="index.js"></script>
</head>
<body> window.onload = function()
<div id="screen_container"> {
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div> var emulator = new V86Starter({
<canvas style="display: none"></canvas> wasm_path: "../build/v86.wasm",
</div> memory_size: 304 * 1024 * 1024,
</body> vga_memory_size: 16 * 1024 * 1024,
screen_container: document.getElementById("screen_container"),
bios: {
url: "https://cdn-mu-ten.vercel.app/v86/seabios.bin",
},
vga_bios: {
url: "https://cdn-mu-ten.vercel.app/v86/vgabios.bin",
},
cdrom: {
url: "https://data.boof.eu.org/alpine-standard-3.18.3-x86.iso",
},
autostart: true,
});
</html> var state;
document.getElementById("save_restore").onclick = async function()
{
var button = this;
if(state)
{
button.value = "Save state";
await emulator.restore_state(state);
state = undefined;
}
else
{
const new_state = await emulator.save_state();
console.log("Saved state of " + new_state.byteLength + " bytes");
button.value = "Restore state";
state = new_state;
}
button.blur();
};
document.getElementById("save_file").onclick = async function()
{
const new_state = await emulator.save_state();
var a = document.createElement("a");
a.download = "v86state.bin";
a.href = window.URL.createObjectURL(new Blob([new_state]));
a.dataset.downloadurl = "application/octet-stream:" + a.download + ":" + a.href;
a.click();
this.blur();
};
document.getElementById("restore_file").onchange = function()
{
if(this.files.length)
{
var filereader = new FileReader();
emulator.stop();
filereader.onload = async function(e)
{
await emulator.restore_state(e.target.result);
emulator.run();
};
filereader.readAsArrayBuffer(this.files[0]);
this.value = "";
}
this.blur();
};
};
</script>
<input id="save_restore" type="button" value="Save state">
<input id="save_file" type="button" value="Save state to file">
Restore from file: <input id="restore_file" type="file">
<hr>
<!-- A minimal structure for the ScreenAdapter defined in browser/screen.js -->
<div id="screen_container">
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>