#[non_exhaustive]pub enum PpuSnapshotError {
Truncated(usize),
TrailingBytes {
consumed: usize,
extra: usize,
},
UnsupportedVersion(u8),
InvalidRegion(u8),
InvalidPresence(u8),
InvalidOam2FetchAddr(u8),
InvalidSprCount(u8),
FieldOutOfRange {
field: &'static str,
value: u8,
max: u8,
},
InvalidRasterPosition {
dot: u16,
scanline: i16,
},
}Expand description
Errors returned by Ppu::restore.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Truncated(usize)
Blob is too short for the version-1 schema.
TrailingBytes
The blob decoded completely with bytes left over (v2.9.9, NC-14:
this used to be reported as Truncated at the end offset).
UnsupportedVersion(u8)
The blob’s version byte is not understood by this build.
InvalidRegion(u8)
Region tag was not one of 0 (NTSC), 1 (PAL), 2 (Dendy).
InvalidPresence(u8)
Optional struct presence byte was something other than 0 or 1.
InvalidOam2FetchAddr(u8)
v9 OAM2 fetch address was outside the 5-bit hardware counter’s range.
oam2_fetch_addr indexes the 32-byte secondary-OAM bus, and the
hardware counter it models is 5 bits wide, so anything >= 32 is a
corrupt or hostile blob rather than a state this emulator can reach.
Rejected at the boundary instead of masked, so a malformed file is
reported rather than silently reinterpreted as a different state.
InvalidSprCount(u8)
The in-range sprite count exceeded the eight sprites secondary OAM holds.
spr_count bounds loops over the eight-slot sprite arrays
(spr_x, spr_halted, the shift registers), so a value above 8 would
restore without complaint and then index out of bounds on the next PPU
dot – a deferred panic, and on a panic = "abort" release build a
process kill from a hand-edited save. Core audit IMP-01.
FieldOutOfRange
A counter or index held a value the PPU never produces.
Each of these is incremented without a mask or used as an index, so a
value past its range overflows or indexes out of bounds on a later dot.
The limits are the ranges the running PPU keeps them in (fine X is the
3-bit x register; the sprite-evaluation and OAM-bus counters are
reset at their wrap points). Found field by field by the v2.7.0
save_state fuzz target (fine X: ppu.rs:4788, shift overflow, in
92,496 runs) and then swept for the rest rather than left to the
fuzzer one run at a time.
Fields
InvalidRasterPosition
The raster position is outside the region’s frame.
dot runs 0..=340 and scanline -1..=the region’s pre-render line
(-1 is the power-on position). The per-dot advance only wraps at
exactly those limits, so a position past either counts on until the
integer overflows (a panic in dev profiles) and never produces a
frame. Found by the v2.7.0 save_state fuzz target in 76,381 runs
(ppu.rs:6078, dot += 1).
Trait Implementations§
Source§impl Debug for PpuSnapshotError
impl Debug for PpuSnapshotError
Source§impl Display for PpuSnapshotError
impl Display for PpuSnapshotError
Source§impl Error for PpuSnapshotError
impl Error for PpuSnapshotError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()