aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/service/am/button_poller.h
blob: b1c39aad30d0b31402e7cb1e3c86daf2190ff9dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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