2019-05-27 19:08:01 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 17:47:58 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2019-05-27 19:08:01 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 17:47:58 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2019-05-27 19:08:01 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HDB_FILE_MANAGER_H
|
|
|
|
#define HDB_FILE_MANAGER_H
|
|
|
|
|
2019-07-24 11:54:18 +00:00
|
|
|
namespace Common {
|
|
|
|
class File;
|
|
|
|
}
|
2019-05-27 19:08:01 +00:00
|
|
|
|
2019-05-28 12:07:43 +00:00
|
|
|
#define MPCIterator Common::Array<MPCEntry *>::iterator
|
|
|
|
|
2019-05-27 19:08:01 +00:00
|
|
|
namespace HDB {
|
|
|
|
|
|
|
|
// Each entry in a MSD file is of the following types
|
|
|
|
|
|
|
|
enum DataType {
|
|
|
|
TYPE_ERROR,
|
|
|
|
TYPE_BINARY,
|
|
|
|
TYPE_TILE32,
|
|
|
|
TYPE_FONT,
|
|
|
|
TYPE_ICON32,
|
|
|
|
TYPE_PIC,
|
|
|
|
|
|
|
|
ENDOFTYPES
|
|
|
|
};
|
|
|
|
|
2019-05-28 12:07:43 +00:00
|
|
|
struct MPCEntry {
|
2019-05-27 19:08:01 +00:00
|
|
|
char filename[64]; // filename
|
2019-05-28 08:34:24 +00:00
|
|
|
int32 offset; // offset in MSD file of data
|
|
|
|
int32 length; // compressed length of data
|
|
|
|
int32 ulength; // uncompressed length
|
2019-05-27 19:08:01 +00:00
|
|
|
DataType type; // type of data
|
|
|
|
};
|
|
|
|
|
|
|
|
class FileMan {
|
|
|
|
private:
|
|
|
|
|
2019-05-28 12:07:43 +00:00
|
|
|
Common::File *_mpcFile;
|
|
|
|
Common::Array<MPCEntry *> _dir;
|
2019-05-27 19:08:01 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2019-05-31 15:02:52 +00:00
|
|
|
FileMan();
|
2019-07-17 18:04:08 +00:00
|
|
|
~FileMan();
|
2019-05-31 15:02:52 +00:00
|
|
|
|
2019-05-27 19:08:01 +00:00
|
|
|
struct {
|
2019-05-28 08:34:24 +00:00
|
|
|
uint32 id;
|
|
|
|
uint32 dirSize;
|
2019-06-07 12:51:18 +00:00
|
|
|
} _dataHeader;
|
2019-07-24 11:54:18 +00:00
|
|
|
|
2023-10-31 21:24:05 +00:00
|
|
|
void openMPC(const Common::Path &filename);
|
2019-05-28 12:07:43 +00:00
|
|
|
void closeMPC();
|
2019-06-01 10:51:46 +00:00
|
|
|
void seek(int32 offset, int flag);
|
|
|
|
|
2020-04-28 07:42:27 +00:00
|
|
|
Common::SeekableReadStream *findFirstData(const char *string, DataType type, int *length = nullptr);
|
2019-06-04 19:40:57 +00:00
|
|
|
int32 getLength(const char *string, DataType type);
|
2019-06-07 17:48:45 +00:00
|
|
|
int getCount(const char *subString, DataType type);
|
2019-06-07 15:37:36 +00:00
|
|
|
Common::Array<const char *> *findFiles(const char *string, DataType type);
|
2019-05-27 19:08:01 +00:00
|
|
|
|
2019-05-28 08:34:24 +00:00
|
|
|
};
|
2019-05-27 19:08:01 +00:00
|
|
|
|
|
|
|
} // End of Namespace HDB
|
|
|
|
|
|
|
|
#endif // !HDB_FILE_MANAGER_H
|