2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

service: hid: Ensure aruid data is initialized

This commit is contained in:
german77 2024-02-05 16:59:13 -06:00
parent a2f23746c2
commit 372897aac4
3 changed files with 8 additions and 8 deletions

View file

@ -57,7 +57,7 @@ Result NpadAbstractSixAxisHandler::UpdateSixAxisState() {
Core::HID::NpadIdType npad_id = properties_handler->GetNpadId(); Core::HID::NpadIdType npad_id = properties_handler->GetNpadId();
for (std::size_t i = 0; i < AruidIndexMax; i++) { for (std::size_t i = 0; i < AruidIndexMax; i++) {
auto* data = applet_resource_holder->applet_resource->GetAruidDataByIndex(i); auto* data = applet_resource_holder->applet_resource->GetAruidDataByIndex(i);
if (data->flag.is_assigned) { if (data == nullptr || !data->flag.is_assigned) {
continue; continue;
} }
auto& npad_entry = data->shared_memory_format->npad.npad_entry[NpadIdTypeToIndex(npad_id)]; auto& npad_entry = data->shared_memory_format->npad.npad_entry[NpadIdTypeToIndex(npad_id)];

View file

@ -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); auto* data = applet_resource_holder.applet_resource->GetAruidDataByIndex(aruid_index);
if (!data->flag.is_assigned) { if (data == nullptr || !data->flag.is_assigned) {
continue; continue;
} }
@ -463,13 +463,13 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
std::scoped_lock lock{*applet_resource_holder.shared_mutex}; std::scoped_lock lock{*applet_resource_holder.shared_mutex};
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; ++aruid_index) { 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* 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; continue;
} }
bool is_set{}; bool is_set{};
const auto aruid = data->aruid;
npad_resource.IsSupportedNpadStyleSet(is_set, aruid); npad_resource.IsSupportedNpadStyleSet(is_set, aruid);
// Wait until style is defined // Wait until style is defined
if (!is_set) { if (!is_set) {

View file

@ -63,7 +63,7 @@ Result TouchResource::ActivateTouch(u64 aruid) {
auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index); auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
TouchAruidData& touch_data = aruid_data[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 = {}; touch_data = {};
continue; continue;
} }
@ -124,7 +124,7 @@ Result TouchResource::ActivateGesture(u64 aruid, u32 basic_gesture_id) {
auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index); auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
TouchAruidData& touch_data = aruid_data[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 = {}; touch_data = {};
continue; continue;
} }
@ -324,7 +324,7 @@ Result TouchResource::SetTouchScreenConfiguration(
const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index); const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
TouchAruidData& data = aruid_data[aruid_index]; TouchAruidData& data = aruid_data[aruid_index];
if (!applet_data->flag.is_assigned) { if (applet_data == nullptr || !applet_data->flag.is_assigned) {
continue; continue;
} }
if (aruid != data.aruid) { if (aruid != data.aruid) {
@ -344,7 +344,7 @@ Result TouchResource::GetTouchScreenConfiguration(
const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index); const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
const TouchAruidData& data = aruid_data[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; continue;
} }
if (aruid != data.aruid) { if (aruid != data.aruid) {