2007-05-30 21:56:52 +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.
|
2004-01-06 17:28:29 +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 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-01-06 17:28:29 +00:00
|
|
|
*/
|
|
|
|
|
2007-02-19 17:48:19 +00:00
|
|
|
#ifndef SCUMM_IMUSE_DIGI_BUNDLE_MGR_H
|
|
|
|
#define SCUMM_IMUSE_DIGI_BUNDLE_MGR_H
|
2004-01-06 17:28:29 +00:00
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/file.h"
|
|
|
|
|
|
|
|
namespace Scumm {
|
|
|
|
|
2006-04-23 17:47:40 +00:00
|
|
|
class BaseScummFile;
|
2006-03-03 14:55:04 +00:00
|
|
|
|
2004-01-07 04:50:38 +00:00
|
|
|
class BundleDirCache {
|
2004-01-07 03:34:41 +00:00
|
|
|
public:
|
|
|
|
struct AudioTable {
|
2005-01-25 22:21:26 +00:00
|
|
|
char filename[24];
|
2004-01-07 03:34:41 +00:00
|
|
|
int32 offset;
|
2005-01-25 22:21:26 +00:00
|
|
|
int32 size;
|
2004-01-07 03:34:41 +00:00
|
|
|
};
|
2005-10-26 21:17:55 +00:00
|
|
|
|
|
|
|
struct IndexNode {
|
|
|
|
char filename[24];
|
|
|
|
int32 index;
|
|
|
|
};
|
|
|
|
|
2004-01-07 04:50:38 +00:00
|
|
|
private:
|
2004-01-06 17:28:29 +00:00
|
|
|
|
2004-01-07 04:50:38 +00:00
|
|
|
struct FileDirCache {
|
|
|
|
char fileName[20];
|
|
|
|
AudioTable *bundleTable;
|
|
|
|
int32 numFiles;
|
2007-06-01 11:41:07 +00:00
|
|
|
bool isCompressed;
|
2005-10-26 21:17:55 +00:00
|
|
|
IndexNode *indexTable;
|
2004-01-07 04:50:38 +00:00
|
|
|
} _budleDirCache[4];
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-07 04:50:38 +00:00
|
|
|
public:
|
|
|
|
BundleDirCache();
|
|
|
|
~BundleDirCache();
|
|
|
|
|
2005-01-25 22:21:26 +00:00
|
|
|
int matchFile(const char *filename);
|
2005-10-26 21:17:55 +00:00
|
|
|
AudioTable *getTable(int slot);
|
|
|
|
IndexNode *getIndexTable(int slot);
|
|
|
|
int32 getNumFiles(int slot);
|
2007-06-01 11:22:49 +00:00
|
|
|
bool isSndDataExtComp(int slot);
|
2004-01-07 04:50:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BundleMgr {
|
2005-10-26 21:17:55 +00:00
|
|
|
|
2004-01-06 17:28:29 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
struct CompTable {
|
|
|
|
int32 offset;
|
|
|
|
int32 size;
|
|
|
|
int32 codec;
|
|
|
|
};
|
|
|
|
|
2004-01-07 04:50:38 +00:00
|
|
|
BundleDirCache *_cache;
|
|
|
|
BundleDirCache::AudioTable *_bundleTable;
|
2005-10-26 21:17:55 +00:00
|
|
|
BundleDirCache::IndexNode *_indexTable;
|
2004-01-07 03:34:41 +00:00
|
|
|
CompTable *_compTable;
|
2007-06-01 11:41:07 +00:00
|
|
|
|
2004-05-23 19:32:11 +00:00
|
|
|
int _numFiles;
|
|
|
|
int _numCompItems;
|
2007-06-01 11:41:07 +00:00
|
|
|
int _curSampleId;
|
2006-04-23 17:47:40 +00:00
|
|
|
BaseScummFile *_file;
|
2004-01-07 03:34:41 +00:00
|
|
|
bool _compTableLoaded;
|
|
|
|
int _fileBundleId;
|
2007-06-01 11:41:07 +00:00
|
|
|
byte _compOutputBuff[0x2000];
|
|
|
|
byte *_compInputBuff;
|
2004-05-23 19:32:11 +00:00
|
|
|
int _outputSize;
|
|
|
|
int _lastBlock;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-08-28 14:06:36 +00:00
|
|
|
bool loadCompTable(int32 index);
|
2004-01-06 17:28:29 +00:00
|
|
|
|
|
|
|
public:
|
2004-01-07 03:34:41 +00:00
|
|
|
|
2004-01-07 04:50:38 +00:00
|
|
|
BundleMgr(BundleDirCache *_cache);
|
2004-01-06 17:28:29 +00:00
|
|
|
~BundleMgr();
|
|
|
|
|
2007-06-01 12:18:33 +00:00
|
|
|
bool open(const char *filename, bool &compressed, bool errorFlag = false);
|
2005-01-25 22:21:26 +00:00
|
|
|
void close();
|
2010-11-23 22:25:10 +00:00
|
|
|
Common::SeekableReadStream *getFile(const char *filename, int32 &offset, int32 &size);
|
2007-06-01 12:18:33 +00:00
|
|
|
int32 decompressSampleByName(const char *name, int32 offset, int32 size, byte **compFinal, bool headerOutside);
|
|
|
|
int32 decompressSampleByIndex(int32 index, int32 offset, int32 size, byte **compFinal, int header_size, bool headerOutside);
|
|
|
|
int32 decompressSampleByCurIndex(int32 offset, int32 size, byte **compFinal, int headerSize, bool headerOutside);
|
2004-01-06 17:28:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Scumm
|
|
|
|
|
|
|
|
#endif
|