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
1a904ded
There was an error fetching the commit references. Please try again later.
Commit
1a904ded
authored
10 years ago
by
bunnei
Browse files
Options
Downloads
Patches
Plain Diff
HID: Added functions to emulate the touchpad.
parent
3229b048
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
+48
-0
48 additions, 0 deletions
src/core/hle/service/hid/hid.cpp
src/core/hle/service/hid/hid.h
+13
-0
13 additions, 0 deletions
src/core/hle/service/hid/hid.h
with
61 additions
and
0 deletions
src/core/hle/service/hid/hid.cpp
+
48
−
0
View file @
1a904ded
...
@@ -29,6 +29,10 @@ static u32 next_pad_index = 0;
...
@@ -29,6 +29,10 @@ static u32 next_pad_index = 0;
static
s16
next_pad_circle_x
=
0
;
static
s16
next_pad_circle_x
=
0
;
static
s16
next_pad_circle_y
=
0
;
static
s16
next_pad_circle_y
=
0
;
static
u32
next_touch_index
=
0
;
static
u16
next_touch_x
=
0
;
static
u16
next_touch_y
=
0
;
/**
/**
* Gets a pointer to the PadData structure inside HID shared memory
* Gets a pointer to the PadData structure inside HID shared memory
*/
*/
...
@@ -125,6 +129,50 @@ void PadUpdateComplete() {
...
@@ -125,6 +129,50 @@ void PadUpdateComplete() {
g_event_pad_or_touch_2
->
Signal
();
g_event_pad_or_touch_2
->
Signal
();
}
}
void
TouchPress
(
u16
x
,
u16
y
)
{
next_touch_x
=
x
;
next_touch_y
=
y
;
}
void
TouchRelease
()
{
next_touch_x
=
0
;
next_touch_y
=
0
;
}
void
TouchUpdateComplete
()
{
SharedMem
*
shared_mem
=
GetSharedMem
();
if
(
shared_mem
==
nullptr
)
return
;
shared_mem
->
touch
.
index
=
next_touch_index
;
next_touch_index
=
(
next_touch_index
+
1
)
%
shared_mem
->
touch
.
entries
.
size
();
// Get the current touch entry
TouchDataEntry
*
current_touch_entry
=
&
shared_mem
->
touch
.
entries
[
shared_mem
->
touch
.
index
];
// Set touchpad position
current_touch_entry
->
x
=
next_touch_x
;
current_touch_entry
->
y
=
next_touch_y
;
// TODO(bunnei): Verify this behavior on real hardware
current_touch_entry
->
data_valid
=
(
next_touch_x
||
next_touch_y
)
?
1
:
0
;
// TODO(bunnei): We're not doing anything with offset 0xA8 + 0x18 of HID SharedMemory, which
// supposedly is "Touch-screen entry, which contains the raw coordinate data prior to being
// converted to pixel coordinates." (http://3dbrew.org/wiki/HID_Shared_Memory#Offset_0xA8).
// If we just updated index 0, provide a new timestamp
if
(
shared_mem
->
touch
.
index
==
0
)
{
shared_mem
->
touch
.
index_reset_ticks_previous
=
shared_mem
->
touch
.
index_reset_ticks
;
shared_mem
->
touch
.
index_reset_ticks
=
(
s64
)
Core
::
g_app_core
->
GetTicks
();
}
// Signal both handles when there's an update to Pad or touch
g_event_pad_or_touch_1
->
Signal
();
g_event_pad_or_touch_2
->
Signal
();
}
void
GetIPCHandles
(
Service
::
Interface
*
self
)
{
void
GetIPCHandles
(
Service
::
Interface
*
self
)
{
u32
*
cmd_buff
=
Kernel
::
GetCommandBuffer
();
u32
*
cmd_buff
=
Kernel
::
GetCommandBuffer
();
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/service/hid/hid.h
+
13
−
0
View file @
1a904ded
...
@@ -180,6 +180,19 @@ void PadButtonRelease(const PadState& pad_state);
...
@@ -180,6 +180,19 @@ void PadButtonRelease(const PadState& pad_state);
*/
*/
void
PadUpdateComplete
();
void
PadUpdateComplete
();
/**
* Signal that the touchpad has been pressed
* @param x Touchpad x-coordinate in bottom screen pixels (between 0 and 320)
* @param y Touchpad y-coordinate in bottom screen pixels (between 0 and 240)
*/
void
TouchPress
(
u16
x
,
u16
y
);
/// Signal that touchpad has been released
void
TouchRelease
();
/// Signal that touchpad updates have been completed
void
TouchUpdateComplete
();
void
HIDInit
();
void
HIDInit
();
void
HIDShutdown
();
void
HIDShutdown
();
...
...
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