godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.55k stars 20.27k forks source link

Remove a non-xinput device joymapping cause game crash #91257

Open yikescloud opened 5 months ago

yikescloud commented 5 months ago

Tested versions

godot 4.2 godot 3.6

System information

windows 10

Issue description

When multi joypad connect and has a xinput joypad and a non-xinput joypad, remove the non-xinput joypad mapping then press any button on xinput-joypad cause game crash, pop a ERROR: FATAL: Index p_index = 754 is out of bounds (size() = 754). <-- the line in gamecontrollerdb and this line has the xinput mapping looks like it remove xinput and cannot find it.

Steps to reproduce

You should at least has 2 joypad to reproduce this. Use Input.remove_joy_mapping remove a non-xinput joypad mapping. then press any button/axis on xinput joypad, game should crash immediate

Minimal reproduction project (MRP)

xinput_crash.zip

dannygaray60 commented 2 months ago

I've encountered the same problem with Godot 3.6beta5. I have two gamepads connected (an Xbox Series one and a generic PS3 one). When using Input.remove_joy_mapping(gamepad_guid), the game crashes and closes without giving any error message.

Deleting the mapping of the XInput controller causes it to close immediately, while deleting the mapping of the PS3 controller only causes it to close when receiving any input from the Xbox controller.