feat(runtime): implement shared transactional memcard with async saves
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
This commit is contained in:
@@ -156,6 +156,26 @@ pub struct HostRunner {
|
||||
}
|
||||
|
||||
impl HostRunner {
|
||||
pub fn install_memcard(
|
||||
&mut self,
|
||||
path: std::path::PathBuf,
|
||||
create: bool,
|
||||
) -> prometeu_system::memcard::image::Result<()> {
|
||||
self.firmware.os.memcard().mount_card_with(move || {
|
||||
use prometeu_drivers::memcard::FileMemcard;
|
||||
use prometeu_system::memcard::{image::IMAGE_BYTES, transaction::Card};
|
||||
let storage = if create {
|
||||
FileMemcard::create(&path, IMAGE_BYTES, |storage, id| {
|
||||
Card::format(storage, id)
|
||||
.map_err(|_| prometeu_hal::memcard::MemcardIoError::IoError)
|
||||
})?
|
||||
} else {
|
||||
FileMemcard::open(&path, false)?
|
||||
};
|
||||
Ok(Box::new(storage))
|
||||
})
|
||||
}
|
||||
|
||||
/// Configures the boot target (Hub or specific Cartridge).
|
||||
pub(crate) fn set_boot_target(&mut self, boot_target: BootTarget) {
|
||||
self.firmware.boot_target = boot_target.clone();
|
||||
|
||||
Reference in New Issue
Block a user