summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/FrameTools.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2016-09-19 00:49:15 +0200
committerLéo Lam <leo@innovatetechnologi.es>2016-10-01 13:06:04 +0200
commit9b72b5f144da14be215554efd2938097086becc9 (patch)
treec421070dccf59c68378d4ada3aba35389d2eec04 /Source/Core/DolphinWX/FrameTools.cpp
parentae723f5251402283ea8e32bb932e0d62659b85dc (diff)
Shut down Wii software gracefully
This adds support for triggering the power event (in the STM), so that stopping emulation first triggers a shutdown event, which notably gives emulated software time to save game data (issue 8979) and clean up SYSCONF (to disconnect Wiimotes and update their state in the SYSCONF). On the first press, the stop button/hotkey/whatever will trigger a STM power event. On a second try, we will forcefully stop emulation, just like how it was working before.
Diffstat (limited to 'Source/Core/DolphinWX/FrameTools.cpp')
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 2b690c0e5a..e20cc15411 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -1155,9 +1155,12 @@ void CFrame::DoStop()
Core::SetState(Core::CORE_PAUSE);
}
- wxMessageDialog m_StopDlg(this, _("Do you want to stop the current emulation?"),
- _("Please confirm..."),
- wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION, wxDefaultPosition);
+ wxMessageDialog m_StopDlg(
+ this, !m_tried_graceful_shutdown ? _("Do you want to stop the current emulation?") :
+ _("A shutdown is already in progress. Unsaved data "
+ "may be lost if you stop the current emulation "
+ "before it completes. Force stop?"),
+ _("Please confirm..."), wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION, wxDefaultPosition);
HotkeyManagerEmu::Enable(false);
int Ret = m_StopDlg.ShowModal();
@@ -1172,6 +1175,16 @@ void CFrame::DoStop()
}
}
+ if (SConfig::GetInstance().bWii && !m_tried_graceful_shutdown)
+ {
+ Core::DisplayMessage("Shutting down", 30000);
+ Core::SetState(Core::CORE_RUN);
+ ProcessorInterface::PowerButton_Tap();
+ m_confirmStop = false;
+ m_tried_graceful_shutdown = true;
+ return;
+ }
+
if (UseDebugger && g_pCodeWindow)
{
if (g_pCodeWindow->m_WatchWindow)
@@ -1207,6 +1220,7 @@ void CFrame::DoStop()
void CFrame::OnStopped()
{
m_confirmStop = false;
+ m_tried_graceful_shutdown = false;
#if defined(HAVE_X11) && HAVE_X11
if (SConfig::GetInstance().bDisableScreenSaver)