aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBastien Bouclet2016-04-03 08:03:48 +0200
committerBastien Bouclet2016-04-03 08:11:56 +0200
commitc8bb597e6754783660efa8011af60e0c2d8490eb (patch)
tree196c701d8bca3844ca14e1fdc81787d050ed6980 /engines
parent9db3f69f5e34b4c0e2f52a4f9d8e3db058deaf49 (diff)
downloadscummvm-rg350-c8bb597e6754783660efa8011af60e0c2d8490eb.tar.gz
scummvm-rg350-c8bb597e6754783660efa8011af60e0c2d8490eb.tar.bz2
scummvm-rg350-c8bb597e6754783660efa8011af60e0c2d8490eb.zip
MOHAWK: Fix endianness issue in Myst opcode 30
The previous code was reading data of the system's endianness as little endian. Now the data is converted to little endian before it is read. Attempt to fix #7100.
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/myst_scripts.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 04e7c5a9b7..6ad7dd088b 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -685,9 +685,14 @@ void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, uint16 arg
// Used on Channelwood Card 3225 with argc = 8 i.e. Conditional Sound List
debugC(kDebugScript, "Opcode %d: Process Sound Block", op);
- Common::MemoryReadStream stream = Common::MemoryReadStream((const byte *) argv, argc * sizeof(uint16));
+ Common::MemoryWriteStreamDynamic writeStream = Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
+ for (uint i = 0; i < argc; i++) {
+ writeStream.writeUint16LE(argv[i]);
+ }
+
+ Common::MemoryReadStream readStream = Common::MemoryReadStream(writeStream.getData(), writeStream.size());
- MystSoundBlock soundBlock = _vm->readSoundBlock(&stream);
+ MystSoundBlock soundBlock = _vm->readSoundBlock(&readStream);
_vm->applySoundBlock(soundBlock);
}