summaryrefslogtreecommitdiff
path: root/MapTool/wii/archiveu8.h
diff options
context:
space:
mode:
Diffstat (limited to 'MapTool/wii/archiveu8.h')
-rw-r--r--MapTool/wii/archiveu8.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/MapTool/wii/archiveu8.h b/MapTool/wii/archiveu8.h
new file mode 100644
index 0000000..5561beb
--- /dev/null
+++ b/MapTool/wii/archiveu8.h
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ This file is part of LayoutStudio (http://github.com/Treeki/LayoutStudio)
+ Copyright (c) 2010 Treeki (treeki@gmail.com)
+
+ 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, version 2.0.
+
+ 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 2.0 for more details.
+
+ You should have received a copy of the GNU General Public License 2.0
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*******************************************************************************/
+
+#ifndef WIIARCHIVEU8_H
+#define WIIARCHIVEU8_H
+
+#include "common.h"
+#include "filesystem.h"
+#include "stringtablebuilder.h"
+
+
+struct U8ReadInfo {
+ qint64 startPos;
+ QString stringTable;
+ int currentNode;
+};
+
+struct U8WriteInfo {
+ qint64 startPos;
+ WiiStringTableBuilder stringTableBuilder;
+ int currentRecursionLevel;
+ int currentNode;
+ int nextDataOffset;
+};
+
+
+class WiiArchiveU8 {
+public:
+ WiiArchiveU8();
+ WiiArchiveU8(QDataStream &stream);
+
+ WiiDirectory root;
+
+ void writeToDataStream(QDataStream &out) const;
+
+private:
+ void readDir(QDataStream &in, WiiDirectory &dir, int lastChild, U8ReadInfo &info);
+
+ void addNodeToStringTable(const WiiFSObject &node, WiiStringTableBuilder &table) const;
+ void countNode(const WiiFSObject &node, int *countPtr) const;
+
+ void writeDir(QDataStream &out, const WiiDirectory &dir, U8WriteInfo &info) const;
+
+ void writeNodeData(QDataStream &out, const WiiFSObject &node) const;
+};
+
+#endif // WIIARCHIVEU8_H