示例#1
0
 private string GetTagTreeNodeImageKey(CachedTag tag)
 {
     if (tag.IsInGroup("cfgt") || tag.IsInGroup("matg") || tag.IsInGroup("mulg") ||
         tag.IsInGroup("aigl") || tag.IsInGroup("smdt") ||
         tag.IsInGroup("inpg") || tag.IsInGroup("rasg") ||
         tag.IsInGroup("wezr") || tag.IsInGroup("wgtz") || tag.IsInGroup("wigl"))
     {
         return("file_settings");
     }
     if (tag.IsInGroup("jmad"))
     {
         return("file_animation");
     }
     else if (tag.IsInGroup("bitm"))
     {
         return("file_bitmap");
     }
     else if (tag.IsInGroup("snd!") || tag.IsInGroup("lsnd"))
     {
         return("file_sound");
     }
     else
     {
         return("file");
     }
 }
示例#2
0
        public DialogResult RenameTag(CachedTag tag)
        {
            var result = DialogResult.OK;

            using (var rd = new RenameDialog(Cache, tag))
            {
                if ((result = rd.ShowDialog()) != DialogResult.OK)
                {
                    return(result);
                }

                if (rd.Value == "" && tag.Name != null)
                {
                    tag.Name = null;
                }
                else if (rd.Value != "")
                {
                    tag.Name = rd.Value;
                }
            }

            LoadTagTree();

            return(result);
        }
 public static void Populate(CommandContext context, GameCache info, CachedTag tag, RenderMethod renderMethod)
 {
     context.AddCommand(new ListArgumentsCommand(info, tag, renderMethod));
     context.AddCommand(new SetArgumentCommand(info, tag, renderMethod));
     context.AddCommand(new ListBitmapsCommand(info, tag, renderMethod));
     context.AddCommand(new SpecifyBitmapsCommand(info, tag, renderMethod));
 }
示例#4
0
 private void closeAllTagsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     currentTagsComboBox.Items.Clear();
     tagEditorPanel.Controls.Clear();
     CurrentTags.Clear();
     CurrentTag = null;
 }
示例#5
0
 public StructMultiControl(CacheForm form, GameCache cache, CachedTag tag, object definition) :
     this()
 {
     Form       = form;
     Cache      = cache;
     Instance   = tag;
     Definition = definition;
 }
示例#6
0
 public SoundControl(GameCache cache, CachedTag tag, Sound sound) :
     this()
 {
     Cache     = cache;
     Instance  = tag;
     Sound     = sound;
     SoundFile = new FileInfo(Path.Combine(Application.StartupPath, "temp", $"{Instance.Index:X4}.mp3"));
 }
示例#7
0
 public static void Populate(CommandContext context, GameCache cache, CachedTag tag, VFilesList definition)
 {
     context.AddCommand(new ListFilesCommand(definition));
     context.AddCommand(new ExtractFileCommand(definition));
     context.AddCommand(new ExtractFilesCommand(definition));
     context.AddCommand(new ReplaceFileCommand(cache, tag, definition));
     context.AddCommand(new ReplaceAllFilesCommand(cache, tag, definition));
     context.AddCommand(new AddFileCommand(cache, tag, definition));
 }
示例#8
0
        public static CommandContext Create(CommandContext parent, GameCache cache, CachedTag tag, CollisionModel definition)
        {
            var groupName      = cache.StringTable.GetString(tag.Group.Name);
            var commandContext = new CommandContext(parent, string.Format("{0:X8}.{1}", tag.Index, groupName));

            Populate(commandContext, cache, tag, definition);

            return(commandContext);
        }
 public static void Populate(CommandContext context, GameCache cache, CachedTag tag, RenderModel renderModel)
 {
     context.AddCommand(new SpecifyShadersCommand(cache, tag, renderModel));
     context.AddCommand(new DumpRenderGeometryCommand(cache, renderModel.Geometry));
     context.AddCommand(new ReplaceRenderGeometryCommand(cache, tag, renderModel));
     context.AddCommand(new ExtractModelCommand(cache, renderModel));
     context.AddCommand(new ExtractBitmapsCommand(cache, renderModel));
     context.AddCommand(new ExtractBMFCommand(cache, renderModel));
 }
