summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2015-01-24 15:54:24 -0500
committerGravatar Subv2015-01-24 15:54:24 -0500
commit2ea60bdc7f6f7b176eb8bfc5b31d0cd76cad3d61 (patch)
tree6fe8f56411a83057372fb4a2900bcf6ddd581a0c /src
parentServices: Stubbed more services. (diff)
downloadyuzu-2ea60bdc7f6f7b176eb8bfc5b31d0cd76cad3d61.tar.gz
yuzu-2ea60bdc7f6f7b176eb8bfc5b31d0cd76cad3d61.tar.xz
yuzu-2ea60bdc7f6f7b176eb8bfc5b31d0cd76cad3d61.zip
Services/HID: Removed some files due to a rebase error
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid_spvr.cpp41
-rw-r--r--src/core/hle/service/hid_spvr.h29
-rw-r--r--src/core/hle/service/hid_user.cpp197
3 files changed, 0 insertions, 267 deletions
diff --git a/src/core/hle/service/hid_spvr.cpp b/src/core/hle/service/hid_spvr.cpp
deleted file mode 100644
index e14e93f4b..000000000
--- a/src/core/hle/service/hid_spvr.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "common/log.h"
6
7#include "core/arm/arm_interface.h"
8#include "core/hle/hle.h"
9#include "core/hle/service/hid_user.h"
10#include "core/hle/service/hid_spvr.h"
11
12////////////////////////////////////////////////////////////////////////////////////////////////////
13// Namespace HID_SPVR
14
15namespace HID_User {
16 extern void GetIPCHandles(Service::Interface* self);
17}
18
19namespace HID_SPVR {
20
21const Interface::FunctionInfo FunctionTable[] = {
22 {0x000A0000, HID_User::GetIPCHandles, "GetIPCHandles"},
23 {0x000B0000, nullptr, "StartAnalogStickCalibration"},
24 {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"},
25 {0x00110000, nullptr, "EnableAccelerometer"},
26 {0x00120000, nullptr, "DisableAccelerometer"},
27 {0x00130000, nullptr, "EnableGyroscopeLow"},
28 {0x00140000, nullptr, "DisableGyroscopeLow"},
29 {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},
30 {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},
31 {0x00170000, nullptr, "GetSoundVolume"},
32};
33
34////////////////////////////////////////////////////////////////////////////////////////////////////
35// Interface class
36
37Interface::Interface() {
38 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
39}
40
41} // namespace
diff --git a/src/core/hle/service/hid_spvr.h b/src/core/hle/service/hid_spvr.h
deleted file mode 100644
index be506358b..000000000
--- a/src/core/hle/service/hid_spvr.h
+++ /dev/null
@@ -1,29 +0,0 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/service.h"
8
9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace HID_SPVR
11
12// This service is used for interfacing to physical user controls.
13// Uses include game pad controls, touchscreen, accelerometers, gyroscopes, and debug pad.
14
15namespace HID_SPVR {
16
17/**
18 * HID service interface.
19 */
20class Interface : public Service::Interface {
21public:
22 Interface();
23
24 std::string GetPortName() const override {
25 return "hid:SPVR";
26 }
27};
28
29} // namespace
diff --git a/src/core/hle/service/hid_user.cpp b/src/core/hle/service/hid_user.cpp
deleted file mode 100644
index 1fa12ddc9..000000000
--- a/src/core/hle/service/hid_user.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "common/log.h"
6
7#include "core/arm/arm_interface.h"
8#include "core/hle/hle.h"
9#include "core/hle/kernel/event.h"
10#include "core/hle/kernel/shared_memory.h"
11#include "hid_user.h"
12
13////////////////////////////////////////////////////////////////////////////////////////////////////
14// Namespace HID_User
15
16namespace HID_User {
17
18// Handle to shared memory region designated to HID_User service
19static Handle shared_mem = 0;
20
21// Event handles
22static Handle event_pad_or_touch_1 = 0;
23static Handle event_pad_or_touch_2 = 0;
24static Handle event_accelerometer = 0;
25static Handle event_gyroscope = 0;
26static Handle event_debug_pad = 0;
27
28// Next Pad state update information
29static PadState next_state = {{0}};
30static u32 next_index = 0;
31static s16 next_circle_x = 0;
32static s16 next_circle_y = 0;
33
34/**
35 * Gets a pointer to the PadData structure inside HID shared memory
36 */
37static inline PadData* GetPadData() {
38 return reinterpret_cast<PadData*>(Kernel::GetSharedMemoryPointer(shared_mem, 0).ValueOr(nullptr));
39}
40
41/**
42 * Circle Pad from keys.
43 *
44 * This is implemented as "pushed all the way to an edge (max) or centered (0)".
45 *
46 * Indicate the circle pad is pushed completely to the edge in 1 of 8 directions.
47 */
48static void UpdateNextCirclePadState() {
49 static const s16 max_value = 0x9C;
50 next_circle_x = next_state.circle_left ? -max_value : 0x0;
51 next_circle_x += next_state.circle_right ? max_value : 0x0;
52 next_circle_y = next_state.circle_down ? -max_value : 0x0;
53 next_circle_y += next_state.circle_up ? max_value : 0x0;
54}
55
56/**
57 * Sets a Pad state (button or button combo) as pressed
58 */
59void PadButtonPress(const PadState& pad_state) {
60 next_state.hex |= pad_state.hex;
61 UpdateNextCirclePadState();
62}
63
64/**
65 * Sets a Pad state (button or button combo) as released
66 */
67void PadButtonRelease(const PadState& pad_state) {
68 next_state.hex &= ~pad_state.hex;
69 UpdateNextCirclePadState();
70}
71
72/**
73 * Called after all Pad changes to be included in this update have been made,
74 * including both Pad key changes and analog circle Pad changes.
75 */
76void PadUpdateComplete() {
77 PadData* pad_data = GetPadData();
78
79 if (pad_data == nullptr) {
80 return;
81 }
82
83 // Update PadData struct
84 pad_data->current_state.hex = next_state.hex;
85 pad_data->index = next_index;
86 next_index = (next_index + 1) % pad_data->entries.size();
87
88 // Get the previous Pad state
89 u32 last_entry_index = (pad_data->index - 1) % pad_data->entries.size();
90 PadState old_state = pad_data->entries[last_entry_index].current_state;
91
92 // Compute bitmask with 1s for bits different from the old state
93 PadState changed;
94 changed.hex = (next_state.hex ^ old_state.hex);
95
96 // Compute what was added
97 PadState additions;
98 additions.hex = changed.hex & next_state.hex;
99
100 // Compute what was removed
101 PadState removals;
102 removals.hex = changed.hex & old_state.hex;
103
104 // Get the current Pad entry
105 PadDataEntry* current_pad_entry = &pad_data->entries[pad_data->index];
106
107 // Update entry properties
108 current_pad_entry->current_state.hex = next_state.hex;
109 current_pad_entry->delta_additions.hex = additions.hex;
110 current_pad_entry->delta_removals.hex = removals.hex;
111
112 // Set circle Pad
113 current_pad_entry->circle_pad_x = next_circle_x;
114 current_pad_entry->circle_pad_y = next_circle_y;
115
116 // If we just updated index 0, provide a new timestamp
117 if (pad_data->index == 0) {
118 pad_data->index_reset_ticks_previous = pad_data->index_reset_ticks;
119 pad_data->index_reset_ticks = (s64)Core::g_app_core->GetTicks();
120 }
121
122 // Signal both handles when there's an update to Pad or touch
123 Kernel::SignalEvent(event_pad_or_touch_1);
124 Kernel::SignalEvent(event_pad_or_touch_2);
125}
126
127
128// TODO(peachum):
129// Add a method for setting analog input from joystick device for the circle Pad.
130//
131// This method should:
132// * Be called after both PadButton<Press, Release>().
133// * Be called before PadUpdateComplete()
134// * Set current PadEntry.circle_pad_<axis> using analog data
135// * Set PadData.raw_circle_pad_data
136// * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_x >= 41
137// * Set PadData.current_state.circle_up = 1 if current PadEntry.circle_pad_y >= 41
138// * Set PadData.current_state.circle_left = 1 if current PadEntry.circle_pad_x <= -41
139// * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_y <= -41
140
141
142/**
143 * HID_User::GetIPCHandles service function
144 * Inputs:
145 * None
146 * Outputs:
147 * 1 : Result of function, 0 on success, otherwise error code
148 * 2 : Unused
149 * 3 : Handle to HID_User shared memory
150 * 4 : Event signaled by HID_User
151 * 5 : Event signaled by HID_User
152 * 6 : Event signaled by HID_User
153 * 7 : Gyroscope event
154 * 8 : Event signaled by HID_User
155 */
156void GetIPCHandles(Service::Interface* self) {
157 u32* cmd_buff = Kernel::GetCommandBuffer();
158
159 cmd_buff[1] = 0; // No error
160 cmd_buff[3] = shared_mem;
161 cmd_buff[4] = event_pad_or_touch_1;
162 cmd_buff[5] = event_pad_or_touch_2;
163 cmd_buff[6] = event_accelerometer;
164 cmd_buff[7] = event_gyroscope;
165 cmd_buff[8] = event_debug_pad;
166}
167
168const Interface::FunctionInfo FunctionTable[] = {
169 {0x000A0000, GetIPCHandles, "GetIPCHandles"},
170 {0x000B0000, nullptr, "StartAnalogStickCalibration"},
171 {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"},
172 {0x00110000, nullptr, "EnableAccelerometer"},
173 {0x00120000, nullptr, "DisableAccelerometer"},
174 {0x00130000, nullptr, "EnableGyroscopeLow"},
175 {0x00140000, nullptr, "DisableGyroscopeLow"},
176 {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},
177 {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},
178 {0x00170000, nullptr, "GetSoundVolume"},
179};
180
181////////////////////////////////////////////////////////////////////////////////////////////////////
182// Interface class
183
184Interface::Interface() {
185 shared_mem = Kernel::CreateSharedMemory("HID_User:SharedMem"); // Create shared memory object
186
187 // Create event handles
188 event_pad_or_touch_1 = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventPadOrTouch1");
189 event_pad_or_touch_2 = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventPadOrTouch2");
190 event_accelerometer = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventAccelerometer");
191 event_gyroscope = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventGyroscope");
192 event_debug_pad = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventDebugPad");
193
194 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
195}
196
197} // namespace