Beispiel #1
0
        public VLTTypeResolver()
        {
            _typeTable = new Hashtable();
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::Double"), typeof(VLTDataItems.Double));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::Float"), typeof(VLTDataItems.Float));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::UInt64"), typeof(VLTDataItems.UInt64));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::UInt32"), typeof(VLTDataItems.UInt32));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::UInt16"), typeof(VLTDataItems.UInt16));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::UInt8"), typeof(VLTDataItems.UInt8));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::Int64"), typeof(VLTDataItems.Int64));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::Int32"), typeof(VLTDataItems.Int32));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::Int16"), typeof(VLTDataItems.Int16));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::Int8"), typeof(VLTDataItems.Int8));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::Bool"), typeof(VLTDataItems.Bool));
            _typeTable.Add(VLTHasher.Hash("EA::Reflection::Text"), typeof(VLTDataItems.Text));

            _typeTable.Add(VLTHasher.Hash("Attrib::Types::Matrix"), typeof(VLTDataItems.Matrix));
            _typeTable.Add(VLTHasher.Hash("Attrib::Types::Vector4"), typeof(VLTDataItems.Vector4));
            _typeTable.Add(VLTHasher.Hash("Attrib::Types::Vector3"), typeof(VLTDataItems.Vector3));
            _typeTable.Add(VLTHasher.Hash("Attrib::Types::Vector2"), typeof(VLTDataItems.Vector2));
            _typeTable.Add(VLTHasher.Hash("Attrib::StringKey"), typeof(VLTDataItems.StringKey));
            _typeTable.Add(VLTHasher.Hash("Attrib::RefSpec"), typeof(VLTDataItems.RefSpec));
            _typeTable.Add(VLTHasher.Hash("Attrib::Blob"), typeof(VLTDataItems.Blob));

            _typeTable.Add(VLTHasher.Hash("UpgradeSpecs"), typeof(VLTDataItems.UpgradeSpecs));
            _typeTable.Add(VLTHasher.Hash("JunkmanMod"), typeof(VLTDataItems.JunkmanMod));
            _typeTable.Add(VLTHasher.Hash("AxlePair"), typeof(VLTDataItems.AxlePair));
            _typeTable.Add(VLTHasher.Hash("CarBodyMotion"), typeof(VLTDataItems.CarBodyMotion));
            _typeTable.Add(VLTHasher.Hash("GCollectionKey"), typeof(VLTDataItems.GCollectionKey));
        }
Beispiel #2
0
        public static void AddAuto(string value)
        {
            uint key = VLTHasher.Hash(value);

            if (!_autoTable.ContainsKey(key))
            {
                _autoTable.Add(key, value);
                if (_loadTable.ContainsKey(key))
                {
                    _loadTable.Remove(key);
                }
            }
        }
Beispiel #3
0
        public static void Open(string filename)
        {
            StreamReader sr = new StreamReader(filename);
            string       line;

            do
            {
                line = sr.ReadLine();
                if (line != null)
                {
                    line = line.Trim();
                }
                if (line != null && line != "" && !line.StartsWith("#"))
                {
                    string[] split = line.Split('\t');
                    uint     key;
                    if (split.Length > 1)
                    {
                        if (split[1].StartsWith("0x"))
                        {
                            key = uint.Parse(split[1].Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            key = uint.Parse(split[1], NumberStyles.HexNumber);
                        }
                        if (!_manualTable.ContainsKey(key))
                        {
                            _manualTable.Add(key, split[2]);
                        }
                    }
                    else
                    {
                        key = VLTHasher.Hash(line);
                        if (!_loadTable.ContainsKey(key))
                        {
                            _loadTable.Add(key, line);
                        }
                    }
                }
            } while (line != null);
            sr.Close();
        }
Beispiel #4
0
        public void LoadDatabase(VLTDataDatabaseLoad dbLoad, VLTFile vltFile)
        {
            VLTPointers vltPointers = vltFile.GetChunk(VLTChunkId.Pointers) as VLTPointers;
            int         offset      = vltPointers[dbLoad.Pointer].OffsetDest;

            vltFile.RawStream.Seek(offset, SeekOrigin.Begin);
            BinaryReader br = new BinaryReader(vltFile.RawStream);

            _types = new Hashtable(dbLoad.Count);

            for (int i = 0; i < dbLoad.Count; i++)
            {
                VLTType type = new VLTType();
                type.TypeName = NullTerminatedString.Read(br);
                type.Length   = dbLoad[i];
                type.Hash     = VLTHasher.Hash(type.TypeName);
                _types.Add(type.Hash, type);
                HashResolver.AddAuto(type.TypeName);
            }

            _classes = new Hashtable();
        }