示例#10
0
        public static CommandContext Create(CommandContext parent, GameCache cache, CachedTag tag, RenderMethodTemplate render_method_template)
        {
            var groupName      = cache.StringTable.GetString(tag.Group.Name);
            var commandContext = new CommandContext(parent, string.Format("{0:X8}.{1}", tag.Index, groupName));

            Populate(commandContext, cache, tag, render_method_template);

            return(commandContext);
        }
示例#11
0
 public static void Populate(CommandContext commandContext, GameCache cache, CachedTag tag, ScenarioStructureBsp bsp)
 {
     commandContext.AddCommand(new GenerateJumpHintsCommand(cache, tag, bsp));
     commandContext.AddCommand(new DumpRenderGeometryCommand(cache, bsp.DecoratorGeometry, "Decorator"));
     commandContext.AddCommand(new DumpRenderGeometryCommand(cache, bsp.Geometry, "Bsp"));
     commandContext.AddCommand(new MoppDataCommand(bsp));
     commandContext.AddCommand(new ExtractCollisionGeometryCommand(cache, bsp));
     commandContext.AddCommand(new ExtractPathfindingGeometryCommand(cache, bsp));
     commandContext.AddCommand(new ExtractRenderGeometryCommand(cache, bsp));
 }
示例#12
0
 public static void Populate(CommandContext context, GameCache cache, CachedTag tag, Scenario scenario)
 {
     context.AddCommand(new CopyForgePaletteCommand(cache, scenario));
     context.AddCommand(new ExtractScriptsCommand(cache, tag, scenario));
     context.AddCommand(new DumpScriptsCommand(cache, scenario));
     context.AddCommand(new CompileScriptsCommand(cache, scenario));
     context.AddCommand(new ListScriptsCommand(cache, tag, scenario));
     context.AddCommand(new ExtractZonesAreasModelCommand(cache, scenario));
     context.AddCommand(new ConvertGeometryCommand(cache, scenario));
 }
示例#13
0
        private static int CompareTags(CachedTag lhs, CachedTag rhs)
        {
            var classCompare = lhs.Group.Tag.CompareTo(rhs.Group.Tag);

            if (classCompare != 0)
            {
                return(classCompare);
            }
            return(lhs.Index.CompareTo(rhs.Index));
        }
示例#14
0
        public static CommandContext Create(CommandContext parent, GameCache cache, CachedTag tag, Scenario scenario)
        {
            var groupName = cache.StringTable.GetString(tag.Group.Name);

            var context = new CommandContext(parent,
                                             string.Format("{0:X8}.{1}", tag.Index, groupName));

            Populate(context, cache, tag, scenario);

            return(context);
        }
示例#15
0
 // add position of tag index from tag references in definition
 public void AddTagReference(CachedTag referencedTag, bool isShort)
 {
     if (isShort)
     {
         _tagReferenceOffsets.Add((uint)Stream.Position);
     }
     else
     {
         _tagReferenceOffsets.Add((uint)Stream.Position + 0xC);
     }
 }
示例#16
0
        private RenderMethodTemplate GetTemplate(CachedTag tag)
        {
            RenderMethodTemplate template;

            if (!_rmt2Cache.TryGetValue(tag, out template))
            {
                template = _rmt2Cache[tag] = BaseCache.Deserialize <RenderMethodTemplate>(BaseCacheStream, tag);
            }

            return(template);
        }
示例#17
0
        public static void Populate(CommandContext commandContext, GameCache cache, CachedTag tag, Sound sound)
        {
            commandContext.AddCommand(new ImportSoundCommand(cache, tag, sound));
            commandContext.AddCommand(new ExportSoundCommand(cache, tag, sound));

            if (cache.GetType() == typeof(GameCacheGen3))
            {
                var h3Cache = cache as GameCacheGen3;
                commandContext.AddCommand(new ExtractXMACommand(h3Cache, tag, sound));
            }
        }
