Example #1
0
        internal void Read(Reader reader)
        {
            switch (Type)
            {
            case AttributeTypes.UINT8:
                value_uint8 = reader.ReadByte();
                break;

            case AttributeTypes.UINT16:
                value_uint16 = reader.ReadUInt16();
                break;

            case AttributeTypes.UINT32:
                value_uint32 = reader.ReadUInt32();
                break;

            case AttributeTypes.INT8:
                value_int8 = reader.ReadSByte();
                break;

            case AttributeTypes.INT16:
                value_int16 = reader.ReadInt16();
                break;

            case AttributeTypes.INT32:
                value_int32 = reader.ReadInt32();
                break;

            case AttributeTypes.ENUM:
                value_enum = reader.ReadInt32();
                break;

            case AttributeTypes.BOOL:
                value_bool = reader.ReadUInt32() != 0;
                break;

            case AttributeTypes.STRING:
                value_string = reader.ReadRSDKUnicodeString();
                break;

            case AttributeTypes.VECTOR2:
                value_vector2 = new Position(reader);
                break;

            case AttributeTypes.VECTOR3:
                value_vector2 = new Position(reader);
                break;

            case AttributeTypes.COLOR:
                value_color = new Color(reader);
                break;
            }
        }
        public StaticObject(Reader reader)
        {
            int[] TmpData = new int[reader.BaseStream.Length];
            DataPos = 0;
            string filename = System.IO.Path.GetFileName(reader.GetFilename());

            if (!reader.ReadBytes(4).SequenceEqual(MAGIC)) //"OBJ" Header
            {
                throw new Exception("Invalid config file header magic");
            }

            if (Debug)
            {
                Console.WriteLine("Viewing Info for " + filename);
            }

            while (!reader.IsEof)
            {
                int  DataType = reader.ReadByte();
                uint Unknown  = reader.ReadUInt32(); //Unknown

                if ((DataType & 0x80) != 0)
                {
                    uint DataSize = reader.ReadUInt32();

                    DataType &= 0x7F;

                    switch (DataType)
                    {
                    //INT8
                    case (int)AttributeTypes.UINT8:
                        for (int i = 0; i < DataSize; i++)
                        {
                            TmpData[DataPos++] = reader.ReadByte();
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.UINT8 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 1) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 1).ToString("X"));
                            }
                        }
                        break;

                    case (int)AttributeTypes.INT8:
                        for (int i = 0; i < DataSize; i++)
                        {
                            TmpData[DataPos++] = reader.ReadSByte();
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Value: Type:" + AttributeTypes.INT8 + ", " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 1) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 1).ToString("X"));
                            }
                        }
                        break;

                    //IN16
                    case (int)AttributeTypes.UINT16:
                        for (int i = 0; i < DataSize; i++)
                        {
                            byte   valA  = reader.ReadByte();
                            byte   valB  = reader.ReadByte();
                            ushort Value = (ushort)(valA + (valB << 8));
                            TmpData[DataPos++] = Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.UINT16 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 2) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 2).ToString("X"));
                            }
                        }
                        break;

                    case (int)AttributeTypes.INT16:
                        for (int i = 0; i < DataSize; i++)
                        {
                            byte  valA  = reader.ReadByte();
                            byte  valB  = reader.ReadByte();
                            short Value = (short)(valA + (valB << 8));
                            TmpData[DataPos++] = Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.INT16 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 2) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 2).ToString("X"));
                            }
                        }
                        break;

                    //INT32
                    case (int)AttributeTypes.UINT32:
                        for (int i = 0; i < DataSize; i++)
                        {
                            byte valA  = reader.ReadByte();
                            byte valB  = reader.ReadByte();
                            byte valC  = reader.ReadByte();
                            byte valD  = reader.ReadByte();
                            uint Value = (uint)(valA + (valB << 8) + (valC << 16) + (valD << 24));
                            TmpData[DataPos++] = (int)Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.UINT32 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 4) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 4).ToString("X"));
                            }
                        }
                        break;

                    case (int)AttributeTypes.INT32:
                        for (int i = 0; i < DataSize; i++)
                        {
                            byte valA  = reader.ReadByte();
                            byte valB  = reader.ReadByte();
                            byte valC  = reader.ReadByte();
                            byte valD  = reader.ReadByte();
                            int  Value = valA + (valB << 8) + (valC << 16) + (valD << 24);
                            TmpData[DataPos++] = Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.INT32 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 4) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 4).ToString("X"));
                            }
                        }
                        break;

                    case (int)AttributeTypes.ENUM:
                        for (int i = 0; i < DataSize; i++)
                        {
                            byte valA  = reader.ReadByte();
                            byte valB  = reader.ReadByte();
                            byte valC  = reader.ReadByte();
                            byte valD  = reader.ReadByte();
                            uint Value = (uint)(valA + (valB << 8) + (valC << 16) + (valD << 24));
                            TmpData[DataPos++] = (int)Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Value: Type:" + AttributeTypes.ENUM + ", " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 4) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 4).ToString("X"));
                            }
                        }
                        break;
                    }
                }
            }
            reader.Close();

            Data = new int[DataPos];

            for (int i = 0; i < DataPos; i++)
            {
                Data[i] = TmpData[i];
            }

            if (Debug)
            {
                Console.WriteLine(filename + " Has " + Data.Length + " Values");
            }
        }
