mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-23 04:15:28 +00:00
Merge pull request #12928 from german77/motion-mp
service: hid: Add multiprocess support to six axis input
This commit is contained in:
commit
5016de3626
|
@ -57,7 +57,7 @@ Result NpadAbstractSixAxisHandler::UpdateSixAxisState() {
|
|||
Core::HID::NpadIdType npad_id = properties_handler->GetNpadId();
|
||||
for (std::size_t i = 0; i < AruidIndexMax; i++) {
|
||||
auto* data = applet_resource_holder->applet_resource->GetAruidDataByIndex(i);
|
||||
if (data->flag.is_assigned) {
|
||||
if (data == nullptr || !data->flag.is_assigned) {
|
||||
continue;
|
||||
}
|
||||
auto& npad_entry = data->shared_memory_format->npad.npad_entry[NpadIdTypeToIndex(npad_id)];
|
||||
|
|
|
@ -131,7 +131,7 @@ void NPad::ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t c
|
|||
|
||||
auto* data = applet_resource_holder.applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
||||
if (!data->flag.is_assigned) {
|
||||
if (data == nullptr || !data->flag.is_assigned) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -463,13 +463,13 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
|||
std::scoped_lock lock{*applet_resource_holder.shared_mutex};
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; ++aruid_index) {
|
||||
const auto* data = applet_resource_holder.applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
const auto aruid = data->aruid;
|
||||
|
||||
if (!data->flag.is_assigned) {
|
||||
if (data == nullptr || !data->flag.is_assigned) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool is_set{};
|
||||
const auto aruid = data->aruid;
|
||||
npad_resource.IsSupportedNpadStyleSet(is_set, aruid);
|
||||
// Wait until style is defined
|
||||
if (!is_set) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -63,7 +63,7 @@ Result TouchResource::ActivateTouch(u64 aruid) {
|
|||
auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
TouchAruidData& touch_data = aruid_data[aruid_index];
|
||||
|
||||
if (!applet_data->flag.is_assigned) {
|
||||
if (applet_data == nullptr || !applet_data->flag.is_assigned) {
|
||||
touch_data = {};
|
||||
continue;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ Result TouchResource::ActivateGesture(u64 aruid, u32 basic_gesture_id) {
|
|||
auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
TouchAruidData& touch_data = aruid_data[aruid_index];
|
||||
|
||||
if (!applet_data->flag.is_assigned) {
|
||||
if (applet_data == nullptr || !applet_data->flag.is_assigned) {
|
||||
touch_data = {};
|
||||
continue;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ Result TouchResource::SetTouchScreenConfiguration(
|
|||
const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
TouchAruidData& data = aruid_data[aruid_index];
|
||||
|
||||
if (!applet_data->flag.is_assigned) {
|
||||
if (applet_data == nullptr || !applet_data->flag.is_assigned) {
|
||||
continue;
|
||||
}
|
||||
if (aruid != data.aruid) {
|
||||
|
@ -344,7 +344,7 @@ Result TouchResource::GetTouchScreenConfiguration(
|
|||
const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
const TouchAruidData& data = aruid_data[aruid_index];
|
||||
|
||||
if (!applet_data->flag.is_assigned) {
|
||||
if (applet_data == nullptr || !applet_data->flag.is_assigned) {
|
||||
continue;
|
||||
}
|
||||
if (aruid != data.aruid) {
|
||||
|
|
Loading…
Reference in a new issue