summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Morph2020-08-21 07:49:22 -0400
committerGravatar Morph2020-08-26 02:32:32 -0400
commit334ef2efdd54731c81f16b883413cb5cf33e481c (patch)
tree701ac2872f2f727832987d64e4cc587b8a74956b
parentcontrollers/npad: Fix LedPattern for P1-4 (diff)
downloadyuzu-334ef2efdd54731c81f16b883413cb5cf33e481c.tar.gz
yuzu-334ef2efdd54731c81f16b883413cb5cf33e481c.tar.xz
yuzu-334ef2efdd54731c81f16b883413cb5cf33e481c.zip
controllers/npad: Fix LibNX controller connection statuses
This allows homebrew applications to be able to properly detect connected controllers.
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 365db4134..d7ca07b7c 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -375,6 +375,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
375 auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index]; 375 auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index];
376 376
377 libnx_entry.connection_status.raw = 0; 377 libnx_entry.connection_status.raw = 0;
378 libnx_entry.connection_status.IsConnected.Assign(1);
378 379
379 switch (controller_type) { 380 switch (controller_type) {
380 case NPadControllerType::None: 381 case NPadControllerType::None:
@@ -387,6 +388,8 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
387 main_controller.pad.pad_states.raw = pad_state.pad_states.raw; 388 main_controller.pad.pad_states.raw = pad_state.pad_states.raw;
388 main_controller.pad.l_stick = pad_state.l_stick; 389 main_controller.pad.l_stick = pad_state.l_stick;
389 main_controller.pad.r_stick = pad_state.r_stick; 390 main_controller.pad.r_stick = pad_state.r_stick;
391
392 libnx_entry.connection_status.IsWired.Assign(1);
390 break; 393 break;
391 case NPadControllerType::Handheld: 394 case NPadControllerType::Handheld:
392 handheld_entry.connection_status.raw = 0; 395 handheld_entry.connection_status.raw = 0;
@@ -398,6 +401,12 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
398 handheld_entry.pad.pad_states.raw = pad_state.pad_states.raw; 401 handheld_entry.pad.pad_states.raw = pad_state.pad_states.raw;
399 handheld_entry.pad.l_stick = pad_state.l_stick; 402 handheld_entry.pad.l_stick = pad_state.l_stick;
400 handheld_entry.pad.r_stick = pad_state.r_stick; 403 handheld_entry.pad.r_stick = pad_state.r_stick;
404
405 libnx_entry.connection_status.IsWired.Assign(1);
406 libnx_entry.connection_status.IsLeftJoyConnected.Assign(1);
407 libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
408 libnx_entry.connection_status.IsLeftJoyWired.Assign(1);
409 libnx_entry.connection_status.IsRightJoyWired.Assign(1);
401 break; 410 break;
402 case NPadControllerType::JoyDual: 411 case NPadControllerType::JoyDual:
403 dual_entry.connection_status.raw = 0; 412 dual_entry.connection_status.raw = 0;
@@ -408,7 +417,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
408 dual_entry.pad.l_stick = pad_state.l_stick; 417 dual_entry.pad.l_stick = pad_state.l_stick;
409 dual_entry.pad.r_stick = pad_state.r_stick; 418 dual_entry.pad.r_stick = pad_state.r_stick;
410 419
411 libnx_entry.connection_status.IsConnected.Assign(1);
412 libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); 420 libnx_entry.connection_status.IsLeftJoyConnected.Assign(1);
413 libnx_entry.connection_status.IsRightJoyConnected.Assign(1); 421 libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
414 break; 422 break;