Xenoveritas / abuse

Abuse SDL port originally from Crack-Dot-Com and released into the public domain
Other
126 stars 24 forks source link

SDL_mixer 2.0 with FluidSynth support causes game to segfault on start #13

Closed chewi closed 3 years ago

chewi commented 3 years ago

With FluidSynth support enabled in SDL_mixer, the game segfaults when you actually start the game. Strangely the intro music does play though. The game runs if I give -nosound but says:

Sound: ERROR - Unrecognized audio format while loading /usr/share/games/abuse/music/abuse00.hmi

I'm not sure if that's a clue. I'm surprised it mentions the file at all when -nosound is given.

You won't hit this if FluidSynth can't find any soundfonts. If it does, you can work around the issue by setting SDL_SOUNDFONTS to the empty string, forcing SDL_mixer to fall back to Timidity, assuming support for that is enabled.

This may be a bug in SDL_mixer but I'm not sure yet. I'm especially curious because I wrote SDL_mixer's FluidSynth support! This could affect a lot of users as I know Debian enables FluidSynth.

chewi commented 3 years ago

I tried replacing abuse00.hmi with intro.hmi and it still crashes. I then deleted intro.hmi and the game starts. I therefore think this is to do with playing more than one file, rather than a bad file or a bad conversion.

chewi commented 3 years ago

I got a backtrace through gdb but I've noticed that CorsixTH segfaults in the same way when you quit the game. I wonder if it happens when you call Mix_FreeMusic before stopping the music. I would have noticed this before though so perhaps something changed in FluidSynth.

chewi commented 3 years ago

Got it! It was FluidSynth/fluidsynth@57f40ea91cae5be3f3cbf6780caf298b00ff5d8b. Reverting this against master makes it work. I'll follow this up with FluidSynth.

chewi commented 3 years ago

See FluidSynth/fluidsynth#974.

chewi commented 3 years ago

Aha, it was already fixed in SDL_mixer but no release since. I've now added a patch to Gentoo's package.