This doesn't implement full sound support but stubs out most of the
sound code under SDL3, so that we can implement it piecemeal.
Implemented here:
1. Sound device initialization.
2. SVid sound playback.
Does not add a dependency on `SDL_mixer`: SDL3 built-ins
are enough to play SVid audio.
In C++, globals initialization order accross translation units is not
defined. Accessing a global via a function ensures that it is initialized.
This will be needed for #7638, which will statically initialize change
handlers after the Options object has been initialized.
SMK format actually defines frame durations in units that are 0.01ms:
91e732bb69/src/SmackerDecoder.cpp (L329-L334)
That's great because it means we can do everything using integer math.
The only named code that was ever set is `STORM_ERROR_NO_MESSAGES_WAITING`.
There was also a call in `menu.cpp` which as far as I can tell is not
needed (if it is, it should be replaced by something else).
Done with the following script:
```ruby
Dir["Source/**/*.{h,c,cc,cpp,hpp}"].each do |path|
v = File.read(path)
next if !v.include?("uint32_t") || v.include?("cstdint")
lines = v.lines
line_num = if lines[2].start_with?(" *")
lines.index { |l| l.start_with?(" */") } + 3
else
3
end
lines.insert(line_num, "#include <cstdint>\n")
File.write(path, lines.join(""))
end
```
then fixed-up manually
Each resampler allocates an input buffer and an output buffer.
Since we create ~100 audio stream objects (1 per `sfx_MISC` effect),
the memory cost of these buffers adds up.
Avoids creating a resampler when the audio sampler rate matches the
output sample rate. This is mostly the case when the output sample
rate is 22050.
When using `UNPACKED_MPQS`, avoid all the SDL machinery for reading
files.
This is beneficial not only due to reduced indirection but also because
we can test for the file's existence and get the file size without
opening it, which is much faster.
* Synchronize item placement in player's backpack
* Synchronize item remove from player's backpack
* Synchronize item placement and removal from player's belt
* Set up loopback network provider for failing tests
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.
This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.
Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
1. Removes adjustments to `orig/system_palette`.
They're not needed because videos have a separate render loop.
For an in-game movie, the caller sets the palette after the movie.
2. Splits some of `SVidPlayContinue` code into functions
(`UpdatePalette` and `BlitFrame`).
3. Adds a separate config variable for SDL1 SVid video mode.
E.g. on rg99 there isn't enough video RAM for double-buffering
the main game but we can do it for the videos.
libmpq is a much simpler alternative to StormLib for reading MPQ archives.
We use our own fork of libmpq: https://github.com/diasurgical/libmpq
Impact:
* DevilutionX is now a lot more portable. Unlike StormLib, libmpq only
needs platform-specific code for Windows.
* Locks around file access **removed** (instead we duplicate the file descriptor for streamed audio only).
* RAM usage is **300 KiB** lower than StormLib.
* Stripped release linux_x86_64 binary is **32 KiB** smaller.
* Amiga build now hangs instead of crashing.