ScummVM API documentation
dimuse_bndmgr.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SCUMM_IMUSE_DIGI_BUNDLE_MGR_H
23 #define SCUMM_IMUSE_DIGI_BUNDLE_MGR_H
24 
25 #include "common/scummsys.h"
26 #include "common/file.h"
27 #include "scumm/imuse_digi/dimuse_defs.h"
28 
29 namespace Scumm {
30 
31 class BaseScummFile;
32 
34 public:
35  struct AudioTable {
36  char filename[24];
37  int32 offset;
38  int32 size;
39  };
40 
41  struct IndexNode {
42  char filename[24];
43  int32 index;
44  };
45 
46 private:
47 
48  struct FileDirCache {
49  char fileName[20];
50  AudioTable *bundleTable;
51  int32 numFiles;
52  bool isCompressed;
53  IndexNode *indexTable;
54  } _bundleDirCache[4];
55 
56  const ScummEngine *_vm;
57 public:
58  BundleDirCache(const ScummEngine *vm);
59  ~BundleDirCache();
60 
61  int matchFile(const char *filename);
62  AudioTable *getTable(int slot);
63  IndexNode *getIndexTable(int slot);
64  int32 getNumFiles(int slot);
65  bool isSndDataExtComp(int slot);
66 };
67 
68 class BundleMgr {
69 
70 private:
71  struct CompTable {
72  int32 offset;
73  int32 size;
74  int32 codec;
75  };
76 
77  BundleDirCache *_cache;
78  BundleDirCache::AudioTable *_bundleTable;
79  BundleDirCache::IndexNode *_indexTable;
80  CompTable *_compTable;
81 
82  int _numFiles;
83  int _numCompItems;
84  int _lastBlockDecompressedSize;
85  int _curSampleId;
86  int _curDecompressedFilePos;
87  BaseScummFile *_file;
88  bool _compTableLoaded;
89  bool _isUncompressed;
90  int _fileBundleId;
91  byte _compOutputBuff[0x2000];
92  byte *_compInputBuff;
93  int _outputSize;
94  int _lastBlock;
95  bool loadCompTable(int32 index);
96 
97 public:
98 
99  BundleMgr(const ScummEngine *vm, BundleDirCache *_cache);
100  ~BundleMgr();
101 
102  bool open(const char *filename, bool &isCompressed, bool errorFlag = false);
103  void close();
104  Common::SeekableReadStream *getFile(const char *filename, int32 &offset, int32 &size);
105  int32 seekFile(int32 offset, int size);
106  int32 readFile(const char *name, int32 size, byte **compFinal, bool headerOutside);
107  bool isExtCompBun(byte gameId);
108 };
109 
110 } // End of namespace Scumm
111 
112 #endif
Definition: dimuse_bndmgr.h:41
Definition: dimuse_bndmgr.h:68
Definition: stream.h:745
Definition: scumm.h:518
Definition: dimuse_bndmgr.h:33
Definition: dimuse_bndmgr.h:35
Definition: actor.h:30
Definition: file.h:34