Skip to content

Commit

Permalink
Fixed cloth resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Neodymium146 committed Jun 17, 2017
1 parent 7e3788e commit 91b8277
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 5 deletions.
1 change: 1 addition & 0 deletions RageLib.GTA5/RageLib.GTA5.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
<Compile Include="Resources\PC\Clothes\Unknown_C_003.cs" />
<Compile Include="Resources\PC\Clothes\Unknown_C_004.cs" />
<Compile Include="Resources\PC\Clothes\Unknown_C_006.cs" />
<Compile Include="Resources\PC\Clothes\Unknown_C_007.cs" />
<Compile Include="Resources\PC\Clothes\VerletCloth.cs" />
<Compile Include="Resources\PC\Drawables\Bone.cs" />
<Compile Include="Resources\PC\Drawables\Drawable.cs" />
Expand Down
62 changes: 62 additions & 0 deletions RageLib.GTA5/Resources/PC/Clothes/Unknown_C_007.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
Copyright(c) 2017 Neodymium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

namespace RageLib.Resources.GTA5.PC.Clothes
{
public class Unknown_C_007 : ResourceSystemBlock
{
public override long Length
{
get { return 16; }
}

// structure data
public uint Unknown_0h; // 0x00000000
public uint Unknown_4h; // 0x00000000
public uint Unknown_8h; // 0x00000000
public uint Unknown_Ch; // 0x00000000

/// <summary>
/// Reads the data-block from a stream.
/// </summary>
public override void Read(ResourceDataReader reader, params object[] parameters)
{
// read structure data
this.Unknown_0h = reader.ReadUInt32();
this.Unknown_4h = reader.ReadUInt32();
this.Unknown_8h = reader.ReadUInt32();
this.Unknown_Ch = reader.ReadUInt32();
}

/// <summary>
/// Writes the data-block to a stream.
/// </summary>
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// write structure data
writer.Write(this.Unknown_0h);
writer.Write(this.Unknown_4h);
writer.Write(this.Unknown_8h);
writer.Write(this.Unknown_Ch);
}
}
}
22 changes: 17 additions & 5 deletions RageLib.GTA5/Resources/PC/Clothes/VerletCloth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ public class VerletCloth : ResourceSystemBlock
public ulong BehaviorPointer;
public uint Unknown_138h; // 0x00100000
public uint Unknown_13Ch; // 0x00000000
public ResourceSimpleList64<uint_r> Unknown_140h;
public ulong Unknown_140h_Pointer;
public uint Unknown_148h;
public uint Unknown_14Ch; // 0x00000000
public uint Unknown_150h; // 0x00000000
public uint Unknown_154h; // 0x00000000
public uint Unknown_158h;
Expand All @@ -117,6 +119,7 @@ public class VerletCloth : ResourceSystemBlock
// reference data
public Bound Bound;
public EnvClothVerletBehavior Behavior;
public Unknown_C_007 Unknown_140h_Data;

/// <summary>
/// Reads the data-block from a stream.
Expand Down Expand Up @@ -190,7 +193,9 @@ public override void Read(ResourceDataReader reader, params object[] parameters)
this.BehaviorPointer = reader.ReadUInt64();
this.Unknown_138h = reader.ReadUInt32();
this.Unknown_13Ch = reader.ReadUInt32();
this.Unknown_140h = reader.ReadBlock<ResourceSimpleList64<uint_r>>();
this.Unknown_140h_Pointer = reader.ReadUInt64();
this.Unknown_148h = reader.ReadUInt32();
this.Unknown_14Ch = reader.ReadUInt32();
this.Unknown_150h = reader.ReadUInt32();
this.Unknown_154h = reader.ReadUInt32();
this.Unknown_158h = reader.ReadUInt32();
Expand All @@ -211,6 +216,9 @@ public override void Read(ResourceDataReader reader, params object[] parameters)
this.Behavior = reader.ReadBlockAt<EnvClothVerletBehavior>(
this.BehaviorPointer // offset
);
this.Unknown_140h_Data = reader.ReadBlockAt<Unknown_C_007>(
this.Unknown_140h_Pointer // offset
);
}

/// <summary>
Expand All @@ -219,7 +227,9 @@ public override void Read(ResourceDataReader reader, params object[] parameters)
public override void Write(ResourceDataWriter writer, params object[] parameters)
{
// update structure data
this.BoundPointer = (ulong)(this.Bound != null ? this.Bound.Position : 0);
this.BehaviorPointer = (ulong)(this.Behavior != null ? this.Behavior.Position : 0);
this.Unknown_140h_Pointer = (ulong)(this.Unknown_140h_Data != null ? this.Unknown_140h_Data.Position : 0);

// write structure data
writer.Write(this.VFT);
Expand Down Expand Up @@ -288,7 +298,9 @@ public override void Write(ResourceDataWriter writer, params object[] parameters
writer.Write(this.BehaviorPointer);
writer.Write(this.Unknown_138h);
writer.Write(this.Unknown_13Ch);
writer.WriteBlock(this.Unknown_140h);
writer.Write(this.Unknown_140h_Pointer);
writer.Write(this.Unknown_148h);
writer.Write(this.Unknown_14Ch);
writer.Write(this.Unknown_150h);
writer.Write(this.Unknown_154h);
writer.Write(this.Unknown_158h);
Expand All @@ -311,6 +323,7 @@ public override IResourceBlock[] GetReferences()
var list = new List<IResourceBlock>();
if (Bound != null) list.Add(Bound);
if (Behavior != null) list.Add(Behavior);
if (Unknown_140h_Data != null) list.Add(Unknown_140h_Data);
return list.ToArray();
}

Expand All @@ -320,8 +333,7 @@ public override Tuple<long, IResourceBlock>[] GetParts()
new Tuple<long, IResourceBlock>(0x70, Unknown_70h),
new Tuple<long, IResourceBlock>(0x80, Unknown_80h),
new Tuple<long, IResourceBlock>(0x100, Unknown_100h),
new Tuple<long, IResourceBlock>(0x110, Unknown_110h),
new Tuple<long, IResourceBlock>(0x140, Unknown_140h)
new Tuple<long, IResourceBlock>(0x110, Unknown_110h)
};
}
}
Expand Down

0 comments on commit 91b8277

Please sign in to comment.