Example #3
0
        public StaticObject(Reader reader, bool PrintDebugInfo = false)
        {
            Debug = PrintDebugInfo;

            int[] TmpData = new int[reader.BaseStream.Length];
            DataPos = 0;
            string filename = System.IO.Path.GetFileName(reader.GetFilename());

            if (!reader.ReadBytes(4).SequenceEqual(MAGIC)) //"OBJ" Header
            {
                throw new Exception("Invalid config file header magic");
            }

            if (Debug)
            {
                Console.WriteLine("Viewing Info for " + filename);
            }

            int MemPos = 0; // I think?

            while (!reader.IsEof)
            {
                int DataType  = reader.ReadByte();
                int ArraySize = reader.ReadInt32();

                if ((DataType & 0x80) != 0)
                {
                    uint DataSize = reader.ReadUInt32();

                    DataType &= 0x7F;

                    ArrayInfo array = new ArrayInfo();
                    array.Type = (byte)DataType;
                    array.Size = (int)DataSize;
                    array.Data = new int[(int)DataSize];

                    switch (DataType)
                    {
                    //INT8
                    case (int)AttributeTypes.UINT8:

                        if (Debug)
                        {
                            Console.WriteLine();
                            Console.WriteLine("Struct Offset: " + MemPos + "(0x" + MemPos.ToString("X") + ")");
                            Console.WriteLine("Array Size: " + DataSize);
                            Console.WriteLine("Array Type: UINT8");
                        }


                        for (int i = 0; i < DataSize; i++)
                        {
                            TmpData[DataPos++] = reader.ReadByte();
                            array.Data[i]      = TmpData[DataPos - 1];
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.UINT8 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 1) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 1).ToString("X"));
                            }
                        }
                        MemPos += ArraySize;
                        break;

                    case (int)AttributeTypes.INT8:

                        if (Debug)
                        {
                            Console.WriteLine();
                            Console.WriteLine("Struct Offset: " + MemPos + "(0x" + MemPos.ToString("X") + ")");
                            Console.WriteLine("Array Size: " + DataSize);
                            Console.WriteLine("Array Type: INT8");
                        }

                        for (int i = 0; i < DataSize; i++)
                        {
                            TmpData[DataPos++] = reader.ReadSByte();
                            array.Data[i]      = TmpData[DataPos - 1];
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Value: Type:" + AttributeTypes.INT8 + ", " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 1) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 1).ToString("X"));
                            }
                        }
                        MemPos += ArraySize;
                        break;

                    //IN16
                    case (int)AttributeTypes.UINT16:
                        int TmpDataOffset = (int)((MemPos & 0xFFFFFFFE) + 2);
                        if ((MemPos & 0xFFFFFFFE) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        if (Debug)
                        {
                            Console.WriteLine();
                            Console.WriteLine("Struct Offset: " + MemPos + "(0x" + MemPos.ToString("X") + ")");
                            Console.WriteLine("Array Size: " + DataSize);
                            Console.WriteLine("Array Type: UINT16");
                        }

                        for (int i = 0; i < DataSize; i++)
                        {
                            byte   valA  = reader.ReadByte();
                            byte   valB  = reader.ReadByte();
                            ushort Value = (ushort)(valA + (valB << 8));
                            TmpData[DataPos++] = Value;
                            array.Data[i]      = Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.UINT16 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 2) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 2).ToString("X"));
                            }
                        }

                        MemPos += 2 * ArraySize;
                        break;

                    case (int)AttributeTypes.INT16:
                        TmpDataOffset = (int)((MemPos & 0xFFFFFFFE) + 2);
                        if ((MemPos & 0xFFFFFFFE) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        if (Debug)
                        {
                            Console.WriteLine();
                            Console.WriteLine("Struct Offset: " + MemPos + "(0x" + MemPos.ToString("X") + ")");
                            Console.WriteLine("Array Size: " + DataSize);
                            Console.WriteLine("Array Type: INT16");
                        }

                        for (int i = 0; i < DataSize; i++)
                        {
                            byte  valA  = reader.ReadByte();
                            byte  valB  = reader.ReadByte();
                            short Value = (short)(valA + (valB << 8));
                            TmpData[DataPos++] = Value;
                            array.Data[i]      = Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.INT16 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 2) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 2).ToString("X"));
                            }
                        }
                        MemPos += 2 * ArraySize;
                        break;

                    //INT32
                    case (int)AttributeTypes.UINT32:
                        TmpDataOffset = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        if (Debug)
                        {
                            Console.WriteLine();
                            Console.WriteLine("Struct Offset: " + MemPos + "(0x" + MemPos.ToString("X") + ")");
                            Console.WriteLine("Array Size: " + DataSize);
                            Console.WriteLine("Array Type: UINT32");
                        }

                        for (int i = 0; i < DataSize; i++)
                        {
                            byte valA  = reader.ReadByte();
                            byte valB  = reader.ReadByte();
                            byte valC  = reader.ReadByte();
                            byte valD  = reader.ReadByte();
                            uint Value = (uint)(valA + (valB << 8) + (valC << 16) + (valD << 24));
                            TmpData[DataPos++] = (int)Value;
                            array.Data[i]      = (int)Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.UINT32 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 4) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 4).ToString("X"));
                            }
                        }
                        MemPos += 4 * ArraySize;
                        break;

                    case (int)AttributeTypes.INT32:
                        TmpDataOffset = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        if (Debug)
                        {
                            Console.WriteLine();
                            Console.WriteLine("Struct Offset: " + MemPos + "(0x" + MemPos.ToString("X") + ")");
                            Console.WriteLine("Array Size: " + DataSize);
                            Console.WriteLine("Array Type: INT32");
                        }

                        for (int i = 0; i < DataSize; i++)
                        {
                            byte valA  = reader.ReadByte();
                            byte valB  = reader.ReadByte();
                            byte valC  = reader.ReadByte();
                            byte valD  = reader.ReadByte();
                            int  Value = valA + (valB << 8) + (valC << 16) + (valD << 24);
                            TmpData[DataPos++] = Value;
                            array.Data[i]      = Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Type:" + AttributeTypes.INT32 + ", Value: " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 4) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 4).ToString("X"));
                            }
                        }
                        MemPos += 4 * ArraySize;
                        break;

                    case (int)AttributeTypes.ENUM:
                        TmpDataOffset = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            TmpDataOffset = MemPos;
                        }
                        MemPos = TmpDataOffset;

                        if (Debug)
                        {
                            Console.WriteLine();
                            Console.WriteLine("Struct Offset: " + MemPos + "(0x" + MemPos.ToString("X") + ")");
                            Console.WriteLine("Array Size: " + DataSize);
                            Console.WriteLine("Array Type: VAR");
                        }

                        for (int i = 0; i < DataSize; i++)
                        {
                            byte valA  = reader.ReadByte();
                            byte valB  = reader.ReadByte();
                            byte valC  = reader.ReadByte();
                            byte valD  = reader.ReadByte();
                            int  Value = (valA + (valB << 8) + (valC << 16) + (valD << 24));
                            TmpData[DataPos++] = (int)Value;
                            array.Data[i]      = Value;
                            if (Debug)
                            {
                                Console.WriteLine("Value Info: Value: Type:" + AttributeTypes.ENUM + ", " + TmpData[DataPos - 1] + ", Value (Hex) 0x" + TmpData[DataPos - 1].ToString("X") + ", Offset: " + (reader.BaseStream.Position - 4) + ", Offset (Hex): 0x" + (reader.BaseStream.Position - 4).ToString("X"));
                            }
                        }
                        MemPos += 4 * ArraySize;
                        break;
                    }
                }
                else
                {
                    int Buffer = 0;
                    switch (DataType)
                    {
                    //INT8
                    case (int)AttributeTypes.UINT8:
                    case (int)AttributeTypes.INT8:
                        MemPos += ArraySize;
                        break;

                    //IN16
                    case (int)AttributeTypes.UINT16:
                    case (int)AttributeTypes.INT16:
                        Buffer = (int)((MemPos & 0xFFFFFFFE) + 2);
                        if ((MemPos & 0xFFFFFFFE) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 2 * ArraySize;
                        break;

                    //INT32
                    case (int)AttributeTypes.UINT32:
                    case (int)AttributeTypes.INT32:
                    case (int)AttributeTypes.ENUM:
                    case (int)AttributeTypes.BOOL:
                        Buffer = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 4 * ArraySize;
                        break;

                    case (int)AttributeTypes.STRING:
                    case (int)AttributeTypes.VECTOR2:
                        Buffer = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 8 * ArraySize;
                        break;

                    case (int)AttributeTypes.VECTOR3:
                        Buffer = (int)((MemPos & 0xFFFFFFFC) + 4);
                        if ((MemPos & 0xFFFFFFFC) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 24 * ArraySize;
                        break;

                    case (int)AttributeTypes.COLOR:
                        Buffer = (int)((MemPos & 0xFFFFFFFE) + 2);
                        if ((MemPos & 0xFFFFFFFE) >= MemPos)
                        {
                            Buffer = MemPos;
                        }
                        MemPos = Buffer + 8 * ArraySize;
                        break;

                    default:
                        break;
                    }
                }
            }
            reader.Close();

            Data = new int[DataPos];

            for (int i = 0; i < DataPos; i++)
            {
                Data[i] = TmpData[i];
            }

            if (Debug)
            {
                Console.WriteLine(filename + " Has " + Data.Length + " Values");
            }
        }
