public ThirdGenLanguageGlobals(StructureValueCollection values, FileSegmenter segmenter, IPointerConverter localePointerConverter, BuildInformation buildInfo)
        {
            LocaleArea = new FileSegmentGroup(localePointerConverter);

            _languages = LoadLanguages(values, segmenter, buildInfo);
            _alignment = buildInfo.SegmentAlignment;
        }
Exemplo n.º 2
0
 public ReflexiveData(string name, uint offset, uint address, uint entrySize, uint pluginLine, FileSegmentGroup metaArea)
     : base(name, offset, address, pluginLine)
 {
     _entrySize = entrySize;
     _metaArea = metaArea;
     _expanded = true;
 }
Exemplo n.º 3
0
        /// <summary>
        ///     Writes data to a reflexive, reallocating the original.
        /// </summary>
        /// <param name="entries">The entries to write.</param>
        /// <param name="oldCount">The old count.</param>
        /// <param name="oldAddress">The old address.</param>
        /// <param name="newCount">The number of entries to write.</param>
        /// <param name="layout">The layout of the data to write.</param>
        /// <param name="metaArea">The meta area of the cache file.</param>
        /// <param name="allocator">The cache file's meta allocator.</param>
        /// <param name="stream">The stream to manipulate.</param>
        /// <returns>The address of the new reflexive, or 0 if the entry list is empty and the reflexive was freed.</returns>
        public static uint WriteReflexive(IEnumerable<StructureValueCollection> entries, int oldCount, uint oldAddress,
			int newCount, StructureLayout layout, FileSegmentGroup metaArea, MetaAllocator allocator, IStream stream)
        {
            if (newCount == 0)
            {
                // Free the old reflexive and return
                if (oldCount > 0 && oldAddress != 0)
                    allocator.Free(oldAddress, oldCount*layout.Size);
                return 0;
            }

            uint newAddress = oldAddress;
            if (newCount != oldCount)
            {
                // Reallocate the reflexive
                int oldSize = oldCount*layout.Size;
                int newSize = newCount*layout.Size;
                if (oldCount > 0 && oldAddress != 0)
                    newAddress = allocator.Reallocate(oldAddress, oldSize, newSize, stream);
                else
                    newAddress = allocator.Allocate(newSize, stream);
            }

            // Write the new values
            WriteReflexive(entries.Take(newCount), newAddress, layout, metaArea, stream);
            return newAddress;
        }
Exemplo n.º 4
0
		private void Load(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea,
			EngineDescription buildInfo)
		{
			Name = new StringID(values.GetInteger("name stringid"));

			LoadPermutations(values, reader, metaArea, buildInfo);
		}
Exemplo n.º 5
0
        private void Load(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, BuildInformation buildInfo)
        {
            ResourceIndex = new DatumIndex(values.GetInteger("resource datum index"));

            LoadRegions(values, reader, metaArea, buildInfo);
            LoadSections(values, reader, metaArea, buildInfo);
            LoadBoundingBox(values, reader, metaArea, buildInfo);
        }
		public FourthGenResourceLayoutTable(ITag playTag, FileSegmentGroup metaArea, MetaAllocator allocator,
			EngineDescription buildInfo)
		{
			_tag = playTag;
			_metaArea = metaArea;
			_allocator = allocator;
			_buildInfo = buildInfo;
		}
Exemplo n.º 7
0
 /// <summary>
 /// Reads all child objects of this reflexive.
 /// </summary>
 /// <param name="values">The values read from the parent.</param>
 /// <param name="reader">The stream to read from.</param>
 /// <param name="metaArea">The meta area of the cache file.</param>
 /// <param name="stringIDs">The string ID source for the cache file.</param>
 /// <param name="buildInfo">The build info for the cache file.</param>
 /// <returns>The objects that were read.</returns>
 public ScriptObject[] ReadObjects(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, StringIDSource stringIDs, BuildInformation buildInfo)
 {
     int count = (int)values.GetInteger(_countEntryName);
     uint address = (uint)values.GetInteger(_addressEntryName);
     var layout = buildInfo.GetLayout(_layoutName);
     var entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);
     return entries.Select(e => ReadScriptObject(e, reader, metaArea, stringIDs, buildInfo)).ToArray();
 }
Exemplo n.º 8
0
		private void Load(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea,
			EngineDescription buildInfo)
		{
			ModelResourceIndex = new DatumIndex(values.GetInteger("model resource datum index"));

			LoadSections(values, reader, metaArea, buildInfo);
			LoadBoundingBoxes(values, reader, metaArea, buildInfo);
		}
Exemplo n.º 9
0
 private SegmentPointer(FileSegment baseSegment, FileSegmentGroup baseGroup, int baseSegmentDelta)
 {
     _baseSegment = baseSegment;
     _baseGroup = baseGroup;
     _baseSegmentDelta = baseSegmentDelta;
     _originalBaseSize = baseSegment.Size;
     _baseBottomResizes = (baseSegment.ResizeOrigin == SegmentResizeOrigin.Beginning);
 }
