With Gamepad plugged in, ET:L does not start - black screen, not responding - SDL BUG #2833
With ET:L 2.71a, having my Razer Onza (XBox-style gamepad controller) plugged in ET:L does not start at all.
SDL2.dll seems to continually throw access violation exceptions.
In order to get a stacktrace I built 8ed276 myself with nmake VS2013, built SDL2 from the sources in the lib folder, and replaced the contents of SDL2-windows with the self-compiled SDL2 include files and library files.
The stack trace is attached as a screenshot.
#2 Updated by Kissaki over 4 years ago
I debugged a bit.
calls SDL2.dll SDL_Init
calls SDL2.dll SDL_SYS_JoystickInit
calls SDL2.dll SDL_SYS_JoystickDetect
calls IDirectInput8_EnumDevices with a non-NULL dinput
Through etl.exe IN_InitJoystick
calls SDL2.dll SDL_JoystickQuit
calls SDL2.dll SDL_SYS_JoystickQuit
SDL_SYS_JoystickQuit unsets dinput via `IDirectInput8_Release(dinput);`
Then, during event polling in the main event loop,
etl.exe IN_ProcessEvents 1030
calls SDL2.dll SDL_SYS_JoystickDetect again,
calls IDirectInput8_EnumDevices with with dinput = NULL (after it was released above
Thus, I suspect `IDirectInput8_EnumDevices` dereferences dinput which is NULL, which results in an access violation.
My guess now is that my gamepad is recognized my SDL2, an added event is added to the event queue, but the ETL code releases the joystick before this event is handled.
So I guess, either the early release is not allowed by the SDL, or the SDL is not robust enough.
#6 Updated by Spyhawk over 4 years ago
18:01 < Kissaki> currently forumlating a robustness question on their irc :) 18:04 < Ensiform> what SDL2 18:11 < Ensiform> where is LegacySDL_Init 18:12 < Ensiform> according to docs the added NOPARACHUTE is irrelevant :d 18:14 < Ensiform> SDL_Quit is also ignored on windows 18:14 < Kissaki> it's an etl implementation error. SDL guys say only one SDL_Init should be called, and subsystems be initialized by SDL_InitSubsystem 18:15 < Ensiform> also an ioq3 error
#7 Updated by Kissaki over 4 years ago
18:14 < Kissaki> it’s an etl implementation error. SDL guys say only one SDL_Init should be called, and subsystems be initialized by SDL_InitSubsystem
Initial misinformation by one of the people in their IRC. Was resolved through discussion.
I created a minimal program for reproducibility of the issue and will submit it to the SDL bug tracker.
Before that, will try with their current HEAD version.
As for the not directly associated LegacySDL_Init, I did local commits cleaning that up as well as the incomplete checks of the return code and will try to send that as a PR.
#13 Updated by Spyhawk over 4 years ago
Since we’ve had at least 5 reports of crash-at-startup on Windows in the past few days, I disabled the Joystick code for now.
According to SDL #2833 and the attached test program, it seems to really be a SDL2 bug - nothing we can do here.
But maybe it’d be worth adding some macro to enable it for Pandora users only?
#21 Updated by IR4T4 over 3 years ago
- Target version changed from ALL to 2.75
- Improved joystick hot-plug detection
I don’t know if SDL 2.04 fixes the above case Kissaki discovered or the issues with OSX. However our joystick code is inactive (see IN_InitJoystick()) and we should enable it again.
IN_InitJoystick() needs some rework: Regardless how in_joystick cvar is set the code tries to init system joysticks/gamepads. We should check in_joystick at start of IN_InitJoystick(), so there is no system init process when in_joystick is set to 0.
#22 Updated by IR4T4 over 3 years ago
- Subject changed from With Gamepad plugged in, ET:L does not start - black screen, not responding to With Gamepad plugged in, ET:L does not start - black screen, not responding - SDL BUG #2833
- Target version changed from 2.75 to ALL
- % Done changed from 0 to 20
Joystick code has been enabled again. In case of crash restart ETL:
etl[exe] +set in_joystick 0
Waiting for the SDL fix - moved to milestone ALL.