summaryrefslogtreecommitdiff
path: root/wii/stringtablebuilder.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2010-10-14 03:15:41 +0200
committerTreeki <treeki@gmail.com>2010-10-14 03:15:41 +0200
commitfdf8cfec2b795393d7ee901abaf747575067068b (patch)
tree1eb3a65765c1c43c4ea91530462cd15d54f995d1 /wii/stringtablebuilder.cpp
parent7213ca723a65dff8ebb0c6c08669695217e60453 (diff)
downloadLayoutStudio-fdf8cfec2b795393d7ee901abaf747575067068b.tar.gz
LayoutStudio-fdf8cfec2b795393d7ee901abaf747575067068b.zip
bugfixes; working U8 archive support for reading/writing
Diffstat (limited to 'wii/stringtablebuilder.cpp')
-rw-r--r--wii/stringtablebuilder.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/wii/stringtablebuilder.cpp b/wii/stringtablebuilder.cpp
new file mode 100644
index 0000000..679247c
--- /dev/null
+++ b/wii/stringtablebuilder.cpp
@@ -0,0 +1,25 @@
+#include "stringtablebuilder.h"
+
+WiiStringTableBuilder::WiiStringTableBuilder() {
+ m_nextOffset = 0;
+ m_data = "";
+}
+
+quint32 WiiStringTableBuilder::add(QString str) {
+ if (m_lookup.contains(str))
+ return m_lookup.value(str);
+
+ quint32 added = m_nextOffset;
+ m_lookup.insert(str, added);
+
+ m_data.append(str.toAscii());
+ m_data.append('\0');
+
+ m_nextOffset = m_data.length();
+
+ return added;
+}
+
+QByteArray WiiStringTableBuilder::pack() {
+ return m_data;
+}