SimpleNES

amhnduGPL-3.0长期未更新

用 C++ 写的 NES 模拟器,基于 SFML 渲染,能直接加载并运行红白机游戏 ROM,适合学习模拟器原理或折腾复古游戏。

An NES emulator in C++

v2发布于 2025-06-03 13:10 UTC5,114star1,129fork同步于 2026-11-10 11:36 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/amhndu/SimpleNES
cd SimpleNES
mkdir build/ && cd build/
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
./SimpleNES ~/Games/SuperMarioBros.nes
硬件要求按 README 说明

README 未说明具体硬件要求;只需能运行 SFML 2 的桌面环境,未提及 GPU 或显存要求

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 C++ 写的 NES 模拟器,能跑约五六成游戏并带音频,适合想读源码学模拟器的人

用 C++ 写的 NES 模拟器,基于 SFML 渲染,能直接加载并运行红白机游戏 ROM,适合学习模拟器原理或折腾复古游戏。

核心能力

  • 用 C++11 实现 NES 模拟器并支持音频输出
  • 支持无 mapper 及 mapper 1、2、3,实验性支持 4、7、66、11
  • 用 SFML 2 渲染画面,窗口尺寸和缩放可调
  • 通过 keybindings.conf 自定义双人按键映射
  • 用 CMake 构建,可产出各平台可执行文件

容易踩的坑

必须先安装 SFML 2 开发库,且需锁定 2.x 版本(如 brew install sfml@2),SFML 装在非标准路径时要用 -DSFML_ROOT 指定;ROM 需自备 .nes 镜像,且仅 NTSC 版本兼容性较好;项目已归档,不再接受新功能或 issue

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本v2
  1. v2最新正式版2025-06-03 · 2025-06-03 13:10 UTC

    这个版本没有写更新说明。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    SimpleNES

    An NES emulator written in C++ (now with audio!)

    Roughly 50-60% of games should work (ie. games that use either no mapper or mappers 1, 2, 3 and experimental support for 4, 7, 66 and 11).


    ARCHIVED: I no longer have the capacity or motivation to entertain new features/issues/PRs. Feel free to fork and/or use the current build.


    Examples of games that have been tested to run (but NOT limited to):

    (USA/Japan or World versions only i.e. NTSC compatible)

    • Super Mario Bros.
    • Contra
    • Adventure Island
    • Ninja Gaiden
    • Wrecking Crew
    • Megaman and Megaman 2
    • Mario Bros.
    • Donky Kong and Donkey Kong Jr.
    • Battle City
    • Paperboy
    • Legend of Zelda
    • Pacman
    • Tennis
    • Excitebike
    • Nightmare Elm Street
    • Cabal
    • Battletoads
    • Arch Rivals
    • etc...

    Screenshots

    Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4 Screenshot 5 Screenshot 6 Screenshot 6 Screenshot 6

    Videos

    OUTDATED(missing audio) YouTube Playlist

    Compiling

    You need:

    • SFML 2.* development headers and library
    • C++11 compliant compiler
    • CMake build system

    Compiling is straight forward with cmake, just run cmake on the project directory with CMAKE_BUILD_TYPE=Release and you'll get Makefile or equivalent for your platform, with which you can compile the emulator

    For e.g., on Linux/OS X/FreeBSD:

    $ git clone https://github.com/amhndu/SimpleNES
    $ cd SimpleNES
    $ mkdir build/ && cd build/
    $ cmake -DCMAKE_BUILD_TYPE=Release ..
    $ make -j4    # Replace 4 with however many cores you have to spare
    

    If SFML is installed on a non-standard location, specify SFML_ROOT as a cmake variable, e.g. on Arch Linux, after installing sfml2 from AUR:

    $ cd SimpleNES && mkdir build/ && cd build/
    $ cmake -DCMAKE_BUILD_TYPE=Release -DSFML_ROOT=/opt/sfml2 ..
    $ make -j8
    

    See also: compile.yaml for platform specific instructions

    Download SimpleNES

    1. Download an executable based on your platform from the latest run on Github Actions OR Latest Release
    2. Install sfml

    Installing SFML

    • Windows: vcpkg install sfml. Alterntaively, download from SFML. See: compile.yaml for instructions on pinning sfml to version 2
    • Debian/Ubuntu/derivates: sudo apt install -y libsfml-dev
    • Arch/etc: yay -S sfml2
    • MacOS: brew install sfml@2 && brew link sfml@2

    Running

    Just pass the path to a .nes image like

    $ ./SimpleNES ~/Games/SuperMarioBros.nes
    

    To set size of the window,

    $ ./SimpleNES -w 600 ~/Games/Contra.nes
    

    For supported command line options, try

    $ ./SimpleNES -h
    SimpleNES is a simple NES emulator.
    It can run off .nes images.
    Set keybindings with keybindings.conf
    
    Usage: SimpleNES [options] rom-path
    
    Options:
    -h, --help             Print this help text and exit
    --mute-audio           Mute audio
    -s, --scale            Set video scale. Default: 3.
                           Scale of 1 corresponds to 256x240
    -w, --width            Set the width of the emulation screen (height is
                           set automatically to fit the aspect ratio)
    -H, --height           Set the height of the emulation screen (width is
                           set automatically to fit the aspect ratio)
                           This option is mutually exclusive to --width
    -C, --conf             Set the keybindings file's path. The default 
                           keybindings file is keybindings.conf.
    
    

    Controller

    Keybindings can be configured with keybindings.conf

    Default keybindings:

    Player 1

    ButtonMapped to
    StartReturn/Enter
    SelectRight Shift
    AJ
    BK
    UpW
    DownS
    LeftA
    RightD

    Player 2

    ButtonMapped to
    StartNumpad9
    SelectNumpad8
    ANumpad5
    BNumpad6
    UpUp
    DownDown
    LeftLeft
    RightRight