Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
85cbccb1
There was an error fetching the commit references. Please try again later.
Commit
85cbccb1
authored
10 years ago
by
bunnei
Browse files
Options
Downloads
Patches
Plain Diff
HID: Added additional variable comments and some code cleanups.
parent
d61b26b7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/hle/service/hid/hid.cpp
+6
-2
6 additions, 2 deletions
src/core/hle/service/hid/hid.cpp
src/core/hle/service/hid/hid.h
+23
-18
23 additions, 18 deletions
src/core/hle/service/hid/hid.h
with
29 additions
and
20 deletions
src/core/hle/service/hid/hid.cpp
+
6
−
2
View file @
85cbccb1
...
...
@@ -17,6 +17,8 @@
namespace
Service
{
namespace
HID
{
static
const
int
MAX_CIRCLEPAD_POS
=
0x9C
;
///< Max value for a circle pad position
Kernel
::
SharedPtr
<
Kernel
::
SharedMemory
>
g_shared_mem
=
nullptr
;
Kernel
::
SharedPtr
<
Kernel
::
Event
>
g_event_pad_or_touch_1
;
...
...
@@ -78,8 +80,10 @@ void HIDUpdate() {
pad_entry
->
delta_removals
.
hex
=
changed
.
hex
&
old_state
.
hex
;;
// Set circle Pad
pad_entry
->
circle_pad_x
=
state
.
circle_left
?
-
0x9C
:
state
.
circle_right
?
0x9C
:
0x0
;
pad_entry
->
circle_pad_y
=
state
.
circle_down
?
-
0x9C
:
state
.
circle_up
?
0x9C
:
0x0
;
pad_entry
->
circle_pad_x
=
state
.
circle_left
?
-
MAX_CIRCLEPAD_POS
:
state
.
circle_right
?
MAX_CIRCLEPAD_POS
:
0x0
;
pad_entry
->
circle_pad_y
=
state
.
circle_down
?
-
MAX_CIRCLEPAD_POS
:
state
.
circle_up
?
MAX_CIRCLEPAD_POS
:
0x0
;
// If we just updated index 0, provide a new timestamp
if
(
shared_mem
->
pad
.
index
==
0
)
{
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/service/hid/hid.h
+
23
−
18
View file @
85cbccb1
...
...
@@ -80,40 +80,45 @@ struct PadDataEntry {
* Structure of a single entry of touch state history within HID shared memory
*/
struct
TouchDataEntry
{
u16
x
;
///< Y-coordinate of a touchpad press on the lower screen
u16
y
;
///< X-coordinate of a touchpad press on the lower screen
BitField
<
0
,
7
,
u32
>
valid
;
///< Set to 1 when this entry contains actual X/Y data, otherwise 0
u16
x
;
///< Y-coordinate of a touchpad press on the lower screen
u16
y
;
///< X-coordinate of a touchpad press on the lower screen
BitField
<
0
,
7
,
u32
>
valid
;
///< Set to 1 when this entry contains actual X/Y data, otherwise 0
};
/**
* Structure of data stored in HID shared memory
*/
struct
SharedMem
{
//
"
Pad data, this is used for buttons and the circle pad
//
/
Pad data, this is used for buttons and the circle pad
struct
{
s64
index_reset_ticks
;
s64
index_reset_ticks_previous
;
u32
index
;
// Index of the last updated pad state
history elem
ent
s64
index_reset_ticks
;
///< CPU tick count for when HID module updated entry index 0
s64
index_reset_ticks_previous
;
///< Previous `index_reset_ticks`
u32
index
;
//
/<
Index of the last updated pad state ent
ry
INSERT_PADDING_
BYTE
S
(
0x
8
);
INSERT_PADDING_
WORD
S
(
0x
2
);
PadState
current_state
;
// Same as entries[index].current_state
u32
raw_circle_pad_data
;
PadState
current_state
;
///< Current state of the pad buttons
INSERT_PADDING_BYTES
(
0x4
);
// TODO(bunnei): Implement `raw_circle_pad_data` field
u32
raw_circle_pad_data
;
///< Raw (analog) circle pad data, before being converted
std
::
array
<
PadDataEntry
,
8
>
entries
;
// Pad state history
INSERT_PADDING_WORDS
(
0x1
);
std
::
array
<
PadDataEntry
,
8
>
entries
;
///< Last 8 pad entries
}
pad
;
// Touchpad data, this is used for touchpad input
//
/
Touchpad data, this is used for touchpad input
struct
{
s64
index_reset_ticks
;
s64
index_reset_ticks_previous
;
u32
index
;
// Index of the last updated touch state history element
s64
index_reset_ticks
;
///< CPU tick count for when HID module updated entry index 0
s64
index_reset_ticks_previous
;
///< Previous `index_reset_ticks`
u32
index
;
///< Index of the last updated touch entry
INSERT_PADDING_WORDS
(
0x1
);
INSERT_PADDING_BYTES
(
0xC
);
// TODO(bunnei): Implement `raw_entry` field
TouchDataEntry
raw_entry
;
///< Raw (analog) touch data, before being converted
std
::
array
<
TouchDataEntry
,
8
>
entries
;
std
::
array
<
TouchDataEntry
,
8
>
entries
;
///< Last 8 touch entries, in pixel coordinates
}
touch
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment