aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/barchive.h
diff options
context:
space:
mode:
authorDenis Kasak2009-06-08 22:18:52 +0000
committerDenis Kasak2009-06-08 22:18:52 +0000
commit39a8c71f776254b272e68a36fa5355293c0ae5f9 (patch)
tree4022a2900177414291fc8e5d947ff0ab1fc4cf2f /engines/draci/barchive.h
parentcfae0162008fb27dfd8e0e6c8aeab1721974c562 (diff)
downloadscummvm-rg350-39a8c71f776254b272e68a36fa5355293c0ae5f9.tar.gz
scummvm-rg350-39a8c71f776254b272e68a36fa5355293c0ae5f9.tar.bz2
scummvm-rg350-39a8c71f776254b272e68a36fa5355293c0ae5f9.zip
Adding Draci Historie engine skeleton (engine stub, BAR archiver, rudimentary GPL disassembler)
svn-id: r41390
Diffstat (limited to 'engines/draci/barchive.h')
-rw-r--r--engines/draci/barchive.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/engines/draci/barchive.h b/engines/draci/barchive.h
new file mode 100644
index 0000000000..0a0ecc832b
--- /dev/null
+++ b/engines/draci/barchive.h
@@ -0,0 +1,76 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef BARCHIVE_H
+#define BARCHIVE_H
+
+#include "common/str.h"
+
+namespace Draci {
+
+/**
+ * Represents individual files inside the archive
+ */
+
+struct BAFile {
+ uint16 _length;
+ uint32 _offset; //!< Offset of file inside archive
+ byte *_data;
+ byte _crc;
+
+ void closeFile(void) { //!< Releases the file data (for memory considerations)
+ delete _data;
+ _data = NULL;
+ }
+};
+
+class BArchive {
+public:
+ BArchive() : _files(NULL), _fileCount(0) {}
+ BArchive(Common::String &path) : _files(NULL), _fileCount(0) { openArchive(path); }
+ ~BArchive() { closeArchive(); }
+
+ void openArchive(const Common::String &path);
+ void closeArchive(void);
+ uint16 size() const { return _fileCount; }
+
+ BAFile *operator[](unsigned int i) const;
+
+private:
+ // Archive header data
+ static const char _magicNumber[];
+ static const unsigned int _archiveHeaderSize = 10;
+
+ // File stream header data
+ static const unsigned int _fileHeaderSize = 6;
+
+ Common::String _path; //!< Path to file
+ BAFile *_files; //!< Internal array of files
+ uint16 _fileCount; //!< Number of files in archive
+};
+
+} // End of namespace Draci
+
+#endif // BARCHIVE_H