Expand description
Fixed-slot residency policy: a handful of equally sized private arenas, a wishlist, and a stored-then-decoded pipeline.
Lifted from hk-psx game/src/room_residency.rs (a policy independent of
the CD transport and of GPU calls) and made generic over the slot count and
the wishlist length. The logic and its tests carry over unchanged; what
changed is naming (loading is SlotResidency::is_loading, stored is
SlotResidency::find_stored, Residency is SlotResidency) and
layout. Region ids are plain usize; EMPTY means none.
A slot is empty, being read or decoded (loading), holding completed but
unverified bytes (stored, len == 0), or holding a verified room (len
non-zero). Only a decoder may turn stored bytes into a verified room, so
completed transport data can never be mistaken for one. The current slot,
the slot an upload is reading from (protected) and every loading slot are
never reused. The wishlist ranks speculative targets: a lower-priority
speculative read never displaces an earlier wishlist entry, and an urgent
read (the room needed now) may.
Use crate::Residency when payloads differ in size, several pools or
categories are in play, or distance should drive eviction; use this when
the game keeps a few interchangeable slots.
Structs§
- Slot
- One arena slot.
- Slot
Residency - Residency over
SLOTSarenas with a wishlist ofWANTEDregions (hk-psx uses 5 and 4: the current room’s slot plus four others).
Constants§
- EMPTY
- Sentinel region id: none.