Example #1
0
 public SecondGenCacheFile(IReader reader, EngineDescription buildInfo, string buildString)
 {
     _buildInfo = buildInfo;
     _segmenter = new FileSegmenter(buildInfo.SegmentAlignment);
     Allocator  = new MetaAllocator(this, 0x10000);
     Load(reader, buildInfo, buildString);
 }
 public FourthGenCacheFile(IReader map_reader, IReader tag_reader, IReader string_reader, IReader tagnames_reader, EngineDescription buildInfo, string buildString)
 {
     _buildInfo = buildInfo;
     _segmenter = new FileSegmenter(buildInfo.SegmentAlignment);
     Allocator  = new MetaAllocator(this, 0x10000);
     Load(map_reader, tag_reader, string_reader, tagnames_reader, buildString);
 }
Example #3
0
 public static void Free(StructureValueCollection values, MetaAllocator allocator, IPointerExpander expander)
 {
     FreeBitArray(values, "number of raw pool flags", "raw pool flag table address", allocator, expander);
     FreeBitArray(values, "number of raw pool 2 flags", "raw pool 2 flag table address", allocator, expander);
     FreeBitArray(values, "number of raw pool 3 flags", "raw pool 3 flag table address", allocator, expander);
     FreeBitArray(values, "number of tag flags", "tag flag table address", allocator, expander);
     FreeBitArray(values, "number of tag 2 flags", "tag 2 flag table address", allocator, expander);
 }
Example #4
0
        public SecondGenTagTable(IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo)
        {
            _metaArea  = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;

            Load(reader);
        }
Example #5
0
 public static void Free(StructureValueCollection values, MetaAllocator allocator)
 {
     FreeBitArray(values, "number of raw pool bitfields", "raw pool bitfield table address", allocator);
     FreeBitArray(values, "number of raw pool 2 bitfields", "raw pool 2 bitfield table address", allocator);
     FreeBitArray(values, "number of raw pool 3 bitfields", "raw pool 3 bitfield table address", allocator);
     FreeBitArray(values, "number of tag bitfields", "tag bitfield table address", allocator);
     FreeBitArray(values, "number of tag 2 bitfields", "tag 2 bitfield table address", allocator);
 }
 public ThirdGenResourceLayoutTable(ITag playTag, FileSegmentGroup metaArea, MetaAllocator allocator,
                                    EngineDescription buildInfo)
 {
     _tag       = playTag;
     _metaArea  = metaArea;
     _allocator = allocator;
     _buildInfo = buildInfo;
 }
 public ThirdGenCacheFile(IReader reader, EngineDescription buildInfo, string buildString)
 {
     _endianness = reader.Endianness;
     _buildInfo  = buildInfo;
     _segmenter  = new FileSegmenter(buildInfo.SegmentAlignment);
     _expander   = new ThirdGenPointerExpander((uint)buildInfo.ExpandMagic);
     Allocator   = new MetaAllocator(this, 0x10000);
     Load(reader, buildString);
 }
Example #8
0
        public FourthGenTagTable(IReader reader, MetaAllocator allocator, EngineDescription buildInfo)
        {
            //_indexHeaderLocation = indexHeaderLocation;
            //_metaArea = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;

            Load(reader);
        }
 public ThirdGenZoneSetTable(ThirdGenResourceGestalt gestalt, IReader reader, FileSegmentGroup metaArea,
                             MetaAllocator allocator, EngineDescription buildInfo)
 {
     _gestalt   = gestalt;
     _metaArea  = metaArea;
     _allocator = allocator;
     _buildInfo = buildInfo;
     Load(reader);
 }
Example #10
0
 public SecondGenCacheFile(IReader reader, EngineDescription buildInfo, string filePath)
 {
     FilePath    = filePath;
     _endianness = reader.Endianness;
     _buildInfo  = buildInfo;
     _segmenter  = new FileSegmenter(buildInfo.SegmentAlignment);
     _expander   = new DummyPointerExpander();
     Allocator   = new MetaAllocator(this, 0x1000);
     Load(reader);
 }
Example #11
0
        public SecondGenTagTable(IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo)
        {
            _metaArea  = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;

            _metaHeaderLayout = _buildInfo.Layouts.GetLayout("meta header");

            Load(reader);
        }
