Expand description
Cycle-accurate NES emulator core.
This crate is the public entry point for embedders (frontend, test harness,
future ports). It owns the scheduler, the bus, save-state serialization,
the rewind ring, and the Nes facade. Per-chip implementations live in
rustynes-cpu, rustynes-ppu, rustynes-apu, and rustynes-mappers, and are re-exported
from this crate so downstream consumers depend on rustynes-core only.
See docs/architecture.md and docs/scheduler.md for the design.
Re-exports§
pub use debug::ApuDebugView;pub use debug::CpuDebugView;pub use debug::MapperDebugView;pub use debug::PpuDebugView;pub use genie::GenieCode;pub use genie::GenieError;pub use input_device::BandaiHyperShotState;pub use input_device::FamilyKeyboardState;pub use input_device::InputDevice;pub use input_device::KonamiHyperShotState;pub use input_device::PowerPadState;pub use input_device::SnesMouseState;pub use input_device::VausState;pub use input_device::ZapperState;pub use legacy_movie::LegacyMeta;pub use legacy_movie::LegacyMovieError;pub use legacy_movie::import_fcm;pub use legacy_movie::import_fmv;pub use legacy_movie::import_mc2;pub use legacy_movie::import_vmv;pub use save_state::BinReader;pub use save_state::BinWriter;pub use save_state::FORMAT_VERSION;pub use save_state::HEADER_LEN;pub use save_state::Header;pub use save_state::MAGIC;pub use save_state::ROM_HASH_TAG_LEN;pub use save_state::Section;pub use save_state::SectionIter;pub use save_state::SnapshotError;pub use save_state::THUMBNAIL_HEIGHT;pub use save_state::THUMBNAIL_LEN;pub use save_state::THUMBNAIL_VERSION;pub use save_state::THUMBNAIL_WIDTH;pub use save_state::parse_header;pub use save_state::tag;pub use save_state::tag_string;pub use save_state::write_header;pub use save_state::write_section;pub use vs_db::VsDbEntry;pub use vs_db::lookup as vs_db_lookup;pub use vs_dualsystem::Emu;pub use vs_dualsystem::VsDualSystem;pub use zwinder::ZWINDER_DEFAULT_BUDGET_BYTES;pub use zwinder::ZWINDER_DEFAULT_KEYFRAME_INTERVAL;pub use zwinder::ZwinderError;pub use zwinder::ZwinderStateManager;pub use rustynes_apu;pub use rustynes_cpu;pub use rustynes_mappers;pub use rustynes_ppu;
Modules§
- bk2_
interop BizHawk.bk2movie interop.- debug
- Read-only debug snapshots for the frontend’s egui debugger UI.
- genie
- Game Genie cheat-code decoding.
- input_
device - Optional non-standard input-device overlays for the
$4016/$4017controller ports: the Arkanoid “Vaus” paddle and the NES Zapper light gun. - legacy_
movie - v1.7.0 “Forge” Workstream G4 — legacy NES TAS movie import.
- movie_
interop - FCEUX
.fm2movie interop: import + export of FCEUX’s plain-text TAS movie format to and from the nativeMovietype. - save_
state - Save-state container format for
RustyNESv2. - scheduler
- Lockstep-scheduler types shared across the bus, the IRQ-timing trace fixture, and (in Phase B+) the CPU IRQ sampling path.
- vs_db
- Vs. System per-game database (v2.7.0).
- vs_
dualsystem - Vs.
DualSystem— two complete NES systems in one arcade cabinet (v2.0.0 beta.5, Workstream C of the “Timebase” plan). - zwinder
- Zwinder-class compressed, density-tiered state manager (v1.7.0 “Forge” Workstream D2).
Structs§
- Access
Rec - v1.1.0 beta.3 (Workstream E, T-110-E2) — one CPU bus-access record for the
Lua
onRead/onWritecallbacks: direction + full address + the byte. - Buttons
- Standard NES controller buttons. Bits ordered to match the wire shift order (LSB first): A, B, Select, Start, Up, Down, Left, Right.
- Controller
- One standard NES controller plugged into
$4016(player 1) or$4017(player 2). - Event
Break Hit - v1.4.0 Workstream D (D2) — one event-driven breakpoint hit.
- Event
Rec - One event-viewer record: kind + the PPU
(scanline, dot)+ the address + (v1.5.0 A2) the byte read or written. - Frame
Input - Per-frame controller input: the
Buttonsbits for both standard ports plus a reserved expansion byte. Bit layout matches FCEUX.fm2(bit0=A .. bit7=Right), which is exactlyButtons::bits. - Interrupt
Rec - v1.2.0 (Workstream E, T-110-E1) — one interrupt-service record for the Lua
onNmi/onIrqcallbacks: the service direction + the vector the CPU fetched its new PC from. - Lockstep
Bus - Lockstep bus.
- Movie
- A complete TAS movie: a versioned header, a start point, and the per-frame input stream.
- Movie
Player - Plays a movie back, feeding its recorded inputs into an emulator one frame at a time.
- Movie
Recorder - Records the per-frame input stream applied to an emulator.
- Nes
- Top-level NES emulator handle.
- Power
OnConfig - v2.1.7 P5 — power-on hardware configuration for a freshly-constructed or power-cycled machine.
- Rewind
Ring - Rewind ring buffer.
- Trace
Rec - v1.1.0 beta.2 (Workstream C, T-110-C2) — one cycle-trace record.
Enums§
- Cpu2
A03Revision - Ricoh 2A03 CPU/APU die revision, selecting the hardware-revision difference in the DMA unit’s “unexpected DMA” extra halt-read (v2.1.7 “Hardware Revisions & DMA Frontier”).
- Event
BpKind - v1.4.0 Workstream D (D2) — the class of hardware event an event-driven breakpoint can trigger on.
- Event
Kind - v1.1.0 beta.2 (Workstream C, T-110-C3) — the class of a captured CPU write.
- M2Phase
- Convention for the M2-phase reference relative to the CPU cycle’s 3 PPU dots.
- Movie
Error - Errors produced by movie encode / decode / playback.
- Palette
Init - v2.1.7 P5 — selectable power-up palette-RAM contents.
- Power
OnRam - v2.1.7 P5 — power-on 2 KiB CPU work-RAM contents.
- PpuRevision
- v2.1.7 P5 — selectable 2C02 die revision, gating revision-dependent quirks.
- Region
- NES region (governs clock dividers, scanline counts, audio rate tables).
- Rewind
Error - Errors raised by
RewindRing::pop_backwhen an entry can’t be reconstructed. - Start
Point - Where a movie begins. Clean-room analogue of Mesen2’s
RecordMovieFrom.
Constants§
- BYTES_
PER_ FRAME - Bytes stored per recorded frame: player 1, player 2, and a reserved
expansion-port byte (always
0in v1). - FRAME_
DURATION_ DENDY - Nominal Dendy frame duration: 50 Hz Russian famiclone, same as PAL.
- FRAME_
DURATION_ NTSC - Nominal NTSC frame duration:
1 / 60.0988 Hz ≈ 16.6393 ms. - FRAME_
DURATION_ PAL - Nominal PAL frame duration:
1 / 50.0070 Hz ≈ 19.9972 ms. - MOVIE_
FORMAT_ VERSION - Current movie container-format version.
- MOVIE_
MAGIC - Magic header bytes — first 8 bytes of every
.rnmmovie file. - REWIND_
DEFAULT_ KEYFRAME_ PERIOD - Default keyframe period (1 keyframe per second of capture).
- REWIND_
DEFAULT_ MAX_ BYTES - Default ring capacity in bytes — 60 s × 60 fps with our typical compression ratio fits comfortably under 32 MiB.
Functions§
- recorded_
before_ v2_ timebase - Peek a
.rnmblob’s header to learn its recording epoch. - version
- Returns the crate version string.