Hard Light Productions Forums

General FreeSpace => FreeSpace & FreeSpace Open Support => Topic started by: Bryan See on December 10, 2016, 10:16:15 am

Title: joy-sdl.cpp crash on mission start
Post by: Bryan See on December 10, 2016, 10:16:15 am
Upon starting a mission after a briefing/ship selection/loadout screen, an Assert message appeared:

Code: [Select]
Assert: "index >= 0 && index < numHats()"
File: joy-sdl.cpp
Line: 445
Invalid index 0!

ntdll.dll! NtWaitForSingleObject + 20 bytes
KERNELBASE.dll! WaitForSingleObjectEx + 143 bytes
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
KERNEL32.DLL! BaseThreadInitThunk + 20 bytes
ntdll.dll! RtlUserThreadStart + 33 bytes
[...]
[ This info is in the clipboard so you can paste it somewhere now ]


Use Debug to break into Debugger, Exit will close the application.

ntdll.dll! NtWaitForSingleObject + 20 bytes
KERNELBASE.dll! WaitForSingleObjectEx + 143 bytes
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_7_5_20161201_be27e65_x64_SSE2-FASTDBG.exe! <no symbol>
KERNEL32.DLL! BaseThreadInitThunk + 20 bytes
ntdll.dll! RtlUserThreadStart + 33 bytes

It may be related to joystick part of SDL, I presume.
Title: Re: joy-sdl.cpp crash on mission start
Post by: AdmiralRalwood on December 10, 2016, 01:10:28 pm
Looks like some of the input code was assuming any joystick would have at least 1 hat; I've opened a PR (https://github.com/scp-fs2open/fs2open.github.com/pull/1088) to fix this assumption.
Title: Re: joy-sdl.cpp crash on mission start
Post by: Bryan See on December 12, 2016, 02:22:28 am
Thanks for the tip, Admiral Ralwood! And this includes taking into account whether any joystick is connected or not, internally or externally.
Title: Re: joy-sdl.cpp crash on mission start
Post by: AdmiralRalwood on December 12, 2016, 12:47:04 pm
Thanks for the tip, Admiral Ralwood! And this includes taking into account whether any joystick is connected or not, internally or externally.
The code already checked for a joystick actually being present; the problem only occurred if you had a joystick connected and that joystick had no hat switches.
Title: Re: joy-sdl.cpp crash on mission start
Post by: Bryan See on January 20, 2017, 10:58:03 am
Still happened even after a fix, here's a link: http://www.hard-light.net/forums/index.php?topic=93045.0#new (http://www.hard-light.net/forums/index.php?topic=93045.0#new).