Example #12
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="SoundResourceManager" /> class.
 /// </summary>
 /// <param name="gestalt">The cache file's sound resource gestalt.</param>
 /// <param name="layoutTable">The cache file's resource layout table.</param>
 /// <param name="tags">The cache file's tag table.</param>
 /// <param name="metaArea">The cache file's meta area.</param>
 /// <param name="allocator">The cache file's tag data allocator.</param>
 /// <param name="buildInfo">The cache file's build information.</param>
 public SoundResourceManager(SoundResourceGestalt gestalt, TagTable tags, FileSegmentGroup metaArea,
                             MetaAllocator allocator, EngineDescription buildInfo, IPointerExpander expander)
 {
     _gestalt   = gestalt;
     _tags      = tags;
     _metaArea  = metaArea;
     _allocator = allocator;
     _buildInfo = buildInfo;
     _expander  = expander;
 }
Example #13
0
        public NewThirdGenTagTable(IReader reader, SegmentPointer indexHeaderLocation, FileSegmentGroup metaArea,
                                   MetaAllocator allocator, EngineDescription buildInfo)
        {
            _indexHeaderLocation = indexHeaderLocation;
            _metaArea            = metaArea;
            _allocator           = allocator;
            _buildInfo           = buildInfo;

            Load(reader);
        }
