Commit Graph

2784 Commits

Author SHA1 Message Date
Torbjörn Andersson
08be916049 SCUMM: Verify sample width in Digital iMUSE callback. CID 1002112
Verify that 'bits' really is one of 8, 12 or 16 before decoding
the data. It's probably always the case (unless the data files are
damaged) but if it isn't we'll either try to queue NULL to the
audio stream, or queue the same buffer more than once, or free the
buffer more than once. All of which are bad, though Coverity only
noticed the last of these cases.
2013-06-04 06:11:41 +02:00
Torbjörn Andersson
f8c0d354af SCUMM: Remove unused variable _quit
CID 1003018
2013-06-02 09:43:59 +02:00
tcarey
dc6b39d058 SCUMM: Clean-up of Roland GS code
1. Remove _sc55 bool. All Roland GS-capable devices have MT-32 sound/drum maps, so they should always be used when _enable_gs is set.
2. Always enable _native_mt32 if Roland GS mode is selected. I don't know why I never did this originally, since _enable_gs is automatically disabled for SCUMM v6+ games that use General MIDI tracks instead of MT-32 music.
3. Set master tune for GS devices to 442.0kHz. This is the master tune setting for the MT-32.
2013-05-11 19:18:11 +03:00
Matthew Hoops
0031c41db8 COMMON: Change kPlatformPC to kPlatformDOS
"PC" was very ambiguous and now it matches what we show in the GUI.

This also corrects sword2's platform to Windows.
2013-05-02 18:43:10 -04:00
Torbjörn Andersson
ce79ff4f2e SCUMM: Change NUM_SCRIPT_LOCALS to NUM_SCRIPT_LOCAL
For consistency with NUM_SCRIPT_SLOT.
2013-05-01 07:47:56 +02:00
Torbjörn Andersson
f70087dc90 SCUMM: Fix out-of-bounds access in runScript() debug messages
I believe this fixes CID 1003954, 1003957, 1003958, 1003962 and
1003966.
2013-05-01 07:33:05 +02:00
Torbjörn Andersson
0638d85ada SCUMM: Cleanup
We only need to initialize 'args' in runInventoryScript() when we
are actually using them.
2013-04-30 22:46:36 +02:00
Torbjörn Andersson
2284aba719 SCUMM: Use correct array size when calling initializeLocals()
The initializeLocals() function assumes that it can copy 25
elements when being provided an array of values. But this array
was frequently a lot smaller than that. I've introduced a constant
for the number of locals (though VirtualMachineState has one more
for some reason), and fixed the array sizes in a number of places.

