Skip to content

Commit cd931b8

Browse files
committed
Add more game files
1 parent 86281d8 commit cd931b8

File tree

3 files changed

+216
-0
lines changed

3 files changed

+216
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
Copyright(c) 2016 Neodymium
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using System.IO;
26+
using System.Text;
27+
using RageLib.Resources.GTA5.PC.Meta;
28+
using SharpDX;
29+
30+
namespace RageLib.Resources.GTA5.PC.GameFiles
31+
{
32+
public class Gxt2File : GameFileBase
33+
{
34+
public uint EntryCount = 0;
35+
public List<Gxt2Entry> TextEntries = new List<Gxt2Entry>();
36+
37+
public override void Parse()
38+
{
39+
using (BinaryReader br = new BinaryReader(this.Stream))
40+
{
41+
uint gxt2 = br.ReadUInt32(); //"GXT2" - 1196971058
42+
43+
if (gxt2 != 1196971058)
44+
return;
45+
46+
EntryCount = br.ReadUInt32();
47+
TextEntries = new List<Gxt2Entry>();
48+
49+
for (uint i = 0; i < EntryCount; i++)
50+
{
51+
var e = new Gxt2Entry();
52+
e.Hash = br.ReadUInt32();
53+
e.Offset = br.ReadUInt32();
54+
TextEntries.Add(e);
55+
}
56+
57+
gxt2 = br.ReadUInt32(); //another "GXT2"
58+
if (gxt2 != 1196971058)
59+
{ return; }
60+
61+
uint endpos = br.ReadUInt32();
62+
63+
List<byte> buf = new List<byte>();
64+
65+
for (uint i = 0; i < EntryCount; i++)
66+
{
67+
var e = TextEntries[(int)i];
68+
br.BaseStream.Position = e.Offset;
69+
70+
buf.Clear();
71+
byte b = br.ReadByte();
72+
while ((b != 0) && (br.BaseStream.Position < endpos))
73+
{
74+
buf.Add(b);
75+
b = br.ReadByte();
76+
}
77+
78+
e.Text = Encoding.UTF8.GetString(buf.ToArray());
79+
}
80+
81+
}
82+
}
83+
84+
public override void Build()
85+
{
86+
87+
}
88+
}
89+
90+
public class Gxt2Entry
91+
{
92+
public uint Hash;
93+
public uint Offset;
94+
public string Text;
95+
}
96+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
Copyright(c) 2016 Neodymium
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using RageLib.Resources.GTA5.PC.Meta;
26+
using SharpDX;
27+
28+
namespace RageLib.Resources.GTA5.PC.GameFiles
29+
{
30+
public class YbnFile : GameFileBase_Resource<Bounds.Bound>
31+
{
32+
public Bounds.Bound Bound;
33+
34+
public YbnFile()
35+
{
36+
37+
}
38+
39+
public override void Parse()
40+
{
41+
this.Bound = this.ResourceFile.ResourceData;
42+
}
43+
44+
public override void Build()
45+
{
46+
47+
}
48+
49+
}
50+
51+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
Copyright(c) 2016 Neodymium
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using RageLib.GTA5.Resources.PC;
26+
using RageLib.GTA5.ResourceWrappers.PC.Meta.Structures;
27+
28+
using RageLib.Resources.GTA5.PC.Meta;
29+
using SharpDX;
30+
31+
namespace RageLib.Resources.GTA5.PC.GameFiles
32+
{
33+
public class YmtPedDefinitionFile : GameFileBase_Resource<MetaFile>
34+
{
35+
public MUnk_376833625 Unk_376833625;
36+
37+
public YmtPedDefinitionFile()
38+
{
39+
this.Unk_376833625 = new RageLib.GTA5.ResourceWrappers.PC.Meta.Structures.MUnk_376833625();
40+
}
41+
42+
public override void Parse()
43+
{
44+
var Unk_376833625Blocks = this.ResourceFile.ResourceData.FindBlocks((MetaName)376833625);
45+
46+
if (Unk_376833625Blocks.Length == 0)
47+
throw new Exception("Unk_376833625 block not found !");
48+
49+
var Unk_376833625 = MetaUtils.ConvertData<Unk_376833625>(Unk_376833625Blocks[0]);
50+
this.Unk_376833625 = new RageLib.GTA5.ResourceWrappers.PC.Meta.Structures.MUnk_376833625();
51+
52+
this.Unk_376833625.Parse(this.ResourceFile.ResourceData, Unk_376833625);
53+
}
54+
55+
public override void Build()
56+
{
57+
var mb = new MetaBuilder();
58+
59+
mb.EnsureBlock((MetaName)376833625);
60+
61+
this.Unk_376833625.Build(mb, true);
62+
63+
ResourceFile.Version = ResourceFileTypes_GTA5_pc.Meta.Version;
64+
ResourceFile.ResourceData = this.Unk_376833625.Meta;
65+
}
66+
67+
}
68+
69+
}

0 commit comments

Comments
 (0)