service: hid: Add multiprocess support to six axis input

This commit is contained in:
german77 2024-02-05 17:07:50 -06:00
parent 372897aac4
commit 8f192b494a

View File

@ -28,11 +28,12 @@ void SixAxis::OnRelease() {}
void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
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) {
return;
continue;
}
if (!IsControllerActivated()) {
@ -44,6 +45,10 @@ void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
auto& controller = controller_data[i];
const auto& controller_type = controller.device->GetNpadStyleIndex();
if (!data->flag.enable_six_axis_sensor) {
continue;
}
if (controller_type == Core::HID::NpadStyleIndex::None ||
!controller.device->IsConnected()) {
continue;
@ -166,6 +171,7 @@ void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
sixaxis_right_lifo.lifo.WriteNextEntry(sixaxis_right_lifo_state);
}
}
}
Result SixAxis::SetGyroscopeZeroDriftMode(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
Core::HID::GyroscopeZeroDriftMode drift_mode) {