示例#18
0
        private MapFile GenerateMapFile(CachedTag scenarioTag, Blf mapInfo = null)
        {
            MapFile  map    = new MapFile();
            var      header = new CacheFileHeader();
            Scenario scnr;

            using (var stream = Cache.OpenCacheRead())
            {
                scnr = Cache.Deserialize <Scenario>(stream, scenarioTag);
            }

            map.Version      = Cache.Version;
            map.EndianFormat = EndianFormat.LittleEndian;
            map.MapVersion   = CacheFileVersion.HaloOnline;

            header.HeaderSignature = new Tag("head");
            header.FooterSignature = new Tag("foot");
            header.FileVersion     = map.MapVersion;
            header.Build           = CacheVersionDetection.GetBuildName(Cache.Version);

            switch (scnr.MapType)
            {
            case ScenarioMapType.MainMenu:
                header.CacheType = CacheFileType.MainMenu;
                break;

            case ScenarioMapType.SinglePlayer:
                header.CacheType = CacheFileType.Campaign;
                break;

            case ScenarioMapType.Multiplayer:
                header.CacheType = CacheFileType.Multiplayer;
                break;
            }
            header.SharedType = CacheFileSharedType.None;

            header.MapId            = scnr.MapId;
            header.ScenarioTagIndex = scenarioTag.Index;
            header.Name             = scenarioTag.Name.Split('\\').Last();
            header.ScenarioPath     = scenarioTag.Name;

            map.Header = header;

            header.FileLength = 0x3390;

            if (mapInfo != null)
            {
                if (mapInfo.ContentFlags.HasFlag(BlfFileContentFlags.StartOfFile) && mapInfo.ContentFlags.HasFlag(BlfFileContentFlags.EndOfFile) && mapInfo.ContentFlags.HasFlag(BlfFileContentFlags.Scenario))
                {
                    map.MapFileBlf = mapInfo;
                }
            }
            return(map);
        }
示例#19
0
        public static CommandContext Create(CommandContext parent, GameCache cache, CachedTag tag, MultilingualUnicodeStringList unic)
        {
            var groupName = cache.StringTable.GetString(tag.Group.Name);

            var context = new CommandContext(parent,
                                             string.Format("{0:X8}.{1}", tag.Index, groupName));

            Populate(context, cache, tag, unic);

            return(context);
        }
示例#20
0
        public static CommandContext Create(CommandContext parent, GameCache cache, CachedTag instance, ForgeGlobalsDefinition definition)
        {
            var groupName = cache.StringTable.GetString(instance.Group.Name);

            var context = new CommandContext(parent,
                                             string.Format("{0:X8}.{1}", instance.Index, groupName));

            Populate(context, cache, instance, definition);

            return(context);
        }
        public GenerateRenderMethodTemplate(GameCache cache, CachedTag tag, RenderMethodTemplate definition) :
            base(true,

                 "Generate",
                 "Compiles HLSL source file from scratch :D",
                 "Generate <shader_type> <parameters...>",
                 "Compiles HLSL source file from scratch :D")
        {
            Cache      = cache;
            Tag        = tag;
            Definition = definition;
        }
示例#22
0
        public GenerateShader(GameCache cache, CachedTag tag, T definition) :
            base(true,

                 "Generate",
                 "Compiles HLSL source file from scratch :D",
                 "Generate <index> <shader_type> <drawmode> <parameters...>",
                 "Compiles HLSL source file from scratch :D")
        {
            Cache      = cache;
            Tag        = tag;
            Definition = definition;
        }
示例#23
0
        public static void Populate(CommandContext context, GameCache cache, CachedTag tag, MultilingualUnicodeStringList unic)
        {
            if (cache.StringTable == null)
            {
                return;
            }

            context.AddCommand(new ListStringsCommand(cache, unic));
            context.AddCommand(new GetStringCommand(cache, tag, unic));
            context.AddCommand(new SetStringCommand(cache, tag, unic));
            context.AddCommand(new RemoveStringCommand(cache, tag, unic));
        }
示例#24
0
        string TagName(CachedTag tag)
        {
            if (tag == null)
            {
                return("null");
            }
            if (tag.Name == null || tag.Name.Length < 1)
            {
                return(tag.ToString());
            }

            return($"{tag.Name}.{tag.Group}");
        }
示例#25
0
        public ReplaceAllFilesCommand(GameCache cache, CachedTag tag, VFilesList definition)
            : base(false,

                   "ReplaceAllFiles",
                   "Replace all files stored in the tag.",

                   "ReplaceAllFiles <directory>",
                   "Replaces all file stored in the tag. The tag will be resized as necessary.")
        {
            Cache      = cache;
            Tag        = tag;
            Definition = definition;
        }
