Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>ReactOS 0.4.15 in v86</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<style> | |
/* Make the emulator fill the entire viewport */ | |
html, body { | |
margin: 0; | |
height: 100%; | |
background: #000; | |
overflow: hidden; | |
} | |
#emulator { | |
width: 100%; | |
height: 100%; | |
} | |
/* Optional: A simple loading overlay while the WASM and ISO download */ | |
#loading-overlay { | |
position: absolute; | |
top: 0; left: 0; | |
width: 100%; height: 100%; | |
background: rgba(0,0,0,0.8); | |
color: #fff; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
font-family: sans-serif; | |
font-size: 1.2rem; | |
z-index: 10; | |
} | |
</style> | |
</head> | |
<body> | |
<!-- Loading overlay --> | |
<div id="loading-overlay">Loading ReactOS… Please wait.</div> | |
<!-- Container where v86 will render VGA output --> | |
<div id="emulator"></div> | |
<!-- v86 runtime (JavaScript + WebAssembly) --> | |
<script src="https://unpkg.com/v86/build/libv86.js"></script> | |
<script> | |
// As soon as libv86.js is parsed, create the emulator instance. | |
// The <div id="emulator"> will become the VGA screen. | |
(function() { | |
const screen = document.getElementById("emulator"); | |
const loadingOverlay = document.getElementById("loading-overlay"); | |
const emu = new V86Starter({ | |
wasm_path: "https://unpkg.com/v86/build/v86.wasm", | |
memory_size: 128 * 1024 * 1024, // 128 MiB RAM | |
vga_memory_size: 2 * 1024 * 1024, // 2 MiB VRAM | |
screen_container: screen, | |
bios: { url: "https://unpkg.com/v86/build/bios/seabios.bin" }, | |
vga_bios: { url: "https://unpkg.com/v86/build/bios/vgabios.bin" }, | |
cdrom: { | |
url: "https://huggingface.co/spaces/namelessai/BrowserVM/resolve/main/ReactOS-0.4.15.iso?download=true" | |
}, | |
autostart: true | |
}); | |
// Hide the loading overlay once the emulator is ready to display frames | |
emu.add_listener("screen-ready", function() { | |
loadingOverlay.style.display = "none"; | |
}); | |
// If anything goes wrong, log it to the console | |
emu.add_listener("emulator-started", function() { | |
console.log("v86 has started successfully."); | |
}); | |
emu.add_listener("emulator-crash", function(e) { | |
console.error("v86 crashed:", e); | |
}); | |
})(); | |
</script> | |
</body> | |
</html> |