Example #4
0
        public void read(Reader reader)
        {
            if (!reader.readBytes(4).SequenceEqual(signature))
            {
                reader.Close();
                throw new Exception("Invalid Static Object v5 signature");
            }

            int memPos = 0;

            while (!reader.isEof)
            {
                int type      = reader.ReadByte();
                int arraySize = reader.ReadInt32();

                if ((type & 0x80) != 0)
                {
                    uint count = reader.ReadUInt32();

                    type &= 0x7F;

                    ArrayInfo array = new ArrayInfo();
                    array.type       = (byte)type;
                    array.size       = arraySize;
                    array.valueCount = (int)count;
                    array.values     = new int[(int)count];

                    switch (type)
                    {
                    default:
                        Console.WriteLine($"ERROR: Encountered unexpected array type ({type})!");
                        break;

                    //INT8
                    case (int)VariableTypes.UINT8:
                        for (int i = 0; i < count; ++i)
                        {
                            array.values[i] = reader.ReadByte();
                        }
                        memPos += arraySize;
                        break;

                    case (int)VariableTypes.INT8:
                        for (int i = 0; i < count; ++i)
                        {
                            array.values[i] = reader.ReadSByte();
                        }
                        memPos += arraySize;
                        break;

                    //IN16
                    case (int)VariableTypes.UINT16:
                        int tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            array.values[i] = (ushort)(valA + (valB << 8));
                        }

                        memPos += 2 * arraySize;
                        break;

                    case (int)VariableTypes.INT16:
                        tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            array.values[i] = (short)(valA + (valB << 8));
                        }
                        memPos += 2 * arraySize;
                        break;

                    //INT32
                    case (int)VariableTypes.UINT32:
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.values[i] = (int)(uint)(valA + (valB << 8) + (valC << 16) + (valD << 24));
                        }
                        memPos += 4 * arraySize;
                        break;

                    case (int)VariableTypes.INT32:
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.values[i] = valA + (valB << 8) + (valC << 16) + (valD << 24);
                        }
                        memPos += 4 * arraySize;
                        break;

                    case (int)VariableTypes.ENUM:     // bool
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos;

                        for (int i = 0; i < count; ++i)
                        {
                            byte valA = reader.ReadByte();
                            byte valB = reader.ReadByte();
                            byte valC = reader.ReadByte();
                            byte valD = reader.ReadByte();
                            array.values[i] = valA + (valB << 8) + (valC << 16) + (valD << 24);
                        }
                        memPos += 4 * arraySize;
                        break;
                    }
                    arrays.Add(array);
                }
                else
                {
                    ArrayInfo array = new ArrayInfo();
                    array.type       = (byte)type;
                    array.size       = arraySize;
                    array.valueCount = 0;
                    array.values     = new int[0];
                    arrays.Add(array);

                    int tmpMemPos = 0;
                    switch (type)
                    {
                    //INT8
                    case (int)VariableTypes.UINT8:
                    case (int)VariableTypes.INT8:
                        memPos += arraySize;
                        break;

                    //IN16
                    case (int)VariableTypes.UINT16:
                    case (int)VariableTypes.INT16:
                        tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 2 * arraySize;
                        break;

                    //INT32
                    case (int)VariableTypes.UINT32:
                    case (int)VariableTypes.INT32:
                    case 6:     //bool
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 4 * arraySize;
                        break;

                    case 7:     // Pointer
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 4 * arraySize;
                        break;

                    case 8:     // Vector2
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 8 * arraySize;
                        break;

                    case 9:     // Text
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 8 * arraySize;
                        break;

                    case 10:     // Animator
                        tmpMemPos = (int)((memPos & 0xFFFFFFFC) + 4);
                        if ((memPos & 0xFFFFFFFC) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 24 * arraySize;
                        break;

                    case 11:     // Hitbox
                        tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 8 * arraySize;
                        break;

                    case 12:     // Unknown
                        tmpMemPos = (int)((memPos & 0xFFFFFFFE) + 2);
                        if ((memPos & 0xFFFFFFFE) >= memPos)
                        {
                            tmpMemPos = memPos;
                        }
                        memPos = tmpMemPos + 18 * arraySize;
                        break;

                    default:
                        break;
                    }
                }
            }
            reader.Close();
        }