nes_rust_wasm
v0.1.2
Published
NES emulator written in Rust and compiled to WebAssembly
Downloads
7
Maintainers
Readme
nes_rust_wasm
nes_rust_wasm is a WebAssembly NES emulator based on nes-rust.
How to install
$ npm install nes_rust_wasm
How to use
const nes = require('nes_rust_wasm').WasmNes.new();
nes.set_rom(new Uint8Array(romArrayBuffer));
const pixels = new Uint8Array(256 * 240 * 4);
// Audio example code is T.B.D.
const audioBuffer = new Float32Array(4096);
const runFrame = () => {
setTimeout(runFrame, 0);
nes.step_frame();
nes.update_pixels(pixels);
// Render pixels
};
nes.bootup();
runFrame();
API
Refer to the comments in WasmNes
How to build WebAssembly RISC-V emulator locally
Prerequirements
- Install wasm-bindgen client
$ git clone https://github.com/takahirox/nes-rust.git
$ cd nes-rust/wasm
$ bash build.sh