aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/service/am/button_poller.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/am/button_poller.h')
-rw-r--r--src/core/hle/service/am/button_poller.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/core/hle/service/am/button_poller.h b/src/core/hle/service/am/button_poller.h
new file mode 100644
index 000000000..b1c39aad3
--- /dev/null
+++ b/src/core/hle/service/am/button_poller.h
@@ -0,0 +1,43 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <chrono>
+#include <optional>
+#include "hid_core/frontend/emulated_controller.h"
+
+namespace Core {
+namespace HID {
+class EmulatedController;
+}
+
+class System;
+} // namespace Core
+
+namespace Service::AM {
+
+class WindowSystem;
+
+class ButtonPoller {
+public:
+ explicit ButtonPoller(Core::System& system, WindowSystem& window_system);
+ ~ButtonPoller();
+
+private:
+ void OnButtonStateChanged();
+
+private:
+ WindowSystem& m_window_system;
+
+ Core::HID::EmulatedController* m_handheld{};
+ int m_handheld_key{};
+ Core::HID::EmulatedController* m_player1{};
+ int m_player1_key{};
+
+ std::optional<std::chrono::steady_clock::time_point> m_home_button_press_start{};
+ std::optional<std::chrono::steady_clock::time_point> m_capture_button_press_start{};
+ std::optional<std::chrono::steady_clock::time_point> m_power_button_press_start{};
+};
+
+} // namespace Service::AM