aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2016-12-05 15:47:04 -0800
committerEugene Sandulenko2017-01-25 22:42:12 +0100
commit1e1e90f8ec273a546e5e7fa776013382b2278f77 (patch)
treedfd7e01c92f551571c2f6e58d2b7a88968b8662b
parent7bf6e1e85029c40c9de25eaea001ecc7e62878ee (diff)
downloadscummvm-rg350-1e1e90f8ec273a546e5e7fa776013382b2278f77.tar.gz
scummvm-rg350-1e1e90f8ec273a546e5e7fa776013382b2278f77.tar.bz2
scummvm-rg350-1e1e90f8ec273a546e5e7fa776013382b2278f77.zip
CRYO: Rewrite the way the HNM header is read.
-rw-r--r--engines/cryo/video.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/engines/cryo/video.cpp b/engines/cryo/video.cpp
index 82fa70283b..6cf90535e1 100644
--- a/engines/cryo/video.cpp
+++ b/engines/cryo/video.cpp
@@ -186,24 +186,31 @@ void HnmPlayer::decompADPCM(byte *buffer, int16 *output, int size) {
// Original name: CLHNM_ReadHeader
void HnmPlayer::readHeader(hnm_t *hnm) {
- int32 size = sizeof(hnm->_header);
- hnm->_file->read(&hnm->_header, size);
-
- hnm->_header._width = LE16(hnm->_header._width);
- hnm->_header._height = LE16(hnm->_header._height);
- hnm->_header._unusedFileSize = LE32(hnm->_header._unusedFileSize);
- hnm->_header._numbFrame = LE32(hnm->_header._numbFrame);
- hnm->_header._unusedTableOffset = LE32(hnm->_header._unusedTableOffset);
- hnm->_header._unusedSpeed = LE16(hnm->_header._unusedSpeed);
- hnm->_header._unusedMaxBuffer = LE16(hnm->_header._unusedMaxBuffer);
- hnm->_header._bufferSize = LE32(hnm->_header._bufferSize);
- hnm->_header._unusedUnknown = LE16(hnm->_header._unusedUnknown);
+ hnm->_header._signature = hnm->_file->readUint32BE();
+ hnm->_header._unusedFlag1 = hnm->_file->readByte();
+ hnm->_header._unusedFlag2 = hnm->_file->readByte();
+ hnm->_header._unusedReserved = hnm->_file->readByte();
+ hnm->_header._unusedBpp = hnm->_file->readByte();
+ hnm->_header._width = hnm->_file->readUint16LE();
+ hnm->_header._height = hnm->_file->readUint16LE();
+ hnm->_header._unusedFileSize = hnm->_file->readSint32LE();
+ hnm->_header._numbFrame = hnm->_file->readSint32LE();
+ hnm->_header._unusedTableOffset = hnm->_file->readSint32LE();
+ hnm->_header._unusedSpeed = hnm->_file->readSint16LE();
+ hnm->_header._unusedMaxBuffer = hnm->_file->readSint16LE();
+ hnm->_header._bufferSize = hnm->_file->readSint32LE();
+ hnm->_header._unusedUnknown = hnm->_file->readSint16LE();
+ for (int i = 0; i < 14; i++)
+ hnm->_header._unusedReserved2[i] = hnm->_file->readSByte();
+ for (int i = 0; i < 16; i++)
+ hnm->_header._unusedCopyright[i] = hnm->_file->readSByte();
+
hnm->_header._bufferSize += 4096; //TODO: checkme
}
// Original name: CLHNM_GetVersion
int16 HnmPlayer::getVersion(hnm_t *hnm) {
- if (hnm->_header._signature == BE32('HNM4'))
+ if (hnm->_header._signature == MKTAG('H','N','M','4'))
return 4;
return -1;
}