A error in how the size of the audio data was calculated meant that the
last eight bytes were never decrypted. As far as I can tell, this bug
was there for more than twenty years! Other than the encryption, the
sound resources appear to be identical to the VGA CD ones.
What is now missing is the delay time between phrases.
Some of the code will be refactored, since this was
hacked in for mantaining compatibility with stuff outside
of MI1:SE.
- Injected the audio code in the correct place (displayDialog), from
disasm provided by @AndyWinXP (thanks!)
- Added support for multiple speech files for the same message
- Added game flag to MI1SE, for using remastered audio
TODOs:
- Correctly calculate the local script offset for all scripts
e.g. object scripts, such as Elaine's poster in the second screen)
- Handle multiple speech files for the same message
- Add handling for speech delay
All the functionality is hooked in the same manner as the Loom Steam
CD audio code. It's still disabled though, since WMA decoding isn't
implemented yet.
There are three known audio formats in MI1 SE and MI2 SE:
- PCM (tested and working)
- WMA (missing implementation)
- MP3 (currently crashes)
Add a game flag for Doublefine packed games, and simplify
the instantiation of the PAK file handler. This avoids
clashes with other packed games (e.g. the Mac version of DOTT)
We need to cache the location of monster.sou, otherwise we'll end up
reindexing the PAK file on every speech sound.
With this, the classic version of DOTT found in the remaster works
This sometimes happens in MI2 and causes weird sounds. The original
would be unable to play that, since the sound tags are strictly tied to
the drivers and no driver will ever eat anything but its own data type.
But our resource maangement works differently, so it could happen...
Keeping the check, while consistent with the default implementation of
isSoundRunning(), would in fact break HE games. They have their own
implementation of isSoundRunning(), while isSoundInUse() is used by all.
This brings isSoundInUse() and isSoundRunning() closer to each other,
while still maintaining the documented differences. It seems to fix a
problem I had where the "follow the shopkeeper" music in the Mac version
of Monkey Island 1 expired when reaching the island overhead map,
causing the music to be be replaced with the regular overhead map theme.
I reviewed what I was comfortable with; this change is not complete
(and I didn't review the HE workarounds at all), but it's still an
improvement.
I may need to update the Enhancement page on the wiki with these
changes...
Algorithm taken from SAMNMAX disassembly.
INDY4 and DOTT share another earlier algorithm, but I couldn't
understand the code enough to know if the resulting effect
is different or not.
Instead of trying to identify it by looking for a value expected to be
the same for all sound effects (which turns out to not be as reliable as
hoped), look for a value that appears to be the same in all music.
This fixes a missing sound effect when pouring liquids, e.g. when
filling the beer stein in the castle Brunwald kitchen, or pouring liquid
on the Venice catacomb torch to loosen it.
Albeit not 100% necessary for rewriting the HE sound engine,
I decided to make this change in order to:
- Give proper meaning to magic numbers and variables
which were given temporary names 20 years ago;
- Avoid going insane when making comparison with HE code
and ours, when rewriting the sound code.
If you ring the boxing bell right at the start of the game, you'll see
Indy hit it 3 times, but the actual bell sound will only be heard twice.
This doesn't happen in the original interpreter or in the other releases
where it can be heard 3 times as expected. Another example is the sound
effect for thunder when Indy is outside the windows of Castle Brunwald;
although it sounds a bit weird this way, the sound is really meant to
have some quick "false starts".
The byte at offset 26 might be responsible for this, in that if it's
unset, the current (identical?) sound is maybe meant to be interrupted.
This is just based on the Indy3 Amiga fixes brought by PR#3598, and
from some naive guesswork. But this change is only applied to Indy3 Mac
and appears to cause no regression (I've done a full gameplay).
Thus, until someone checks this against the original Indy3 Macintosh
interpreter (we have no disasm for it yet), doing this change probably
makes sense for now...
And Andy says I should be more confident about this change :p
(Monkey 1 EGA / CMS music and sound effects dissapear after loading saved game)
This is at least one obvious bug which I found. For CMS sound the sound resources get invalidated after one use which is only supposed to happen if the resource cannot be loaded.
MI1 also has other issues with CMS sound if the user changes the sound setting between savegames. The savegames are not compatible. But that is a more complex thing to fix and might not be related to the bug ticket.
Also, we might need to restore sounds that were currently playing at the time of saving (but I have to check if the original actually does that for CMS).