Example #14
0
        public FourthGenResourceGestalt(IReader reader, ITag zoneTag, FileSegmentGroup metaArea, MetaAllocator allocator,
                                        StringIDSource stringIDs, EngineDescription buildInfo)
        {
            _tag       = zoneTag;
            _metaArea  = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;

            Load(reader, stringIDs);
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="FourthGenResourceManager" /> class.
 /// </summary>
 /// <param name="gestalt">The cache file's resource gestalt.</param>
 /// <param name="layoutTable">The cache file's resource layout table.</param>
 /// <param name="tags">The cache file's tag table.</param>
 /// <param name="metaArea">The cache file's meta area.</param>
 /// <param name="allocator">The cache file's tag data allocator.</param>
 /// <param name="buildInfo">The cache file's build information.</param>
 public FourthGenResourceManager(FourthGenResourceGestalt gestalt, FourthGenResourceLayoutTable layoutTable, TagTable tags,
                                 FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo)
 {
     _gestalt     = gestalt;
     _layoutTable = layoutTable;
     _tags        = tags;
     _metaArea    = metaArea;
     _allocator   = allocator;
     _buildInfo   = buildInfo;
 }
Example #16
0
        public SecondGenSimulationDefinitionTable(ITag scenario, TagTable tags, IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo)
        {
            _scenario  = scenario;
            _tags      = tags;
            _metaArea  = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;

            Load(reader);
        }
        public ThirdGenResourceLayoutTable(ITag playTag, FileSegmentGroup metaArea, MetaAllocator allocator,
                                           EngineDescription buildInfo, IPointerExpander expander)
        {
            _tag       = playTag;
            _metaArea  = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;
            _expander  = expander;

            _zone = _tag.Group.Magic != 1886151033;            //"play"
        }
Example #18
0
        public ThirdGenResourceGestalt(IReader reader, ITag zoneTag, FileSegmentGroup metaArea, MetaAllocator allocator,
                                       StringIDSource stringIDs, EngineDescription buildInfo, IPointerExpander expander)
        {
            _tag       = zoneTag;
            _metaArea  = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;
            _expander  = expander;

            Load(reader, stringIDs);
        }
Example #19
0
        public StructureValueCollection Serialize(IStream stream, MetaAllocator allocator, TagBlockCache <int> cache, IPointerExpander expander)
        {
            var result = new StructureValueCollection();

            SaveBitArray(_activeResources, "number of raw pool flags", "raw pool flag table address", allocator, stream, cache, result, expander);
            SaveBitArray(_unknownResources, "number of raw pool 2 flags", "raw pool 2 flag table address", allocator, stream, cache, result, expander);
            SaveBitArray(_unknownResources2, "number of raw pool 3 flags", "raw pool 3 flag table address", allocator, stream, cache, result, expander);
            SaveBitArray(_activeTags, "number of tag flags", "tag flag table address", allocator, stream, cache, result, expander);
            SaveBitArray(_unknownTags, "number of tag 2 flags", "tag 2 flag table address", allocator, stream, cache, result, expander);
            return(result);
        }
Example #20
0
        public ThirdGenSimulationDefinitionTable(ITag scenario, TagTable tags, IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo, IPointerExpander expander)
        {
            _scenario  = scenario;
            _tags      = tags;
            _metaArea  = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;
            _expander  = expander;

            Load(reader);
        }
Example #21
0
        public StructureValueCollection Serialize(IStream stream, MetaAllocator allocator, ReflexiveCache <int> cache)
        {
            var result = new StructureValueCollection();

            SaveBitArray(_activeResources, "number of raw pool bitfields", "raw pool bitfield table address", allocator, stream, cache, result);
            SaveBitArray(_unknownResources, "number of raw pool 2 bitfields", "raw pool 2 bitfield table address", allocator, stream, cache, result);
            SaveBitArray(_unknownResources2, "number of raw pool 3 bitfields", "raw pool 3 bitfield table address", allocator, stream, cache, result);
            SaveBitArray(_activeTags, "number of tag bitfields", "tag bitfield table address", allocator, stream, cache, result);
            SaveBitArray(_unknownTags, "number of tag 2 bitfields", "tag 2 bitfield table address", allocator, stream, cache, result);
            return(result);
        }
Example #22
0
        public FirstGenCacheFile(IReader reader, EngineDescription buildInfo, string buildString)
        {
            _endianness = reader.Endianness;
            _buildInfo  = buildInfo;
            _segmenter  = new FileSegmenter(buildInfo.SegmentAlignment);
            _expander   = new FirstGenPointerExpander();

            // TODO (Dragon): not sure if this is right for first gen
            Allocator = new MetaAllocator(this, 0x10000);

            Load(reader, buildInfo, buildString);
        }
Example #23
0
        public EffectInterop(ITag scenario, IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo, IPointerExpander expander)
        {
            _scenario  = scenario;
            _metaArea  = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;
            _expander  = expander;

            _effe = new List <byte[]>();
            _beam = new List <byte[]>();
            _cntl = new List <byte[]>();
            _ltvl = new List <byte[]>();

            Load(reader);
        }
Example #24
0
        public ScnrScriptFile(ITag scnrTag, string tagName, FileSegmentGroup metaArea, EngineDescription buildInfo, StringIDSource stringIDs, IPointerExpander expander, MetaAllocator allocator)
        {
            if (CharConstant.ToString(scnrTag.Group.Magic) != "scnr")
            {
                throw new ArgumentException("Invalid tag. The tag must belong to the scnr group.");
            }

            _scnrTag   = scnrTag;
            Name       = tagName.Substring(tagName.LastIndexOf('\\') + 1) + ".hsc";;
            _metaArea  = metaArea;
            _buildInfo = buildInfo;
            _stringIDs = stringIDs;
            _expander  = expander;
            _allocator = allocator;
        }
Example #25
0
        private void SaveBitArray(BitArray bits, string countName, string addressName, MetaAllocator allocator, IStream stream, TagBlockCache <int> cache, StructureValueCollection values, IPointerExpander expander)
        {
            if (bits.Length == 0)
            {
                values.SetInteger(countName, 0);
                values.SetInteger(addressName, 0);
                return;
            }

            var ints = bits.ToIntArray();

            // If the address isn't cached, then allocate space and write a new array
            long newAddress;

            if (!cache.TryGetAddress(ints, out newAddress))
            {
                newAddress = allocator.Allocate(ints.Length * 4, stream);
                stream.SeekTo(_metaArea.PointerToOffset(newAddress));
                foreach (int i in ints)
                {
                    stream.WriteInt32(i);
                }

                cache.Add(newAddress, ints);
            }

            uint cont = expander.Contract(newAddress);

            values.SetInteger(countName, (uint)ints.Length);
            values.SetInteger(addressName, cont);
        }
Example #26
0
        private static void FreeBitArray(StructureValueCollection values, string countName, string addressName, MetaAllocator allocator)
        {
            if (!values.HasInteger(countName) || !values.HasInteger(addressName))
            {
                return;
            }

            var  oldCount   = (int)values.GetInteger(countName);
            uint oldAddress = values.GetInteger(addressName);

            if (oldCount > 0 && oldAddress > 0)
            {
                allocator.Free(oldAddress, oldCount * 4);
            }
        }
Example #27
0
        private void SaveBitArray(BitArray bits, string countName, string addressName, MetaAllocator allocator, IStream stream, ReflexiveCache <int> cache, StructureValueCollection values)
        {
            if (bits.Length == 0)
            {
                values.SetInteger(countName, 0);
                values.SetInteger(addressName, 0);
                return;
            }

            var ints = new int[((bits.Length + 31) & ~31) / 32];

            bits.CopyTo(ints, 0);

            // If the address isn't cached, then allocate space and write a new array
            uint newAddress;

            if (!cache.TryGetAddress(ints, out newAddress))
            {
                newAddress = allocator.Allocate(ints.Length * 4, stream);
                stream.SeekTo(_metaArea.PointerToOffset(newAddress));
                foreach (int i in ints)
                {
                    stream.WriteInt32(i);
                }

                cache.Add(newAddress, ints);
            }

            values.SetInteger(countName, (uint)ints.Length);
            values.SetInteger(addressName, newAddress);
        }