Only to create and destroy joystick devices for connected joysticks
Details
- Reviewers
Campbell Barton (campbellbarton) Sybren A. Stüvel (sybren) Mitchell Stokes (moguri) - Maniphest Tasks
- T43883: joystick Xbox does not work properly in Blender 2.73 and 2.74 testbuild
T43876: Blender Crashed by Joystick. - Commits
- rBSb4fccce1f6f4: BGE: Fix for regressions T43883 and T43456 (and T43876 likely). SDL joystick…
rBb4fccce1f6f4: BGE: Fix for regressions T43883 and T43456 (and T43876 likely). SDL joystick…
Diff Detail
- Repository
- rB Blender
Event Timeline
I'd like to know why this wasn't a problem in the past. Did other code change? Is SDL2 less forgiving?
This comes from the change to SDL2. Maybe it is related with the new way of SDL2 internal indexing to support hotplugging
Joystick (Logitech Force 3D Pro) on Win7 64-bit works fine here, with and without the patch.
@Jorge Bernal (lordloki) do you know any steps to reproduce crashes or other issues?
Strange. Maybe it is related to if SDL considers your joystick as a controller or a joystick.
Mine, It is considered a generic joystick Rainbow 7310. You can test it using testcontroller.c which comes with SDL2 source.
The steps for the issues are easy:
1st issue:
- Connect joystick
- Start blender
- start/stop BGE pressing "p" 9 times.
- crash
If you modify JOYINDEX_MAX blender will crash earlier (i.e if JOYINDEX_MAX = 2 it will crash after 3rd BGE start).
2nd issue:
- Connect joystick
- Start blender
- load a blend using joystick sensor
- start BGE
- first time it works perfectly
- stop BGE and start again
- second time doesn't works.
Edit: I forgot, it occurs always for both cases under windows. Linux it is working for me.
My joystick, according to testgamecontroller.c:
% ./testjoystick2.exe INFO: Joystick 0: Logitech Force 3D Pro (guid 6d0486c2000000000000504944564944) INFO: There are 0 game controller(s) attached (1 joystick(s))
Apparently you need to have the joystick sensor set to Axis. I had it set to Hat, which doesn't cause this crash.
I can confirm the issues, and confirm that this patch fixes them. It fixes T43876 and probably fixes T43883 + T43456 too (but they didn't attach a blend file to test with).