UICommon: Move TriggerSTMPowerEvent() from Wx

This commit is contained in:
spycrab 2017-06-24 21:41:53 +02:00
parent 4320c641f7
commit 2de31317e9
4 changed files with 33 additions and 22 deletions

View file

@ -85,6 +85,7 @@
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "UICommon/UICommon.h"
#include "UICommon/WiiUtils.h"
#include "VideoCommon/RenderBase.h"
@ -879,36 +880,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;