CID 1003951, 1003952, 1003953, 1003955, 1003956, 1003959, 1003960,
1003961, 1003963, 100394, 1003965
2013-04-30 22:26:51 +02:00
Eugene Sandulenko
b1893bc5f7 SCUMM HE: fix crash introduced in a10ad272a8 2013-04-29 23:16:55 +03:00
Matthew Hoops
c7aceeb08e SCUMM: Fix o100_videoOps subOp 0
football2002 endzone videos now display
2013-04-29 15:35:14 -04:00
Eugene Sandulenko
a10ad272a8 SCUMM HE: Plug memory leak. CID 1003582 2013-04-28 23:59:20 +03:00
Eugene Sandulenko
cfbc8be757 SCUMM: Fix non-terminated string. CID 1003867 2013-04-24 01:08:09 +03:00
Matthew Hoops
f4a566afb1 SCUMM: Fix football2002 field coordinates 2013-04-23 16:19:23 -04:00
Matthew Hoops
0209ce4e3a SCUMM: Fix a bug in football's nextPoint U32 opcode
Seems to fix bug #3495704
2013-04-22 17:22:29 -04:00
Eugene Sandulenko
095dfcad15 INSANE: Fix potential buffer overflow. CID 1003866 2013-04-21 14:27:30 +03:00
Max Horn
b791edabf7 ENGINES: Remove a bunch of unused private member variables
All instances uncovered by clang warnings.
2013-04-18 23:50:20 +02:00
Kirben
7e290c963f SCUMM: Add Italian Windows version of Freddi Fish 4. 2013-04-06 08:10:28 +11:00
Kirben
b22a9b119e SCUMM: Add Italian Windows demos of Freddi Fish 4 and Putt-Putt Enters the Game. 2013-04-03 11:36:59 +11:00
Torbjörn Andersson
a1168e932c SCUMM: Hardly-even-worth-mentioning cleanup. 2013-04-02 08:20:33 +02:00
Eugene Sandulenko
49da129e63 SCUMM: Fix bug #3575444: "FT: Enemy behaviour in biker fight"
Also fixed enemy behavior along the way. No wonder it differed
from the original!
2013-04-02 00:18:50 +03:00
Eugene Sandulenko
d8d5012fc7 SCUMM: More fixes in INSANE 2013-04-02 00:18:50 +03:00
Eugene Sandulenko
880f264150 SCUMM: Fix more bugs in INSANE 2013-03-30 17:10:30 +02:00
Eugene Sandulenko
a36a7253e4 SCUMM: Fix several bugs in INSANE 2013-03-30 15:53:44 +02:00
Eugene Sandulenko
9479d1a9ee SCUMM: Fix bug #3546434: "SCUMM: FT glitches in Vulture encounter on old mine road"
There was a missing Sfx call.
2013-03-30 15:53:44 +02:00
Willem Jan Palenstijn
2d1fd3b554 ALL: Fix typo (existant->existent) 2013-02-23 22:07:32 +01:00
Johannes Schickel
1bab59aa06 SCUMM: Update handling of non so resources in Loom Mac.
This changes the warning to a debug and also updates the comment a bit.
Thanks to eriktorbjorn for checking Loom Mac in an emulator.
2013-01-27 14:52:07 +01:00
Torbjörn Andersson
2dd0690d26 SCUMM: Work around bug #3602239 ("Mac Loom crashes using opening...")
Skip music resources that don't have the "so" (song?) tag. It is
better than asserting, now that it turns out that they do exist.
2013-01-27 09:38:01 +01:00
Johannes Schickel
59dde54519 Merge pull request #301 from lordhoto/c++11-playground
RFC: Allow use of override and nullptr. Also allow C++11 compilation.
2013-01-26 05:25:14 -08:00
Matthew Hoops
550a169d8a SCUMM: Cleanup ScummEngine_v80he::createSound()
Added some comments to make it more readable. Switched usage of a temporary buffer and a double memcpy with a memmove.

