Beispiel #1
0
 private static void ShaderPassPostprocessImplementationNewBlock_Preprocess(AbideTagBlock block)
 {
     //Remove...
     block.FieldSet.RemoveAt(25); //pixel shader
     block.FieldSet.RemoveAt(24); //pixel shader switch extern map
     block.FieldSet.RemoveAt(23); //pixel shader index block
 }
Beispiel #2
0
 private static void ScenarioCutsceneTitleBlock_Preprocess(AbideTagBlock block)
 {
     //Add...
     block.FieldSet.Insert(9, new AbideTagField()
     {
         FieldType = FieldType.FieldPad, Length = 2
     });
 }
Beispiel #3
0
 private static void PixelShaderFragmentBlock_Preprocess(AbideTagBlock block)
 {
     //Add...
     block.FieldSet.Insert(1, new AbideTagField()
     {
         FieldType = FieldType.FieldPad, Length = 1
     });                                                                                             //1-byte padding
 }
Beispiel #4
0
        private static void SoundBlock_Preprocess(AbideTagBlock block, TagDefinitionCollection cache)
        {
            //Get sound tag group
            AbideTagGroup sound = cache.GetTagGroup("snd!");

            //Change definition to cache_file_sound_block
            sound.BlockName = "cache_file_sound_block";
        }
Beispiel #5
0
 private static void ScenarioPlacementBlock_Preprocess(AbideTagBlock block)
 {
     //Add
     block.FieldSet.Insert(5, new AbideTagField()
     {
         FieldType = FieldType.FieldPad, Length = 4
     });
 }
Beispiel #6
0
        private static void VertexShaderClassificationBlock_Preprocess(AbideTagBlock block)
        {
            //Change element size of compiled shader
            block.FieldSet[1].ElementSize = 2;

            //Insert pad field
            block.FieldSet.Insert(3, new AbideTagField()
            {
                FieldType = FieldType.FieldPad, Length = 8
            });
        }
Beispiel #7
0
        private static void BitmapBlock_Preprocess(AbideTagBlock block)
        {
            //Rename field 12
            block.FieldSet[12].Name = "sprite size";

            //Remove WDP fields
            block.FieldSet.RemoveAt(35);
            block.FieldSet.RemoveAt(34);
            block.FieldSet.RemoveAt(33);
            block.FieldSet.RemoveAt(32);
            block.FieldSet.RemoveAt(31);
        }
Beispiel #8
0
 private static void DecoratorPermutationsBlock_Preprocess(AbideTagBlock block)
 {
     //Add...
     block.FieldSet.Insert(10, new AbideTagField()
     {
         FieldType = FieldType.FieldPad, Length = 1
     });                                                                                             //1-byte padding
     block.FieldSet.Insert(9, new AbideTagField()
     {
         FieldType = FieldType.FieldPad, Length = 1
     });                                                                                             //1-byte padding
 }
Beispiel #9
0
        /// <summary>
        /// Returns a pascal-cased member name of the tag block.
        /// </summary>
        /// <param name="tagBlock">The tag block.</param>
        /// <returns>A string.</returns>
        public static string GetMemberName(AbideTagBlock tagBlock)
        {
            //Check
            if (!tagBlockMemberLookup.ContainsKey(tagBlock))
            {
                tagBlockNameLookup.Add(tagBlock.Name, tagBlock);
                tagBlockMemberLookup.Add(tagBlock, GeneratePascalMemberName(tagBlock.Name));
            }

            //Return
            return(tagBlockMemberLookup[tagBlock]);
        }
Beispiel #10
0
        private static void ModelVariantBlock_Preprocess(AbideTagBlock block)
        {
            //Remove FieldPad
            block.FieldSet.RemoveAt(1);

            //Add 16 byte block indices
            for (int i = 0; i < 16; i++)
            {
                block.FieldSet.Insert(1, new AbideTagField()
                {
                    FieldType = FieldType.FieldCharBlockIndex1,
                    Name      = $"model varient {16 - i}"
                });
            }
        }
Beispiel #11
0
        /// <summary>
        /// Adds an Abide tag block definition to the collection.
        /// </summary>
        /// <param name="tagBlock">The tag block definition.</param>
        public void Add(AbideTagBlock tagBlock)
        {
            //Check
            if (tagBlock == null)
            {
                return;
            }

            //Check
            if (!tagBlocks.Contains(tagBlock) && !tagBlockLookup.ContainsKey(tagBlock.Name))
            {
                tagBlockLookup.Add(tagBlock.Name, tagBlocks.Count);
                tagBlocks.Add(tagBlock);
            }
        }
