[Scummvm-git-logs] scummvm master -> 2486824e3c7ba51a0cebd4bed9f98d28cf51c10b
sluicebox
22204938+sluicebox at users.noreply.github.com
Sat Feb 8 21:30:41 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2486824e3c SCI32: Detect Robot file endianness
Commit: 2486824e3c7ba51a0cebd4bed9f98d28cf51c10b
https://github.com/scummvm/scummvm/commit/2486824e3c7ba51a0cebd4bed9f98d28cf51c10b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-02-08T13:29:13-08:00
Commit Message:
SCI32: Detect Robot file endianness
Changed paths:
engines/sci/video/robot_decoder.cpp
diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp
index a99a15a..6ebaf8f 100644
--- a/engines/sci/video/robot_decoder.cpp
+++ b/engines/sci/video/robot_decoder.cpp
@@ -378,8 +378,15 @@ void RobotDecoder::initStream(const GuiResourceId robotId) {
error("Invalid robot file %s", fileName.c_str());
}
- // TODO: Mac version not tested, so this could be totally wrong
- _stream = new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(), g_sci->getPlatform() == Common::kPlatformMacintosh, DisposeAfterUse::YES);
+ // Determine the robot file's endianness by examining the version field.
+ // Some games such as Lighthouse were distributed as dual PC/Mac CDs
+ // that shared the same little endian robot files, so endianness doesn't
+ // always correspond to platform.
+ stream->seek(6, SEEK_SET);
+ const uint16 version = stream->readUint16BE();
+ const bool bigEndian = (0 < version && version <= 0x00ff);
+
+ _stream = new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(), bigEndian, DisposeAfterUse::YES);
_stream->seek(2, SEEK_SET);
if (_stream->readUint32BE() != MKTAG('S', 'O', 'L', 0)) {
error("Resource %s is not Robot type!", fileName.c_str());
More information about the Scummvm-git-logs
mailing list