Merge pull request #5681 from spycrab/qt_safeshutdown

Qt: Implement safe shutdown
This commit is contained in:
Leo Lam
2017-06-26 21:55:27 +02:00
committed by GitHub
6 changed files with 96 additions and 32 deletions

View File

@ -86,6 +86,7 @@
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "UICommon/UICommon.h"
#include "UICommon/WiiUtils.h"
#include "VideoCommon/RenderBase.h"
@ -880,36 +881,24 @@ void CFrame::DoStop()
if (NetPlayDialog::GetNetPlayClient())
NetPlayDialog::GetNetPlayClient()->Stop();
if (!m_tried_graceful_shutdown && TriggerSTMPowerEvent())
if (!m_tried_graceful_shutdown && UICommon::TriggerSTMPowerEvent())
{
m_tried_graceful_shutdown = true;
m_confirm_stop = false;
// Unpause because gracefully shutting down needs the game to actually request a shutdown.
// Do not unpause in debug mode to allow debugging until the complete shutdown.
if (Core::GetState() == Core::State::Paused && !m_use_debugger)
Core::SetState(Core::State::Running);
return;
}
Core::Stop();
UpdateGUI();
}
}
bool CFrame::TriggerSTMPowerEvent()
{
const auto ios = IOS::HLE::GetIOS();
if (!ios)
return false;
const auto stm = ios->GetDeviceByName("/dev/stm/eventhook");
if (!stm || !std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->HasHookInstalled())
return false;
Core::DisplayMessage("Shutting down", 30000);
// Unpause because gracefully shutting down needs the game to actually request a shutdown.
// Do not unpause in debug mode to allow debugging until the complete shutdown.
if (Core::GetState() == Core::State::Paused && !m_use_debugger)
DoPause();
ProcessorInterface::PowerButton_Tap();
m_confirm_stop = false;
return true;
}
void CFrame::OnStopped()
{
m_confirm_stop = false;