From 1e1e90f8ec273a546e5e7fa776013382b2278f77 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 Dec 2016 15:47:04 -0800 Subject: CRYO: Rewrite the way the HNM header is read. --- engines/cryo/video.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'engines') 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; } -- cgit v1.2.3