XML editing for audioconfig.dat4.rel

This commit is contained in:
dexy 2019-01-20 16:54:42 +11:00
parent 63a7b1bceb
commit 6d8a785635
3 changed files with 1020 additions and 92 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2376,11 +2376,12 @@ namespace CodeWalker.GameFiles
sb.AppendLine();
byte[] data;
if (!savetest) continue;
if (savetest)
{
byte[] data = rel.Save();
data = rel.Save();
if (data != null)
{
if (data.Length != rbfe.FileUncompressedSize)
@ -2393,9 +2394,6 @@ namespace CodeWalker.GameFiles
if (data[i] != rel.RawFileData[i])
{ break; }
}
}
else
{ }
RelFile rel2 = new RelFile();
@ -2406,9 +2404,14 @@ namespace CodeWalker.GameFiles
if (rel2.RelDatas == null)
{ }
}
else
{ }
if (!xmltest) continue;
}
if (xmltest)
{
var relxml = RelXml.GetXml(rel); //XML test...
var rel3 = XmlRel.GetRel(relxml);
if (rel3 != null)
@ -2447,7 +2450,7 @@ namespace CodeWalker.GameFiles
else
{ }
}
//sbi.Clear();

View File

@ -303,6 +303,51 @@ namespace CodeWalker
return GetRawVector3Array(cnode);
}
public static Vector4[] GetRawVector4Array(XmlNode node)
{
if (node == null) return new Vector4[0];
float x = 0f;
float y = 0f;
float z = 0f;
float w = 0f;
var items = new List<Vector4>();
var split = node.InnerText.Split('\n');// Regex.Split(node.InnerText, @"[\s\r\n\t]");
for (int i = 0; i < split.Length; i++)
{
var s = split[i]?.Trim();
if (string.IsNullOrEmpty(s)) continue;
var split2 = s.Split(',');// Regex.Split(s, @"[\s\t]");
int c = 0;
x = 0f; y = 0f;
for (int n = 0; n < split2.Length; n++)
{
var ts = split2[n]?.Trim();
if (string.IsNullOrEmpty(ts)) continue;
var f = FloatUtil.Parse(ts);
switch (c)
{
case 0: x = f; break;
case 1: y = f; break;
case 2: z = f; break;
case 3: w = f; break;
}
c++;
}
if (c >= 4)
{
var val = new Vector4(x, y, z, w);
items.Add(val);
}
}
return items.ToArray();
}
public static Vector4[] GetChildRawVector4Array(XmlNode node, string name)
{
var cnode = node.SelectSingleNode(name);
return GetRawVector4Array(cnode);
}
}
}