Commit graph

311 commits

Author SHA1 Message Date
Filippos Karapetis
f65dd2cc4d SCUMM: DIMUSE: Initialize class members 2024-11-16 18:40:51 +02:00
Torbjörn Andersson
81b938eafc SCUMM: Fix one of many Full Throttle Valgrind warnings 2024-11-16 18:40:51 +02:00
Torbjörn Andersson
f300e9f87e SCUMM: Initialize data to avoid Valgrind warnings on saving
This is enough to silence all the Valgrind warnings I got when saving in
The Dig.
2024-11-16 18:40:51 +02:00
Hubert Maier
370064f93f JANITORIAL: SCUMM: Fix typos 2024-09-16 01:55:26 +03:00
AndywinXp
342afe0925 SCUMM: DIMUSE: Rename previously mislabeled argument in dispatchSwitchStream() 2023-11-26 12:54:24 +01:00
AndywinXp
8461f25218 SCUMM: Rename enhancementClassActive to enhancementEnabled 2023-11-08 11:46:06 +01:00
AndywinXp
d5fa7aeb90 SCUMM: Mark all enhancements with their respective classes 2023-11-08 11:46:06 +01:00
AndywinXp
61a700ed67 SCUMM: DiMUSE: Fix unused private field warning 2023-08-15 20:42:16 +02:00
AndywinXp
ca36141f9b JANITORIAL: SCUMM: Remove magic numbers from DiMUSE engine
Also improve readability on some bits
2023-08-03 23:58:38 +02:00
Vladimir Serbinenko
b06893a692 SCUMM: Support extracting resources from macbinary 2023-05-10 22:44:04 +02:00
Vladimir Serbinenko
0208fac907 SCUMM: Make Scumm*File compatible with non-File streams 2023-05-10 22:44:04 +02:00
AndywinXp
84b2f1fd11 JANITORIAL: SCUMM: Improve readability of SMUSH audio code 2023-01-19 10:31:13 +01:00
Donovan Watteau
af841a27c7 SCUMM: DIMUSE: Fix signed integer overflow warning from UBSan
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.
2023-01-18 20:50:33 +01:00
Donovan Watteau
7a522f5ec3 SCUMM: FT: Make the Kick Stand bar music workaround an optional enhancement
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.
2023-01-18 20:45:05 +01:00
AndywinXp
d4a0ac0e78 SCUMM: DIMUSE: Fix uninit memory read for low latency mode 2023-01-15 12:12:06 +01:00
BLooperZ
4f5a71aae1 SCUMM: FT: Fix unitialized stream in low latency mode 2023-01-14 21:27:29 +01:00
AndywinXp
845c739801 SCUMM: DIMUSE: Avoid using a nullptr stream 2023-01-12 22:11:12 +01:00
AndywinXp
8d6737e16f SCUMM: DIMUSE: Increase buffer size for low latency mode 2023-01-10 21:17:23 +01:00
AndywinXp
8d0e97af70 SCUMM: DIMUSE: Implement low latency mode
This fixes bug #13462
2023-01-10 21:17:23 +01:00
AndywinXp
833703b0b1 JANITORIAL: SCUMM: Remove magic numbers and document VOC format blocks 2023-01-04 19:59:42 +01:00
AndywinXp
4d556f0db6 JANITORIAL: SCUMM: Change order of class members declarations
The _output* vars are semantically separate from the _internal* ones
2023-01-03 09:51:15 +01:00
AndywinXp
5b18d1aa6b SCUMM: DIMUSE: Implement support for higher internal sample rates
This lays the ground for:
* Supporting fan dubbings and self-made high quality music replacement;
* Reintroduction of support for compressed audio.
2023-01-02 23:30:57 +01:00
AndywinXp
92efa503fb SCUMM: DIMUSE: Fix theoretical possibility of division by zero 2023-01-02 23:05:50 +01:00
AndywinXp
c3256a614a SCUMM: DIMUSE: Make engine sample rate and feed size parametric 2023-01-02 22:55:26 +01:00
AndywinXp
b4c52cac22 SCUMM: DIMUSE: Implement adaptive buffer underrun correction
Thanks to lephilousophe for the help on this one :-)
2023-01-02 17:50:00 +01:00
AndywinXp
3c81f19840 SCUMM: DiMUSE: Prevent negative buffer count in roundRobinSetBufferCount() 2022-12-04 23:01:06 +01:00
AndywinXp
5190796a3d JANITORIAL: SCUMM: Rename _budleDirCache to _bundleDirCache
Typo :-)
2022-12-04 22:21:18 +01:00
AndywinXp
344349dbd9 SCUMM: DiMUSE: Allow original mono mixing routines to work
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.
2022-11-27 12:25:14 +01:00
Le Philousophe
137b51d7ac SCUMM: Don't use unsafe sprintf and vsprintf 2022-10-23 22:46:19 +02:00
AndywinXp
938212c6f1 SCUMM: DiMUSE: Fix endianness issues with speech lipsync 2022-10-10 21:26:26 +02:00
AndywinXp
474ccf041a SCUMM: DiMUSE: Clarify and document IMuseDigital::tracksLipSync() 2022-10-10 00:46:05 +02:00
AndywinXp
7077d8d124 SCUMM: Fix AmigaOS and NDS builds 2022-10-04 13:50:49 +02:00
AndywinXp
a7a4d9f120 SCUMM: DiMUSE: Implement antiskip system for devices with slow load times
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.
2022-10-04 11:34:14 +02:00
Andrea Boscarino
6ad5ed0b92 SCUMM: DiMUSE: Solve very rare deadlocks caused by two different mutex objects 2022-10-04 11:33:26 +02:00
AndywinXp
57a4f165d5 SCUMM: DIMUSE: Add defines for magic numbers and command IDs 2022-10-01 17:47:17 +02:00
AndywinXp
c1502271b4 SCUMM: DiMUSE: Don't crash the app if we try to deallocate a non-existent soundfile
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.
2022-09-26 15:25:18 +02:00
AndywinXp
457bcb67db SCUMM: GUI: Implement the majority of the v7 Main Menu 2022-09-08 19:10:42 +02:00
athrxx
3d39d206ee SCUMM: replace strcpy calls with Common::strlcpy
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...
2022-08-27 13:08:38 +03:00
Dominik Kreutzer
f9f864c959 SCUMM: DiMUSE: Fix unaligned map access
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.
2022-08-19 16:59:23 +02:00
AndywinXp
edf63e8672 SCUMM: DiMUSE: Prevent crashes if a .SOU/.BUN file can't be found 2022-08-13 11:57:55 +02:00
Donovan Watteau
4ec06a2bf6 SCUMM: Unify WORKAROUND usage and complete/tweak some of them 2022-08-07 17:24:27 +02:00
AndywinXp
61535ee8c9 SCUMM: DiMUSE: Increment upper and lower limit for roundRobinSetBufferCount() 2022-08-06 13:33:56 +02:00
AndywinXp
51d0b8ef06 SCUMM: COMI: Implement iMUSE buffer toggle GUI banner 2022-08-06 13:33:56 +02:00
AndywinXp
1e9d51c28a SCUMM: COMI: Implement the original main menu
Every functionality has been implemented (audio options, text options, saving and loading).
The only thing currently missing from the menu is the thumbnail handling.
2022-08-06 13:33:56 +02:00
Donovan Watteau
27f9a460b5 JANITORIAL: Fix "the the" and similar typos 2022-07-29 19:36:40 +03:00
AndywinXp
2a13273e5c SCUMM: DiMUSE: Remove unnecessary mutex call causing softlocks
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.
2022-07-28 00:16:17 +02:00
AndywinXp
9518dc5341 SCUMM: DiMUSE: Fix if guard for quarter samplerate case
Also, amend a5d4e15 which removed the half samplerate case.
2022-07-13 07:50:04 +02:00
D G Turner
a5d4e15f14 SCUMM: DiMUSE: Remove Older Code Path for 8-bit Stereo Audio Mixing
This would have been executed instead of the newer code added in the
previous commit on this module.
2022-07-13 00:51:33 +01:00
AndywinXp
19a7a40c41 SCUMM: DiMUSE: Properly mix audio which with quarter sample rate
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.
2022-07-12 17:49:26 +02:00
AndywinXp
2eb63a8931 SCUMM: DiMUSE: Fix possible heap buffer overflow when fetching sound header 2022-05-28 10:30:40 +02:00