blob: 632bb173b61ac8e47ccba6c8579e03673debd440 (
plain) (
blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h"
#include "core/hle/service/kernel_helpers.h"
#include "hid_core/hid_core.h"
#include "hid_core/hidbus/hidbus_base.h"
namespace Service::HID {
HidbusBase::HidbusBase(Core::System& system_, KernelHelpers::ServiceContext& service_context_)
: system(system_), service_context(service_context_) {
send_command_async_event = service_context.CreateEvent("hidbus:SendCommandAsyncEvent");
}
HidbusBase::~HidbusBase() {
service_context.CloseEvent(send_command_async_event);
};
void HidbusBase::ActivateDevice() {
if (is_activated) {
return;
}
is_activated = true;
OnInit();
}
void HidbusBase::DeactivateDevice() {
if (is_activated) {
OnRelease();
}
is_activated = false;
}
bool HidbusBase::IsDeviceActivated() const {
return is_activated;
}
void HidbusBase::Enable(bool enable) {
device_enabled = enable;
}
bool HidbusBase::IsEnabled() const {
return device_enabled;
}
bool HidbusBase::IsPollingMode() const {
return polling_mode_enabled;
}
JoyPollingMode HidbusBase::GetPollingMode() const {
return polling_mode;
}
void HidbusBase::SetPollingMode(JoyPollingMode mode) {
polling_mode = mode;
polling_mode_enabled = true;
}
void HidbusBase::DisablePollingMode() {
polling_mode_enabled = false;
}
void HidbusBase::SetTransferMemoryAddress(Common::ProcessAddress t_mem) {
transfer_memory = t_mem;
}
Kernel::KReadableEvent& HidbusBase::GetSendCommandAsycEvent() const {
return send_command_async_event->GetReadableEvent();
}
} // namespace Service::HID
|