Skip to content

Commit 752db3f

Browse files
committed
C013 and basic TMFC
1 parent 7f8bf01 commit 752db3f

File tree

5 files changed

+150
-0
lines changed

5 files changed

+150
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using PropertyChanged;
2+
using XAT.Core;
3+
4+
namespace XAT.Game.Formats.Tmb.Entries;
5+
6+
[AddINotifyPropertyChangedInterface]
7+
public class C013Format : TmbEntry
8+
{
9+
public const string MAGIC = "C013";
10+
public override string Magic => MAGIC;
11+
12+
public override int Size => 0x1C;
13+
public override int ExtraSize => 0;
14+
public override int TimelineCount => 0;
15+
16+
[UserType]
17+
public int Unk1 { get; set; } = 0;
18+
19+
[UserType]
20+
public int Unk2 { get; set; } = 0;
21+
22+
[UserType]
23+
public int Unk3 { get; set; } = 0;
24+
25+
[UserType]
26+
public int Unk4 { get; set; } = 0;
27+
28+
public C013Format()
29+
{
30+
31+
}
32+
33+
public C013Format(TmbReadContext context)
34+
{
35+
ReadHeader(context);
36+
37+
Unk1 = context.Reader.ReadInt32();
38+
Unk2 = context.Reader.ReadInt32();
39+
Unk3 = context.Reader.ReadInt32();
40+
Unk4 = context.Reader.ReadInt32();
41+
}
42+
43+
public override void Serialize(TmbWriteContext context)
44+
{
45+
WriteHeader(context);
46+
47+
context.Writer.Write(Unk1);
48+
context.Writer.Write(Unk2);
49+
context.Writer.Write(Unk3);
50+
context.Writer.Write(Unk4);
51+
}
52+
}

XAT/XAT/Game/Formats/Tmb/TmbFormat.cs

+31
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,25 @@ public bool HasFaceLibrary
3131
}
3232
}
3333
public TmppFormat? FaceLibrary { get; set; }
34+
35+
[DependsOn(nameof(TmfcEntry))]
36+
public bool HasTmfc
37+
{
38+
get => TmfcEntry != null;
39+
set
40+
{
41+
if (value && TmfcEntry == null)
42+
{
43+
TmfcEntry = new TmfcFormat();
44+
}
45+
else if (!value && TmfcEntry != null)
46+
{
47+
TmfcEntry = null;
48+
}
49+
}
50+
}
51+
public TmfcFormat? TmfcEntry { get; set; }
52+
3453
public TmalFormat ActorList { get; set; }
3554

3655
public TmbFormat(BinaryReader reader)
@@ -89,6 +108,15 @@ public TmbFormat(BinaryReader reader)
89108
{
90109
throw new Exception("Expected entry to be TMAL");
91110
}
111+
112+
foreach(var item in items)
113+
{
114+
// Tmfc
115+
if (item is TmfcFormat tmfc)
116+
{
117+
TmfcEntry = tmfc;
118+
}
119+
}
92120
}
93121
public void Serialize(BinaryWriter writer)
94122
{
@@ -147,6 +175,9 @@ public void Serialize(BinaryWriter writer)
147175
}
148176
}
149177

178+
if (TmfcEntry != null)
179+
items.Add(TmfcEntry);
180+
150181
int itemLength = items.Sum(x => x.Size);
151182
int extraLength = items.Sum(x => x.ExtraSize);
152183
int timelineLength = items.Sum(x => x.TimelineCount) * sizeof(short);

XAT/XAT/Game/Formats/Tmb/TmbUtils.cs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public static class TmbUtils
1616
{ TmalFormat.MAGIC, typeof(TmalFormat) },
1717
{ TmacFormat.MAGIC, typeof(TmacFormat) },
1818
{ TmtrFormat.MAGIC, typeof(TmtrFormat) },
19+
{ TmfcFormat.MAGIC, typeof(TmfcFormat) },
1920

2021
// Entry Types
2122
{ C002Format.MAGIC, typeof(C002Format) },
@@ -24,6 +25,7 @@ public static class TmbUtils
2425
{ C010Format.MAGIC, typeof(C010Format) },
2526
{ C011Format.MAGIC, typeof(C011Format) },
2627
{ C012Format.MAGIC, typeof(C012Format) },
28+
{ C013Format.MAGIC, typeof(C013Format) },
2729
{ C014Format.MAGIC, typeof(C014Format) },
2830
{ C015Format.MAGIC, typeof(C015Format) },
2931
{ C031Format.MAGIC, typeof(C031Format) },
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using PropertyChanged;
2+
using XAT.Core;
3+
using XAT.Game.Formats.Tmb.Entries;
4+
5+
namespace XAT.Game.Formats.Tmb;
6+
7+
[AddINotifyPropertyChangedInterface]
8+
public class TmfcFormat : TmbItemFormat
9+
{
10+
public const string MAGIC = "TMFC";
11+
public override string Magic => MAGIC;
12+
13+
public override int Size => 0x20;
14+
public override int ExtraSize => 0;
15+
public override int TimelineCount => 0;
16+
17+
[UserType]
18+
public int Unk1 { get; set; } = 0;
19+
20+
[UserType]
21+
public int Unk2 { get; set; } = 0;
22+
23+
[UserType]
24+
public int Unk3 { get; set; } = 0;
25+
26+
[UserType]
27+
public int Unk4 { get; set; } = 0;
28+
[UserType]
29+
public int Unk5 { get; set; } = 0;
30+
[UserType]
31+
public int Unk6 { get; set; } = 0;
32+
33+
public TmfcFormat()
34+
{
35+
36+
}
37+
38+
public TmfcFormat(TmbReadContext context)
39+
{
40+
ReadHeader(context);
41+
42+
Unk1 = context.Reader.ReadInt32();
43+
Unk2 = context.Reader.ReadInt32();
44+
Unk3 = context.Reader.ReadInt32();
45+
Unk4 = context.Reader.ReadInt32();
46+
Unk5 = context.Reader.ReadInt32();
47+
Unk6 = context.Reader.ReadInt32();
48+
}
49+
50+
public override void Serialize(TmbWriteContext context)
51+
{
52+
WriteHeader(context);
53+
54+
context.Writer.Write(Unk1);
55+
context.Writer.Write(Unk2);
56+
context.Writer.Write(Unk3);
57+
context.Writer.Write(Unk4);
58+
context.Writer.Write(Unk5);
59+
context.Writer.Write(Unk6);
60+
}
61+
}

XAT/XAT/UI/Timeline/TimelineEditor.xaml

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113
<Separator />
114114
<CheckBox IsChecked="{Binding Timeline.HasFaceLibrary}" Margin="10, 10, 10, 10">Enable Face Library</CheckBox>
115115
<inspector:InspectorView Target="{Binding Timeline.FaceLibrary}" Visibility="{Binding Timeline.FaceLibrary, Converter={StaticResource NotNullToVisibilityConverter}}" Margin="10" />
116+
117+
<Separator />
118+
<CheckBox IsChecked="{Binding Timeline.HasTmfc}" Margin="10, 10, 10, 10">Enable TMFC</CheckBox>
119+
<inspector:InspectorView Target="{Binding Timeline.TmfcEntry}" Visibility="{Binding Timeline.TmfcEntry, Converter={StaticResource NotNullToVisibilityConverter}}" Margin="10" />
116120
</StackPanel>
117121
</Expander>
118122

0 commit comments

Comments
 (0)