YED/XML conversion

This commit is contained in:
dexy
2022-01-31 19:39:42 +11:00
Unverified
parent 8c037e24f0
commit 7a8977b277
6 changed files with 1390 additions and 507 deletions
+20 -5
View File
@@ -279,7 +279,7 @@ namespace CodeWalker
InitFileType(".yvr", "Vehicle Record", 9, FileTypeAction.ViewYvr);
InitFileType(".ywr", "Waypoint Record", 9, FileTypeAction.ViewYwr);
InitFileType(".fxc", "Compiled Shaders", 9, FileTypeAction.ViewFxc);
InitFileType(".yed", "Expression Dictionary", 9, FileTypeAction.ViewYed);
InitFileType(".yed", "Expression Dictionary", 9, FileTypeAction.ViewYed, true);
InitFileType(".yld", "Cloth Dictionary", 9, FileTypeAction.ViewYld, true);
InitFileType(".yfd", "Frame Filter Dictionary", 9, FileTypeAction.ViewYfd);
InitFileType(".asi", "ASI Plugin", 9);
@@ -1748,16 +1748,16 @@ namespace CodeWalker
private void ViewYed(string name, string path, byte[] data, RpfFileEntry e)
{
var yed = RpfFile.GetFile<YedFile>(e, data);
GenericForm f = new GenericForm(this);
MetaForm f = new MetaForm(this);
f.Show();
f.LoadFile(yed, yed.RpfFileEntry);
f.LoadMeta(yed);
}
private void ViewYld(string name, string path, byte[] data, RpfFileEntry e)
{
var yld = RpfFile.GetFile<YldFile>(e, data);
GenericForm f = new GenericForm(this);
MetaForm f = new MetaForm(this);
f.Show();
f.LoadFile(yld, yld.RpfFileEntry);
f.LoadMeta(yld);
}
private void ViewYfd(string name, string path, byte[] data, RpfFileEntry e)
{
@@ -2741,6 +2741,10 @@ namespace CodeWalker
{
mformat = MetaFormat.Yld;
}
if (fnamel.EndsWith(".yed.xml"))
{
mformat = MetaFormat.Yed;
}
if (fnamel.EndsWith(".awc.xml"))
{
mformat = MetaFormat.Awc;
@@ -2924,6 +2928,17 @@ namespace CodeWalker
data = yld.Save();
break;
}
case MetaFormat.Yed:
{
var yed = XmlYed.GetYed(doc, fpathin);
if (yed.ExpressionDictionary == null)
{
MessageBox.Show(fname + ": Schema not supported.", "Cannot import YED XML");
continue;
}
data = yed.Save();
break;
}
case MetaFormat.Awc:
{
var awc = XmlAwc.GetAwc(doc, fpathin);
+46
View File
@@ -318,6 +318,34 @@ namespace CodeWalker.Forms
metaFormat = MetaFormat.Ynd;
}
}
public void LoadMeta(YldFile yld)
{
var fn = ((yld?.RpfFileEntry?.Name) ?? "") + ".xml";
Xml = MetaXml.GetXml(yld, out fn);
FileName = fn;
RawPropertyGrid.SelectedObject = yld;
rpfFileEntry = yld?.RpfFileEntry;
modified = false;
metaFormat = MetaFormat.XML;
if (yld?.RpfFileEntry != null)
{
metaFormat = MetaFormat.Yld;
}
}
public void LoadMeta(YedFile yed)
{
var fn = ((yed?.RpfFileEntry?.Name) ?? "") + ".xml";
Xml = MetaXml.GetXml(yed, out fn);
FileName = fn;
RawPropertyGrid.SelectedObject = yed;
rpfFileEntry = yed?.RpfFileEntry;
modified = false;
metaFormat = MetaFormat.XML;
if (yed?.RpfFileEntry != null)
{
metaFormat = MetaFormat.Yed;
}
}
public void LoadMeta(CacheDatFile cachedat)
{
var fn = ((cachedat?.FileEntry?.Name) ?? "") + ".xml";
@@ -404,6 +432,24 @@ namespace CodeWalker.Forms
}
data = ynd.Save();
break;
case MetaFormat.Yld:
var yld = XmlYld.GetYld(doc);
if (yld.ClothDictionary == null)
{
MessageBox.Show("Schema not supported.", "Cannot import YLD XML");
return false;
}
data = yld.Save();
break;
case MetaFormat.Yed:
var yed = XmlYed.GetYed(doc);
if (yed.ExpressionDictionary == null)
{
MessageBox.Show("Schema not supported.", "Cannot import YED XML");
return false;
}
data = yed.Save();
break;
case MetaFormat.CacheFile:
MessageBox.Show("Sorry, CacheFile import is not supported.", "Cannot import CacheFile XML");
return false;