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
a2ad5762
There was an error fetching the commit references. Please try again later.
Commit
a2ad5762
authored
3 years ago
by
german77
Committed by
Narr the Reg
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
service/hid: Update console sixaxis to the emulated console
parent
800a66d2
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/console_sixaxis.cpp
+13
-20
13 additions, 20 deletions
src/core/hle/service/hid/controllers/console_sixaxis.cpp
src/core/hle/service/hid/controllers/console_sixaxis.h
+13
-8
13 additions, 8 deletions
src/core/hle/service/hid/controllers/console_sixaxis.h
with
26 additions
and
28 deletions
src/core/hle/service/hid/controllers/console_sixaxis.cpp
+
13
−
20
View file @
a2ad5762
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
// Refer to the license.txt file included.
#include
"common/settings.h"
#include
"common/settings.h"
#include
"core/core.h"
#include
"core/core_timing.h"
#include
"core/core_timing.h"
#include
"core/hle/service/hid/controllers/console_sixaxis.h"
#include
"core/hle/service/hid/controllers/console_sixaxis.h"
...
@@ -10,7 +11,10 @@ namespace Service::HID {
...
@@ -10,7 +11,10 @@ namespace Service::HID {
constexpr
std
::
size_t
SHARED_MEMORY_OFFSET
=
0x3C200
;
constexpr
std
::
size_t
SHARED_MEMORY_OFFSET
=
0x3C200
;
Controller_ConsoleSixAxis
::
Controller_ConsoleSixAxis
(
Core
::
System
&
system_
)
Controller_ConsoleSixAxis
::
Controller_ConsoleSixAxis
(
Core
::
System
&
system_
)
:
ControllerBase
{
system_
}
{}
:
ControllerBase
{
system_
}
{
console
=
system
.
HIDCore
().
GetEmulatedConsole
();
}
Controller_ConsoleSixAxis
::~
Controller_ConsoleSixAxis
()
=
default
;
Controller_ConsoleSixAxis
::~
Controller_ConsoleSixAxis
()
=
default
;
void
Controller_ConsoleSixAxis
::
OnInit
()
{}
void
Controller_ConsoleSixAxis
::
OnInit
()
{}
...
@@ -38,25 +42,21 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti
...
@@ -38,25 +42,21 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti
cur_entry
.
sampling_number2
=
cur_entry
.
sampling_number
;
cur_entry
.
sampling_number2
=
cur_entry
.
sampling_number
;
// Try to read sixaxis sensor states
// Try to read sixaxis sensor states
MotionDevice
motion_device
{};
const
auto
motion_status
=
console
->
GetMotion
();
const
auto
&
device
=
motions
[
0
];
if
(
device
)
{
std
::
tie
(
motion_device
.
accel
,
motion_device
.
gyro
,
motion_device
.
rotation
,
motion_device
.
orientation
,
motion_device
.
quaternion
)
=
device
->
GetStatus
();
console_six_axis
.
is_seven_six_axis_sensor_at_rest
=
motion_device
.
gyro
.
Length2
()
<
0.0001
f
;
}
cur_entry
.
accel
=
motion_device
.
accel
;
console_six_axis
.
is_seven_six_axis_sensor_at_rest
=
motion_status
.
is_at_rest
;
cur_entry
.
accel
=
motion_status
.
accel
;
// Zero gyro values as they just mess up with the camera
// Zero gyro values as they just mess up with the camera
// Note: Probably a correct sensivity setting must be set
// Note: Probably a correct sensivity setting must be set
cur_entry
.
gyro
=
{};
cur_entry
.
gyro
=
{};
cur_entry
.
quaternion
=
{
cur_entry
.
quaternion
=
{
{
{
motion_
device
.
quaternion
.
xyz
.
y
,
motion_
status
.
quaternion
.
xyz
.
y
,
motion_
device
.
quaternion
.
xyz
.
x
,
motion_
status
.
quaternion
.
xyz
.
x
,
-
motion_
device
.
quaternion
.
w
,
-
motion_
status
.
quaternion
.
w
,
},
},
-
motion_
device
.
quaternion
.
xyz
.
z
,
-
motion_
status
.
quaternion
.
xyz
.
z
,
};
};
console_six_axis
.
sampling_number
++
;
console_six_axis
.
sampling_number
++
;
...
@@ -70,13 +70,6 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti
...
@@ -70,13 +70,6 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti
std
::
memcpy
(
transfer_memory
,
&
seven_six_axis
,
sizeof
(
seven_six_axis
));
std
::
memcpy
(
transfer_memory
,
&
seven_six_axis
,
sizeof
(
seven_six_axis
));
}
}
void
Controller_ConsoleSixAxis
::
OnLoadInputDevices
()
{
const
auto
player
=
Settings
::
values
.
players
.
GetValue
()[
0
];
std
::
transform
(
player
.
motions
.
begin
()
+
Settings
::
NativeMotion
::
MOTION_HID_BEGIN
,
player
.
motions
.
begin
()
+
Settings
::
NativeMotion
::
MOTION_HID_END
,
motions
.
begin
(),
Input
::
CreateDevice
<
Input
::
MotionDevice
>
);
}
void
Controller_ConsoleSixAxis
::
SetTransferMemoryPointer
(
u8
*
t_mem
)
{
void
Controller_ConsoleSixAxis
::
SetTransferMemoryPointer
(
u8
*
t_mem
)
{
is_transfer_memory_set
=
true
;
is_transfer_memory_set
=
true
;
transfer_memory
=
t_mem
;
transfer_memory
=
t_mem
;
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/service/hid/controllers/console_sixaxis.h
+
13
−
8
View file @
a2ad5762
...
@@ -5,10 +5,10 @@
...
@@ -5,10 +5,10 @@
#pragma once
#pragma once
#include
<array>
#include
<array>
#include
"common/bit_field.h"
#include
"common/common_types.h"
#include
"common/common_types.h"
#include
"common/quaternion.h"
#include
"common/quaternion.h"
#include
"core/frontend/input.h"
#include
"core/hid/hid_core.h"
#include
"core/hid/hid_types.h"
#include
"core/hle/service/hid/controllers/controller_base.h"
#include
"core/hle/service/hid/controllers/controller_base.h"
namespace
Service
::
HID
{
namespace
Service
::
HID
{
...
@@ -26,9 +26,6 @@ public:
...
@@ -26,9 +26,6 @@ public:
// When the controller is requesting an update for the shared memory
// When the controller is requesting an update for the shared memory
void
OnUpdate
(
const
Core
::
Timing
::
CoreTiming
&
core_timing
,
u8
*
data
,
size_t
size
)
override
;
void
OnUpdate
(
const
Core
::
Timing
::
CoreTiming
&
core_timing
,
u8
*
data
,
size_t
size
)
override
;
// Called when input devices should be loaded
void
OnLoadInputDevices
()
override
;
// Called on InitializeSevenSixAxisSensor
// Called on InitializeSevenSixAxisSensor
void
SetTransferMemoryPointer
(
u8
*
t_mem
);
void
SetTransferMemoryPointer
(
u8
*
t_mem
);
...
@@ -47,12 +44,22 @@ private:
...
@@ -47,12 +44,22 @@ private:
};
};
static_assert
(
sizeof
(
SevenSixAxisState
)
==
0x50
,
"SevenSixAxisState is an invalid size"
);
static_assert
(
sizeof
(
SevenSixAxisState
)
==
0x50
,
"SevenSixAxisState is an invalid size"
);
struct
CommonHeader
{
s64_le
timestamp
;
s64_le
total_entry_count
;
s64_le
last_entry_index
;
s64_le
entry_count
;
};
static_assert
(
sizeof
(
CommonHeader
)
==
0x20
,
"CommonHeader is an invalid size"
);
// TODO(german77): SevenSixAxisMemory doesn't follow the standard lifo. Investigate
struct
SevenSixAxisMemory
{
struct
SevenSixAxisMemory
{
CommonHeader
header
{};
CommonHeader
header
{};
std
::
array
<
SevenSixAxisState
,
0x21
>
sevensixaxis_states
{};
std
::
array
<
SevenSixAxisState
,
0x21
>
sevensixaxis_states
{};
};
};
static_assert
(
sizeof
(
SevenSixAxisMemory
)
==
0xA70
,
"SevenSixAxisMemory is an invalid size"
);
static_assert
(
sizeof
(
SevenSixAxisMemory
)
==
0xA70
,
"SevenSixAxisMemory is an invalid size"
);
// This is nn::hid::detail::ConsoleSixAxisSensorSharedMemoryFormat
struct
ConsoleSharedMemory
{
struct
ConsoleSharedMemory
{
u64_le
sampling_number
{};
u64_le
sampling_number
{};
bool
is_seven_six_axis_sensor_at_rest
{};
bool
is_seven_six_axis_sensor_at_rest
{};
...
@@ -69,9 +76,7 @@ private:
...
@@ -69,9 +76,7 @@ private:
Common
::
Quaternion
<
f32
>
quaternion
;
Common
::
Quaternion
<
f32
>
quaternion
;
};
};
using
MotionArray
=
Core
::
HID
::
EmulatedConsole
*
console
;
std
::
array
<
std
::
unique_ptr
<
Input
::
MotionDevice
>
,
Settings
::
NativeMotion
::
NUM_MOTIONS_HID
>
;
MotionArray
motions
;
u8
*
transfer_memory
=
nullptr
;
u8
*
transfer_memory
=
nullptr
;
bool
is_transfer_memory_set
=
false
;
bool
is_transfer_memory_set
=
false
;
ConsoleSharedMemory
console_six_axis
{};
ConsoleSharedMemory
console_six_axis
{};
...
...
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