Initial commit: NES emulator with GTK4 desktop frontend
Some checks failed
CI / rust (push) Has been cancelled

Full NES emulation: CPU, PPU, APU, 47 mappers, iNES/NES 2.0 parsing.
GTK4 desktop client with HeaderBar, pixel-perfect Cairo rendering,
drag-and-drop ROM loading, and keyboard shortcuts.
187 tests covering core emulation, mappers, and runtime.
This commit is contained in:
2026-03-13 11:48:45 +03:00
commit bdf23de8db
143 changed files with 18501 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
use nesemu_adapter_api::{
AudioSink, BUTTONS_COUNT, ButtonState, InputSource, TimeSource, VideoSink,
};
#[derive(Default)]
pub struct NullInput;
impl InputSource for NullInput {
fn poll_buttons(&mut self) -> ButtonState {
[false; BUTTONS_COUNT]
}
}
#[derive(Default)]
pub struct NullVideo;
impl VideoSink for NullVideo {
fn present_rgba(&mut self, _frame: &[u8], _width: u32, _height: u32) {}
}
#[derive(Default)]
pub struct NullAudio;
impl AudioSink for NullAudio {
fn push_samples(&mut self, _samples: &[f32]) {}
}
#[derive(Default)]
pub struct NoopTime;
impl TimeSource for NoopTime {
fn wait_next_frame(&mut self) {}
}
#[cfg(test)]
mod tests {
use super::{NoopTime, NullAudio, NullInput, NullVideo};
use nesemu_adapter_api::{AudioSink, BUTTONS_COUNT, InputSource, TimeSource, VideoSink};
#[test]
fn null_adapters_are_noop() {
let mut input = NullInput;
let mut video = NullVideo;
let mut audio = NullAudio;
let mut time = NoopTime;
assert_eq!(input.poll_buttons(), [false; BUTTONS_COUNT]);
video.present_rgba(&[], 256, 240);
audio.push_samples(&[]);
time.wait_next_frame();
}
}