2013-05-20 02:45:54 +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.
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* 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
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VOYEUR_FILES_H
|
|
|
|
#define VOYEUR_FILES_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/file.h"
|
2013-05-25 19:36:57 +00:00
|
|
|
#include "common/rect.h"
|
2013-05-20 02:45:54 +00:00
|
|
|
#include "common/str.h"
|
|
|
|
|
|
|
|
namespace Voyeur {
|
|
|
|
|
|
|
|
class VoyeurEngine;
|
2013-05-25 13:58:03 +00:00
|
|
|
class BoltFile;
|
2013-05-20 02:45:54 +00:00
|
|
|
class BoltGroup;
|
|
|
|
class BoltEntry;
|
2013-05-25 19:36:57 +00:00
|
|
|
class PictureResource;
|
2013-05-22 03:15:43 +00:00
|
|
|
#define DECOMPRESS_SIZE 0x7000
|
2013-05-20 02:45:54 +00:00
|
|
|
|
2013-05-25 13:58:03 +00:00
|
|
|
typedef void (BoltFile::*BoltMethodPtr)();
|
|
|
|
|
2013-05-25 19:36:57 +00:00
|
|
|
class BoltFilesState {
|
|
|
|
public:
|
2013-05-26 00:51:53 +00:00
|
|
|
VoyeurEngine *_vm;
|
2013-05-25 19:36:57 +00:00
|
|
|
BoltFile *_curLibPtr;
|
|
|
|
BoltGroup *_curGroupPtr;
|
|
|
|
BoltEntry *_curMemberPtr;
|
|
|
|
byte *_curMemInfoPtr;
|
|
|
|
int _fromGroupFlag;
|
|
|
|
byte _xorMask;
|
|
|
|
bool _encrypt;
|
|
|
|
int _curFilePosition;
|
|
|
|
int _bufferEnd;
|
|
|
|
int _bufferBegin;
|
|
|
|
int _bytesLeft;
|
|
|
|
int _bufSize;
|
|
|
|
byte *_bufStart;
|
|
|
|
byte *_bufPos;
|
|
|
|
byte _decompressBuf[DECOMPRESS_SIZE];
|
|
|
|
int _historyIndex;
|
|
|
|
byte _historyBuffer[0x200];
|
|
|
|
int _runLength;
|
|
|
|
int _decompState;
|
|
|
|
int _runType;
|
|
|
|
int _runValue;
|
|
|
|
int _runOffset;
|
2013-05-26 00:51:53 +00:00
|
|
|
Common::File *_curFd;
|
|
|
|
|
|
|
|
byte *_boltPageFrame;
|
|
|
|
int _sImageShift;
|
|
|
|
bool _SVGAReset;
|
2013-05-25 19:36:57 +00:00
|
|
|
public:
|
|
|
|
BoltFilesState();
|
|
|
|
|
|
|
|
byte *decompress(byte *buf, int size, int mode);
|
|
|
|
void nextBlock();
|
2013-05-26 00:51:53 +00:00
|
|
|
|
|
|
|
void EMSGetFrameAddr(byte **pageFrame) {} // TODO: Maybe?
|
|
|
|
bool EMSAllocatePages(uint *planeSize) { return false; } // TODO: Maybe?
|
|
|
|
void EMSMapPageHandle(int planeSize, int idx1, int idx2) {} // TODO: Maybe?
|
2013-05-25 19:36:57 +00:00
|
|
|
};
|
|
|
|
|
2013-05-20 02:45:54 +00:00
|
|
|
class BoltFile {
|
|
|
|
private:
|
2013-05-25 13:58:03 +00:00
|
|
|
static const BoltMethodPtr _fnInitType[25];
|
2013-05-20 02:45:54 +00:00
|
|
|
private:
|
2013-05-25 19:36:57 +00:00
|
|
|
BoltFilesState &_state;
|
2013-05-20 02:45:54 +00:00
|
|
|
Common::Array<BoltGroup> _groups;
|
2013-05-26 00:51:53 +00:00
|
|
|
Common::File _file;
|
2013-05-22 02:07:17 +00:00
|
|
|
|
2013-05-25 13:58:03 +00:00
|
|
|
// initType method table
|
|
|
|
void initDefault();
|
|
|
|
void sInitPic();
|
|
|
|
void vInitCMap();
|
|
|
|
void vInitCycl();
|
|
|
|
void initViewPort();
|
|
|
|
void initViewPortList();
|
|
|
|
void initFontInfo();
|
|
|
|
void initSoundMap();
|
2013-05-20 02:45:54 +00:00
|
|
|
private:
|
|
|
|
void resolveAll() {}
|
2013-05-21 01:18:40 +00:00
|
|
|
byte *getBoltMember(uint32 id);
|
2013-05-20 02:45:54 +00:00
|
|
|
|
2013-05-25 13:58:03 +00:00
|
|
|
void initType() {}
|
2013-05-20 02:45:54 +00:00
|
|
|
void termType() {}
|
2013-05-21 01:18:40 +00:00
|
|
|
void initMem(int id) {}
|
2013-05-20 02:45:54 +00:00
|
|
|
void termMem() {}
|
|
|
|
void initGro() {}
|
|
|
|
void termGro() {}
|
2013-05-21 01:18:40 +00:00
|
|
|
public:
|
2013-05-25 19:36:57 +00:00
|
|
|
BoltFile(BoltFilesState &state);
|
2013-05-21 01:18:40 +00:00
|
|
|
~BoltFile();
|
|
|
|
|
|
|
|
bool getBoltGroup(uint32 id);
|
|
|
|
byte *memberAddr(uint32 id);
|
2013-05-20 02:45:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BoltGroup {
|
|
|
|
private:
|
|
|
|
Common::SeekableReadStream *_file;
|
|
|
|
public:
|
2013-05-22 02:07:17 +00:00
|
|
|
byte _loaded;
|
|
|
|
bool _processed;
|
2013-05-20 02:45:54 +00:00
|
|
|
bool _callInitGro;
|
|
|
|
int _count;
|
|
|
|
int _fileOffset;
|
|
|
|
Common::Array<BoltEntry> _entries;
|
|
|
|
public:
|
|
|
|
BoltGroup(Common::SeekableReadStream *f);
|
|
|
|
|
|
|
|
void load();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BoltEntry {
|
|
|
|
private:
|
|
|
|
Common::SeekableReadStream *_file;
|
|
|
|
public:
|
2013-05-21 01:18:40 +00:00
|
|
|
byte _mode;
|
|
|
|
byte _field1;
|
2013-05-25 13:58:03 +00:00
|
|
|
byte _initMethod;
|
2013-05-20 02:45:54 +00:00
|
|
|
int _fileOffset;
|
2013-05-21 01:18:40 +00:00
|
|
|
byte _xorMask;
|
|
|
|
int _size;
|
|
|
|
byte *_data;
|
2013-05-25 19:36:57 +00:00
|
|
|
|
|
|
|
PictureResource *_picResource;
|
2013-05-20 02:45:54 +00:00
|
|
|
public:
|
|
|
|
BoltEntry(Common::SeekableReadStream *f);
|
2013-05-21 01:18:40 +00:00
|
|
|
virtual ~BoltEntry();
|
2013-05-20 02:45:54 +00:00
|
|
|
|
|
|
|
void load();
|
|
|
|
};
|
|
|
|
|
|
|
|
class FilesManager {
|
|
|
|
private:
|
|
|
|
int _decompressSize;
|
|
|
|
public:
|
2013-05-25 19:36:57 +00:00
|
|
|
BoltFilesState _boltFilesState;
|
2013-05-20 02:45:54 +00:00
|
|
|
BoltFile *_curLibPtr;
|
|
|
|
public:
|
|
|
|
FilesManager();
|
2013-05-26 00:51:53 +00:00
|
|
|
void setVm(VoyeurEngine *vm) { _boltFilesState._vm = vm; }
|
2013-05-20 02:45:54 +00:00
|
|
|
|
2013-05-21 01:18:40 +00:00
|
|
|
bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
|
2013-05-20 02:45:54 +00:00
|
|
|
};
|
|
|
|
|
2013-05-25 19:36:57 +00:00
|
|
|
class PictureResource {
|
|
|
|
uint16 _flags;
|
|
|
|
byte _select;
|
|
|
|
byte _pick;
|
|
|
|
byte _onOff;
|
|
|
|
byte _depth;
|
|
|
|
Common::Point _offset;
|
|
|
|
int _width;
|
|
|
|
int _height;
|
|
|
|
uint32 _maskData;
|
2013-05-26 00:51:53 +00:00
|
|
|
uint _planeSize;
|
2013-05-25 19:36:57 +00:00
|
|
|
|
|
|
|
byte *_imgData;
|
|
|
|
public:
|
|
|
|
PictureResource(BoltFilesState &state, const byte *src);
|
|
|
|
virtual ~PictureResource();
|
|
|
|
};
|
|
|
|
|
2013-05-20 02:45:54 +00:00
|
|
|
} // End of namespace Voyeur
|
|
|
|
|
2013-05-23 13:13:28 +00:00
|
|
|
#endif /* VOYEUR_FILES_H */
|