Merge pull request #4545 from leoetlino/stop-recording

Stop Movie/Netplay before triggering STM shutdown
This commit is contained in:
Mat M 2016-12-24 06:14:51 -05:00 committed by GitHub
commit abfa297166
2 changed files with 21 additions and 14 deletions

View File

@ -90,6 +90,7 @@ public:
void DoPause(); void DoPause();
void DoStop(); void DoStop();
bool TriggerSTMPowerEvent();
void OnStopped(); void OnStopped();
void DoRecordingSave(); void DoRecordingSave();
void UpdateGUI(); void UpdateGUI();

View File

@ -824,20 +824,6 @@ void CFrame::DoStop()
} }
} }
const auto& stm = WII_IPC_HLE_Interface::GetDeviceByName("/dev/stm/eventhook");
if (!m_tried_graceful_shutdown && stm &&
std::static_pointer_cast<CWII_IPC_HLE_Device_stm_eventhook>(stm)->HasHookInstalled())
{
Core::DisplayMessage("Shutting down", 30000);
// Unpause because gracefully shutting down needs the game to actually request a shutdown
if (Core::GetState() == Core::CORE_PAUSE)
DoPause();
ProcessorInterface::PowerButton_Tap();
m_confirmStop = false;
m_tried_graceful_shutdown = true;
return;
}
if (UseDebugger && g_pCodeWindow) if (UseDebugger && g_pCodeWindow)
{ {
if (g_pCodeWindow->HasPanel<CWatchWindow>()) if (g_pCodeWindow->HasPanel<CWatchWindow>())
@ -862,11 +848,31 @@ void CFrame::DoStop()
if (NetPlayDialog::GetNetPlayClient()) if (NetPlayDialog::GetNetPlayClient())
NetPlayDialog::GetNetPlayClient()->Stop(); NetPlayDialog::GetNetPlayClient()->Stop();
if (!m_tried_graceful_shutdown && TriggerSTMPowerEvent())
{
m_tried_graceful_shutdown = true;
return;
}
Core::Stop(); Core::Stop();
UpdateGUI(); UpdateGUI();
} }
} }
bool CFrame::TriggerSTMPowerEvent()
{
const auto stm = WII_IPC_HLE_Interface::GetDeviceByName("/dev/stm/eventhook");
if (!stm || !std::static_pointer_cast<CWII_IPC_HLE_Device_stm_eventhook>(stm)->HasHookInstalled())
return false;
Core::DisplayMessage("Shutting down", 30000);
// Unpause because gracefully shutting down needs the game to actually request a shutdown
if (Core::GetState() == Core::CORE_PAUSE)
DoPause();
ProcessorInterface::PowerButton_Tap();
m_confirmStop = false;
return true;
}
void CFrame::OnStopped() void CFrame::OnStopped()
{ {
m_confirmStop = false; m_confirmStop = false;