1 /* ScummVM Tools 2 * 3 * ScummVM Tools is the legal property of its developers, whose 4 * names are too numerous to list here. Please refer to the 5 * COPYRIGHT file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef EXTRACT_HDB_H 23 #define EXTRACT_HDB_H 24 25 #include "tool.h" 26 #include "common/array.h" 27 28 enum DataType { 29 TYPE_ERROR, 30 TYPE_BINARY, 31 TYPE_TILE32, 32 TYPE_FONT, 33 TYPE_ICON32, 34 TYPE_PIC, 35 36 ENDOFTYPES 37 }; 38 39 struct MPCEntry { 40 char filename[64]; // filename 41 int32 offset; // offset in MSD file of data 42 int32 length; // compressed length of data 43 uint32 ulength; // uncompressed length 44 DataType type; // type of data 45 }; 46 47 #define MPCIterator Common::Array<MPCEntry *>::iterator 48 49 class ExtractHDB : public Tool { 50 public: 51 ExtractHDB(const std::string &name = "extract_hdb"); 52 53 virtual void execute(); 54 55 virtual InspectionMatch inspectInput(const Common::Filename &filename); 56 57 protected: 58 bool openMPC(Common::Filename &filename); 59 60 Common::File _mpcFile; 61 62 struct { 63 uint32 id; 64 uint32 dirSize; 65 } _dataHeader; 66 67 Common::Array<MPCEntry *> _dir; 68 bool _compressed; 69 }; 70 71 #endif 72