Beispiel #12
0
 private static void TagBlockIndexStructBlock_Preprocess(AbideTagBlock block)
 {
     block.FieldSet.Clear();
     block.FieldSet.Add(new AbideTagField()
     {
         Name = "index", FieldType = FieldType.FieldCharInteger
     });
     block.FieldSet.Add(new AbideTagField()
     {
         Name = "Length", FieldType = FieldType.FieldCharInteger
     });
     block.FieldSet.Add(new AbideTagField()
     {
         FieldType = FieldType.FieldTerminator
     });
 }
Beispiel #13
0
        /// <summary>
        /// Preprocesses a tag block.
        /// </summary>
        /// <param name="block">The tag block to preprocess.</param>
        /// <param name="cache">The tag cache that <paramref name="block"/> belongs to.</param>
        public static void Preprocess(AbideTagBlock block, TagDefinitionCollection cache)
        {
            //Check Block
            switch (block.Name)
            {
            case "bitmap_block":
                BitmapBlock_Preprocess(block, cache);
                break;

            case "scenario_structure_bsp_reference_block":
                ScenarioStructureBspReferenceBlock_Preprocess(block, cache);
                break;

            case "sound_block":
                SoundBlock_Preprocess(block, cache);
                break;
            }
        }
Beispiel #14
0
        private static void ScenarioStructureBspReferenceBlock_Preprocess(AbideTagBlock block, TagDefinitionCollection cache)
        {
            //Create struct
            AbideTagBlock scenarioStructureBspInfoStructBlock = new AbideTagBlock()
            {
                Name                = "scenario_structure_bsp_info_struct_block",
                DisplayName         = "scenario_structure_bsp_info_struct_block",
                MaximumElementCount = 1,
            };

            scenarioStructureBspInfoStructBlock.FieldSet.Add(new AbideTagField()
            {
                Name = "block offset", FieldType = FieldType.FieldLongInteger
            });
            scenarioStructureBspInfoStructBlock.FieldSet.Add(new AbideTagField()
            {
                Name = "block length", FieldType = FieldType.FieldLongInteger
            });
            scenarioStructureBspInfoStructBlock.FieldSet.Add(new AbideTagField()
            {
                Name = "block address", FieldType = FieldType.FieldLongInteger
            });
            scenarioStructureBspInfoStructBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });
            scenarioStructureBspInfoStructBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldTerminator
            });

            //Replace 16-byte padding
            block.FieldSet[0] = new AbideTagField()
            {
                FieldType       = FieldType.FieldStruct,
                Name            = "structure block info",
                StructName      = "scenario_structure_bsp_info_struct_block",
                ReferencedBlock = scenarioStructureBspInfoStructBlock
            };

            //Add block to cache
            cache.Add(scenarioStructureBspInfoStructBlock);
        }
