https://github.com/rupertavery/fami
A fast Nintendo Famicom/NES emulator with audio written in C#
https://github.com/rupertavery/fami
csharp emulation emulator famicom nes
Last synced: 9 months ago
JSON representation
A fast Nintendo Famicom/NES emulator with audio written in C#
- Host: GitHub
- URL: https://github.com/rupertavery/fami
- Owner: RupertAvery
- License: other
- Created: 2021-08-28T05:14:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-22T19:30:30.000Z (over 2 years ago)
- Last Synced: 2024-04-24T06:38:19.886Z (about 2 years ago)
- Topics: csharp, emulation, emulator, famicom, nes
- Language: C#
- Homepage:
- Size: 869 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fami - Famicom/NES Emulator
**Fami** is a NES emulator written in C#. The name is derived from the Japanese model of the NES, the Family Computer or Famicom.
The main goal was to build a fast NES emulator with sound in C#.
When running in Debug mode, the emulator manages around 40-50 fps, but runs full speed when running in Release mode on a Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz.
# Screenshots




# Prerequisites
* .NET 5 SDK
* Visual Studio 2019 v16+
# Features
* Zapper/Light-gun support
* Support for using controllers
* Save/Load States (only slot 1 right now)
* Rewind (up to 8 seconds)
# Todo
* Button mapping through a configuration file
* Menus and dialogs
* Implement more mappers
* Fullscreen
# Usage
```
fami.exe ""
```
# Key mapping
The mappings don't use Space or Enter or Escape since Steam maps the controller to these buttons.
| Key | Function |
|-------------|--------------|
| Up | D-Pad Up |
| Down | D-Pad Down |
| Left | D-Pad Left |
| Right | D-Pad Right |
| V | Start |
| C | Select |
| Z | Button A |
| X | Button B |
| R | Reset |
| F2 | Save State |
| F4 | Load State |
| Backspace | Rewind |
# Mappers
* NROM (000)
* MMC1 (001)
* UxROM (002)
* MMC3 (004)
* AxROM (007)
# PPU
The PPU is a port of the C++ PPU used in One Lone Coders NES Emulation Tutorial and retains all the comments.
# APU
The APU is taken from the BizHawk NES APU found here: https://github.com/TASVideos/BizHawk/blob/master/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/APU.cs
I decided to use it as it gave the best audio output.
It uses blargg's `blip_buf` library to effectively generate samples that are timed against an emulation clock (it coincides with every tick of a CPU cycle) which greatly simplifies synchronization of audio.
# Known Issues
## Zapper/Light gun
If you move the mouse immediately after firing, the sensor position will move, causing your aim to be off from where you clicked.
Right-clicking to trigger "outside" of the screen kind of works. It's good enough for game mode selection screens, but doesn't work well during actual gameplay. It still registers as a trigger "inside" the screen. This is probably caused by timing issues.