-
Notifications
You must be signed in to change notification settings - Fork 5
/
NierA_YAX.bt
45 lines (37 loc) · 864 Bytes
/
NierA_YAX.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// YAX - Yet Another Xml encoding
#include "NierA_YAX_HashLookup.h"
string makeIndentStr(uint32 indents) {
local uint32 i;
local string s = "";
for (i = 0; i < indents; i++) {
s += " ";
}
return s;
}
string getNodeText(uint32 offset) {
if (offset == 0)
return "";
return ReadString(offset);
}
string PrettyPrintXmlNode (struct XmlNode& entry) {
local string tagName = getTagName(entry.tagNameHash);
local string indentStr = makeIndentStr(entry.indentation);
local string text = getNodeText(entry.stringOffset);
local string s = indentStr + "<" + tagName + ">" + text + "</" + tagName + ">";
return s;
}
struct XmlNode {
ubyte indentation;
uint32 tagNameHash;
uint32 stringOffset;
};
uint32 nodeCount;
XmlNode nodes[nodeCount] <name=PrettyPrintXmlNode>;
struct String {
string s;
};
struct {
while (!FEof()) {
String s;
}
} Strings;