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
0fd45e78
There was an error fetching the commit references. Please try again later.
Commit
0fd45e78
authored
6 years ago
by
Zach Hilman
Browse files
Options
Downloads
Patches
Plain Diff
hid: Add keyboard bindings for Keyboard controller
parent
06cf050c
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/controllers/keyboard.cpp
+17
-2
17 additions, 2 deletions
src/core/hle/service/hid/controllers/keyboard.cpp
src/core/hle/service/hid/controllers/keyboard.h
+7
-0
7 additions, 0 deletions
src/core/hle/service/hid/controllers/keyboard.h
with
24 additions
and
2 deletions
src/core/hle/service/hid/controllers/keyboard.cpp
+
17
−
2
View file @
0fd45e78
...
...
@@ -6,6 +6,7 @@
#include
"common/common_types.h"
#include
"core/core_timing.h"
#include
"core/hle/service/hid/controllers/keyboard.h"
#include
"core/settings.h"
namespace
Service
::
HID
{
constexpr
std
::
size_t
SHARED_MEMORY_OFFSET
=
0x3800
;
...
...
@@ -34,10 +35,24 @@ void Controller_Keyboard::OnUpdate(u8* data, std::size_t size) {
cur_entry
.
sampling_number
=
last_entry
.
sampling_number
+
1
;
cur_entry
.
sampling_number2
=
cur_entry
.
sampling_number
;
// TODO(ogniK): Update keyboard states
for
(
std
::
size_t
i
=
0
;
i
<
keyboard_keys
.
size
();
++
i
)
{
for
(
std
::
size_t
k
=
0
;
k
<
8
;
++
k
)
{
cur_entry
.
key
[
i
/
8
]
|=
(
keyboard_keys
[
i
]
->
GetStatus
()
<<
k
);
}
}
for
(
std
::
size_t
i
=
0
;
i
<
keyboard_mods
.
size
();
++
i
)
{
cur_entry
.
modifier
|=
(
keyboard_mods
[
i
]
->
GetStatus
()
<<
i
);
}
std
::
memcpy
(
data
+
SHARED_MEMORY_OFFSET
,
&
shared_memory
,
sizeof
(
SharedMemory
));
}
void
Controller_Keyboard
::
OnLoadInputDevices
()
{}
void
Controller_Keyboard
::
OnLoadInputDevices
()
{
std
::
transform
(
Settings
::
values
.
keyboard_keys
.
begin
(),
Settings
::
values
.
keyboard_keys
.
end
(),
keyboard_keys
.
begin
(),
Input
::
CreateDevice
<
Input
::
ButtonDevice
>
);
std
::
transform
(
Settings
::
values
.
keyboard_mods
.
begin
(),
Settings
::
values
.
keyboard_mods
.
end
(),
keyboard_mods
.
begin
(),
Input
::
CreateDevice
<
Input
::
ButtonDevice
>
);
}
}
// namespace Service::HID
This diff is collapsed.
Click to expand it.
src/core/hle/service/hid/controllers/keyboard.h
+
7
−
0
View file @
0fd45e78
...
...
@@ -8,7 +8,9 @@
#include
"common/common_funcs.h"
#include
"common/common_types.h"
#include
"common/swap.h"
#include
"core/frontend/input.h"
#include
"core/hle/service/hid/controllers/controller_base.h"
#include
"core/settings.h"
namespace
Service
::
HID
{
class
Controller_Keyboard
final
:
public
ControllerBase
{
...
...
@@ -46,5 +48,10 @@ private:
};
static_assert
(
sizeof
(
SharedMemory
)
==
0x400
,
"SharedMemory is an invalid size"
);
SharedMemory
shared_memory
{};
std
::
array
<
std
::
unique_ptr
<
Input
::
ButtonDevice
>
,
Settings
::
NativeKeyboard
::
NumKeyboardKeys
>
keyboard_keys
;
std
::
array
<
std
::
unique_ptr
<
Input
::
ButtonDevice
>
,
Settings
::
NativeKeyboard
::
NumKeyboardMods
>
keyboard_mods
;
};
}
// namespace Service::HID
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