service/apt: Implement soft reset & CloseApplication

This commit is contained in:
zhupengfei 2018-07-18 20:07:00 +08:00
parent ca701e2610
commit ad6b140cb0
No known key found for this signature in database
GPG key ID: 85B82A3E62174206
9 changed files with 160 additions and 12 deletions

View file

@ -76,6 +76,12 @@ System::ResultStatus System::RunLoop(bool tight_loop) {
HW::Update();
Reschedule();
if (reset_requested.exchange(false)) {
Reset();
} else if (shutdown_requested.exchange(false)) {
return ResultStatus::ShutdownRequested;
}
return status;
}
@ -131,6 +137,8 @@ System::ResultStatus System::Load(EmuWindow& emu_window, const std::string& file
}
Memory::SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table);
status = ResultStatus::Success;
m_emu_window = &emu_window;
m_filepath = filepath;
return status;
}
@ -238,4 +246,14 @@ void System::Shutdown() {
LOG_DEBUG(Core, "Shutdown OK");
}
void System::Reset() {
// This is NOT a proper reset, but a temporary workaround by shutting down the system and
// reloading.
// TODO: Properly implement the reset
Shutdown();
// Reload the system with the same setting
Load(*m_emu_window, m_filepath);
}
} // namespace Core