Initial commit: NES emulator with GTK4 desktop frontend
Some checks failed
CI / rust (push) Has been cancelled
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:
28
src/runtime/error.rs
Normal file
28
src/runtime/error.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use crate::CpuError;
|
||||
use core::fmt;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum RuntimeError {
|
||||
RomParse(String),
|
||||
MapperInit(String),
|
||||
Cpu(CpuError),
|
||||
BufferTooSmall { expected: usize, got: usize },
|
||||
InvalidState(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for RuntimeError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::RomParse(e) => write!(f, "ROM parse error: {e}"),
|
||||
Self::MapperInit(e) => write!(f, "mapper init error: {e}"),
|
||||
Self::Cpu(e) => write!(f, "CPU error: {e:?}"),
|
||||
Self::BufferTooSmall { expected, got } => {
|
||||
write!(f, "buffer too small: expected {expected} bytes, got {got}")
|
||||
}
|
||||
Self::InvalidState(e) => write!(f, "invalid runtime state: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for RuntimeError {}
|
||||
Reference in New Issue
Block a user