Skip to content

Commit

Permalink
update header to version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyman192 committed Apr 27, 2024
1 parent a094a15 commit 323b378
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 67 deletions.
2 changes: 1 addition & 1 deletion MBINCompiler/Source/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class OptionBackers
public static FormatType optOutputFormat = FormatType.Unknown;
public static List<string> optIncludeFilters = null;
public static List<string> optExcludeFilters = null;
public static HeaderFormat optFormatVersion = HeaderFormat.V2;
public static HeaderFormat optFormatVersion = HeaderFormat.V3;
public static bool optUseThreads = true;
}

Expand Down
20 changes: 10 additions & 10 deletions MBINCompilerTests/Source/Tests/MBINHeaderTestsV0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class MBINHeaderTestsV0 {

private static MBINHeader CreateMockHeader(
uint magic = MBINHeader.MBIN_MAGIC,
uint formatID = MBINHeader.MBIN_VERSION,
uint formatID = MBINHeader.MBIN_VERSION_OLD,
ulong timestamp = TIMESTAMP,
ulong guid = TEMPLATE_GUID,
string name = TEMPLATE_NAME,
Expand Down Expand Up @@ -86,7 +86,7 @@ public void TestIsFormatV2() {
[TestMethod]
public void TestCreateHeaderCommon() {
Assert.AreEqual( MBINHeader.MBIN_MAGIC, HeaderCommon.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, HeaderCommon.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, HeaderCommon.FormatID );
Assert.AreEqual( TIMESTAMP, HeaderCommon.Timestamp );
Assert.AreEqual( TEMPLATE_GUID, HeaderCommon.TemplateGUID );
Assert.AreEqual( TEMPLATE_NAME, HeaderCommon.TemplateName );
Expand All @@ -98,7 +98,7 @@ public void TestCreateHeaderCommon() {
[TestMethod]
public void TestCreateHeaderTkGeometryData() {
Assert.AreEqual( MBINHeader.MBIN_MAGIC_PC, HeaderTkGeometryData.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, HeaderTkGeometryData.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, HeaderTkGeometryData.FormatID );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_TAG, HeaderTkGeometryData.Timestamp );
Assert.AreEqual( TKGEOMETRYDATA_GUID, HeaderTkGeometryData.TemplateGUID );
Assert.AreEqual( TEMPLATE_NAME, HeaderTkGeometryData.TemplateName );
Expand All @@ -110,7 +110,7 @@ public void TestCreateHeaderTkGeometryData() {
[TestMethod]
public void TestCreateHeaderTkAnimMetadata() {
Assert.AreEqual( MBINHeader.MBIN_MAGIC, HeaderTkAnimMetadata.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, HeaderTkAnimMetadata.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, HeaderTkAnimMetadata.FormatID );
Assert.AreEqual( MBINHeader.TKANIMMETADATA_TAG, HeaderTkAnimMetadata.Timestamp );
Assert.AreEqual( TKANIMMETADATA_GUID, HeaderTkAnimMetadata.TemplateGUID );
Assert.AreEqual( TEMPLATE_NAME, HeaderTkAnimMetadata.TemplateName );
Expand All @@ -125,7 +125,7 @@ public void TestSetDefaultsV0Common() {
header.SetDefaultsV0();

Assert.AreEqual( MBINHeader.MBIN_MAGIC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( 0ul, header.Timestamp );
Assert.AreEqual( 0ul, header.TemplateGUID );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -140,7 +140,7 @@ public void TestSetDefaultsV0TkGeometry() {
header.SetDefaultsV0( typeof( NMS.Toolkit.TkGeometryData ) );

Assert.AreEqual( MBINHeader.MBIN_MAGIC_PC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_TAG, header.Timestamp );
Assert.AreEqual( TKGEOMETRYDATA_GUID, header.TemplateGUID );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -155,7 +155,7 @@ public void TestSetDefaultsV0TkAnimMetadata() {
header.SetDefaultsV0( typeof( NMS.Toolkit.TkAnimMetadata ) );

Assert.AreEqual( MBINHeader.MBIN_MAGIC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.TKANIMMETADATA_TAG, header.Timestamp );
Assert.AreEqual( TKANIMMETADATA_GUID, header.TemplateGUID );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -170,7 +170,7 @@ public void TestSetDefaultsCommon() {
header.SetDefaults( format: MBINHeader.Format.V0 );

Assert.AreEqual( MBINHeader.MBIN_MAGIC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( 0ul, header.Timestamp );
Assert.AreEqual( 0ul, header.TemplateGUID );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -185,7 +185,7 @@ public void TestSetDefaultsTkGeometry() {
header.SetDefaults( typeof( NMS.Toolkit.TkGeometryData ), MBINHeader.Format.V0 );

Assert.AreEqual( MBINHeader.MBIN_MAGIC_PC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_TAG, header.Timestamp );
Assert.AreEqual( TKGEOMETRYDATA_GUID, header.TemplateGUID );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -200,7 +200,7 @@ public void TestSetDefaultsTkAnimMetadata() {
header.SetDefaults( typeof( NMS.Toolkit.TkAnimMetadata ), MBINHeader.Format.V0 );

Assert.AreEqual( MBINHeader.MBIN_MAGIC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.TKANIMMETADATA_TAG, header.Timestamp );
Assert.AreEqual( TKANIMMETADATA_GUID, header.TemplateGUID );
Assert.AreEqual( "", header.TemplateName );
Expand Down
20 changes: 10 additions & 10 deletions MBINCompilerTests/Source/Tests/MBINHeaderTestsV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MBINHeaderTestsV1 {

private MBINHeader CreateMockHeader(
uint magic = MBINHeader.MBIN_MAGIC,
uint formatID = MBINHeader.MBIN_VERSION,
uint formatID = MBINHeader.MBIN_VERSION_OLD,
ulong tag = MBINHeader.MBINCVER_TAG,
ulong version = ~0ul,
string name = TEMPLATE_NAME,
Expand Down Expand Up @@ -104,7 +104,7 @@ public void TestUlongToString() {
[TestMethod]
public void TestCreateHeaderCommon() {
Assert.AreEqual( MBINHeader.MBIN_MAGIC, HeaderCommon.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, HeaderCommon.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, HeaderCommon.FormatID );
Assert.AreEqual( MBINHeader.MBINCVER_TAG, HeaderCommon.Timestamp );
Assert.AreEqual( VERSION_ID, HeaderCommon.TemplateGUID );
Assert.AreEqual( TEMPLATE_NAME, HeaderCommon.TemplateName );
Expand All @@ -116,7 +116,7 @@ public void TestCreateHeaderCommon() {
[TestMethod]
public void TestCreateHeaderTkGeometryData() {
Assert.AreEqual( MBINHeader.MBIN_MAGIC_PC, HeaderTkGeometryData.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, HeaderTkGeometryData.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, HeaderTkGeometryData.FormatID );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_TAG, HeaderTkGeometryData.Timestamp );
Assert.AreEqual( TKGEOMETRYDATA_GUID, HeaderTkGeometryData.TemplateGUID );
Assert.AreEqual( TEMPLATE_NAME, HeaderTkGeometryData.TemplateName );
Expand All @@ -128,7 +128,7 @@ public void TestCreateHeaderTkGeometryData() {
[TestMethod]
public void TestCreateHeaderTkAnimMetadata() {
Assert.AreEqual( MBINHeader.MBIN_MAGIC, HeaderTkAnimMetadata.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, HeaderTkAnimMetadata.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, HeaderTkAnimMetadata.FormatID );
Assert.AreEqual( MBINHeader.TKANIMMETADATA_TAG, HeaderTkAnimMetadata.Timestamp );
Assert.AreEqual( TKANIMMETADATA_GUID, HeaderTkAnimMetadata.TemplateGUID );
Assert.AreEqual( TEMPLATE_NAME, HeaderTkAnimMetadata.TemplateName );
Expand All @@ -141,7 +141,7 @@ public void TestSetDefaultsV1Common() {
header.SetDefaultsV1();

Assert.AreEqual( MBINHeader.MBIN_MAGIC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.MBINCVER_TAG, header.Tag );
Assert.AreEqual( VERSION_ID, header.MbinVersion );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -156,7 +156,7 @@ public void TestSetDefaultsV1TkGeometry() {
header.SetDefaultsV1( typeof( NMS.Toolkit.TkGeometryData ) );

Assert.AreEqual( MBINHeader.MBIN_MAGIC_PC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_TAG, header.Tag );
Assert.AreEqual( TKGEOMETRYDATA_GUID, header.MbinVersion );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -171,7 +171,7 @@ public void TestSetDefaultsV1TkAnimMetadata() {
header.SetDefaultsV1( typeof( NMS.Toolkit.TkAnimMetadata ) );

Assert.AreEqual( MBINHeader.MBIN_MAGIC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.TKANIMMETADATA_TAG, header.Tag );
Assert.AreEqual( TKANIMMETADATA_GUID, header.MbinVersion );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -186,7 +186,7 @@ public void TestSetDefaultsCommon() {
header.SetDefaults( format: MBINHeader.Format.V1 );

Assert.AreEqual( MBINHeader.MBIN_MAGIC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.MBINCVER_TAG, header.Tag );
Assert.AreEqual( VERSION_ID, header.MbinVersion );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -201,7 +201,7 @@ public void TestSetDefaultsTkGeometry() {
header.SetDefaults( typeof( NMS.Toolkit.TkGeometryData ), MBINHeader.Format.V1 );

Assert.AreEqual( MBINHeader.MBIN_MAGIC_PC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_TAG, header.Tag );
Assert.AreEqual( TKGEOMETRYDATA_GUID, header.MbinVersion );
Assert.AreEqual( "", header.TemplateName );
Expand All @@ -216,7 +216,7 @@ public void TestSetDefaultsTkAnimMetadata() {
header.SetDefaults( typeof( NMS.Toolkit.TkAnimMetadata ), MBINHeader.Format.V1 );

Assert.AreEqual( MBINHeader.MBIN_MAGIC, header.MagicID );
Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatID );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatID );
Assert.AreEqual( MBINHeader.TKANIMMETADATA_TAG, header.Tag );
Assert.AreEqual( TKANIMMETADATA_GUID, header.MbinVersion );
Assert.AreEqual( "", header.TemplateName );
Expand Down
22 changes: 11 additions & 11 deletions MBINCompilerTests/Source/Tests/MBINHeaderTestsV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class MBINHeaderTestsV2 {
private const ushort FORMAT_V0 = 0;
private const ushort FORMAT_V2 = 2;

private const uint FORMAT_ID0 = (MBINHeader.MBIN_VERSION & 0xFFFF) | (FORMAT_V0 & 0xFFFF) << 16;
private const uint FORMAT_ID2 = (MBINHeader.MBIN_VERSION & 0xFFFF) | (FORMAT_V2 & 0xFFFF) << 16;
private const uint FORMAT_ID0 = (MBINHeader.MBIN_VERSION_OLD & 0xFFFF) | (FORMAT_V0 & 0xFFFF) << 16;
private const uint FORMAT_ID2 = (MBINHeader.MBIN_VERSION_OLD & 0xFFFF) | (FORMAT_V2 & 0xFFFF) << 16;

private static readonly System.Version NMS_VERSION = Version.NMSVersion;
private static readonly System.Version API_VERSION = Version.AssemblyVersion;
Expand Down Expand Up @@ -60,7 +60,7 @@ private MBINHeader CreateMockHeader(
private MBINHeader HeaderCommon => CreateMockHeader();
private MBINHeader HeaderTkGeometryData => CreateMockHeader(
magic: MBINHeader.MBIN_MAGIC_PC,
formatID: MBINHeader.MBIN_VERSION,
formatID: MBINHeader.MBIN_VERSION_OLD,
versionID: MBINHeader.TKGEOMETRYDATA_TAG,
guid: TKGEOMETRYDATA_GUID,
metaOffset: MBINHeader.TKGEOMETRYDATA_PADDING
Expand Down Expand Up @@ -105,7 +105,7 @@ public void TestCreateHeaderCommon() {
Assert.AreEqual( TEMPLATE_NAME, HeaderCommon.TemplateName );
Assert.AreEqual( METAOFFSET, HeaderCommon.MetaOffset );

Assert.AreEqual( MBINHeader.MBIN_VERSION, HeaderCommon.FormatNMS );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, HeaderCommon.FormatNMS );
Assert.AreEqual( FORMAT_V2, HeaderCommon.FormatAPI );

Assert.AreEqual( NMS_VERSION_ID, HeaderCommon.VersionID_NMS );
Expand All @@ -124,7 +124,7 @@ public void TestCreateHeaderTkGeometryData() {
Assert.AreEqual( TEMPLATE_NAME, HeaderTkGeometryData.TemplateName );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_PADDING, HeaderTkGeometryData.MetaOffset );

Assert.AreEqual( MBINHeader.MBIN_VERSION, HeaderTkGeometryData.FormatNMS );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, HeaderTkGeometryData.FormatNMS );
Assert.AreEqual( FORMAT_V0, HeaderTkGeometryData.FormatAPI );
}

Expand All @@ -140,7 +140,7 @@ public void TestSetDefaultsV2Common() {
Assert.AreEqual( "", header.TemplateName );
Assert.AreEqual( 0ul, header.MetaOffset );

Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatNMS );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatNMS );
Assert.AreEqual( FORMAT_V2, header.FormatAPI );

Assert.AreEqual( NMS_VERSION_STRING, header.VersionNMS.ToString() );
Expand All @@ -159,7 +159,7 @@ public void TestSetDefaultsV2TkGeometry() {
Assert.AreEqual( "", header.TemplateName );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_PADDING, header.MetaOffset );

Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatNMS );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatNMS );
Assert.AreEqual( FORMAT_V0, header.FormatAPI );
}

Expand All @@ -175,7 +175,7 @@ public void TestSetDefaultsCommon() {
Assert.AreEqual( "", header.TemplateName );
Assert.AreEqual( 0ul, header.MetaOffset );

Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatNMS );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatNMS );
Assert.AreEqual( FORMAT_V2, header.FormatAPI );

Assert.AreEqual( NMS_VERSION_STRING, header.VersionNMS.ToString() );
Expand All @@ -194,7 +194,7 @@ public void TestSetDefaultsTkGeometry() {
Assert.AreEqual( "", header.TemplateName );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_PADDING, header.MetaOffset );

Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatNMS );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatNMS );
Assert.AreEqual( FORMAT_V0, header.FormatAPI );
}

Expand All @@ -210,7 +210,7 @@ public void TestSetDefaultsImplicitCommon() {
Assert.AreEqual( "", header.TemplateName );
Assert.AreEqual( 0ul, header.MetaOffset );

Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatNMS );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatNMS );
Assert.AreEqual( FORMAT_V2, header.FormatAPI );

Assert.AreEqual( NMS_VERSION_STRING, header.VersionNMS.ToString() );
Expand All @@ -229,7 +229,7 @@ public void TestSetDefaultsImplicitTkGeometry() {
Assert.AreEqual( "", header.TemplateName );
Assert.AreEqual( MBINHeader.TKGEOMETRYDATA_PADDING, header.MetaOffset );

Assert.AreEqual( MBINHeader.MBIN_VERSION, header.FormatNMS );
Assert.AreEqual( MBINHeader.MBIN_VERSION_OLD, header.FormatNMS );
Assert.AreEqual( FORMAT_V0, header.FormatAPI );
}

Expand Down
Loading

0 comments on commit 323b378

Please sign in to comment.