mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 20:28:56 +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
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <memory>
|
||||
#ifdef _WIN32
|
||||
#include <shlobj.h> // for SHGetFolderPath
|
||||
#endif
|
||||
|
@ -14,7 +15,11 @@
|
|||
|
||||
#include "Core/ConfigLoaders/BaseConfigLoader.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/ProcessorInterface.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
#include "Core/IOS/STM/STM.h"
|
||||
|
||||
#include "InputCommon/GCAdapter.h"
|
||||
|
||||
|
@ -225,4 +230,20 @@ void SaveWiimoteSources()
|
|||
inifile.Save(ini_filename);
|
||||
}
|
||||
|
||||
bool 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);
|
||||
ProcessorInterface::PowerButton_Tap();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace UICommon
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue