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:
@@ -56,6 +56,16 @@ impl HubHomeStep {
|
||||
Some(SystemProfileAction::LaunchGame { target }) => {
|
||||
match CartridgeLoader::load(&target.path) {
|
||||
Ok(cartridge) => {
|
||||
if ctx.os.lifecycle().resident_game_task().is_none()
|
||||
&& ctx.os.memcard().session.mode().is_some()
|
||||
{
|
||||
if ctx.os.memcard().session.unsaved() {
|
||||
return Some(FirmwareState::ConfirmDiscard(
|
||||
super::firmware_state::ConfirmDiscardStep::new(Some(cartridge)),
|
||||
));
|
||||
}
|
||||
ctx.os.memcard().session.end_session();
|
||||
}
|
||||
if cartridge.app_mode == AppMode::Game
|
||||
&& let Some(resident_task_id) = ctx.os.lifecycle().resident_game_task()
|
||||
{
|
||||
@@ -70,6 +80,11 @@ impl HubHomeStep {
|
||||
return Some(FirmwareState::ResumeResidentGame);
|
||||
}
|
||||
|
||||
if ctx.os.memcard().session.unsaved() {
|
||||
return Some(FirmwareState::ConfirmDiscard(
|
||||
super::firmware_state::ConfirmDiscardStep::new(Some(cartridge)),
|
||||
));
|
||||
}
|
||||
if let Err(error) = resident_game_termination::terminate_resident_game(
|
||||
ctx.os,
|
||||
ctx.platform,
|
||||
@@ -107,6 +122,12 @@ impl HubHomeStep {
|
||||
}
|
||||
}
|
||||
Some(SystemProfileAction::KillResidentGame) => {
|
||||
if ctx.os.memcard().session.unsaved() {
|
||||
return Some(FirmwareState::ConfirmDiscard(
|
||||
super::firmware_state::ConfirmDiscardStep::new(None),
|
||||
));
|
||||
}
|
||||
|
||||
if let Err(error) =
|
||||
resident_game_termination::terminate_resident_game(ctx.os, ctx.platform, true)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user