RPF Explorer import/export .rel XML options

This commit is contained in:
dexy 2019-01-20 09:34:44 +11:00
parent f1562e6da0
commit 33af1b45f8
2 changed files with 27 additions and 0 deletions

View File

@ -46,6 +46,11 @@ namespace CodeWalker.GameFiles
CutFile cut = RpfFile.GetFile<CutFile>(e, data);
return GetXml(cut, out filename);
}
else if (fnl.EndsWith(".rel"))
{
RelFile rel = RpfFile.GetFile<RelFile>(e, data);
return GetXml(rel, out filename);
}
filename = fn;
return string.Empty;
}
@ -99,6 +104,12 @@ namespace CodeWalker.GameFiles
filename = string.Empty;
return string.Empty;
}
public static string GetXml(RelFile rel, out string filename)
{
var fn = (rel?.RpfFileEntry?.Name) ?? "";
filename = fn + ".xml";
return RelXml.GetXml(rel);
}

View File

@ -1316,6 +1316,7 @@ namespace CodeWalker
case FileTypeAction.ViewYtyp:
case FileTypeAction.ViewJPso:
case FileTypeAction.ViewCut:
case FileTypeAction.ViewRel:
return true;
}
return false;
@ -2269,6 +2270,10 @@ namespace CodeWalker
MessageBox.Show(fname + ": RBF XML import not yet supported.", "Cannot import XML");
continue;
}
if (fnamel.EndsWith(".rel.xml"))
{
mformat = MetaFormat.AudioRel;
}
fname = fname.Substring(0, fname.Length - trimlength);
fnamel = fnamel.Substring(0, fnamel.Length - trimlength);
@ -2311,6 +2316,17 @@ namespace CodeWalker
//todo!
break;
}
case MetaFormat.AudioRel:
{
var rel = XmlRel.GetRel(doc);
if ((rel.RelDatasSorted == null) || (rel.RelDatas == null))
{
MessageBox.Show(fname + ": Schema not supported.", "Cannot import REL XML");
continue;
}
data = rel.Save();
break;
}
}