mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-25 10:52:48 -06:00
service: hid: Add multiprocess support to six axis input
This commit is contained in:
parent
372897aac4
commit
8f192b494a
1 changed files with 130 additions and 124 deletions
|
@ -28,11 +28,12 @@ void SixAxis::OnRelease() {}
|
||||||
|
|
||||||
void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||||
std::scoped_lock shared_lock{*shared_mutex};
|
std::scoped_lock shared_lock{*shared_mutex};
|
||||||
const u64 aruid = applet_resource->GetActiveAruid();
|
|
||||||
auto* data = applet_resource->GetAruidData(aruid);
|
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; ++aruid_index) {
|
||||||
|
const auto* data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||||
|
|
||||||
if (data == nullptr || !data->flag.is_assigned) {
|
if (data == nullptr || !data->flag.is_assigned) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsControllerActivated()) {
|
if (!IsControllerActivated()) {
|
||||||
|
@ -44,6 +45,10 @@ void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||||
auto& controller = controller_data[i];
|
auto& controller = controller_data[i];
|
||||||
const auto& controller_type = controller.device->GetNpadStyleIndex();
|
const auto& controller_type = controller.device->GetNpadStyleIndex();
|
||||||
|
|
||||||
|
if (!data->flag.enable_six_axis_sensor) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (controller_type == Core::HID::NpadStyleIndex::None ||
|
if (controller_type == Core::HID::NpadStyleIndex::None ||
|
||||||
!controller.device->IsConnected()) {
|
!controller.device->IsConnected()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -166,6 +171,7 @@ void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||||
sixaxis_right_lifo.lifo.WriteNextEntry(sixaxis_right_lifo_state);
|
sixaxis_right_lifo.lifo.WriteNextEntry(sixaxis_right_lifo_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Result SixAxis::SetGyroscopeZeroDriftMode(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
|
Result SixAxis::SetGyroscopeZeroDriftMode(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
|
||||||
Core::HID::GyroscopeZeroDriftMode drift_mode) {
|
Core::HID::GyroscopeZeroDriftMode drift_mode) {
|
||||||
|
|
Loading…
Reference in a new issue