[Scummvm-devel] Another bug in sam n max

Sam Kenny SamKenny at cit.com.au
Tue Dec 4 14:24:03 CET 2001


Hi again,

I thought I'd ask someone here as to the best way to tackle this. In the Sam
N Max demo, when the credits are loading, the music plays until a certain
point, then stops, and the credit sequence stops. The error is
'SoundEngine::findTag failed finding sound 57' and then "Sound 57 was
unloaded while active" or something like that.

The problem is occurring because blit is overwriting past the end of memory
right onto the memory containing the midi data. You can see this in
printChar in string.cpp (take a look at _bottom, it is 209 or something when
it happens). Putting in a quick hack and changing:
	if (_blitAlso)
		blit(_backbuff_ptr, _bgbak_ptr, _width, _height);
to:
	if (_blitAlso && (_top < 200)) {
		if (_bottom > 200) {
			_height = (200 - _top);
			_bottom = 200;
		}
		blit(_backbuff_ptr, _bgbak_ptr, _width, _height);
	}
fixes this problem, although the problem really is that blit (and perhaps
blitToScreen) does not check that it is in (320*200) area. Obviously this
could also be a problem if width > 320 as well on the last line (although
unlikely).

Anyone have any good suggestions on how to fix this?
On a good note, the intro now works beautifully...

Cheers,

Sam





More information about the Scummvm-devel mailing list