コード例 #1
0
        public override void Read(BlamLib.IO.EndianReader s)
        {
            CacheFile cache = s.Owner as CacheFile;
            bool      isPC  = cache.EngineVersion.IsPc() || cache.EngineVersion == BlamVersion.Halo1_XboxX;

            #region base address
            Managers.BlamDefinition bdef = Program.GetManager(cache.EngineVersion);

            cache.AddressMask = bdef[cache.EngineVersion].CacheTypes.BaseAddress
                                - (uint)cache.Header.OffsetToIndex;
            #endregion

            address = s.ReadUInt32();
            scenario.Read(s);
            s.ReadInt32();             // CRC
            tagCount            = s.ReadInt32();
            vertexBufferCount   = s.ReadInt32();
            vertexBufferAddress = s.ReadUInt32(); vertexBufferOffset = (int)(vertexBufferAddress - cache.AddressMask);
            indexBufferCount    = s.ReadInt32();
            indexBufferAddress  = s.ReadUInt32(); indexBufferOffset = (int)(indexBufferAddress - cache.AddressMask);
            if (isPC)
            {
                s.ReadInt32();         // total vertex and index buffer size
            }
            s.ReadInt32();             // 'tags'

            tagsOffset = s.PositionUnsigned;

            ReadTagInstances(s, cache);

            InitializeBspTags(s, cache);
        }
コード例 #2
0
        public override void Read(BlamLib.IO.EndianReader s)
        {
            CacheFile cache  = s.Owner as CacheFile;
            bool      isHA10 = cache.EngineVersion == BlamVersion.Halo1_XboxX || cache.EngineVersion == BlamVersion.Halo1_PCX;

            GameDefinition gd = Program.Halo1.Manager;

            GroupTagInt = s.ReadUInt32();
            groupTag    = gd.TagGroupFind(TagInterface.TagGroup.FromUInt(GroupTagInt));
            IO.ByteSwap.SwapUDWord(ref GroupTagInt);

            uint group_tag_int = s.ReadUInt32();

            if (group_tag_int != uint.MaxValue)
            {
                groupParent1 = gd.TagGroupFind(TagInterface.TagGroup.FromUInt(group_tag_int));
            }
            else
            {
                groupParent1 = TagInterface.TagGroup.Null;
            }

            group_tag_int = s.ReadUInt32();
            if (group_tag_int != uint.MaxValue)
            {
                groupParent2 = gd.TagGroupFind(TagInterface.TagGroup.FromUInt(group_tag_int));
            }
            else
            {
                groupParent2 = TagInterface.TagGroup.Null;
            }

            datum.Read(s);
            tagNameOffset = s.ReadPointer();

            address = s.ReadUInt32();             // external index for pc\ce, if its a bitmap, ptr if its a sound or anything else
            // TODO: HA10 Xbox doesn't use data files (and a PC port probably won't either)
            if (isHA10 || address > s.BaseAddress)
            {
                offset = (int)(address - s.BaseAddress);
            }
            this.location = (CacheIndex.ItemLocation)s.ReadInt32();             // bool_in_data_file

            s.ReadInt32();
        }
コード例 #3
0
        public override void Read(BlamLib.IO.EndianReader s)
        {
            int pos = 0;

            Blam.CacheFile.ValidateHeaderAdjustEndian(s, 0x800);
            s.Seek(4);

            Halo1.Version ver = (Halo1.Version)(version = s.ReadInt32());
            fileLength = s.ReadInt32();
            if (fileLength < s.Length)
            {
                throw new Debug.ExceptionLog("Compressed map editing not available yet!");
            }

            s.ReadInt32();

            if (ver == Halo1.Version.PC_Demo)
            {
                pos           = s.Position;
                s.Position    = 0x5EC;
                offsetToIndex = s.ReadInt32();
                s.Position    = pos;
            }
            else
            {
                offsetToIndex = s.ReadInt32();
            }

            tagBufferSize = s.ReadInt32();

            s.ReadInt32(); s.ReadInt32();

            if (ver == Halo1.Version.PC_Demo)
            {
                pos        = s.Position;
                s.Position = 0x5E8;
                name       = s.ReadTagString();
                s.Position = pos;
            }
            else
            {
                name = s.ReadTagString();
            }

            build     = s.ReadTagString();
            cacheType = (CacheType)s.ReadInt32();
            s.ReadInt32();             // CRC

            s.ReadInt32();
            s.Seek((484 * sizeof(int)) + sizeof(uint), System.IO.SeekOrigin.Current);

            CacheFile cache = s.Owner as CacheFile;

            if (ver == Halo1.Version.Xbox)
            {
                cache.EngineVersion = BlamVersion.Halo1_Xbox;
            }
            else if (ver == Halo1.Version.PC || ver == Halo1.Version.PC_Demo)
            {
                if (s.State == IO.EndianState.Big)
                {
                    cache.EngineVersion = BlamVersion.Halo1_XboxX;
                }
                else
                {
                    // Interestingly, HaloPC is build 01.00.00.0564, HA10 is build 01.00.01.0563
                    // Little
                    if (build == "01.00.01.0563")
                    {
                        cache.EngineVersion = BlamVersion.Halo1_PCX;
                    }
                    else
                    {
                        cache.EngineVersion = BlamVersion.Halo1_PC;
                    }
                }
            }
            else if (ver == Halo1.Version.CE)
            {
                cache.EngineVersion = BlamVersion.Halo1_CE;
            }
        }