YFT/XML conversion progress

This commit is contained in:
dexy
2020-01-21 03:12:36 +11:00
Unverified
parent bec16ea42d
commit e44b2ef095
14 changed files with 1478 additions and 917 deletions
+11 -11
View File
@@ -5,6 +5,7 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
/*
Copyright(c) 2017 Neodymium
@@ -892,7 +893,7 @@ namespace CodeWalker.GameFiles
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class EnvironmentCloth : ResourceSystemBlock
[TypeConverter(typeof(ExpandableObjectConverter))] public class EnvironmentCloth : ResourceSystemBlock, IMetaXmlItem
{
// pgBase
// clothBase (TODO)
@@ -938,9 +939,6 @@ namespace CodeWalker.GameFiles
private ResourceSystemStructBlock<uint> UnknownDataBlock = null;
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
@@ -992,10 +990,6 @@ namespace CodeWalker.GameFiles
}
}
/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data
@@ -1037,10 +1031,15 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_78h);
writer.Write(this.Unknown_7Ch);
}
public void WriteXml(StringBuilder sb, int indent)
{
//TODO!!
}
public void ReadXml(XmlNode node)
{
//TODO!!
}
/// <summary>
/// Returns a list of data blocks which are referenced by this block.
/// </summary>
public override IResourceBlock[] GetReferences()
{
var list = new List<IResourceBlock>();
@@ -1054,6 +1053,7 @@ namespace CodeWalker.GameFiles
}
return list.ToArray();
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -140,6 +140,28 @@ namespace CodeWalker.GameFiles
//public float Unknown_22 { get; set; }
//public float Unknown_23 { get; set; }
//public float Unknown_24 { get; set; }
public Matrix3_s(float[] a)
{
if ((a != null) && (a.Length == 12))
{
Row1 = new Vector4(a[0], a[1], a[2], a[3]);
Row2 = new Vector4(a[4], a[5], a[6], a[7]);
Row3 = new Vector4(a[8], a[9], a[10], a[11]);
}
else
{
Row1 = new Vector4(1, 0, 0, 0);
Row2 = new Vector4(0, 1, 0, 0);
Row3 = new Vector4(0, 0, 1, 0);
}
}
public float[] ToArray()
{
return new[] { Row1.X, Row1.Y, Row1.Z, Row1.W, Row2.X, Row2.Y, Row2.Z, Row2.W, Row3.X, Row3.Y, Row3.Z, Row3.W };
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public struct AABB_s
+14 -6
View File
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -506,9 +507,16 @@ namespace CodeWalker.GameFiles
try
{
var filepath = System.IO.Path.Combine(ddsfolder, (Name ?? "null") + ".dds");
var dds = DDSIO.GetDDSFile(this);
System.IO.File.WriteAllBytes(filepath, dds);
if (!string.IsNullOrEmpty(ddsfolder))
{
if (!Directory.Exists(ddsfolder))
{
Directory.CreateDirectory(ddsfolder);
}
var filepath = Path.Combine(ddsfolder, (Name ?? "null") + ".dds");
var dds = DDSIO.GetDDSFile(this);
File.WriteAllBytes(filepath, dds);
}
}
catch { }
}
@@ -526,10 +534,10 @@ namespace CodeWalker.GameFiles
try
{
var filepath = System.IO.Path.Combine(ddsfolder, filename);
if (System.IO.File.Exists(filepath))
var filepath = Path.Combine(ddsfolder, filename);
if (File.Exists(filepath))
{
var dds = System.IO.File.ReadAllBytes(filepath);
var dds = File.ReadAllBytes(filepath);
var tex = DDSIO.GetTexture(dds);
if (tex != null)
{
@@ -74,6 +74,7 @@ namespace CodeWalker.GameFiles
GTAV1 = 0x7755555555996996, // GTAV - used by most drawables
GTAV2 = 0x030000000199A006, // GTAV - used on cloth?
GTAV3 = 0x0300000001996006, // GTAV - used on cloth?
GTAV4 = 0x7655555555996996, // GTAV - used by FragGlassWindow
//Types4 = 0x0000000007097007, // Max Payne 3
//Types5 = 0x0700000007097977, // Max Payne 3