Skip to content

Commit

Permalink
Fix homebrew input (#528)
Browse files Browse the repository at this point in the history
* fix homebrew input
  • Loading branch information
emmauss committed Dec 7, 2018
1 parent 5b4382f commit f1529b1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Ryujinx.HLE/Input/Hid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void InitilizePrimaryController(HidControllerType controllerType)
PrimaryController.Connect(controllerId);
}

private HidControllerButtons UpdateStickButtons(
public HidControllerButtons UpdateStickButtons(
HidJoystickPosition leftStick,
HidJoystickPosition rightStick)
{
Expand Down
6 changes: 6 additions & 0 deletions Ryujinx.HLE/Input/HidNpadController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ public override void SendInput
Device.Memory.WriteInt64(controllerOffset + 0x28,
(Connected ? (uint)HidControllerConnState.ControllerStateConnected : 0) |
(_currentLayout == HidControllerLayouts.HandheldJoined ? (uint)HidControllerConnState.ControllerStateWired : 0));

controllerOffset = WriteInput(buttons, leftStick, rightStick, HidControllerLayouts.Main);

Device.Memory.WriteInt64(controllerOffset + 0x28,
(Connected ? (uint)HidControllerConnState.ControllerStateWired : 0) |
(uint)HidControllerConnState.ControllerStateWired);
}
}
}
6 changes: 6 additions & 0 deletions Ryujinx.HLE/Input/HidProController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public override void SendInput(
Device.Memory.WriteInt64(controllerOffset + 0x28,
(Connected ? (uint)HidControllerConnState.ControllerStateConnected : 0) |
(_wired ? (uint)HidControllerConnState.ControllerStateWired : 0));

controllerOffset = WriteInput(buttons, leftStick, rightStick, HidControllerLayouts.Main);

Device.Memory.WriteInt64(controllerOffset + 0x28,
(Connected ? (uint)HidControllerConnState.ControllerStateWired : 0) |
(uint)HidControllerConnState.ControllerStateWired);
}
}
}
2 changes: 2 additions & 0 deletions Ryujinx/Ui/GLScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public void MainLoop()
Dy = rightJoystickDy
};

currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick);

bool hasTouch = false;

//Get screen touch position from left mouse click
Expand Down

0 comments on commit f1529b1

Please sign in to comment.