From fb00f5cb4e7edcf912b56952a5b1a77768a36286 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Sat, 1 Jun 2019 01:59:12 +0530 Subject: HDB: Fix Endian problem with the MPC data file --- engines/hdb/file-manager.cpp | 13 ++++++------- engines/hdb/file-manager.h | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engines/hdb/file-manager.cpp b/engines/hdb/file-manager.cpp index d43c4dac2b..1632da90bb 100644 --- a/engines/hdb/file-manager.cpp +++ b/engines/hdb/file-manager.cpp @@ -48,13 +48,13 @@ bool FileMan::openMPC(const Common::String &filename) { else if (dataHeader.id == MKTAG('M', 'P', 'C', 'U')) { _compressed = false; - offset = _mpcFile->readUint32BE(); + offset = _mpcFile->readUint32LE(); _mpcFile->seek((int32)offset); // Note: The MPC archive format assumes the offset to be uint32, // but Common::File::seek() takes the offset as int32. - dataHeader.dirSize = _mpcFile->readUint32BE(); + dataHeader.dirSize = _mpcFile->readUint32LE(); debug(8, "MPC: Read %d entries", dataHeader.dirSize); @@ -65,10 +65,10 @@ bool FileMan::openMPC(const Common::String &filename) { dirEntry->filename[i] = _mpcFile->readByte(); } - dirEntry->offset = _mpcFile->readUint32BE(); - dirEntry->length = _mpcFile->readUint32BE(); - dirEntry->ulength = _mpcFile->readUint32BE(); - dirEntry->type = (DataType)_mpcFile->readUint32BE(); + dirEntry->offset = _mpcFile->readUint32LE(); + dirEntry->length = _mpcFile->readUint32LE(); + dirEntry->ulength = _mpcFile->readUint32LE(); + dirEntry->type = (DataType)_mpcFile->readUint32LE(); _dir.push_back(dirEntry); } @@ -92,7 +92,6 @@ MPCEntry *FileMan::findFirstData(const char *string, DataType type) { debug("Hello"); - int i = 0; /*for (MPCIterator it = _dir.begin(); it != _dir.end(); it++) { fileString = (*it)->filename; if (fileString.contains(string)) { diff --git a/engines/hdb/file-manager.h b/engines/hdb/file-manager.h index f50f547184..68f36192a5 100644 --- a/engines/hdb/file-manager.h +++ b/engines/hdb/file-manager.h @@ -94,7 +94,6 @@ private: Common::File *_mpcFile; Common::Array _dir; - int _numEntries; bool _compressed; public: -- cgit v1.2.3