diff options
| author | Connor McLaughlin <stenzek@gmail.com> | 2019-02-16 14:15:00 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-16 14:15:00 +1000 |
| commit | b5c3881fe703287c4f883ca42a3b931bb6594854 (patch) | |
| tree | 29daf45582fa2860c76127271457675184341900 /Source/Core/DolphinNoGUI/Platform.cpp | |
| parent | c41f32bcf8fe0c04d54d3541df210a604b2399d1 (diff) | |
| parent | eabde77892faf4408481f685f2fbf1b348232d5f (diff) | |
Merge pull request #7512 from stenzek/runtime-headless
DolphinNoGUI: Runtime selection of platform
Diffstat (limited to 'Source/Core/DolphinNoGUI/Platform.cpp')
| -rw-r--r-- | Source/Core/DolphinNoGUI/Platform.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Source/Core/DolphinNoGUI/Platform.cpp b/Source/Core/DolphinNoGUI/Platform.cpp new file mode 100644 index 0000000000..69b184bfe9 --- /dev/null +++ b/Source/Core/DolphinNoGUI/Platform.cpp @@ -0,0 +1,53 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinNoGUI/Platform.h" +#include "Core/IOS/IOS.h" +#include "Core/IOS/STM/STM.h" +#include "Core/State.h" + +namespace ProcessorInterface +{ +void PowerButton_Tap(); +} + +Platform::~Platform() = default; + +bool Platform::Init() +{ + return true; +} + +void Platform::SetTitle(const std::string& title) +{ +} + +void Platform::UpdateRunningFlag() +{ + if (m_shutdown_requested.TestAndClear()) + { + const auto ios = IOS::HLE::GetIOS(); + const auto stm = ios ? ios->GetDeviceByName("/dev/stm/eventhook") : nullptr; + if (!m_tried_graceful_shutdown.IsSet() && stm && + std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->HasHookInstalled()) + { + ProcessorInterface::PowerButton_Tap(); + m_tried_graceful_shutdown.Set(); + } + else + { + m_running.Clear(); + } + } +} + +void Platform::Stop() +{ + m_running.Clear(); +} + +void Platform::RequestShutdown() +{ + m_shutdown_requested.Set(); +} |
