LIJI32 / SameBoy

Game Boy and Game Boy Color emulator written in C
https://sameboy.github.io/
Other
1.65k stars 207 forks source link

Warn user about SDL initialization failure #568

Open hitomi-nakayama opened 11 months ago

hitomi-nakayama commented 11 months ago

On my system, I had issues with SameBoy detecting my controller, though sound and graphics were working. It turns out that it was because SDL_Init was silently failing, as my system's SDL was compiled without support for haptics. (My Gentoo Linux system's libsdl2 was built without the haptic USE flag. After re-installing with the haptic flag enabled, my controller worked.)

This patch will now give the user this warning: Couldn't initialize SDL: SDL not built with haptic (force feedback) support.

hitomi-nakayama commented 11 months ago

This may not be the best solution to the overall issue.

We could additionally warn the user that the lack of haptics support may lead to no controller functionality. Alternatively, we can conditionally enable haptics support for SameBoy compilation, so that SDL initialization will not fail on these systems.

ISSOtm commented 3 months ago

Perhaps it may be more useful to call SDL_InitSubSystem for each thing we want to init, and report errors for each. The increased granularity then would make the error messages more useful.

The questions then are: