summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2015-03-08 00:13:49 -0500
committerGravatar bunnei2015-03-10 18:05:17 -0400
commit3229b048d9b4f16433fb1c5d623e6b79bc1a2d93 (patch)
tree20b3976db72b7191a899692433e6b34e491c827c /src
parentHID: Refactored shared memory decoding for touchpad support. (diff)
downloadyuzu-3229b048d9b4f16433fb1c5d623e6b79bc1a2d93.tar.gz
yuzu-3229b048d9b4f16433fb1c5d623e6b79bc1a2d93.tar.xz
yuzu-3229b048d9b4f16433fb1c5d623e6b79bc1a2d93.zip
HID: Moved some docstrings to the header.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid/hid.cpp25
-rw-r--r--src/core/hle/service/hid/hid.h15
2 files changed, 16 insertions, 24 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index c21799db6..5812724d2 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -32,7 +32,7 @@ static s16 next_pad_circle_y = 0;
32/** 32/**
33 * Gets a pointer to the PadData structure inside HID shared memory 33 * Gets a pointer to the PadData structure inside HID shared memory
34 */ 34 */
35static inline SharedMem* GetPadData() { 35static inline SharedMem* GetSharedMem() {
36 if (g_shared_mem == nullptr) 36 if (g_shared_mem == nullptr)
37 return nullptr; 37 return nullptr;
38 return reinterpret_cast<SharedMem*>(g_shared_mem->GetPointer().ValueOr(nullptr)); 38 return reinterpret_cast<SharedMem*>(g_shared_mem->GetPointer().ValueOr(nullptr));
@@ -66,28 +66,18 @@ static void UpdateNextCirclePadState() {
66 next_pad_circle_y += next_state.circle_up ? max_value : 0x0; 66 next_pad_circle_y += next_state.circle_up ? max_value : 0x0;
67} 67}
68 68
69/**
70 * Sets a Pad state (button or button combo) as pressed
71 */
72void PadButtonPress(const PadState& pad_state) { 69void PadButtonPress(const PadState& pad_state) {
73 next_state.hex |= pad_state.hex; 70 next_state.hex |= pad_state.hex;
74 UpdateNextCirclePadState(); 71 UpdateNextCirclePadState();
75} 72}
76 73
77/**
78 * Sets a Pad state (button or button combo) as released
79 */
80void PadButtonRelease(const PadState& pad_state) { 74void PadButtonRelease(const PadState& pad_state) {
81 next_state.hex &= ~pad_state.hex; 75 next_state.hex &= ~pad_state.hex;
82 UpdateNextCirclePadState(); 76 UpdateNextCirclePadState();
83} 77}
84 78
85/**
86 * Called after all Pad changes to be included in this update have been made,
87 * including both Pad key changes and analog circle Pad changes.
88 */
89void PadUpdateComplete() { 79void PadUpdateComplete() {
90 SharedMem* shared_mem = GetPadData(); 80 SharedMem* shared_mem = GetSharedMem();
91 81
92 if (shared_mem == nullptr) 82 if (shared_mem == nullptr)
93 return; 83 return;
@@ -135,17 +125,6 @@ void PadUpdateComplete() {
135 g_event_pad_or_touch_2->Signal(); 125 g_event_pad_or_touch_2->Signal();
136} 126}
137 127
138 // If we just updated index 0, provide a new timestamp
139 if (pad_data->index == 0) {
140 pad_data->index_reset_ticks_previous = pad_data->index_reset_ticks;
141 pad_data->index_reset_ticks = (s64)Core::g_app_core->GetTicks();
142 }
143
144 // Signal both handles when there's an update to Pad or touch
145 g_event_pad_or_touch_1->Signal();
146 g_event_pad_or_touch_2->Signal();
147}
148
149void GetIPCHandles(Service::Interface* self) { 128void GetIPCHandles(Service::Interface* self) {
150 u32* cmd_buff = Kernel::GetCommandBuffer(); 129 u32* cmd_buff = Kernel::GetCommandBuffer();
151 130
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index 6318d1d53..cd6263243 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -162,9 +162,22 @@ const PadState PAD_CIRCLE_DOWN = {{1u << 31}};
162 */ 162 */
163void GetIPCHandles(Interface* self); 163void GetIPCHandles(Interface* self);
164 164
165// Methods for updating the HID module's state 165/**
166 * Sets a Pad state (button or button combo) as pressed
167 * @param pad_state PadState data indicating which buttons have been pressed
168 */
166void PadButtonPress(const PadState& pad_state); 169void PadButtonPress(const PadState& pad_state);
170
171/**
172 * Sets a Pad state (button or button combo) as released
173 * @param pad_state PadState data indicating which buttons have been released
174 */
167void PadButtonRelease(const PadState& pad_state); 175void PadButtonRelease(const PadState& pad_state);
176
177/**
178 * Called after all Pad changes to be included in this update have been made, including both Pad
179 * key changes and analog circle Pad changes.
180 */
168void PadUpdateComplete(); 181void PadUpdateComplete();
169 182
170void HIDInit(); 183void HIDInit();