From a0a246bf3e33eac9fd4d234590c721d972979bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Tue, 4 Oct 2016 22:58:01 +0200 Subject: Only attempt a graceful shutdown when there's a STM hook For Wii graceful shutdown to work, the emulated software has to open the STM event hook and install a hook. Without this, there is no way to inform them about the shutdown, so trying to do a graceful shutdown and requiring the use of the shutdown fallback (exiting a second time to force) is pointless. --- Source/Core/DolphinWX/MainNoGUI.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/MainNoGUI.cpp') diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index 8e8512c07d..216eb5a707 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -23,6 +23,8 @@ #include "Core/Core.h" #include "Core/HW/Wiimote.h" #include "Core/Host.h" +#include "Core/IPC_HLE/WII_IPC_HLE.h" +#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h" #include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h" #include "Core/State.h" @@ -232,7 +234,9 @@ class PlatformX11 : public Platform { if (s_shutdown_requested.TestAndClear()) { - if (!s_tried_graceful_shutdown.IsSet() && SConfig::GetInstance().bWii) + const auto& stm = WII_IPC_HLE_Interface::GetDeviceByName("/dev/stm/eventhook"); + if (!s_tried_graceful_shutdown.IsSet() && stm && + std::static_pointer_cast(stm)->HasHookInstalled()) { ProcessorInterface::PowerButton_Tap(); s_tried_graceful_shutdown.Set(); -- cgit v1.2.3