Beispiel #15
0
        public static void GenerateControls(AbideTagBlock tagBlock, FlowLayoutPanel container)
        {
            //Begin
            container.SuspendLayout();

            //Loop
            Control control = null;

            foreach (AbideTagField field in tagBlock.FieldSet)
            {
                switch (field.FieldType)
                {
                case FieldType.FieldStruct:
                    if (field.ReferencedBlock != null)
                    {
                        GenerateControls(field.ReferencedBlock, container);
                    }
                    break;

                case FieldType.FieldBlock:
                    control = new Controls.BlockControl()
                    {
                        Title = field.Name
                    };
                    if (field.ReferencedBlock != null)
                    {
                        GenerateControls(field.ReferencedBlock, ((Controls.BlockControl)control).Contents);
                    }
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldExplanation:
                    control = new Controls.ExplanationControl()
                    {
                        Title       = field.Name,
                        Explanation = field.Explanation
                    };
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldString:
                    control = new Controls.StringControl()
                    {
                        Title      = field.Name,
                        IsReadOnly = field.IsReadOnly,
                    };
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldLongString:
                    break;

                case FieldType.FieldStringId:
                    control = new Controls.ValueControl()
                    {
                        Title       = field.Name,
                        Information = field.Information,
                        Details     = field.Details,
                        IsReadOnly  = field.IsReadOnly
                    };
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldOldStringId:
                case FieldType.FieldCharInteger:
                case FieldType.FieldShortInteger:
                case FieldType.FieldLongInteger:
                case FieldType.FieldAngle:
                case FieldType.FieldTag:
                case FieldType.FieldReal:
                    control = new Controls.ValueControl()
                    {
                        Title       = field.Name,
                        Details     = field.Details,
                        Information = field.Information,
                        IsReadOnly  = field.IsReadOnly
                    };
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldCharEnum:
                case FieldType.FieldEnum:
                case FieldType.FieldLongEnum:
                    control = new Controls.EnumControl()
                    {
                        Title       = field.Name,
                        Details     = field.Details,
                        Information = field.Information,
                        IsReadOnly  = field.IsReadOnly
                    };
                    ((Controls.EnumControl)control).Options = field.Options.Select(o => o.Name).ToArray();
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldShortBounds:
                case FieldType.FieldAngleBounds:
                case FieldType.FieldRealBounds:
                    control = new Controls.RangeControl()
                    {
                        Title = field.Name,
                    };
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldLongBlockFlags:
                case FieldType.FieldWordBlockFlags:
                case FieldType.FieldByteBlockFlags:
                case FieldType.FieldLongFlags:
                case FieldType.FieldWordFlags:
                case FieldType.FieldByteFlags:
                    control = new Controls.FlagsControl()
                    {
                        Title       = field.Name,
                        Details     = field.Details,
                        Information = field.Information,
                        IsReadOnly  = field.IsReadOnly
                    };
                    ((Controls.FlagsControl)control).Options = field.Options.Select(o => o.Name).ToArray();
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldPoint2D:
                    control = new Controls.Point2Control()
                    {
                        Title      = field.Name,
                        IsReadOnly = field.IsReadOnly
                    };
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldRectangle2D:
                    break;

                case FieldType.FieldRgbColor:
                    break;

                case FieldType.FieldArgbColor:
                    break;

                case FieldType.FieldRealFraction:
                    break;

                case FieldType.FieldRealPoint2D:
                    break;

                case FieldType.FieldRealPoint3D:
                    break;

                case FieldType.FieldRealVector2D:
                    break;

                case FieldType.FieldRealVector3D:
                    control = new Controls.ThreeTupleControl()
                    {
                        Title      = field.Name,
                        IsReadOnly = field.IsReadOnly
                    };
                    container.Controls.Add(control);
                    break;

                case FieldType.FieldQuaternion:
                    break;

                case FieldType.FieldEulerAngles2D:
                    break;

                case FieldType.FieldEulerAngles3D:
                    break;

                case FieldType.FieldRealPlane2D:
                    break;

                case FieldType.FieldRealPlane3D:
                    break;

                case FieldType.FieldRealRgbColor:
                    break;

                case FieldType.FieldRealArgbColor:
                    break;

                case FieldType.FieldRealHsvColor:
                    break;

                case FieldType.FieldRealAhsvColor:
                    break;

                case FieldType.FieldRealFractionBounds:
                    break;

                case FieldType.FieldTagReference:
                    break;

                case FieldType.FieldCharBlockIndex1:
                    break;

                case FieldType.FieldCharBlockIndex2:
                    break;

                case FieldType.FieldShortBlockIndex1:
                    break;

                case FieldType.FieldShortBlockIndex2:
                    break;

                case FieldType.FieldLongBlockIndex1:
                    break;

                case FieldType.FieldLongBlockIndex2:
                    break;

                case FieldType.FieldData:
                    break;

                case FieldType.FieldVertexBuffer:
                    break;

                case FieldType.FieldArrayStart:
                    break;

                case FieldType.FieldArrayEnd:
                    break;
                }
            }

            //End
            container.ResumeLayout();
        }
Beispiel #16
0
 private static void GlobalGeometryBlockInfoStructBlock_Preprocess(AbideTagBlock block)
 {
     //Change...
     block.FieldSet[6].FieldType = FieldType.FieldTagIndex;
 }
Beispiel #17
0
 private static void BitmapBlock_Preprocess(AbideTagBlock block, TagDefinitionCollection cache)
 {
     //Change data fields to pad
     block.FieldSet[17].FieldType = FieldType.FieldPad; block.FieldSet[17].Length = 8;
     block.FieldSet[19].FieldType = FieldType.FieldPad; block.FieldSet[19].Length = 8;
 }
Beispiel #18
0
 private static void HsUnitSeatBlock_Preprocess(AbideTagBlock block)
 {
     //Change...
     block.FieldSet[0].FieldType = FieldType.FieldTagIndex;
 }
Beispiel #19
0
 private static void ShaderBlock_Preprocess(AbideTagBlock block)
 {
     //Remove...
     block.FieldSet.RemoveAt(17);    //Postprocess Properties
 }
Beispiel #20
0
 private static void UserInterfaceScreenWidgetDefinitionBlock_Preprocess(AbideTagBlock block)
 {
     //Remove...
     block.FieldSet.RemoveAt(31);    //Mouse cursor tag reference
     block.FieldSet.RemoveAt(30);    //Mouse cursor explanation
 }
