pub struct Cart { /* private fields */ }Expand description
PI cart + PIF/CIC + save state — the concrete board.
Implementations§
Source§impl Cart
impl Cart
Sourcepub fn load(raw: &[u8]) -> Result<Self, CartError>
pub fn load(raw: &[u8]) -> Result<Self, CartError>
Load + normalize a raw ROM image of any supported byte order.
§Errors
CartError::UnknownFormat for an unrecognized magic, or
CartError::ShortHeader for a truncated header.
Sourcepub fn reattach_rom(&mut self, rom: Vec<u8>)
pub fn reattach_rom(&mut self, rom: Vec<u8>)
Re-attach a ROM image after a save-state restore (which deserializes an
empty ROM — the ROM field is #[serde(skip)]’d). The rom bytes are the
normalized big-endian image (what Cart::load stores, i.e. what
rom_image returns); the frontend keeps the loaded image and re-inserts it
here so cart/PI reads resolve again. All other cart state (save, PIF,
header) came from the snapshot and is left untouched.
Sourcepub fn rom_image(&self) -> &[u8] ⓘ
pub fn rom_image(&self) -> &[u8] ⓘ
The normalized (big-endian) ROM image, for the frontend to stash so it can
Cart::reattach_rom after a restore.
Sourcepub const fn pif_ram(&self) -> &[u8; 64]
pub const fn pif_ram(&self) -> &[u8; 64]
The PIF’s 64-byte RAM (the SI DMA copies it to/from RDRAM).
Sourcepub fn pif_load(&mut self, bytes: &[u8; 64])
pub fn pif_load(&mut self, bytes: &[u8; 64])
Load the whole PIF RAM (an SI 64-byte write from RDRAM).
Sourcepub fn pif_execute(&mut self, controllers: &[u32; 4])
pub fn pif_execute(&mut self, controllers: &[u32; 4])
Execute the pending joybus frame (on an SI read), using the four packed controller port words and the cart’s save backend.
Sourcepub fn pif_load_boot_rom(&mut self, bytes: &[u8])
pub fn pif_load_boot_rom(&mut self, bytes: &[u8])
Install the PIF boot ROM (IPL1/IPL2) for the real-PIF boot path.
Sourcepub fn pif_boot_rom_read(&self, off: usize) -> u8
pub fn pif_boot_rom_read(&self, off: usize) -> u8
Read a byte of the PIF boot ROM (0x1FC0_0000 + off); 0 when absent (HLE).
Sourcepub const fn pif_has_boot_rom(&self) -> bool
pub const fn pif_has_boot_rom(&self) -> bool
Is a real PIF boot ROM installed (real-PIF boot path active)?
Sourcepub const fn pif_set_boot_checksum(&mut self, checksum: [u8; 6])
pub const fn pif_set_boot_checksum(&mut self, checksum: [u8; 6])
Register the CIC’s IPL2 checksum for the real-PIF boot verify.
Sourcepub fn pif_boot_command(&mut self) -> bool
pub fn pif_boot_command(&mut self) -> bool
Process a reset-mode PIF command-byte write (real-PIF boot); returns true
if the checksum verify failed and the CPU must be NMI-halted.
Sourcepub const fn pif_reset_boot(&mut self)
pub const fn pif_reset_boot(&mut self)
Warm-reset the transient PIF boot state (unlock the ROM, drop the latched checksum) so a reset can re-run IPL1→IPL2.
Sourcepub fn save(&self) -> &[u8] ⓘ
pub fn save(&self) -> &[u8] ⓘ
The persistable save backing bytes (empty for SaveType::None).
Sourcepub fn save_device_mut(&mut self) -> &mut SaveDevice
pub fn save_device_mut(&mut self) -> &mut SaveDevice
Mutable access to the save device (the joybus module drives EEPROM/Pak).
Sourcepub fn pi_write_word(&mut self, addr: u32, word: u32)
pub fn pi_write_word(&mut self, addr: u32, word: u32)
A whole-word PI write (direct-I/O or DMA). Routes the FlashRAM Command
Internal Register (0x0801_0000) as a 32-bit command; other DOM2-window
writes fall to the byte path. ROM-window writes are ignored (read-only).
Trait Implementations§
Source§impl Cartridge for Cart
impl Cartridge for Cart
Source§fn pi_read(&mut self, addr: u32) -> u8
fn pi_read(&mut self, addr: u32) -> u8
$1000_0000..).