This reverts commit 747b3dfcfe.
# Conflicts:
# libraries/asmjit/asmjit/core/compiler.h
This had to be reverted because it breaks exception handling which is a critical problem.
With the updated code any exception thrown inside code that had a JITed call stack would crash.
FluidSynth 1.x: these functions return 1 on success and 0 otherwise
FluidSynth 2.x: these functions return FLUID_OK (0) on success and FLUID_FAILED (-1) otherwise
The main exits are initiated from code that cannot filter this back to D_DoomMain easily so the exception is the only way to get there.
The 3 main points of exit are:
* quit/exit CCMD
* quitting the menu through ST_Endoom
* receiving a quit message on the main window.
These ones were particularly bad examples of misusing the exit handlers by temporarily installing one themselves and then calling exit to clean stuff up.
Now they just return an error code to D_DoomMain to perform a regular exit.
The main catch is now in D_DoomMain, only calling platform specific functions to handle the output for the error.
As a nice side effect, -norun can now be done without an exception, just by exiting D_DoomMain with a special exit code.
This implementation only reads GIF, BMP and PIC formats. No animated GIF support because stb_image does not handle that.
PNG, JPG and TGA are still being handled by the existing dedicated implementations.
PSD and HDR are impractical for reading texture data and thus are disabled.
PnM could be enabled, if its identification semantics were stronger. stb_image only checks the first two characters which simply would falsely identify several flats with the right colors in the first two bytes.
This is more or less a waste product of getting stb_image to work with something actually testable, so it is just provided as-is.
DYN_SNDFILE=NO and DYN_MPG123=NO were ignored while DYN_FLUIDSYNTH=NO broke compilation
These options should be applied to ZMusic target instead of the main executable
As a bonus, it's now possible to build GZDoom without FluidSynth
Since this made heavy use of Windows type, those were duplicated to avoid rewriting the entire interface.
This split at least reduces the amount of code needed to refactor for making the screens work on other platforms than Windows.
Now there is only one single entry point for both, instead of previously 2 entry and 4 exit points.
This also eliminates the explicit shutdown of ZMusic. Timidity++'s two buffers have been put in containers that self-destruct on shutdown and calling dumb_exit is not necessary because the only feature requiring it is not used by any code in the music library.
Instead of trying a homegrown way to avoid recursive exceptions, let's do it with the defined procedure C++ has for this case: call std::terminate.
This allowed removing some old hackery inherited from Boom and will now hopefully allow sanitizing the exit procedure to the point that it can be done without depending on exit handlers.
The only difference here were the size values on Windows but for this initial call they have been useless for a long time. When this code was written the console buffer still had a fixed width that needed to be set before adding any text.
Mainly done to isolate the calls that actually manipulate the global frame buffer.
V_Init alsoi initialized some palette data, which was moved to V_InitPalette and did something entirely different when running a restart as opposed to an initial start.
Default: off (false)
When this option is enabled (true), then exiting the game from
main menu and by menu_quit command doesn't require confirmation
and doesn't play sound.
Steps to reproduce:
1. Load game.
2. Press any key to bring up the main menu.
3. Move the mouse anywhere out of the menu entries.
4. Press Down arrow.
Expected result: the menu cursor sound is played, the first menu element is selected.
Actual result: the menu cursor sound is played, no menu element is selected.
Repeated Down arrow pressing doesn't give any result, either.
If on step 4 Up arrow is pressed, the last element in the menu is selected.