diff options
author | Treeki <treeki@gmail.com> | 2011-03-12 23:17:12 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-12 23:17:12 +0100 |
commit | 7d4e4c0b34a613dd3c0220475ae4e448197522c1 (patch) | |
tree | 4f5cee367de3fdef4f9a7c84af59ffe76a2bb1c3 /MapTool/wii/archiveu8.h | |
download | kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.tar.gz kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.zip |
initial commit. now I can start playing with stuff!
Diffstat (limited to 'MapTool/wii/archiveu8.h')
-rw-r--r-- | MapTool/wii/archiveu8.h | 61 |
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 |