Commit Graph
34 Commits
Author SHA1 Message Date
Colin Snover 4946f149b4 SCI: Improve MidiParser_SCI robustness against bad sound resources
1. KQ4 sound 104 has an extra 0xFC (MIDI Stop command/kEndOfTrack)
   at the end of the resource, which causes an out-of-bounds read
   because the filtering loop continues after the first 0xFC and
   unconditionally attempts to read 2 bytes (expecting there to
   always be a delta value + a command, whereas in this file there
   is only another kEndOfTrack command). This is corrected by
   exiting the filtering loop when a kEndOfTrack is encountered
   and there is not enough data remaining in the resource to
   continue reading.

2. KQ5 sound 699 is truncated, which causes the parser to attempt
   to read past the end of the resource. This is addressed by
   adding bounds checks that exit the mix loop early if there is
   no more data available to read. This allows truncated sounds
   to be played as far as possible (previously, trying to read
   truncated resources would result in a fatal error).

3. midiMixChannels allocates an arbitrary amount of raw memory
   for the mixed MIDI sequence, without performing any bounds
   checking when writing to this memory, potentially leading to
   a crash or silent corruption of adjacent memory. This is
   mitigated by using SciSpan instead of a raw pointer for the
   mixed data.

Fixes Trac#9727.
2017-04-16 12:23:35 -05:00
Johannes Schickel 8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Alyssa Milburn bb1cd924f0 SCI: Fix breakage from f92df4c6 2014-01-27 10:10:35 +01:00
Willem Jan Palenstijn 857d2e7bef SCI: Rewrite MIDI channel remapping
This adds MIDI state tracking to allow channels to be temporarily
unmapped and later re-mapped when there are free device channels
available again.
2013-12-31 13:52:15 +01:00
Martin Kiewitz 551e263165 SCI: revert fix music start code
add workaround for eq2
the issue is known, but can't be properly fixed without rewriting the midiparser into a channel specific parser
previous commit caused issues in kq5/french and others
2013-09-22 20:13:33 +02:00
Martin Kiewitz f1b0a77408 SCI: fix music start code fixes eq2 bug #3037267
we start at offset 10 for sound SCI1 games. This is hardcoded in the interpreter. Also removing not handling signals on tick 0. This fixes Eco Quest 2 / Gonzales dancing in room 530. Thanks to wjp for the help.
2013-09-22 15:40:51 +02:00
Willem Jan Palenstijn 11d425b76c SCI: Move MIDI event processing out of parseNextEvent 2013-09-21 01:43:04 +02:00
Filippos Karapetis 0f30ba2f10 SCI: Fix bug #3614566 - "LSL6: ScummVM locks up at Electro-Shock room"
We now do the jumpToTick() for hold events after waiting for the delta
of the current event, like we do for the signal set events. This keeps
the fixes for the hold timings in QFG3, while not breaking LSL6.

Many thanks to wjp for pinpointing the actual cause of the issue.
2013-07-07 19:41:42 +03:00
Alyssa Milburn f08978a075 JANITORIAL: Remove underscores from MidiParser variable names. 2012-09-07 23:04:34 +02:00
strangerke 69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Max Horn 42ab839dd6 AUDIO: Rename sound/ dir to audio/
svn-id: r55850
2011-02-09 01:09:01 +00:00
Filippos Karapetis 601494cad4 SCI: implemented reverb handling and related functionality
svn-id: r54478
2010-11-25 16:09:45 +00:00
Martin Kiewitz 64313cd7f1 SCI: set master volume correctly
and merge it together with global volume, fixes bug #3053104)

