/fceux

FCEUX, a NES Emulator

Primary LanguageC++GNU General Public License v2.0GPL-2.0

em-fceux

https://github.com/tsone/fceux/tree/emscripten/src/drivers/em

Web fork of the FCEUX Nintendo Entertainment System/Famicom (NES/FC) emulator. Powered by Emscripten and WebAssembly.

Try it at https://tsone.kapsi.fi/em-fceux/.

Overview

em-fceux enables many core FCEUX features on the web browsers through a convenient API and is available as npm package em-fceux. It achieves high emulation performance by compiling the FCEUX source code to WebAssembly.

Features

There are some modifications in FCEUX to make the code suitable for Emscripten. Primary addition is WebGL renderer which enables the use of shaders.

Supported FCEUX features:

  • All mappers supported by FCEUX.
  • NTSC, PAL and Dendy system emulation.
  • Save states and battery-backed SRAM.
  • Speed throttling.
  • Support for two game controllers.
  • Zapper support.
  • Support for NES, ZIP and NSF file formats.

Unsupported FCEUX features:

  • New PPU emulation (old PPU is used for its performance).
  • FDS disk system.
  • VS system.
  • Special peripherals (Family Keyboard, Mahjong controller, etc.)
  • Screenshots and movie recording.
  • Cheats, debugging, TAS and Lua scripting features.
  • Custom palettes.

New features:

  • NTSC composite and CRT TV video shaders.

Examples and API

For basic usage, see em-fceux-example-minimal. For advanced usage (a full web emulator), see em-fceux-site.

API documentation can be found in API.md.

Build

Setup:

  1. Have python 3.x.
  2. Install cmake.
  3. Install and activate Emscripten 3.1.12.
  4. Run source emsdk_env.sh to add Emscripten in your shell env.
    • This also adds npm in the env.
  5. Run npm install.

Then build for debug with npm run build:debug and for release with npm run build. The build results will are under dist/.

Building Shaders

You only need to rebuild the shaders when the shader sources in src/drivers/em/assets/shaders/ are changed. Do this with npm run build:shaders. This will download and build glsl-optimizer from source, and requires cmake and a C++ compiler.

Note, npm run build:shaders must be run before npm run build as the shaders are embedded in the output binary.

Browser Requirements

NTSC Composite Video Emulation Details

The NTSC composite video emulation emulates a signal path of an early 1990s TV. The separation to luminance (Y) and chroma (IQ) uses a two-line comb filter to reduce chroma fringing. Conversion of the separated YIQ to RGB uses a large lookup texture in the fragment shader.

Contact

Authored by Valtteri "tsone" Heikkilä.

Please submit bugs and feature requests in the em-fceux issue tracker.

License

Licensed under GNU GPL 2.