Skip to content
Snippets Groups Projects
Commit 334ef2ef authored by Morph's avatar Morph
Browse files

controllers/npad: Fix LibNX controller connection statuses

This allows homebrew applications to be able to properly detect connected controllers.
parent e7c174b4
No related branches found
No related tags found
No related merge requests found
...@@ -375,6 +375,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* ...@@ -375,6 +375,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index]; auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index];
libnx_entry.connection_status.raw = 0; libnx_entry.connection_status.raw = 0;
libnx_entry.connection_status.IsConnected.Assign(1);
switch (controller_type) { switch (controller_type) {
case NPadControllerType::None: case NPadControllerType::None:
...@@ -387,6 +388,8 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* ...@@ -387,6 +388,8 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
main_controller.pad.pad_states.raw = pad_state.pad_states.raw; main_controller.pad.pad_states.raw = pad_state.pad_states.raw;
main_controller.pad.l_stick = pad_state.l_stick; main_controller.pad.l_stick = pad_state.l_stick;
main_controller.pad.r_stick = pad_state.r_stick; main_controller.pad.r_stick = pad_state.r_stick;
libnx_entry.connection_status.IsWired.Assign(1);
break; break;
case NPadControllerType::Handheld: case NPadControllerType::Handheld:
handheld_entry.connection_status.raw = 0; handheld_entry.connection_status.raw = 0;
...@@ -398,6 +401,12 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* ...@@ -398,6 +401,12 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
handheld_entry.pad.pad_states.raw = pad_state.pad_states.raw; handheld_entry.pad.pad_states.raw = pad_state.pad_states.raw;
handheld_entry.pad.l_stick = pad_state.l_stick; handheld_entry.pad.l_stick = pad_state.l_stick;
handheld_entry.pad.r_stick = pad_state.r_stick; handheld_entry.pad.r_stick = pad_state.r_stick;
libnx_entry.connection_status.IsWired.Assign(1);
libnx_entry.connection_status.IsLeftJoyConnected.Assign(1);
libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
libnx_entry.connection_status.IsLeftJoyWired.Assign(1);
libnx_entry.connection_status.IsRightJoyWired.Assign(1);
break; break;
case NPadControllerType::JoyDual: case NPadControllerType::JoyDual:
dual_entry.connection_status.raw = 0; dual_entry.connection_status.raw = 0;
...@@ -408,7 +417,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* ...@@ -408,7 +417,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
dual_entry.pad.l_stick = pad_state.l_stick; dual_entry.pad.l_stick = pad_state.l_stick;
dual_entry.pad.r_stick = pad_state.r_stick; dual_entry.pad.r_stick = pad_state.r_stick;
libnx_entry.connection_status.IsConnected.Assign(1);
libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); libnx_entry.connection_status.IsLeftJoyConnected.Assign(1);
libnx_entry.connection_status.IsRightJoyConnected.Assign(1); libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment