[Scummvm-git-logs] scummvm master -> 2e39acf84c9c2b3ae2056047354bdc612d824ffa

rvanlaar noreply at scummvm.org
Tue Oct 18 20:03:12 UTC 2022


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
144dfead98 JANITORIAL: DIRECTOR: remove superfluous ':'
2e39acf84c DIRECTOR: Improve RIFF loading


Commit: 144dfead988f2a0f27fe49db2c64ee6480ab5473
    https://github.com/scummvm/scummvm/commit/144dfead988f2a0f27fe49db2c64ee6480ab5473
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-10-18T22:02:41+02:00

Commit Message:
JANITORIAL: DIRECTOR: remove superfluous ':'

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 02f92874db8..4f1a9ff3a22 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -722,7 +722,7 @@ void Cast::loadBitmapData(int key, BitmapCastMember *bitmapCast) {
 	}
 
 	if (!img || !img->loadStream(*pic)) {
-		warning("Cast::loadBitmapData():: Unable to load id: %d", imgId);
+		warning("Cast::loadBitmapData(): Unable to load id: %d", imgId);
 		delete pic;
 		delete img;
 		return;


Commit: 2e39acf84c9c2b3ae2056047354bdc612d824ffa
    https://github.com/scummvm/scummvm/commit/2e39acf84c9c2b3ae2056047354bdc612d824ffa
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-10-18T22:02:41+02:00

Commit Message:
DIRECTOR: Improve RIFF loading

Two improvements for RIFF loading: size and alignment
A RIFF elements header: FourCC and size (4 bytes each) are not included
in the size. Offset + 12 then size - 4.

'DIB ' resources were found to always lead with two zero bytes.
Tested with: Fujitsu fmTOWNS SUPER TECHNOLOGY DEMO 1993.
Other resources such as 'SND ' do need alignment.
Tested with: SpaceWarlock Win. Intro movie lacked sound without
alignment. (WARNING: SNDDecoder: Bad format: 17408!)

Changed paths:
    engines/director/archive.cpp


diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index ebf64f430d6..285c28bef21 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -439,8 +439,11 @@ Common::SeekableReadStreamEndian *RIFFArchive::getResource(uint32 tag, uint16 id
 	const Resource &res = resMap[id];
 
 	// Adjust to skip the resource header
+	// FourCC, size and id (all 4 bytes each)
+	// Resource size excludes FourCC and size.
 	uint32 offset = res.offset + 12;
 	uint32 size = res.size - 4;
+
 	// Skip the Pascal string
 	_stream->seek(_startOffset + offset);
 	byte stringSize = _stream->readByte(); // 1 for this byte
@@ -448,12 +451,15 @@ Common::SeekableReadStreamEndian *RIFFArchive::getResource(uint32 tag, uint16 id
 	offset += stringSize + 1;
 	size -= stringSize + 1;
 
-	// Align to nearest word boundary
-	if (offset & 1) {
+	// 'DIB ' was observed to always have two 0 bytes
+	// other resources such as 'SND ' need alignment to nearest word boundary.
+	bool needsAlignment = offset & 1;
+	if (needsAlignment || tag == MKTAG('D', 'I', 'B', ' ')) {
 		offset++;
 		size--;
 	}
 
+	debugC(4, kDebugLoading, "RIFFArchive::getResource() tag: %s id: %i offset: %i size: %i", tag2str(tag), id, res.offset, res.size);
 	return new Common::SeekableSubReadStreamEndian(_stream, _startOffset + offset, _startOffset + offset + size, true, DisposeAfterUse::NO);
 }
 




More information about the Scummvm-git-logs mailing list