Redot-Engine / redot-engine

Redot Engine – Multi-platform 2D and 3D game engine
https://redotengine.org/
MIT License
4.4k stars 183 forks source link

[Godot] Input.joy_connection_changed bug on disconnect joypad (no signal emit) #192

Open Andrew6311 opened 2 weeks ago

Andrew6311 commented 2 weeks ago

Tested versions

v4.3.stable.official

System information

Windows 10, v4.3.stable.official [77dcf97], Vulkan

Issue description

When connecting and disconnecting joypads, information is transmitted via a signal to some function and the Array Input.get_connected_joypads() is also formed. When 2 joypads are connected in series (!), each one triggers the signal connected = true.

When disconnecting joypads in series (!), the return signal disconnected = true does not trigger, if the first joypad#1 on device0 was disconnected first. Thus, Joypad#2 on device1 remains in Input.get_connected_joypads(), while all joypads are disconnected.

The description says that the signal is emitted every time a connection or disconnection occurs, which does not happen.

Steps to reproduce

1) Create a simple 2D scene. 2) Attach a script with the code:

extends Node2D

func _ready() -> void:
    Input.joy_connection_changed.connect(_on_joy_connection_changed)

func _on_joy_connection_changed(device: int, connected: bool):
    if connected:
        prints("Joypad Array", Input.get_connected_joypads())
    else:
        prints("Joypad Array", Input.get_connected_joypads())

3) Run the scene and start connecting joypads 4) Then when we see Joypad Array [0, 1] in the console:

a) Disconnect in reverse order - joypad#2, then joypad#1. Everything works, Joypad Array [] all joypads are excluded.

b) Connect back, first joypad#1 then joypad#2. After that, first disconnect joypad#1 (`device0`) then disconnect joypad#2 (`device1`). Joypad Array [1] all joypads are excluded. The list of joypads should be Joypad Array [].

If after this you connect any joypad that gets to `device0`, then the `disconnected = true` signal is triggered and immediately `connected = true` is triggered. The list of devices becomes Joypad Array [0].

Minimal reproduction project (MRP)

Input bug Project.zip

jawbroken commented 1 week ago

why are you reporting real bugs here? the guy who made this fork can't code or fix them. report them to the real project

Andrew6311 commented 1 week ago

I did it 3 weeks ago.

чт, 10 окт. 2024 г., 18:26 jawbroken @.***>:

why are you reporting real bugs here? the guy who made this fork can't code or fix them. report them to the real project

— Reply to this email directly, view it on GitHub https://github.com/Redot-Engine/redot-engine/issues/192#issuecomment-2405433143, or unsubscribe https://github.com/notifications/unsubscribe-auth/BK2A5Y6WAWTTJ3HCLWFKDQTZ22MBXAVCNFSM6AAAAABPOEIPWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBVGQZTGMJUGM . You are receiving this because you authored the thread.Message ID: @.***>

jawbroken commented 1 week ago

hmm…how's the weather in moscow, russian bot

jawbroken commented 1 week ago

that was rude, sorry. please just withdraw your forces from ukraine 🇺🇦 and stop interfering in the US elections 🇺🇸 then we can have a civilised discussion 🫶🏽

jawbroken commented 1 week ago

oh man, the aurora borealis is going off in russia right now @Andrew6311 you should go outside right now and take some pictures for me

Spartan322 commented 6 days ago

Does this have a related Godot issue?

SkogiB commented 6 days ago

Does this have a related Godot issue?

Andrew added one 2 weeks ago https://github.com/godotengine/godot/issues/97539

There's also this one from Aug https://github.com/godotengine/godot/issues/96020