Beispiel #21
0
 private static void SyntaxDatumBlock_Preprocess(AbideTagBlock block)
 {
     //Change...
     block.FieldSet[6].FieldType = FieldType.FieldTagIndex;
 }
Beispiel #22
0
        private static void ModelAnimationGraphBlock_Preprocess(AbideTagBlock block, TagDefinitionCollection cache)
        {
            //Create unknown block
            AbideTagBlock xboxUnknownAnimationBlock = null;

            xboxUnknownAnimationBlock = new AbideTagBlock()
            {
                Name        = "xbox_unknown_animation_block",
                DisplayName = "xbox_unknown_animaiton_block",
                FieldSet    = new AbideFieldSet(xboxUnknownAnimationBlock)
                {
                    Alignment = 4
                },
                MaximumElementCount = short.MaxValue
            };
            xboxUnknownAnimationBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });
            xboxUnknownAnimationBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });
            xboxUnknownAnimationBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });
            xboxUnknownAnimationBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });
            xboxUnknownAnimationBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });
            xboxUnknownAnimationBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });

            //Create data block
            AbideTagBlock xboxAnimaitonDataBlock = null;

            xboxAnimaitonDataBlock = new AbideTagBlock()
            {
                Name        = "xbox_animation_data_block",
                DisplayName = "xbox_animation_data_block",
                FieldSet    = new AbideFieldSet(xboxAnimaitonDataBlock)
                {
                    Alignment = 4
                },
                MaximumElementCount = short.MaxValue
            };
            xboxAnimaitonDataBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldTagIndex, Name = "owner index"
            });
            xboxAnimaitonDataBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger, Name = "block size"
            });
            xboxAnimaitonDataBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger, Name = "block offset"
            });
            xboxAnimaitonDataBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });
            xboxAnimaitonDataBlock.FieldSet.Add(new AbideTagField()
            {
                FieldType = FieldType.FieldLongInteger
            });

            //Unknown block field
            AbideTagField unknownBlockField = new AbideTagField()
            {
                Name            = "",
                FieldType       = FieldType.FieldBlock,
                BlockName       = "xbox_unknown_animation_block",
                ReferencedBlock = xboxUnknownAnimationBlock
            };
            //Data block field
            AbideTagField animationDataBlockField = new AbideTagField()
            {
                Name            = "animation data",
                FieldType       = FieldType.FieldBlock,
                BlockName       = "xbox_animation_data_block",
                ReferencedBlock = xboxAnimaitonDataBlock
            };

            //Add blocks to cache
            cache.Add(xboxUnknownAnimationBlock);
            cache.Add(xboxAnimaitonDataBlock);

            //Add fields to block
            block.FieldSet.Insert(6, animationDataBlockField);
            block.FieldSet.Insert(7, unknownBlockField);
        }
Beispiel #23
0
        /// <summary>
        /// Preprocesses tag groups and their tag blocks.
        /// </summary>
        /// <param name="tagGroups"></param>
        /// <param name="tagBlocks"></param>
        public static void Preprocess(AbideTagGroup[] tagGroups, AbideTagBlock[] tagBlocks)
        {
            //Create find function
            Func <string, AbideTagBlock> blockFindFunction = new Func <string, AbideTagBlock>((blockName) =>
            {
                //Find
                return(Array.Find(tagBlocks, b => b.Name == blockName));
            });

            //Create block search function
            Action <AbideTagBlock> blockSearchAction = null;

            blockSearchAction = new Action <AbideTagBlock>((block) =>
            {
                //Loop
                foreach (AbideTagField field in block.FieldSet)
                {
                    //Check
                    if (field.FieldType == FieldType.FieldBlock)
                    {
                        //Find
                        AbideTagBlock child = blockFindFunction(field.BlockName);

#if DEBUG
                        //Check
                        if (child == null)
                        {
                            System.Diagnostics.Debugger.Break();
                        }
#endif

                        //Process
                        Preprocess(child);

                        //Search
                        blockSearchAction.Invoke(child);
                    }
                    else if (field.FieldType == FieldType.FieldStruct)
                    {
                        //Find
                        AbideTagBlock child = blockFindFunction(field.StructName);

#if DEBUG
                        //Check
                        if (child == null)
                        {
                            System.Diagnostics.Debugger.Break();
                        }
#endif

                        //Process
                        Preprocess(child);

                        //Search
                        blockSearchAction.Invoke(child);
                    }
                }
            });

            //Loop through tag groups
            foreach (AbideTagGroup tagGroup in tagGroups)
            {
                //Preprocess group
                Preprocess(tagGroup);

                //Preprocess the group's tag block
                AbideTagBlock block = blockFindFunction.Invoke(tagGroup.BlockName);
#if DEBUG
                //Check
                if (block == null)
                {
                    System.Diagnostics.Debugger.Break();
                }
#endif

                //Preprocess
                Preprocess(block);

                //Search
                blockSearchAction.Invoke(block);
            }
        }
