pub struct ProvenanceStash { /* private fields */ }Expand description
Both provenance stores, moved out of a Ppu so a caller can put them back.
§Why this exists
A save-state restore clears both stores, and that is right: the restored bytes were not written by anything this session ran, so the honest answer is “no record” rather than a PC from a timeline that no longer exists.
Run-ahead is the one caller for which that is wrong, and it is wrong for a reason that has nothing to do with the restore itself. Its cycle runs the persistent frame, snapshots, runs the hidden and then the visible frame, lets the frontend harvest that frame, and only then rolls back. The rollback is therefore the last thing to happen before the emulator lock reaches the UI — so a clear there does not discard a stale timeline, it discards the record for the exact frame the user is looking at, before anyone can read it. That is what made the shipped Pixel Provenance inspector render a complete, confident, entirely empty report (v2.3.6 workstream 0, defect 1).
Stashing is a move, not a copy: both stores are boxed, so this costs two
pointer moves per visible frame rather than the ~37 KiB memcpy a snapshot of
the contents would. The restore in between sees None on both, so its clear
is a no-op and its own reasoning is left completely intact — this mechanism
changes nothing for save-state loads or for netplay rollback, both of which
still want the clear.
Implementations§
Source§impl ProvenanceStash
impl ProvenanceStash
Sourcepub const fn is_armed(&self) -> bool
pub const fn is_armed(&self) -> bool
Whether either store was armed when this stash was taken.
Callers use it to skip the put-back entirely on the overwhelmingly common path where nothing is armed at all.
Sourcepub fn pixel_frame(&self) -> Option<&PixelProvenanceFrame>
pub fn pixel_frame(&self) -> Option<&PixelProvenanceFrame>
The stashed per-pixel provenance frame, or None when unarmed.
v2.3.8 — read-only, so a detached stash can be inspected without being
put back into an emulator first. The Divergence Lens captures a trial’s
provenance precisely so it never touches a live Nes again; routing the
read through a scratch instance would undo that. Mirrors
rustynes_apu::provenance::AudioProvenanceStash::mix_trace.