From 7d4e4c0b34a613dd3c0220475ae4e448197522c1 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 12 Mar 2011 23:17:12 +0100 Subject: initial commit. now I can start playing with stuff! --- MapTool/wii/archiveu8.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 MapTool/wii/archiveu8.h (limited to 'MapTool/wii/archiveu8.h') 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 . +*******************************************************************************/ + +#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 -- cgit v1.2.3