Beispiel #24
0
 private static void PredictedResourceBlock_Preprocess(AbideTagBlock block)
 {
     //Change...
     block.FieldSet[2].FieldType = FieldType.FieldTagIndex;
 }
Beispiel #25
0
 /// <summary>
 /// Preprocesses a tag block, preparing a valid member name.
 /// </summary>
 /// <param name="tagBlock">The tag block.</param>
 private static void Preprocess(AbideTagBlock tagBlock)
 {
     memberNames.Add(GetMemberName(tagBlock));
 }
Beispiel #26
0
 private static void VertexShaderBlock_Preprocess(AbideTagBlock block)
 {
     //Remove output swizzles
     block.FieldSet.RemoveAt(3);
 }
Beispiel #27
0
 private static void ShaderPostprocessNewBlock_Preprocess(AbideTagBlock block)
 {
     //Change...
     block.FieldSet[0].FieldType = FieldType.FieldTagIndex;
 }
Beispiel #28
0
 private static void ScenarioSimulationDefinitionTableBlock_Preprocess(AbideTagBlock block)
 {
     //Change...
     block.FieldSet[0].FieldType = FieldType.FieldTagIndex;
 }
Beispiel #29
0
        private void tagDefinitions_BuildCache(string directory)
        {
            //Clear
            collection.Clear();

            //Get files
            string[] abideTagGroupFiles = Directory.GetFiles(directory, "*.atg");
            string[] abideTagBlockfiles = Directory.GetFiles(directory, "*.atb");

            //Loop
            foreach (string abideTagGroup in abideTagGroupFiles)
            {
                //Load
                AbideTagGroup group = new AbideTagGroup();
                group.Load(abideTagGroup);

                //Add
                collection.Add(group);
            }
            foreach (string abideTagGroup in abideTagBlockfiles)
            {
                //Load
                AbideTagBlock block = new AbideTagBlock();
                block.Load(abideTagGroup);

                //Add
                collection.Add(block);
            }

            //Begin
            tagGroupTreeView.BeginUpdate();

            //Clear
            tagGroupTreeView.Nodes.Clear();

            //Recursive block node creation
            Func <AbideTagBlock, TreeNode> createTagBlockNode = null;

            createTagBlockNode = new Func <AbideTagBlock, TreeNode>((tagBlock) =>
            {
                //Create Node
                TreeNode blockNode = new TreeNode(tagBlock.DisplayName)
                {
                    Tag = tagBlock
                };

                //Loop
                AbideTagBlock block = null;
                foreach (AbideTagField field in tagBlock.FieldSet)
                {
                    //Check
                    switch (field.FieldType)
                    {
                    case FieldType.FieldBlock:
                        block = collection.GetTagBlock(field.BlockName);
                        blockNode.Nodes.Add(createTagBlockNode(block));
                        field.ReferencedBlock = block;
                        break;

                    case FieldType.FieldStruct:
                        block = collection.GetTagBlock(field.StructName);
                        blockNode.Nodes.Add(createTagBlockNode(block));
                        field.ReferencedBlock = block;
                        break;
                    }
                }

                //Return
                return(blockNode);
            });

            //Recursive group node creation
            Action <AbideTagGroup, TreeNode> createTagGroupNode = null;

            createTagGroupNode = new Action <AbideTagGroup, TreeNode>((tagGroup, node) =>
            {
                //Check
                if (tagGroup.ParentGroupTag.Dword != 0)
                {
                    createTagGroupNode(collection.GetTagGroup(tagGroup.ParentGroupTag), node);
                }

                //Add blocks
                node.Nodes.Add(createTagBlockNode(collection.GetTagBlock(tagGroup.BlockName)));
            });

            //Loop
            foreach (AbideTagGroup group in collection.GetTagGroups())
            {
                //Create Node
                TreeNode groupNode = new TreeNode($"[{group.GroupTag}] - {group.Name}")
                {
                    Tag = group
                };

                //Add parent blocks
                createTagGroupNode(group, groupNode);

                //Add
                tagGroupTreeView.Nodes.Add(groupNode);
            }

            //End
            tagGroupTreeView.EndUpdate();
        }
Beispiel #30
0
 private static void SoundGlobalsBlock_Preprocess(AbideTagBlock block)
 {
     //Change...
     block.FieldSet[4].FieldType = FieldType.FieldTagIndex;
 }