mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 22:38:34 +00:00
UICommon: Move TriggerSTMPowerEvent() from Wx
This commit is contained in:
parent
4320c641f7
commit
2de31317e9
4 changed files with 33 additions and 22 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue