Fixed bug in PSO/XML conversion for structure pointers

This commit is contained in:
dexy 2019-01-13 18:13:03 +11:00
parent 187f8379cd
commit 9506069e35
2 changed files with 19 additions and 3 deletions

View File

@ -885,7 +885,10 @@ namespace CodeWalker.GameFiles
}
if (pbok)
{
var typename = HashString(cont.Pso.GetBlock(pbid).NameHash);
OpenTag(sb, cind, ename + " type=\"" + typename + "\"");
WriteNode(sb, cind, cont, ptrVal.BlockID, (int)ptrVal.ItemOffset, XmlTagMode.None, (MetaName)entry.ReferenceKey);
CloseTag(sb, cind, ename);
}
else
{

View File

@ -83,7 +83,16 @@ namespace CodeWalker.GameFiles
}
case PsoDataType.Structure:
{
var struc = Traverse(cnode, pb, (MetaName)entry.ReferenceKey);
var stype = (MetaName)entry.ReferenceKey;
if (stype == 0)
{
var stypestr = Xml.GetStringAttribute(cnode, "type");
if (!string.IsNullOrEmpty(stypestr))
{
stype = (MetaName)(uint)GetHash(stypestr);
}
}
var struc = Traverse(cnode, pb, stype);
if (struc != null)
{
switch (entry.Unk_5h)
@ -99,7 +108,7 @@ namespace CodeWalker.GameFiles
case 3: //structure pointer...
case 4: //also pointer? what's the difference?
var bptr = pb.AddItem((MetaName)entry.ReferenceKey, struc);
var bptr = pb.AddItem(stype, struc);
var ptr = new PsoPOINTER(bptr.BlockID, bptr.Offset, 0);
ptr.SwapEnd();
var ptrb = MetaTypes.ConvertToBytes(ptr);
@ -109,6 +118,8 @@ namespace CodeWalker.GameFiles
break;
}
}
else
{ }
break;
}
case PsoDataType.Map:
@ -348,6 +359,8 @@ namespace CodeWalker.GameFiles
return data;
}
else
{ }//info not found
return null;
}