xoreos  0.0.5
bzffile.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos 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 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
28 #ifndef AURORA_BZFFILE_H
29 #define AURORA_BZFFILE_H
30 
31 #include <vector>
32 
33 #include "src/common/types.h"
34 #include "src/common/scopedptr.h"
35 
36 #include "src/aurora/types.h"
37 #include "src/aurora/keydatafile.h"
38 #include "src/aurora/aurorafile.h"
39 
40 namespace Common {
41  class SeekableReadStream;
42 }
43 
44 namespace Aurora {
45 
46 class KEYFile;
47 
55 class BZFFile : public KEYDataFile, public AuroraFile {
56 public:
59  ~BZFFile();
60 
62  const ResourceList &getResources() const;
63 
65  uint32 getResourceSize(uint32 index) const;
66 
68  Common::SeekableReadStream *getResource(uint32 index, bool tryNoCopy = false) const;
69 
78  void mergeKEY(const KEYFile &key, uint32 dataFileIndex);
79 
80 private:
82  struct IResource {
84 
87 
89  };
90 
91  typedef std::vector<IResource> IResourceList;
92 
94 
97 
100 
101  void load(Common::SeekableReadStream &bzf);
103 
104  const IResource &getIResource(uint32 index) const;
105 };
106 
107 } // End of namespace Aurora
108 
109 #endif // AURORA_BZFFILE_H
Definition: 2dafile.h:39
Internal resource information.
Definition: bzffile.h:82
const ResourceList & getResources() const
Return the list of resources.
Definition: bzffile.cpp:128
BZFFile(Common::SeekableReadStream *bzf)
Take over this stream and read a BZF file out of it.
Definition: bzffile.cpp:44
std::vector< IResource > IResourceList
Definition: bzffile.h:91
Common::ScopedPtr< Common::SeekableReadStream > _bzf
Definition: bzffile.h:93
Class to hold resource index information of a KEY file.
Definition: keyfile.h:70
Class to hold resource data information of a BZF file.
Definition: bzffile.h:55
A simple scoped smart pointer template.
IResourceList _iResources
Internal list of resource offsets and sizes.
Definition: bzffile.h:99
const IResource & getIResource(uint32 index) const
Definition: bzffile.cpp:132
ResourceList _resources
External list of resource names and types.
Definition: bzffile.h:96
std::list< Resource > ResourceList
Definition: archive.h:57
Base for BioWare&#39;s Aurora engine files.
uint32 offset
The offset of the resource within the BZF.
Definition: bzffile.h:85
FileType type
The resource&#39;s type.
Definition: bzffile.h:83
Low-level type definitions to handle fixed width types portably.
uint32 size
The resource&#39;s size.
Definition: bzffile.h:86
void readVarResTable(Common::SeekableReadStream &bzf, uint32 offset)
Definition: bzffile.cpp:83
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
An abstract KEY data file (BIF or BZF).
void mergeKEY(const KEYFile &key, uint32 dataFileIndex)
Merge information from the KEY into the data file.
Definition: bzffile.cpp:101
uint32_t uint32
Definition: types.h:204
Common::SeekableReadStream * getResource(uint32 index, bool tryNoCopy=false) const
Return a stream of the resource&#39;s contents.
Definition: bzffile.cpp:143
uint32 getResourceSize(uint32 index) const
Return the size of a resource.
Definition: bzffile.cpp:139
Base class for most files found in games using BioWare&#39;s Aurora engine.
Definition: aurorafile.h:52
FileType
Various file types used by the Aurora engine and found in archives.
Definition: types.h:56
uint32 packedSize
Raw, compressed data size.
Definition: bzffile.h:88
Interface for a seekable & readable data stream.
Definition: readstream.h:265
void load(Common::SeekableReadStream &bzf)
Definition: bzffile.cpp:53