source: OniSplit/Metadata/OniPcMetadata.cs@ 1155

Last change on this file since 1155 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 3.0 KB
Line 
1using System;
2using System.Collections.Generic;
3
4namespace Oni.Metadata
5{
6 internal class OniPcMetadata : InstanceMetadata
7 {
8 //
9 // Binary Data template
10 //
11
12 private static MetaStruct bina = new MetaStruct("BINAInstance",
13 new Field(MetaType.Int32, "DataSize"),
14 new BinaryPartField(MetaType.RawOffset, "DataOffset", "DataSize")
15 );
16
17 //
18 // Oni Sound Binary Data template
19 //
20
21 private static MetaStruct osbd = new MetaStruct("OSBDInstance",
22 new Field(MetaType.Int32, "DataSize"),
23 new BinaryPartField(MetaType.RawOffset, "DataOffset", "DataSize")
24 );
25
26 //
27 // Texture Map template
28 //
29
30 private static MetaStruct txmp = new MetaStruct("TXMPInstance",
31 new Field(MetaType.Padding(128)),
32 new Field(MetaType.Enum<TXMPFlags>(), "Flags"),
33 new Field(MetaType.UInt16, "Width"),
34 new Field(MetaType.UInt16, "Height"),
35 new Field(MetaType.Enum<TXMPFormat>(), "Format"),
36 new Field(MetaType.Pointer(TemplateTag.TXAN), "Animation"),
37 new Field(MetaType.Pointer(TemplateTag.TXMP), "EnvMap"),
38 new BinaryPartField(MetaType.RawOffset, "DataOffset"),
39 new Field(MetaType.Padding(12))
40 );
41
42 //
43 // Sound Data template
44 //
45
46 private static MetaStruct sndd = new MetaStruct("SNDDInstance",
47 new Field(MetaType.Int32, "WaveHeaderSize"),
48
49 new Field(MetaType.Int16, "Format"),
50 new Field(MetaType.Int16, "ChannelCount"),
51 new Field(MetaType.Int32, "SamplesPerSecond"),
52 new Field(MetaType.Int32, "BytesPerSecond"),
53 new Field(MetaType.Int16, "BlockAlignment"),
54 new Field(MetaType.Int16, "BitsPerSample"),
55 new Field(MetaType.Int16, "AdpcmHeaderSize"),
56
57 new Field(MetaType.Int16, "SamplesPerBlock"),
58 new Field(MetaType.Int16, "CoefficientCount"),
59 new Field(MetaType.Array(7, new MetaStruct("ADPCMCoefficient",
60 new Field(MetaType.Int16, "Coefficient1"),
61 new Field(MetaType.Int16, "Coefficient2")
62 )), "Coefficients"),
63
64 new Field(MetaType.Int16, "Duration"),
65 new Field(MetaType.Int32, "DataSize"),
66 new BinaryPartField(MetaType.RawOffset, "DataOffset", "DataSize")
67 );
68
69 protected override void InitializeTemplates(IList<Template> templates)
70 {
71 base.InitializeTemplates(templates);
72
73 templates.Add(new Template(TemplateTag.BINA, bina, 0xdb41, "Binary Data"));
74 templates.Add(new Template(TemplateTag.OSBD, osbd, 0xdb6c, "Oni Sound Binary Data"));
75 templates.Add(new Template(TemplateTag.TXMP, txmp, 0x891187581, "Texture Map"));
76 templates.Add(new Template(TemplateTag.SNDD, sndd, 0x370578, "Sound Data"));
77 }
78 }
79}
Note: See TracBrowser for help on using the repository browser.