Stop Movie/Netplay before triggering STM shutdown

This fixes a bug which caused Movie (input recording or playback) or
netplay not to be stopped. DolphinWX previously triggered a STM power
event, and then the STM directly stopped the emulation; the code
which stops Movie/Netplay was completely skipped.

This is fixed by moving it /before/ sending the shutdown event.
This commit is contained in:
Léo Lam 2016-12-23 22:26:24 +01:00
parent 01c2c50f6a
commit ec729e2ee3
2 changed files with 21 additions and 14 deletions

View File

@ -90,6 +90,7 @@ public:
void DoPause();
void DoStop();
bool TriggerSTMPowerEvent();
void OnStopped();
void DoRecordingSave();
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 (g_pCodeWindow->HasPanel<CWatchWindow>())
@ -862,11 +848,31 @@ void CFrame::DoStop()
if (NetPlayDialog::GetNetPlayClient())
NetPlayDialog::GetNetPlayClient()->Stop();
if (!m_tried_graceful_shutdown && TriggerSTMPowerEvent())
{
m_tried_graceful_shutdown = true;
return;
}
Core::Stop();
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()
{
m_confirmStop = false;