From 46cdeb4549dbd549f9700967c25c089594f3b4ff Mon Sep 17 00:00:00 2001 From: David Marcec Date: Wed, 10 Oct 2018 14:21:56 +1100 Subject: [PATCH] Kirby expects handheld controllers to be at position 8 --- src/core/hle/service/hid/controllers/npad.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 211b8bb60a..282953bab2 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -104,7 +104,8 @@ void Controller_NPad::OnInit() { } std::memcpy(supported_npad_id_types.data(), npad_id_list.data(), npad_id_list.size() * sizeof(u32)); - if (controller_count == 0) { + if (std::none_of(connected_controllers.begin(), connected_controllers.end(), + [](const ControllerHolder& controller) { return controller.is_connected; })) { AddNewController(NPadControllerType::Handheld); } } @@ -272,7 +273,7 @@ void Controller_NPad::OnUpdate(u8* data, std::size_t data_len) { } std::memcpy(data + NPAD_OFFSET, shared_memory_entries.data(), shared_memory_entries.size() * sizeof(NPadEntry)); -} +} // namespace Service::HID void Controller_NPad::SetSupportedStyleSet(NPadType style_set) { style.raw = style_set.raw; @@ -333,6 +334,11 @@ void Controller_NPad::AddNewController(NPadControllerType controller) { LOG_ERROR(Service_HID, "Cannot connect any more controllers!"); return; } + if (controller == NPadControllerType::Handheld) { + connected_controllers[8] = {controller, true}; + InitNewlyAddedControler(8); + return; + } connected_controllers[controller_count] = {controller, true}; InitNewlyAddedControler(controller_count++); }