Skip to content

Commit 2da50e0

Browse files
authored
Merge pull request #79 from PiterWeb/main
Fix windows gamepad (caused no compile), fix linux gamepad race
2 parents 6e08a67 + c5b53c0 commit 2da50e0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/devices/gamepad/handler_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ func HandleGamepad(gamepadChannel *webrtc.DataChannel) {
4242
}()
4343

4444
var lastPad GamepadAPIXState
45-
46-
var actualPad GamepadAPIXState
4745

4846
// Update the virtual device
4947
gamepadChannel.OnMessage(func(msg webrtc.DataChannelMessage) {
@@ -52,6 +50,8 @@ func HandleGamepad(gamepadChannel *webrtc.DataChannel) {
5250
return
5351
}
5452

53+
var actualPad GamepadAPIXState
54+
5555
err := jsoniter.ConfigFastest.Unmarshal(msg.Data, &actualPad)
5656

5757
if err != nil {

src/devices/gamepad/handler_windows.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ func gamepadAPIXToXInput(gms GamepadAPIXState) XInputState {
8282

8383
return XInputState{
8484
ID: ID(gms.Index),
85-
Connected: gms.Connected,
85+
// Connected: gms.Connected,
86+
Connected: true,
8687
Packet: uint32(time.Now().Nanosecond()), // Different values trigger update
8788
Raw: RawControls{
8889
Buttons: convertGamepadButtons(gms.Buttons),

0 commit comments

Comments
 (0)