mirror of
https://github.com/hexahigh/games.git
synced 2025-12-11 20:15:38 +01:00
fixed alpine linux
This commit is contained in:
parent
872f323226
commit
eb0fd2632a
@ -1,19 +1,94 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!doctype html>
|
||||
<title>Save and restore</title>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<script src="libv86.js"></script>
|
||||
<script src="index.js"></script>
|
||||
</head>
|
||||
<script src="../build/libv86.js"></script>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
<body>
|
||||
<div id="screen_container">
|
||||
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
|
||||
<canvas style="display: none"></canvas>
|
||||
</div>
|
||||
</body>
|
||||
window.onload = function()
|
||||
{
|
||||
var emulator = new V86Starter({
|
||||
wasm_path: "../build/v86.wasm",
|
||||
memory_size: 304 * 1024 * 1024,
|
||||
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>
|
||||
Loading…
x
Reference in New Issue
Block a user