svn-id: r52484
2010-09-01 19:20:17 +00:00
Martin Kiewitz e4cb2703ca SCI: implementing real setVolume() support, fixing some fading in sci1 games (like pq3 intro)
svn-id: r50414
2010-06-28 09:22:57 +00:00
Martin Kiewitz a887d4898d SCI: tell midiparser that he lost ownership of channels in case we take them away
svn-id: r50405
2010-06-27 21:41:30 +00:00
Martin Kiewitz 1041067a0c SCI: instead of queueing inside midiparser, we are queueing now globally in SciMusic, also some little cleanup
svn-id: r50130
2010-06-21 22:07:03 +00:00
Martin Kiewitz 81f64c9e3e SCI: storing all manual midi commands now and actually sending them to driver during onTimer() - fixes mt32 emulation crashing during lsl5 piano scene
svn-id: r50073
2010-06-20 10:25:46 +00:00
Martin Kiewitz f3b8a5927d SCI: fixing another uninitialized variable usage issue - also limiting reset velocity to used channels only, same is true for setting voice count
svn-id: r50062
2010-06-19 20:23:55 +00:00
Martin Kiewitz 089f5bba14 SCI: stopping scripts from sending to unused channels manually (fixes sq1vga)
svn-id: r50060
2010-06-19 20:00:32 +00:00
Martin Kiewitz 562f8a9463 SCI: implementing fading for sci1 only for used channels of the object, fixes lsl1 music issues when going right at the start
svn-id: r50018
2010-06-18 13:36:29 +00:00
Martin Kiewitz 423029c027 SCI: implemented channel muting for sci1, finally fixes lsl5 paino scene with patti
svn-id: r49926
2010-06-17 11:54:54 +00:00
Martin Kiewitz af65de6e1a SCI: implement channel remapping for SCI1
svn-id: r49905
2010-06-16 21:02:58 +00:00
Filippos Karapetis a6a482b83c SCI: Added a version of allNotesOff() which sends messages only to the channels used by the associated song instead of all channels
svn-id: r49673
2010-06-14 22:35:49 +00:00
Filippos Karapetis a08d06ad35 - Added a new debug command, verify_midi, which can be used to check all the songs of a game for unmapped instruments (still WIP and disabled)
- Fixed a bug in the verify_scripts command (it was loading the script resource twice)

svn-id: r49597
2010-06-11 14:47:13 +00:00
Filippos Karapetis 722c4f1b8d Some more work on channel remapping: Moved the remapping code to the music loading code (still disabled)
svn-id: r49430
2010-06-04 15:01:26 +00:00
Johannes Schickel 02ed1a684a - Made some methods const
- Prefer const_iterator over iterator in SciMusic::findUsedChannels

svn-id: r49417
2010-06-03 23:07:53 +00:00
Filippos Karapetis 1973bd5a71 Added channel remapping to MidiParser_SCI (currently unused)
svn-id: r49414
2010-06-03 21:57:49 +00:00
Filippos Karapetis 47c97f4a60 - The reverb value is now obtained from the music driver
- Implemented kSetReverb (0x50) and kResetOnPause (0x4C)

svn-id: r47433
2010-01-22 12:26:12 +00:00
Martin Kiewitz c8e2b0f967 SCI: fixing iceman intro again (dont set datainc immediately but after delta)
svn-id: r47424
2010-01-21 22:33:35 +00:00
Filippos Karapetis 177cfe4c92 When unloading a song, only reset the channels that it actually used, not all channels
svn-id: r47304
2010-01-15 07:40:07 +00:00
Filippos Karapetis b44a56aa92 Documented MidiParser_SCI, mentioning that it's an extension to the MidiParser_SMF parser
svn-id: r47287
2010-01-13 08:14:16 +00:00
Johannes Schickel 0d995c5920 Rename all "Adlib" uses to "AdLib" to match the real name of the sound card / company.
Check this for reference:
http://en.wikipedia.org/wiki/Ad_Lib,_Inc.
http://www.crossfire-designs.de/images/articles/soundcards/adlib.jpg (note the upper left of the card)

This commit does not touch "adlib" and "ADLIB" uses!

Also it does not update all the SCUMM detection entries, which still use "Adlib".

svn-id: r47279
2010-01-12 21:07:56 +00:00
Filippos Karapetis 3b8512b104 Cleanup, fixed fading of digital sound effects
svn-id: r47023
2010-01-05 10:28:09 +00:00
Filippos Karapetis 84cd8d2dc7 Renamed /gui to /graphics and /sfx to /sound, to better illustrate their purpose
svn-id: r47007
2010-01-05 01:22:16 +00:00