示例#1
0
        public static bool TryGetSoundContent(IIndexItem item, out ISoundContainer content)
        {
            content = null;

            if (item == null)
            {
                return(false);
            }

            if (item.ClassCode != sound)
            {
                return(false);
            }

            switch (item.CacheFile.CacheType)
            {
            case CacheType.Halo2Xbox:
                content = item.ReadMetadata <Halo2.sound>();
                break;

            //case CacheType.Halo3Beta:
            case CacheType.Halo3Retail:
            case CacheType.Halo3ODST:
                content = item.ReadMetadata <Halo3.sound>();
                break;

            case CacheType.HaloReachBeta:
            case CacheType.HaloReachRetail:
                content = item.ReadMetadata <HaloReach.sound>();
                break;
            }

            return(content != null);
        }
        public static ModelConfig FromIndexItem(IIndexItem item)
        {
            ModelConfig result;

            switch (item.CacheFile.CacheType)
            {
            case CacheType.Halo3Retail:
            case CacheType.MccHalo3:
            case CacheType.MccHalo3U4:
            case CacheType.Halo3ODST:
            case CacheType.MccHalo3ODST:
                result = item.ReadMetadata <Blam.Halo3.model>().ToModelConfig();
                break;

            case CacheType.HaloReachRetail:
            case CacheType.MccHaloReach:
            case CacheType.MccHaloReachU3:
                result = item.ReadMetadata <Blam.HaloReach.model>().ToModelConfig();
                break;

            case CacheType.Halo4Retail:
            case CacheType.MccHalo4:
            case CacheType.MccHalo2X:
                result = item.ReadMetadata <Blam.Halo4.model>().ToModelConfig();
                break;

            default: return(null);
            }

            result.ModelTag = item;
            return(result);
        }
示例#3
0
        public static bool TryGetBitmapContent(IIndexItem item, out IBitmap content)
        {
            content = null;

            if (item == null)
            {
                return(false);
            }

            if (item.ClassCode != bitmap)
            {
                return(false);
            }

            switch (item.CacheFile.CacheType)
            {
            case CacheType.Halo1Xbox:
            case CacheType.Halo1CE:
            case CacheType.Halo1PC:
                content = item.ReadMetadata <Halo1.bitmap>();
                break;

            case CacheType.Halo2Beta:
            case CacheType.Halo2Xbox:
                content = item.ReadMetadata <Halo2.bitmap>();
                break;

            case CacheType.Halo3Alpha:
            case CacheType.Halo3Beta:
            case CacheType.Halo3Retail:
            case CacheType.MccHalo3:
            case CacheType.MccHalo3U4:
            case CacheType.Halo3ODST:
            case CacheType.MccHalo3ODST:
                content = item.ReadMetadata <Halo3.bitmap>();
                break;

            case CacheType.HaloReachBeta:
            case CacheType.HaloReachRetail:
            case CacheType.MccHaloReach:
            case CacheType.MccHaloReachU3:
                content = item.ReadMetadata <HaloReach.bitmap>();
                break;

            case CacheType.Halo4Beta:
            case CacheType.Halo4Retail:
            case CacheType.MccHalo4:
            case CacheType.MccHalo2X:
                content = item.ReadMetadata <Halo4.bitmap>();
                break;
            }

            return(content != null);
        }
        private IIndexItem FindModelTag(IIndexItem source, out string defaultVariant)
        {
            defaultVariant = null;

            //already a hlmt tag
            if (source.ClassCode.Equals(compositeTags[0], StringComparison.OrdinalIgnoreCase))
            {
                return(source);
            }

            switch (source.CacheFile.CacheType)
            {
            case CacheType.Halo3Retail:
            case CacheType.MccHalo3:
            case CacheType.MccHalo3U4:
            case CacheType.Halo3ODST:
            case CacheType.MccHalo3ODST:
                var h3Meta = source.ReadMetadata <Blam.Halo3.@object>();
                defaultVariant = h3Meta.DefaultVariant;
                return(h3Meta.Model.Tag);

            case CacheType.HaloReachRetail:
            case CacheType.MccHaloReach:
            case CacheType.MccHaloReachU3:
                var reachMeta = source.ReadMetadata <Blam.HaloReach.@object>();
                defaultVariant = reachMeta.DefaultVariant;
                return(reachMeta.Model.Tag);

            case CacheType.Halo4Retail:
            case CacheType.MccHalo4:
            case CacheType.MccHalo2X:
                var h4Meta = source.ReadMetadata <Blam.Halo4.@object>();
                defaultVariant = h4Meta.DefaultVariant;
                return(h4Meta.Model.Tag);

            default: return(null);
            }
        }
示例#5
0
        public static bool TryGetGeometryContent(IIndexItem item, out IRenderGeometry content)
        {
            content = null;

            if (item == null)
            {
                return(false);
            }

            if (item.ClassCode == gbxmodel || item.ClassCode == render_model)
            {
                switch (item.CacheFile.CacheType)
                {
                case CacheType.Halo1Xbox:
                case CacheType.Halo1CE:
                case CacheType.Halo1PC:
                    content = item.ReadMetadata <Halo1.gbxmodel>();
                    break;

                case CacheType.Halo2Beta:
                    content = item.ReadMetadata <Halo2Beta.render_model>();
                    break;

                case CacheType.Halo2Xbox:
                    content = item.ReadMetadata <Halo2.render_model>();
                    break;

                case CacheType.Halo3Alpha:
                case CacheType.Halo3Beta:
                case CacheType.Halo3Retail:
                case CacheType.MccHalo3:
                case CacheType.MccHalo3U4:
                case CacheType.Halo3ODST:
                case CacheType.MccHalo3ODST:
                    content = item.ReadMetadata <Halo3.render_model>();
                    break;

                case CacheType.HaloReachBeta:
                case CacheType.HaloReachRetail:
                case CacheType.MccHaloReach:
                case CacheType.MccHaloReachU3:
                    content = item.ReadMetadata <HaloReach.render_model>();
                    break;

                case CacheType.Halo4Beta:
                case CacheType.Halo4Retail:
                case CacheType.MccHalo4:
                case CacheType.MccHalo2X:
                    content = item.ReadMetadata <Halo4.render_model>();
                    break;
                }
            }
            else if (item.ClassCode == scenario_structure_bsp)
            {
                switch (item.CacheFile.CacheType)
                {
                case CacheType.Halo1CE:
                case CacheType.Halo1PC:
                    content = item.ReadMetadata <Halo1.scenario_structure_bsp>();
                    break;

                case CacheType.Halo2Xbox:
                    content = item.ReadMetadata <Halo2.scenario_structure_bsp>();
                    break;

                case CacheType.Halo3Alpha:
                case CacheType.Halo3Beta:
                case CacheType.Halo3Retail:
                case CacheType.MccHalo3:
                case CacheType.MccHalo3U4:
                case CacheType.Halo3ODST:
                case CacheType.MccHalo3ODST:
                    content = item.ReadMetadata <Halo3.scenario_structure_bsp>();
                    break;

                case CacheType.HaloReachBeta:
                case CacheType.HaloReachRetail:
                case CacheType.MccHaloReach:
                case CacheType.MccHaloReachU3:
                    content = item.ReadMetadata <HaloReach.scenario_structure_bsp>();
                    break;

                case CacheType.Halo4Beta:
                case CacheType.Halo4Retail:
                case CacheType.MccHalo4:
                case CacheType.MccHalo2X:
                    content = item.ReadMetadata <Halo4.scenario_structure_bsp>();
                    break;
                }
            }

            return(content != null);
        }