summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinNoGUI/Platform.cpp
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-02-16 14:15:00 +1000
committerGitHub <noreply@github.com>2019-02-16 14:15:00 +1000
commitb5c3881fe703287c4f883ca42a3b931bb6594854 (patch)
tree29daf45582fa2860c76127271457675184341900 /Source/Core/DolphinNoGUI/Platform.cpp
parentc41f32bcf8fe0c04d54d3541df210a604b2399d1 (diff)
parenteabde77892faf4408481f685f2fbf1b348232d5f (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.cpp53
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();
+}