summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2018-10-10 05:21:56 +0200
committerDavid Marcec <dmarcecguzman@gmail.com>2018-10-10 05:21:56 +0200
commit46cdeb4549dbd549f9700967c25c089594f3b4ff (patch)
tree714229f888dc438711fb3a3d3c955460faa017c0 /src
parentAdded the ability to "disconnect" individual npads (diff)
downloadyuzu-46cdeb4549dbd549f9700967c25c089594f3b4ff.tar
yuzu-46cdeb4549dbd549f9700967c25c089594f3b4ff.tar.gz
yuzu-46cdeb4549dbd549f9700967c25c089594f3b4ff.tar.bz2
yuzu-46cdeb4549dbd549f9700967c25c089594f3b4ff.tar.lz
yuzu-46cdeb4549dbd549f9700967c25c089594f3b4ff.tar.xz
yuzu-46cdeb4549dbd549f9700967c25c089594f3b4ff.tar.zst
yuzu-46cdeb4549dbd549f9700967c25c089594f3b4ff.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp10
1 files 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 211b8bb60..282953bab 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++);
}