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
db08721d
There was an error fetching the commit references. Please try again later.
Commit
db08721d
authored
3 years ago
by
german77
Committed by
Narr the Reg
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
service/hid: Create ring LIFO
parent
8fff6d6c
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/CMakeLists.txt
+1
-1
1 addition, 1 deletion
src/core/CMakeLists.txt
src/core/hle/service/hid/ring_lifo.h
+54
-0
54 additions, 0 deletions
src/core/hle/service/hid/ring_lifo.h
with
55 additions
and
1 deletion
src/core/CMakeLists.txt
+
1
−
1
View file @
db08721d
...
...
@@ -132,7 +132,6 @@ add_library(core STATIC
frontend/emu_window.h
frontend/framebuffer_layout.cpp
frontend/framebuffer_layout.h
frontend/input.h
hardware_interrupt_manager.cpp
hardware_interrupt_manager.h
hid/emulated_console.cpp
...
...
@@ -415,6 +414,7 @@ add_library(core STATIC
hle/service/hid/hid.h
hle/service/hid/irs.cpp
hle/service/hid/irs.h
hle/service/hid/ring_lifo.h
hle/service/hid/xcd.cpp
hle/service/hid/xcd.h
hle/service/hid/errors.h
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/service/hid/ring_lifo.h
0 → 100644
+
54
−
0
View file @
db08721d
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included
#pragma once
#include
"common/common_types.h"
#include
"common/swap.h"
namespace
Service
::
HID
{
constexpr
std
::
size_t
max_entry_size
=
17
;
template
<
typename
State
>
struct
AtomicStorage
{
s64_le
sampling_number
;
State
state
;
};
template
<
typename
State
>
struct
Lifo
{
s64_le
timestamp
{};
s64_le
total_entry_count
=
max_entry_size
;
s64_le
last_entry_index
{};
s64_le
entry_count
{};
std
::
array
<
AtomicStorage
<
State
>
,
max_entry_size
>
entries
{};
const
AtomicStorage
<
State
>&
ReadCurrentEntry
()
const
{
return
entries
[
last_entry_index
];
}
const
AtomicStorage
<
State
>&
ReadPreviousEntry
()
const
{
return
entries
[
GetPreviuousEntryIndex
()];
}
std
::
size_t
GetPreviuousEntryIndex
()
const
{
return
(
last_entry_index
+
total_entry_count
-
1
)
%
total_entry_count
;
}
std
::
size_t
GetNextEntryIndex
()
const
{
return
(
last_entry_index
+
1
)
%
total_entry_count
;
}
void
WriteNextEntry
(
const
State
&
new_state
)
{
if
(
entry_count
<
total_entry_count
-
1
)
{
entry_count
++
;
}
last_entry_index
=
GetNextEntryIndex
();
const
auto
&
previous_entry
=
ReadPreviousEntry
();
entries
[
last_entry_index
].
sampling_number
=
previous_entry
.
sampling_number
+
1
;
entries
[
last_entry_index
].
state
=
new_state
;
}
};
}
// 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