Exemplo n.º 10
0
        public ThirdGenLanguage(GameLanguage language, StructureValueCollection values, FileSegmenter segmenter,
			FileSegmentGroup localeArea, EngineDescription buildInfo)
        {
            Language = language;
            _pointerLayout = buildInfo.Layouts.GetLayout("locale index table entry");
            _encryptionKey = buildInfo.LocaleKey;
            _sizeAlign = (_encryptionKey != null) ? AES.BlockSize : 1;
            Load(values, segmenter, localeArea);
        }
		private void LoadSoundNames(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, EngineDescription buildInfo)
		{
			var count = (int)values.GetInteger("number of sound names");
			var address = values.GetInteger("sound name table address");
			var layout = buildInfo.Layouts.GetLayout("sound names");
			var entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);

			SoundNames = entries.Select(e => new StringID(e.GetInteger("name index"))).ToArray();
		}
Exemplo n.º 12
0
        private void Load(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, BuildInformation buildInfo)
        {
            VertexFormat = (int)values.GetInteger("vertex format");
            ExtraElementsPerVertex = (int)values.GetInteger("extra elements per vertex");
            ExtraElementsType = (ExtraVertexElementType)values.GetInteger("extra element type");

            LoadSubmeshes(values, reader, metaArea, buildInfo);
            LoadVertexGroups(values, reader, metaArea, buildInfo, Submeshes);
        }
Exemplo n.º 13
0
 public ThirdGenLanguage(StructureValueCollection values, FileSegmenter segmenter, FileSegmentGroup localeArea, BuildInformation buildInfo)
 {
     _pointerLayout = buildInfo.GetLayout("locale index table entry");
     _encryptionKey = buildInfo.LocaleKey;
     _symbols = buildInfo.LocaleSymbols;
     _localeArea = localeArea;
     _sizeAlign = (_encryptionKey != null) ? AES.BlockSize : 1;
     Load(values, segmenter, localeArea);
 }
Exemplo n.º 14
0
		public FourthGenZoneSetTable(FourthGenResourceGestalt gestalt, IReader reader, FileSegmentGroup metaArea,
			MetaAllocator allocator, EngineDescription buildInfo)
		{
			_gestalt = gestalt;
			_metaArea = metaArea;
			_allocator = allocator;
			_buildInfo = buildInfo;
			Load(reader);
		}
Exemplo n.º 15
0
        private void LoadSubmeshes(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, BuildInformation buildInfo)
        {
            int count = (int)values.GetInteger("number of submeshes");
            uint address = values.GetInteger("submesh table address");
            var layout = buildInfo.GetLayout("model submesh");
            var entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);

            Submeshes = (from entry in entries
                         select new ThirdGenModelSubmesh(entry)).ToArray();
        }
Exemplo n.º 16
0
        private void LoadPermutations(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, BuildInformation buildInfo)
        {
            int count = (int)values.GetInteger("number of permutations");
            uint address = values.GetInteger("permutation table address");
            var layout = buildInfo.GetLayout("model permutation");
            var entries = ReflexiveReader.ReadReflexive(count, address, reader, layout, metaArea);

            Permutations = (from entry in entries
                            select new ThirdGenModelPermutation(entry)).ToArray();
        }
        private void LoadSegments(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, BuildInformation buildInfo, ThirdGenResourcePage[] pages)
        {
            int count = (int)values.GetInteger("number of raw segments");
            uint address = values.GetInteger("raw segment table address");
            var layout = buildInfo.GetLayout("raw segment table entry");
            var entries = ReflexiveReader.ReadReflexive(count, address, reader, layout, metaArea);

            Segments = (from entry in entries
                        select new ThirdGenResourceSegment(entry, pages)).ToArray();
        }
Exemplo n.º 18
0
		/// <summary>
		///     Initializes a new instance of the <see cref="ThirdGenResourceManager" /> 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 ThirdGenResourceManager(ThirdGenResourceGestalt gestalt, ThirdGenResourceLayoutTable layoutTable, TagTable tags,
			FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo)
		{
			_gestalt = gestalt;
			_layoutTable = layoutTable;
			_tags = tags;
			_metaArea = metaArea;
			_allocator = allocator;
			_buildInfo = buildInfo;
		}
Exemplo n.º 19
0
        public ThirdGenResourceGestalt(IReader reader, ITag zoneTag, FileSegmentGroup metaArea, MetaAllocator allocator,
			StringIDSource stringIDs, EngineDescription buildInfo)
        {
            _tag = zoneTag;
            _metaArea = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;

            Load(reader, stringIDs);
        }
