UBSan would report this when starting Full Throttle, for example:
runtime error: signed integer overflow: 2147287044 + 393204 cannot be
represented in type 'int'
Change checked by AndywinXp.
The bug also happens with the original interpreter, but the workaround
is backported from the 2017 remaster, and so it probably qualifies as an
enhancement, if one really wants to be as close as possible to the
original experience and the original bugs.
These changes make use of _mixer->getOutputStereo() to select the proper number of audio channels.
This makes it possible to have mono audio produced using the proper DiMUSE internal mixer mono
routines, instead of having the ScummVM mixer folding down a stereo mix.
This code is present in all the original interpreters using Digital iMUSE, and it was implemented
in order to allow slower CD drives to fetch new data without having music skipping during load times.
This works by basically flooding the music buffer with data whenever a big resource, a voice file, or
a SMUSH movie is loaded.
Arguably this is not needed for devices using SSD drives, but since this change had its benefits on a
quite old laptop of mine, and since the memory overhead is very minimal, I have decided to implement it.
Previously we had asserts instructions in place for this; they work under the assumption that the user
always has the sound files available. Unfortunately this assumption breaks in at least two cases:
- The user plays the COMI demo (small version, without sound files);
- The user copies the whole COMI game from the CDs/Steam to the device of choice (e.g. tablet),
and doesn't copy the BUN files over (e.g. for storage issues).
We simply remove the assertions and put a check in its place, and if that check fails we just exit
the function and resume normal execution. This fixes#13845.
This replaces every single strcpy call in the engine with
Common::strlcpy.
Some of these might cases seem a bit pointless, but it is
supposed to discourage future use of strcpy. If people don't
see a single occasion of it they might think twice before they
use it...
The map in IMuseDigiDispatch can contain unaligned blocks if it
contains a TEXT block with a length not divisible by four. This causes
unaligned memory accesses in a few places.
This commit fixes the issue by ensuring only aligned pointers are typed
as `int32 *` while unaligned pointers are typed as `uint8 *` and are
only accessed through helper functions.
Every functionality has been implemented (audio options, text options, saving and loading).
The only thing currently missing from the menu is the thumbnail handling.
The call was unnecessary since the one being fundamental is the call made
to the resource manager mutex in _vm->getResourceAddress(); this fixes
some very rare (but also very real) cases of v7-8 games softlocking.
This fixes instances in which audio chunks with a sample rate equal to a
quarter of the global one were not mixed correctly, causing wave aliasing
during the reconstruction of the analog signal from the digital one.