示例#26
0
        public ImportSoundCommand(GameCache cache, CachedTag tag, Sound definition) :
            base(true,

                 "ImportSound",
                 "Import one (or many) sound files into the current snd! tag. Overwrites existing sound data. See documentation for formatting and options.",

                 "ImportSound",
                 "")
        {
            Cache      = cache;
            Tag        = tag;
            Definition = definition;
        }
示例#27
0
        public ExportSoundCommand(GameCache cache, CachedTag tag, Sound definition) :
            base(true,

                 "ExportSound",
                 "Export snd! data to a file",

                 "ExportSound <Path>",
                 "")
        {
            Cache      = cache;
            Tag        = tag;
            Definition = definition;
        }
示例#28
0
        private Dialogue ConvertDialogue(Stream cacheStream, Dialogue dialogue)
        {
            CachedTag         edAdlg = null;
            AiDialogueGlobals adlg   = null;

            foreach (var tag in CacheContext.TagCache.FindAllInGroup("adlg"))
            {
                edAdlg = tag;
                break;
            }

            adlg = CacheContext.Deserialize <AiDialogueGlobals>(cacheStream, edAdlg);

            //Create empty udlg vocalization block and fill it with empty blocks matching adlg

            List <Dialogue.Vocalization> newVocalization = new List <Dialogue.Vocalization>();

            foreach (var vocalization in adlg.Vocalizations)
            {
                Dialogue.Vocalization block = new Dialogue.Vocalization
                {
                    Sound   = null,
                    Flags   = 0,
                    Unknown = 0,
                    Name    = vocalization.Name,
                };
                newVocalization.Add(block);
            }

            //Match the tags with the proper stringId

            for (int i = 0; i < 304; i++)
            {
                var vocalization = newVocalization[i];
                for (int j = 0; j < dialogue.Vocalizations.Count; j++)
                {
                    var vocalizationH3 = dialogue.Vocalizations[j];
                    if (CacheContext.StringTable.GetString(vocalization.Name).Equals(CacheContext.StringTable.GetString(vocalizationH3.Name)))
                    {
                        vocalization.Flags   = vocalizationH3.Flags;
                        vocalization.Unknown = vocalizationH3.Unknown;
                        vocalization.Sound   = vocalizationH3.Sound;
                        break;
                    }
                }
            }

            dialogue.Vocalizations = newVocalization;

            return(dialogue);
        }
示例#29
0
        public ListScriptsCommand(GameCache cacheContext, CachedTag tag, Scenario definition)
            : base(true,

                   "ListScripts",
                   "Lists all scripts in the current scenario tag.",

                   "ListScripts [Filter]",

                   "Lists all scripts in the current scenario tag.")
        {
            CacheContext = cacheContext;
            Tag          = tag;
            Definition   = definition;
        }
示例#30
0
        private void FindClosestShaderTemplate(CachedTag sourceRmt2)
        {
            // somehow build a list of rmt2 of the same type
            List <CachedTag> candidateTemplates = new List <CachedTag>();

            // defined method search order, ignore last method from ms30
            List <int> methodOrder = new List <int> {
                0, 2, 3, 1, 6, 4, 5, 7, 8, 9, 10
            };

            Dictionary <CachedTag, int> matchLevelDictionary = new Dictionary <CachedTag, int>();
            Rmt2Descriptor sourceRmt2Desc;

            if (!Rmt2Descriptor.TryParse(sourceRmt2.Name, out sourceRmt2Desc))
            {
                return;
            }

            while (candidateTemplates.Count != 0)
            {
                var            template = candidateTemplates.Last();
                Rmt2Descriptor destRmt2Desc;
                if (!Rmt2Descriptor.TryParse(template.Name, out destRmt2Desc))
                {
                    candidateTemplates.Remove(template);
                    matchLevelDictionary[template] = 0;
                }
                else
                {
                    var matchLevel = 0;
                    for (int i = 0; i < methodOrder.Count; i++)
                    {
                        var methodIndex = methodOrder[i];
                        // we need to define a ordering on the method options, so that there is a single best rmt2
                        if (sourceRmt2Desc.Options[methodIndex] == destRmt2Desc.Options[methodIndex])
                        {
                            matchLevel++;
                        }
                        else
                        {
                            break;
                        }
                    }
                    matchLevelDictionary[template] = matchLevel;
                }
            }

            CachedTag bestRmt2  = null;
            var       bestScore = -1;
        }