Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
indilo53 committed Feb 16, 2020
1 parent 371971e commit e6dab63
Showing 7 changed files with 7,311 additions and 1,451 deletions.
2 changes: 1 addition & 1 deletion RageLib.GTA5/ResourceWrappers/PC/Meta/Convert/MetaXml.cs
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ public static string GetXml(MetaFile meta)
{
var cont = new MetaCont(meta);

WriteNode(sb, 0, cont, meta.RootBlockIndex, 0, XmlTagMode.Structure, 0, (string)meta.Name);
WriteNode(sb, 0, cont, meta.RootBlockIndex, 0, XmlTagMode.Structure, 0, meta.Name is null ? "" : (string)meta.Name);
}

return sb.ToString();
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ public MCEntityDef ParentEntity
}
else
{
this._ParentIndex = value.Parent.Entities.IndexOf(value);
this._ParentIndex = value.Parent?.Entities.IndexOf(value) ?? -1;
}

if (this._ParentEntity != null && this.ParentEntity.Children.IndexOf(this) == -1)
10 changes: 5 additions & 5 deletions RageLib.GTA5/Resources/PC/Drawables/VertexDeclaration.cs
Original file line number Diff line number Diff line change
@@ -10,11 +10,11 @@ public override long Length
}

// structure data
public uint Flags { get; set; }
public ushort Stride { get; set; }
public byte Unknown_6h { get; set; }
public byte Count { get; set; }
public ulong Types { get; set; }
public uint Flags;
public ushort Stride;
public byte Unknown_6h;
public byte Count;
public ulong Types;

/// <summary>
/// Reads the data-block from a stream.
3 changes: 3 additions & 0 deletions RageLib.GTA5/Resources/PC/GameFiles/YmapFile.cs
Original file line number Diff line number Diff line change
@@ -62,6 +62,9 @@ public override void Parse(object[] parameters = null)

public override void Build(object[] parameters = null)
{
for (int i = 0; i < this.CMapData.Entities.Count; i++)
this.CMapData.Entities[i].ParentEntity = this.CMapData.Entities[i].ParentEntity;

var mb = new MetaBuilder();

mb.EnsureBlock(MetaName.CMapData);
6 changes: 6 additions & 0 deletions RageLib.GTA5/Resources/PC/GameFiles/YmtPedDefinitionFile.cs
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ THE SOFTWARE.
using System.Collections.Generic;
using RageLib.GTA5.Resources.PC;
using RageLib.GTA5.ResourceWrappers.PC.Meta.Structures;
using RageLib.Resources.Common;

using RageLib.Resources.GTA5.PC.Meta;
using SharpDX;
@@ -33,6 +34,7 @@ namespace RageLib.Resources.GTA5.PC.GameFiles
public class YmtPedDefinitionFile : GameFileBase_Resource<MetaFile>
{
public MUnk_376833625 Unk_376833625;
public string metaYmtName = "";

public YmtPedDefinitionFile()
{
@@ -50,6 +52,8 @@ public override void Parse(object[] parameters = null)
this.Unk_376833625 = new RageLib.GTA5.ResourceWrappers.PC.Meta.Structures.MUnk_376833625();

this.Unk_376833625.Parse(this.ResourceFile.ResourceData, Unk_376833625);

this.metaYmtName = (string)this.ResourceFile.ResourceData.Name;
}

public override void Build(object[] parameters = null)
@@ -60,6 +64,8 @@ public override void Build(object[] parameters = null)

this.Unk_376833625.Build(mb, true);

this.Unk_376833625.Meta.Name = (string_r)metaYmtName;

ResourceFile.Version = ResourceFileTypes_GTA5_pc.Meta.Version;
ResourceFile.ResourceData = this.Unk_376833625.Meta;
}
8,732 changes: 7,291 additions & 1,441 deletions RageLib.GTA5/Resources/PC/Meta/MetaNames.cs

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions _TestTools.GTA5/GenerateMetaEnumsAndStructs/Program.cs
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ THE SOFTWARE.
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using RageLib.GTA5.Archives;
using RageLib.GTA5.Cryptography;
using RageLib.GTA5.Utilities;
@@ -81,7 +82,7 @@ static void Main(string[] args)

ArchiveUtilities.ForEachFile(GTAVDir, (fullName, file, encryption) =>
{
if(file.Name.EndsWith(".ymap") || file.Name.EndsWith(".ytyp") || file.Name.EndsWith(".ymt"))
if(/*file.Name.EndsWith(".ymap") || file.Name.EndsWith(".ytyp") || */file.Name.EndsWith(".ymt") && Regex.Match(file.Name, @"mp_m_freemode_01.*\.ymt").Success)
{
using (MemoryStream ms = new MemoryStream())
{
@@ -868,12 +869,12 @@ class StructureInfoComparer : IEqualityComparer<StructureInfo>
{
public bool Equals(StructureInfo a, StructureInfo b)
{
return a.StructureKey == b.StructureKey;
return a.StructureKey == b.StructureKey && a.StructureLength == b.StructureLength;
}

public int GetHashCode(StructureInfo e)
{
return e.StructureKey;
return e.StructureKey + e.StructureLength;
}
}
}

0 comments on commit e6dab63

Please sign in to comment.