Also fixed a potential out-of-bounds write, thanks to LordHoto.
2013-01-09 21:54:47 -05:00
Johannes Schickel
ff7a34aec5 SCUMM: Silence C++11 narrowing warnings. 2013-01-09 07:24:37 +01:00
Torbjörn Andersson
f4514069f3 JANITORIAL: Fix or silence a couple of Clang analyzer warnings
Clang will produce plenty of warnings (most of them seem to be of
the "if the stars align the wrong way, this may happen" variety),
but I don't have the time or patience to look at all of them.
2013-01-02 19:31:05 +01:00
Torbjörn Andersson
69cdccd962 SCUMM: Handle double-clicks in Mac Loom (bug #3588164)
Unlike the EGA DOS version, it doesn't seem to be the scripts
that keep track of double-clicks. Instead, the engine sets a
variable to indicate them. Unlike the DOS version, we don't check
that the second click happens close enough on the screen to the
first one. We could, but it seemed needlessly complicated.
2012-12-15 00:35:00 +01:00
Johannes Schickel
9a0e2b7ee7 SCUMM: Fix compilation on AmigaOS4. 2012-12-14 21:18:56 +01:00
Johannes Schickel
97d7bf9b9a Merge pull request #291 from eriktorbjorn/mac-mi-music-final
SCUMM: Add support for Macintosh music in Monkey Island 1 and Loom
2012-12-14 11:57:49 -08:00
Torbjörn Andersson
d3cf4d10f2 SCUMM: Handle note value 1 as "hold current note" in MI1 Mac
After listening to the original music in a Mac emulator (which
unfortunately doesn't handle the music very well), I can only
conclude that note value 1 means the note should continue playing.
At first I thought maybe it was supposed to fade the current note,
or perhaps change its volume, but I can't hear any traces of
either. So I'm going to assume it just means "hold the current
note", though for the life of me I cannot think of any valid
reason for such a command. So it may be wrong, but it sounds
closer to the emulator than it did before.
2012-11-24 01:39:16 +01:00
Torbjörn Andersson
076bcbc5c6 SCUMM: Added TODO comment about Mac MI1 music
Some notes in the main theme are very staccato, and this could
possibly explain why.
2012-11-23 06:54:25 +01:00
Torbjörn Andersson
d06f69f94b SCUMM: Fix memory leak when loading old MI1 Mac savegames
I completely forgot to delete the dummy iMUSE object after using it
to skip over the old music save information. Thanks to Lordhoto for
pointing this out.
2012-11-23 06:01:30 +01:00
Johannes Schickel
7c2f5e2d0e Merge pull request #283 from lordhoto/scumm-opl3
SCUMM: Support OPL3 in Sam&Max
2012-11-22 17:28:31 -08:00
Torbjörn Andersson
2aa8d0d65d SCUMM: Try harder to find Mac Monkey Island instruments
At least for me, hfsutils turns spaces into underscores so try both
"Monkey Island" and "Monkey_Island".
2012-11-19 08:40:51 +01:00
Torbjörn Andersson
fc0288e9d5 SCUMM: Simplify checkMusicAvailable() a bit 2012-11-19 07:25:42 +01:00
Torbjörn Andersson
9e995991e7 SCUMM: Fix crash when Macintosh instruments aren't available
Initialise _channel[] even when the instruments aren't available.
Otherwise, ScummVM will crash in a number of places including,
but not limited to, when loading savegames.
2012-11-19 07:18:05 +01:00
Torbjörn Andersson
cb21d7309e SCUMM: Add Windows encoding of the Mac Loom filename 2012-11-19 07:16:42 +01:00
Torbjörn Andersson
94b0881427 SCUMM: Lock the sound resource while the music is playing
After some discussion on #scummvm, the player now locks the sound
resource while the music is playing. This prevents the resource
manager from expiring the resource, which at best could cause
music to restart where it shouldn't.. At worst, I guess it could
have crashed, but I never saw that happen.
2012-11-18 19:18:21 +01:00
Torbjörn Andersson
ae823b5c6a SCUMM: Fix regression that caused "pops" in MI1 jungle music
Properly treat rests as rests, not notes. Otherwise, it would try
to play a really low note which just came out as a "pop".
2012-11-18 17:57:01 +01:00
Torbjörn Andersson
34a8b5049e SCUMM: Use more correct (I think) way of converting samples
It shouldn't make any real difference, but it's probably more
formally correct.
2012-11-18 17:56:13 +01:00
Torbjörn Andersson
4f18a92f5a SCUMM: Prevent music channels from drifting out of sync in Mac MI1
In looped music, prevent the music channels from drifting out of
sync over time. This was noticeable after a few minutes in the
SCUMM Bar. We do this by extending the last note (which is just
zeroes, so we didn't even use to play it) so that it has the
exact number of samples needed to make all channels the exact
same length. (This is calculated when the music is loaded, so it
does not need any extra data in the save games, thankfully.)

As a result, the getNextNote() is now responsible for converting
the duration to number of samples (out of necessity) and for
converting the note to a pitch modifier (out of symmetry). I made
several false starts before I realized how much easier it would
be this way.
2012-11-18 14:30:17 +01:00
Torbjörn Andersson
f3c9b21806 SCUMM: Fix whitespace 2012-11-18 13:43:33 +01:00
Torbjörn Andersson
ee65532a5e SCUMM: Avoid "pops" at the end of the note in Mac MI1/Loom music
At least on my computer, when the note ended abruptly there would
be an annoying "pop" at the end. This was particularly noticeable
at the end of the distaff notes in Loom. To get around this, fade
out the last 100 samples. There's nothing magical about 100 in
particular, but it's a nice even number and it should be short
enough that it's never a noticeable part of the note, even at low
sample rates.
2012-11-17 11:53:54 +01:00
Torbjörn Andersson
4626e21149 SCUMM: Remove commented out code.
It was the remains of an experiment and no longer serves a purpose.
2012-11-17 11:42:41 +01:00
Torbjörn Andersson
38b2a8518f SCUMM: Fix the "drafts" debugger command for Mac Loom
Mac Loom's drafts appear to be stored from variable 55 and upwards.
I'm working under the assumption that there's either only one
version of Loom for the Mac, or that they all behave the same. I
could be wrong about that.
2012-11-16 22:13:23 +01:00