Exemplo n.º 20
0
        public ThirdGenTagTable(IReader reader, SegmentPointer indexHeaderLocation, FileSegmentGroup metaArea,
			MetaAllocator allocator, EngineDescription buildInfo)
        {
            _indexHeaderLocation = indexHeaderLocation;
            _metaArea = metaArea;
            _allocator = allocator;
            _buildInfo = buildInfo;

            Load(reader);
        }
Exemplo n.º 21
0
        private void LoadVertexGroups(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, BuildInformation buildInfo, IModelSubmesh[] submeshes)
        {
            int count = (int)values.GetInteger("number of vertex groups");
            uint address = values.GetInteger("vertex group table address");
            var layout = buildInfo.GetLayout("model vertex group");
            var entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);

            VertexGroups = (from entry in entries
                            select new ThirdGenModelVertexGroup(entry, submeshes)).ToArray();
        }
		private void Load(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, EngineDescription buildInfo)
		{
			LoadSoundNames(values, reader, metaArea, buildInfo);
			LoadPlatformCodecs(values, reader, metaArea, buildInfo);
			LoadPlaybackParameters(values, reader, metaArea, buildInfo);
			LoadScales(values, reader, metaArea, buildInfo);
			LoadSoundPlaybacks(values, reader, metaArea, buildInfo);
			LoadSoundPermutations(values, reader, metaArea, buildInfo);
			LoadSoundPermutationChunks(values, reader, metaArea, buildInfo);
		}
        private void LoadFileReferences(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, BuildInformation buildInfo)
        {
            int count = (int)values.GetInteger("number of external cache files");
            uint address = values.GetInteger("external cache file table address");
            var layout = buildInfo.GetLayout("external cache file table entry");
            var entries = ReflexiveReader.ReadReflexive(count, address, reader, layout, metaArea);

            FileReferences = (from entry in entries
                              select new ThirdGenCacheFileReference(entry)).ToArray();
        }
		public FourthGenSimulationDefinitionTable(ITag scenario, TagTable tags, IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo)
		{
			_scenario = scenario;
			_tags = tags;
			_metaArea = metaArea;
			_allocator = allocator;
			_buildInfo = buildInfo;

			Load(reader);
		}
		private void LoadSoundPermutations(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, EngineDescription buildInfo)
		{
			var count = (int)values.GetInteger("number of sound permutations");
			var address = values.GetInteger("sound permutation table address");
			var layout = buildInfo.Layouts.GetLayout("sound permutations");
			var entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);

			SoundPermutations = (from entry in entries
								 select new FourthGenSoundPermutation(entry, SoundNames)).ToArray<ISoundPermutation>();
		}
		private void LoadPlatformCodecs(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, EngineDescription buildInfo)
		{
			var count = (int)values.GetInteger("number of platform codecs");
			var address = values.GetInteger("platform codecs table address");
			var layout = buildInfo.Layouts.GetLayout("sound platform codecs");
			var entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);

			SoundPlatformCodecs = (from entry in entries
						   select new FourthGenSoundPlatformCodec(entry)).ToArray<ISoundPlatformCodec>();
		}
Exemplo n.º 27
0
        public ThirdGenPluginVisitor(TagHierarchy tags, Trie stringIDTrie, FileSegmentGroup metaArea, bool showInvisibles)
        {
            _tags = tags;
            _stringIDTrie = stringIDTrie;
            _metaArea = metaArea;

            Values = new ObservableCollection<MetaField>();
            Reflexives = new ObservableCollection<ReflexiveData>();
            _showInvisibles = showInvisibles;
        }
        public ThirdGenScenarioScriptFile(ITag scenarioTag, string scenarioName, FileSegmentGroup metaArea, StringIDSource stringIDs, BuildInformation buildInfo)
        {
            _tag = scenarioTag;
            _stringIDs = stringIDs;
            _metaArea = metaArea;
            _buildInfo = buildInfo;
            Name = scenarioName.Substring(scenarioName.LastIndexOf('\\') + 1) + ".hsc";

            DefineScriptObjectReflexives();
        }
		private void LoadScales(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, EngineDescription buildInfo)
		{
			var count = (int)values.GetInteger("number of scales");
			var address = values.GetInteger("scales table address");
			var layout = buildInfo.Layouts.GetLayout("sound scales");
			var entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);

			SoundScales = (from entry in entries
						   select new ThirdGenSoundScale(entry)).ToArray<ISoundScale>();
		}
Exemplo n.º 30
0
		private void LoadPermutations(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea,
			EngineDescription buildInfo)
		{
			var count = (int) values.GetInteger("number of permutations");
			uint address = values.GetInteger("permutation table address");
			StructureLayout layout = buildInfo.Layouts.GetLayout("model permutation");
			StructureValueCollection[] entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, metaArea);

			Permutations = (from entry in entries
				select new FourthGenModelPermutation(entry)).ToArray();
		}