hex007 / freej2me

A free J2ME emulator with libretro, awt and sdl2 frontends.
Other
469 stars 72 forks source link

"Orcs and Elves" endlessly tries to stop MIDI streams that might not be playing #200

Closed AShiningRay closed 4 months ago

AShiningRay commented 8 months ago

A very small PR for a change, and for yet another ID Software game.

Orcs and Elves has an issue where it constantly tries to stop a MIDI stream before loading another one in. However, this doesn't go well when the stream is already stopped and seems to be buggy even when it's still playing, with the game entering a loop of endlessly issuing stop calls until it hits a Stack Overflow when notifying listeners.

Basically, it ends up like this: image

If we check isRunning() before actually issuing stop() calls, this is no longer the case and the game can be played normally (assuming #199 's fix for memory leaks in ID games is taken into account).

Still, this game has yet another bug where MIDI streams only play a single time after they're loaded, which means that you can't use the same weapon 2 times and hear the SFX two times for example. Didn't track that one down yet.