mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-29 02:12:54 +08:00
FXC/XML conversion
This commit is contained in:
parent
a2f34ddf05
commit
1648378010
File diff suppressed because it is too large
Load Diff
@ -4577,6 +4577,34 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
else
|
||||
{ }
|
||||
|
||||
var xml1 = FxcXml.GetXml(fxcfile);//won't output bytecodes with no output folder
|
||||
var fxc1 = XmlFxc.GetFxc(xml1);
|
||||
var xml2 = FxcXml.GetXml(fxc1);
|
||||
if (xml1 != xml2)
|
||||
{ }
|
||||
|
||||
|
||||
for (int i = 0; i < fxcfile.Shaders.Length; i++)
|
||||
{
|
||||
if (fxc1.Shaders[i].Name != fxcfile.Shaders[i].Name)
|
||||
{ }
|
||||
fxc1.Shaders[i].ByteCode = fxcfile.Shaders[i].ByteCode;
|
||||
}
|
||||
|
||||
var xdata = fxc1.Save();
|
||||
if (xdata.Length == odata.Length)
|
||||
{
|
||||
for (int i = 0; i < xdata.Length; i++)
|
||||
{
|
||||
if (xdata[i] != odata[i])
|
||||
{ break; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{ }
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{ }
|
||||
|
@ -132,6 +132,11 @@ namespace CodeWalker.GameFiles
|
||||
AwcFile awc = RpfFile.GetFile<AwcFile>(e, data);
|
||||
return GetXml(awc, out filename, outputfolder);
|
||||
}
|
||||
else if (fnl.EndsWith(".fxc"))
|
||||
{
|
||||
FxcFile fxc = RpfFile.GetFile<FxcFile>(e, data);
|
||||
return GetXml(fxc, out filename, outputfolder);
|
||||
}
|
||||
else if (fnl.EndsWith("cache_y.dat"))
|
||||
{
|
||||
CacheDatFile cdf = RpfFile.GetFile<CacheDatFile>(e, data);
|
||||
@ -291,6 +296,12 @@ namespace CodeWalker.GameFiles
|
||||
filename = fn + ".xml";
|
||||
return AwcXml.GetXml(awc, outputfolder);
|
||||
}
|
||||
public static string GetXml(FxcFile fxc, out string filename, string outputfolder)
|
||||
{
|
||||
var fn = (fxc?.Name) ?? "";
|
||||
filename = fn + ".xml";
|
||||
return FxcXml.GetXml(fxc, outputfolder);
|
||||
}
|
||||
public static string GetXml(CacheDatFile cdf, out string filename, string outputfolder)
|
||||
{
|
||||
var fn = (cdf?.FileEntry?.Name) ?? "";
|
||||
@ -2217,8 +2228,9 @@ namespace CodeWalker.GameFiles
|
||||
Ywr = 17,
|
||||
Yvr = 18,
|
||||
Awc = 19,
|
||||
Heightmap = 20,
|
||||
Ypdb = 21,
|
||||
Fxc = 20,
|
||||
Heightmap = 21,
|
||||
Ypdb = 22,
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ namespace CodeWalker.GameFiles
|
||||
return GetYvrData(doc, fpathin);
|
||||
case MetaFormat.Awc:
|
||||
return GetAwcData(doc, fpathin);
|
||||
case MetaFormat.Fxc:
|
||||
return GetFxcData(doc, fpathin);
|
||||
case MetaFormat.CacheFile:
|
||||
return GetCacheFileData(doc);
|
||||
case MetaFormat.Heightmap:
|
||||
@ -168,6 +170,12 @@ namespace CodeWalker.GameFiles
|
||||
if (awc.Streams == null) return null;
|
||||
return awc.Save();
|
||||
}
|
||||
public static byte[] GetFxcData(XmlDocument doc, string fpathin)
|
||||
{
|
||||
var fxc = XmlFxc.GetFxc(doc, fpathin);
|
||||
if (fxc.Shaders == null) return null;
|
||||
return fxc.Save();
|
||||
}
|
||||
public static byte[] GetCacheFileData(XmlDocument doc)
|
||||
{
|
||||
var cdf = XmlCacheDat.GetCacheDat(doc);
|
||||
@ -210,6 +218,7 @@ namespace CodeWalker.GameFiles
|
||||
case MetaFormat.Ywr: return "YWR XML";
|
||||
case MetaFormat.Yvr: return "YVR XML";
|
||||
case MetaFormat.Awc: return "AWC XML";
|
||||
case MetaFormat.Fxc: return "FXC XML";
|
||||
case MetaFormat.CacheFile: return "CacheFile XML";
|
||||
case MetaFormat.Heightmap: return "Heightmap XML";
|
||||
case MetaFormat.Ypdb: return "YPDB XML";
|
||||
@ -295,6 +304,10 @@ namespace CodeWalker.GameFiles
|
||||
{
|
||||
mformat = MetaFormat.Awc;
|
||||
}
|
||||
if (fnamel.EndsWith(".fxc.xml"))
|
||||
{
|
||||
mformat = MetaFormat.Fxc;
|
||||
}
|
||||
if (fnamel.EndsWith("cache_y.dat.xml"))
|
||||
{
|
||||
mformat = MetaFormat.CacheFile;
|
||||
|
@ -278,7 +278,7 @@ namespace CodeWalker
|
||||
InitFileType(".ynv", "Nav Mesh", 9, FileTypeAction.ViewModel, true);
|
||||
InitFileType(".yvr", "Vehicle Record", 9, FileTypeAction.ViewYvr, true);
|
||||
InitFileType(".ywr", "Waypoint Record", 9, FileTypeAction.ViewYwr, true);
|
||||
InitFileType(".fxc", "Compiled Shaders", 9, FileTypeAction.ViewFxc);
|
||||
InitFileType(".fxc", "Compiled Shaders", 9, FileTypeAction.ViewFxc, true);
|
||||
InitFileType(".yed", "Expression Dictionary", 9, FileTypeAction.ViewYed, true);
|
||||
InitFileType(".yld", "Cloth Dictionary", 9, FileTypeAction.ViewYld, true);
|
||||
InitFileType(".yfd", "Frame Filter Dictionary", 9, FileTypeAction.ViewYfd);
|
||||
@ -2107,7 +2107,7 @@ namespace CodeWalker
|
||||
var nl = file?.File?.NameLower ?? file?.Name?.ToLowerInvariant();
|
||||
if (!string.IsNullOrEmpty(nl))
|
||||
{
|
||||
needfolder = nl.EndsWith(".ytd") || nl.EndsWith(".ydr") || nl.EndsWith(".ydd") || nl.EndsWith(".yft") || nl.EndsWith(".ypt") || nl.EndsWith(".awc");
|
||||
needfolder = nl.EndsWith(".ytd") || nl.EndsWith(".ydr") || nl.EndsWith(".ydd") || nl.EndsWith(".yft") || nl.EndsWith(".ypt") || nl.EndsWith(".awc") || nl.EndsWith(".fxc");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user