Giter Site home page Giter Site logo

takahirox / nes-rust Goto Github PK

View Code? Open in Web Editor NEW
201.0 10.0 24.0 1003 KB

NES emulator written in Rust + WASM

License: MIT License

Rust 64.43% Shell 0.14% HTML 17.89% JavaScript 17.54%
rust nes emulator wasm webassembly nes-emulator nes-emu webaudio webrtc

nes-rust's Introduction

nes-rust

Build Status Crate npm version

nes-rust is a NES emulator written in Rust. It can be compiled to WebAssembly.

Online Demos / Videos

Screenshots

nestest

nestest

Sgt. Helmet Training Day

Sgt. Helmet Training Day

Features

  • Audio support with SDL2 / WebAudio
  • WebAssembly support
  • Remote multiplay support with WebRTC

How to import into your Rust project

The emulator module and document are released at crates.io.

How to build core library locally

$ git clone https://github.com/takahirox/nes-rust.git
$ cd nes-rust
$ cargo build --release

How to run as desktop application

Prerequirements

$ cd nes-rust/cli
$ cargo run --release path_to_rom_file

How to import and use WebAssembly NES emulator in a web browser

See wasm/web

How to install and use WebAssembly NES emulator npm package

See wasm/npm

nes-rust's People

Contributors

takahirox avatar tyfkda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nes-rust's Issues

Key pad button don't work in web apps on mobile

Key pad buttons don't work in web apps on mobile. I tested on Android Chrome, OculusBrowser, and Firefox Reality.

DOM button event seems be fired but somehow input data doesn't seem to be sent to the emulator correctly.

Optimize JS-WASM data transfer and API

We should optimize JS-WASM data transfer and API. Currently pixel data and audio sample buffer are copied twice each. One in WASM side and another onc in JS side.

Stack overflow if running without --release

nes-rust fails to run if booting without --release option.

Error message.

$ cargo run roms/nestest.nes

...

thread 'main' has overflowed its stack
error: process didn't exit successfully: `target\debug\nes-rust.exe roms/nestest.nes` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)

No side effect CPU dump method

CPU has dump method to show the status of CPU but it has a side effect by loading memory. Loading memory can have some side effects, e.g. increasing stall_cycles, increasing pc, changing the state of PPU/APU, and so on.

No side effect CPU dump method is more useful.

WASM support

Compile to WASM and add web examples. Users can easily try nes-rust.

Run at 60fps

nes-rust can run faster than 60fps. It should process a frame per 1/60 sec.

Vertical scroll looks weird in MegaAri(megaari.nes)

megaari.nes

image

  1. No Alice in OP as the above screenshot shows
  2. After the OP, it halts with the following message, out of range access of PALETTES array.
thread 'main' panicked at 'index out of bounds: the len is 64 but the index is 68', src\ppu.rs:972:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: process didn't exit successfully: `target\release\nes-rust.exe ../nes-js/roms2/megaari.nes` (exit code: 101)

Improve Audio

We introduced Audio support in #24 but still a bit buggy for example

  • Noisy
  • Pitch or something is a bit weird

Add a proper way to exit

Currently user needs to kill the process to terminate nes-rust in standalone mode. We should add a proper way to stop.

PostProcessing

It's nice to apply postprocessing for example CRT monitor style effect.

Keep pixels crip when scaling up

Hi, I just started playing around with the demo, it's really cool ๐Ÿ™!

One thing I would suggest, though, is to add image-rendering: pixelated; or image-rendering: crisp-edges; (depending on the browser) to the <canvas> in the web app to avoid the blur that can be seen on the scaled-up versions right now.

Implement APU

Implement APU, at least IRQ interrupting. Otherwise games relying on IRQ from APU don't run.

More modern style web app development

I'm not a front-end engineer but I know the current web app development I do is maybe an old style. We should adopt more modern web app development style, like using React(?).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.