Пример #1
0
        public CVariable CreateVariable(CArray in_array, string type)
        {
            var var = CreateVariable(type);

            in_array.AddVariable(var);
            return(var);
        }
Пример #2
0
        public CHandle CreateHandle(CArray in_array, string type, string handle, string varname = "")
        {
            var var = CreateHandle(type, handle, varname);

            in_array.AddVariable(var);
            return(var);
        }
Пример #3
0
        public CPtr CreatePtr(CArray in_array, CR2WExportWrapper to_chunk, string varname = "")
        {
            var var = CreatePtr("", to_chunk, varname);

            in_array.AddVariable(var);
            return(var);
        }
Пример #4
0
        public CVector CreateVector(CArray in_array, string varname = "")
        {
            var var = CreateVector("", varname);

            in_array.AddVariable(var);
            return(var);
        }
Пример #5
0
        public CPtr CreatePtr(CArray in_array, CR2WChunk to_chunk, string varname = "")
        {
            var ptr = CreatePtr("", to_chunk, varname);

            in_array.AddVariable(ptr);
            return(ptr);
        }
Пример #6
0
        public CSoft CreateSoft(CArray in_array, string type, string handle, string varname = "")
        {
            var soft = CreateSoft(type, handle, varname);

            in_array.AddVariable(soft);
            return(soft);
        }
Пример #7
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            var cnt = file.ReadInt32();

            for (int i = 0; i < cnt; i++)
            {
                CArray group = new CArray(cr2w)
                {
                    Name = "Group - " + i
                };

                CInt16 lod1 = new CInt16(cr2w)
                {
                    Name = "Lod1"
                };
                lod1.val = file.ReadInt16();
                group.AddVariable(lod1);

                CInt16 lod2 = new CInt16(cr2w)
                {
                    Name = "Lod2"
                };
                lod2.val = file.ReadInt16();
                group.AddVariable(lod2);

                CInt16 lod3 = new CInt16(cr2w)
                {
                    Name = "Lod3"
                };
                lod3.val = file.ReadInt16();
                group.AddVariable(lod3);

                CInt32 res = new CInt32(cr2w)
                {
                    Name = "Resolution"
                };
                res.val = file.ReadInt32();
                group.AddVariable(res);

                groups.AddVariable(group);
            }
            var maxres = file.ReadInt32();
        }
        public void Load(string filename)
        {
            using (StreamReader r = new StreamReader(filename))
            {
                string        json     = r.ReadToEnd();
                ReadCSkeleton skeleton = JsonConvert.DeserializeObject <ReadCSkeleton>(json);
                byte[]        data;
                //data = File.ReadAllBytes(@"D:\w3.modding\animation\template.w2rig");
                data = new byte[] { 0x43, 0x52, 0x32, 0x57, 0xA3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0x03, 0x7E, 0x27, 0xDF, 0xE1, 0x03, 0x48, 0xC9, 0x12, 0x00, 0xF3, 0x07, 0x00, 0x00, 0xF3, 0x07, 0x00, 0x00, 0xAF, 0xE7, 0x43, 0x5A, 0x06, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x9B, 0x95, 0xBE, 0x25, 0x98, 0x04, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x53, 0x1D, 0xB7, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x55, 0x4B, 0xBB, 0xEC, 0xC0, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xE6, 0x44, 0x44, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x53, 0x6B, 0x65, 0x6C, 0x65, 0x74, 0x6F, 0x6E, 0x00, 0x62, 0x6F, 0x6E, 0x65, 0x73, 0x00, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3A, 0x32, 0x2C, 0x30, 0x2C, 0x53, 0x53, 0x6B, 0x65, 0x6C, 0x65, 0x74, 0x6F, 0x6E, 0x42, 0x6F, 0x6E, 0x65, 0x00, 0x6E, 0x61, 0x6D, 0x65, 0x00, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x41, 0x6E, 0x73, 0x69, 0x00, 0x6E, 0x61, 0x6D, 0x65, 0x41, 0x73, 0x43, 0x4E, 0x61, 0x6D, 0x65, 0x00, 0x43, 0x4E, 0x61, 0x6D, 0x65, 0x00, 0x52, 0x6F, 0x6F, 0x74, 0x00, 0x54, 0x72, 0x61, 0x6A, 0x65, 0x63, 0x74, 0x6F, 0x72, 0x79, 0x00, 0x70, 0x65, 0x6C, 0x76, 0x69, 0x73, 0x00, 0x74, 0x6F, 0x72, 0x73, 0x6F, 0x00, 0x74, 0x6F, 0x72, 0x73, 0x6F, 0x32, 0x00, 0x74, 0x6F, 0x72, 0x73, 0x6F, 0x33, 0x00, 0x6E, 0x65, 0x63, 0x6B, 0x00, 0x68, 0x65, 0x61, 0x64, 0x00, 0x6C, 0x5F, 0x74, 0x68, 0x69, 0x67, 0x68, 0x00, 0x6C, 0x5F, 0x73, 0x68, 0x69, 0x6E, 0x00, 0x6C, 0x5F, 0x66, 0x6F, 0x6F, 0x74, 0x00, 0x72, 0x5F, 0x74, 0x68, 0x69, 0x67, 0x68, 0x00, 0x72, 0x5F, 0x73, 0x68, 0x69, 0x6E, 0x00, 0x72, 0x5F, 0x66, 0x6F, 0x6F, 0x74, 0x00, 0x6C, 0x5F, 0x73, 0x68, 0x6F, 0x75, 0x6C, 0x64, 0x65, 0x72, 0x00, 0x6C, 0x5F, 0x62, 0x69, 0x63, 0x65, 0x70, 0x00, 0x6C, 0x5F, 0x66, 0x6F, 0x72, 0x65, 0x61, 0x72, 0x6D, 0x00, 0x6C, 0x5F, 0x68, 0x61, 0x6E, 0x64, 0x00, 0x6C, 0x5F, 0x6D, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x31, 0x00, 0x6C, 0x5F, 0x6D, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x32, 0x00, 0x72, 0x5F, 0x73, 0x68, 0x6F, 0x75, 0x6C, 0x64, 0x65, 0x72, 0x00, 0x72, 0x5F, 0x62, 0x69, 0x63, 0x65, 0x70, 0x00, 0x72, 0x5F, 0x66, 0x6F, 0x72, 0x65, 0x61, 0x72, 0x6D, 0x00, 0x72, 0x5F, 0x68, 0x61, 0x6E, 0x64, 0x00, 0x72, 0x5F, 0x6D, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x31, 0x00, 0x72, 0x5F, 0x6D, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x32, 0x00, 0x72, 0x5F, 0x77, 0x65, 0x61, 0x70, 0x6F, 0x6E, 0x00, 0x6C, 0x5F, 0x77, 0x65, 0x61, 0x70, 0x6F, 0x6E, 0x00, 0x72, 0x5F, 0x62, 0x6F, 0x6F, 0x62, 0x00, 0x6C, 0x5F, 0x62, 0x6F, 0x6F, 0x62, 0x00, 0x6C, 0x5F, 0x74, 0x6F, 0x65, 0x00, 0x6C, 0x5F, 0x6C, 0x65, 0x67, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x6C, 0x65, 0x67, 0x52, 0x6F, 0x6C, 0x6C, 0x32, 0x00, 0x6C, 0x5F, 0x6B, 0x6E, 0x65, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x74, 0x6F, 0x65, 0x00, 0x72, 0x5F, 0x6C, 0x65, 0x67, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x6C, 0x65, 0x67, 0x52, 0x6F, 0x6C, 0x6C, 0x32, 0x00, 0x72, 0x5F, 0x6B, 0x6E, 0x65, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x62, 0x69, 0x63, 0x65, 0x70, 0x32, 0x00, 0x6C, 0x5F, 0x73, 0x68, 0x6F, 0x75, 0x6C, 0x64, 0x65, 0x72, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x65, 0x6C, 0x62, 0x6F, 0x77, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x66, 0x6F, 0x72, 0x65, 0x61, 0x72, 0x6D, 0x52, 0x6F, 0x6C, 0x6C, 0x31, 0x00, 0x6C, 0x5F, 0x66, 0x6F, 0x72, 0x65, 0x61, 0x72, 0x6D, 0x52, 0x6F, 0x6C, 0x6C, 0x32, 0x00, 0x6C, 0x5F, 0x68, 0x61, 0x6E, 0x64, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x62, 0x69, 0x63, 0x65, 0x70, 0x32, 0x00, 0x72, 0x5F, 0x65, 0x6C, 0x62, 0x6F, 0x77, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x66, 0x6F, 0x72, 0x65, 0x61, 0x72, 0x6D, 0x52, 0x6F, 0x6C, 0x6C, 0x31, 0x00, 0x72, 0x5F, 0x66, 0x6F, 0x72, 0x65, 0x61, 0x72, 0x6D, 0x52, 0x6F, 0x6C, 0x6C, 0x32, 0x00, 0x72, 0x5F, 0x68, 0x61, 0x6E, 0x64, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x73, 0x68, 0x6F, 0x75, 0x6C, 0x64, 0x65, 0x72, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x68, 0x72, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x31, 0x00, 0x6C, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x32, 0x00, 0x6C, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x33, 0x00, 0x6C, 0x5F, 0x6D, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x33, 0x00, 0x6C, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x30, 0x00, 0x6C, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x31, 0x00, 0x6C, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x32, 0x00, 0x6C, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x33, 0x00, 0x6C, 0x5F, 0x72, 0x69, 0x6E, 0x67, 0x31, 0x00, 0x6C, 0x5F, 0x72, 0x69, 0x6E, 0x67, 0x32, 0x00, 0x6C, 0x5F, 0x72, 0x69, 0x6E, 0x67, 0x33, 0x00, 0x6C, 0x5F, 0x74, 0x68, 0x75, 0x6D, 0x62, 0x31, 0x00, 0x6C, 0x5F, 0x74, 0x68, 0x75, 0x6D, 0x62, 0x32, 0x00, 0x6C, 0x5F, 0x74, 0x68, 0x75, 0x6D, 0x62, 0x33, 0x00, 0x72, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x31, 0x00, 0x72, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x32, 0x00, 0x72, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x33, 0x00, 0x72, 0x5F, 0x6D, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x33, 0x00, 0x72, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x30, 0x00, 0x72, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x31, 0x00, 0x72, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x32, 0x00, 0x72, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x33, 0x00, 0x72, 0x5F, 0x72, 0x69, 0x6E, 0x67, 0x31, 0x00, 0x72, 0x5F, 0x72, 0x69, 0x6E, 0x67, 0x32, 0x00, 0x72, 0x5F, 0x72, 0x69, 0x6E, 0x67, 0x33, 0x00, 0x72, 0x5F, 0x74, 0x68, 0x75, 0x6D, 0x62, 0x31, 0x00, 0x72, 0x5F, 0x74, 0x68, 0x75, 0x6D, 0x62, 0x32, 0x00, 0x72, 0x5F, 0x74, 0x68, 0x75, 0x6D, 0x62, 0x33, 0x00, 0x6C, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x5F, 0x6B, 0x6E, 0x75, 0x63, 0x6B, 0x6C, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x6D, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x5F, 0x6B, 0x6E, 0x75, 0x63, 0x6B, 0x6C, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x5F, 0x6B, 0x6E, 0x75, 0x63, 0x6B, 0x6C, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x72, 0x69, 0x6E, 0x67, 0x5F, 0x6B, 0x6E, 0x75, 0x63, 0x6B, 0x6C, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x6C, 0x5F, 0x74, 0x68, 0x75, 0x6D, 0x62, 0x5F, 0x72, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x5F, 0x6B, 0x6E, 0x75, 0x63, 0x6B, 0x6C, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x6D, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x5F, 0x6B, 0x6E, 0x75, 0x63, 0x6B, 0x6C, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x70, 0x69, 0x6E, 0x6B, 0x79, 0x5F, 0x6B, 0x6E, 0x75, 0x63, 0x6B, 0x6C, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x72, 0x69, 0x6E, 0x67, 0x5F, 0x6B, 0x6E, 0x75, 0x63, 0x6B, 0x6C, 0x65, 0x52, 0x6F, 0x6C, 0x6C, 0x00, 0x72, 0x5F, 0x74, 0x68, 0x75, 0x6D, 0x62, 0x5F, 0x72, 0x6F, 0x6C, 0x6C, 0x00, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x49, 0x6E, 0x64, 0x69, 0x63, 0x65, 0x73, 0x00, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3A, 0x32, 0x2C, 0x30, 0x2C, 0x49, 0x6E, 0x74, 0x31, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA3, 0x3D, 0x4F, 0x72, 0x0B, 0x00, 0x00, 0x00, 0x5C, 0xC8, 0x16, 0x46, 0x11, 0x00, 0x00, 0x00, 0x12, 0x05, 0x4C, 0xD0, 0x29, 0x00, 0x00, 0x00, 0x12, 0xF1, 0xE5, 0x37, 0x2E, 0x00, 0x00, 0x00, 0x45, 0x91, 0x58, 0x83, 0x39, 0x00, 0x00, 0x00, 0x08, 0xF8, 0xB3, 0x89, 0x45, 0x00, 0x00, 0x00, 0xDB, 0x5B, 0x10, 0xF1, 0x4B, 0x00, 0x00, 0x00, 0xFF, 0x4C, 0x19, 0x19, 0x50, 0x00, 0x00, 0x00, 0x68, 0x17, 0x16, 0x22, 0x5B, 0x00, 0x00, 0x00, 0x58, 0xB4, 0xEA, 0xE4, 0x62, 0x00, 0x00, 0x00, 0x8C, 0x3D, 0xF7, 0x70, 0x68, 0x00, 0x00, 0x00, 0xE6, 0xCB, 0xB1, 0xCD, 0x6F, 0x00, 0x00, 0x00, 0x4F, 0x46, 0xB4, 0xF3, 0x76, 0x00, 0x00, 0x00, 0x56, 0x37, 0x87, 0xAB, 0x7B, 0x00, 0x00, 0x00, 0xF9, 0x43, 0xC2, 0x1E, 0x80, 0x00, 0x00, 0x00, 0x5C, 0x06, 0x02, 0x17, 0x88, 0x00, 0x00, 0x00, 0x7C, 0xD6, 0x63, 0xA7, 0x8F, 0x00, 0x00, 0x00, 0x80, 0x8A, 0x61, 0xDC, 0x96, 0x00, 0x00, 0x00, 0xFA, 0x3D, 0x98, 0x2E, 0x9E, 0x00, 0x00, 0x00, 0x12, 0x30, 0x83, 0x19, 0xA5, 0x00, 0x00, 0x00, 0x5A, 0x05, 0x0D, 0x97, 0xAC, 0x00, 0x00, 0x00, 0x34, 0xDB, 0x99, 0x55, 0xB7, 0x00, 0x00, 0x00, 0x99, 0xDE, 0x3E, 0x67, 0xBF, 0x00, 0x00, 0x00, 0x1C, 0x6B, 0xC0, 0x1F, 0xC9, 0x00, 0x00, 0x00, 0x67, 0x43, 0x5E, 0xB6, 0xD0, 0x00, 0x00, 0x00, 0x98, 0x4D, 0x0D, 0xD0, 0xDA, 0x00, 0x00, 0x00, 0xD3, 0xBC, 0x14, 0x42, 0xE4, 0x00, 0x00, 0x00, 0x4E, 0x5C, 0x7A, 0x07, 0xEF, 0x00, 0x00, 0x00, 0x93, 0x6E, 0x3D, 0x01, 0xF7, 0x00, 0x00, 0x00, 0x7E, 0xD8, 0x5B, 0x20, 0x01, 0x01, 0x00, 0x00, 0xB9, 0x77, 0xFF, 0x5C, 0x08, 0x01, 0x00, 0x00, 0xDA, 0x78, 0xB2, 0x29, 0x12, 0x01, 0x00, 0x00, 0x71, 0xFE, 0xAF, 0x03, 0x1C, 0x01, 0x00, 0x00, 0xAA, 0x2A, 0xBA, 0x51, 0x25, 0x01, 0x00, 0x00, 0xE0, 0x11, 0x62, 0x2C, 0x2E, 0x01, 0x00, 0x00, 0x68, 0xE6, 0x48, 0xDF, 0x35, 0x01, 0x00, 0x00, 0x92, 0xA9, 0x6D, 0x35, 0x3C, 0x01, 0x00, 0x00, 0x70, 0x3A, 0xFB, 0x34, 0x42, 0x01, 0x00, 0x00, 0x99, 0x1E, 0x77, 0x76, 0x4C, 0x01, 0x00, 0x00, 0x79, 0x8F, 0x58, 0x6A, 0x57, 0x01, 0x00, 0x00, 0xBC, 0x99, 0xE7, 0x41, 0x62, 0x01, 0x00, 0x00, 0xD6, 0xE4, 0x6D, 0x5D, 0x68, 0x01, 0x00, 0x00, 0x3F, 0x2C, 0x76, 0xD3, 0x72, 0x01, 0x00, 0x00, 0x6F, 0xF5, 0xE4, 0x0D, 0x7D, 0x01, 0x00, 0x00, 0xDA, 0x1C, 0xD7, 0x02, 0x88, 0x01, 0x00, 0x00, 0x79, 0xCF, 0xCB, 0x74, 0x91, 0x01, 0x00, 0x00, 0xAD, 0x93, 0xAC, 0x28, 0xA0, 0x01, 0x00, 0x00, 0x4C, 0x13, 0x93, 0x6E, 0xAC, 0x01, 0x00, 0x00, 0x86, 0x96, 0x0B, 0x8E, 0xBB, 0x01, 0x00, 0x00, 0x1D, 0x1C, 0x09, 0x68, 0xCA, 0x01, 0x00, 0x00, 0xD2, 0xD2, 0x51, 0x88, 0xD5, 0x01, 0x00, 0x00, 0xEB, 0xF9, 0x30, 0xF3, 0xDE, 0x01, 0x00, 0x00, 0x2A, 0x97, 0x99, 0x18, 0xEA, 0x01, 0x00, 0x00, 0x94, 0x96, 0xA1, 0x74, 0xF9, 0x01, 0x00, 0x00, 0xCF, 0x05, 0xA9, 0xE6, 0x08, 0x02, 0x00, 0x00, 0x74, 0xA2, 0xBA, 0x92, 0x13, 0x02, 0x00, 0x00, 0x8F, 0x35, 0x68, 0x4D, 0x22, 0x02, 0x00, 0x00, 0xB8, 0x70, 0xF1, 0x92, 0x28, 0x02, 0x00, 0x00, 0xD1, 0x34, 0x96, 0x93, 0x31, 0x02, 0x00, 0x00, 0x3A, 0xAF, 0x98, 0xB9, 0x3A, 0x02, 0x00, 0x00, 0xA3, 0x29, 0x9B, 0xDF, 0x43, 0x02, 0x00, 0x00, 0x6A, 0x42, 0x12, 0x1C, 0x4D, 0x02, 0x00, 0x00, 0x33, 0x2A, 0x09, 0x01, 0x56, 0x02, 0x00, 0x00, 0xCA, 0xAF, 0x06, 0xDB, 0x5F, 0x02, 0x00, 0x00, 0x61, 0x35, 0x04, 0xB5, 0x68, 0x02, 0x00, 0x00, 0xF8, 0xBA, 0x01, 0x8F, 0x71, 0x02, 0x00, 0x00, 0xDF, 0x39, 0x62, 0x28, 0x79, 0x02, 0x00, 0x00, 0xA4, 0xCA, 0x5A, 0xB6, 0x81, 0x02, 0x00, 0x00, 0x0D, 0x45, 0x5D, 0xDC, 0x89, 0x02, 0x00, 0x00, 0x35, 0x6F, 0x80, 0x4A, 0x92, 0x02, 0x00, 0x00, 0x9E, 0xE9, 0x82, 0x70, 0x9B, 0x02, 0x00, 0x00, 0x07, 0x64, 0x85, 0x96, 0xA4, 0x02, 0x00, 0x00, 0x8B, 0xB1, 0xC3, 0x06, 0xAD, 0x02, 0x00, 0x00, 0x50, 0x42, 0xBC, 0x94, 0xB6, 0x02, 0x00, 0x00, 0xB9, 0xBC, 0xBE, 0xBA, 0xBF, 0x02, 0x00, 0x00, 0x08, 0x84, 0xAD, 0xDD, 0xC9, 0x02, 0x00, 0x00, 0xD1, 0xA5, 0x23, 0x7D, 0xD2, 0x02, 0x00, 0x00, 0x68, 0x2B, 0x21, 0x57, 0xDB, 0x02, 0x00, 0x00, 0xA3, 0x9A, 0x28, 0xC9, 0xE4, 0x02, 0x00, 0x00, 0x3A, 0x20, 0x26, 0xA3, 0xED, 0x02, 0x00, 0x00, 0xCD, 0x55, 0x75, 0xEC, 0xF5, 0x02, 0x00, 0x00, 0x36, 0xD0, 0x77, 0x12, 0xFD, 0x02, 0x00, 0x00, 0x9F, 0x4A, 0x7A, 0x38, 0x05, 0x03, 0x00, 0x00, 0x07, 0x21, 0xFA, 0x1A, 0x0E, 0x03, 0x00, 0x00, 0xCC, 0xB1, 0xF2, 0xA8, 0x17, 0x03, 0x00, 0x00, 0x35, 0x2C, 0xF5, 0xCE, 0x20, 0x03, 0x00, 0x00, 0xC3, 0x5A, 0x68, 0xBE, 0x34, 0x03, 0x00, 0x00, 0xC8, 0x88, 0x77, 0xE7, 0x49, 0x03, 0x00, 0x00, 0xC2, 0x29, 0xBC, 0xF3, 0x5D, 0x03, 0x00, 0x00, 0x99, 0x21, 0x83, 0xC3, 0x70, 0x03, 0x00, 0x00, 0x1E, 0x14, 0x9D, 0x0A, 0x7D, 0x03, 0x00, 0x00, 0x6D, 0xE8, 0x69, 0xE3, 0x91, 0x03, 0x00, 0x00, 0xB2, 0xAD, 0x7F, 0xE1, 0xA6, 0x03, 0x00, 0x00, 0xF8, 0x21, 0x90, 0x38, 0xBA, 0x03, 0x00, 0x00, 0xA7, 0x0F, 0xB6, 0x12, 0xCD, 0x03, 0x00, 0x00, 0xE4, 0x1B, 0x18, 0x6E, 0xDA, 0x03, 0x00, 0x00, 0x7E, 0x22, 0x4E, 0x6E, 0xE8, 0x03, 0x00, 0x00, 0xA4, 0xBB, 0xE3, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0xD8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x65, 0xB5, 0xDE, 0x00, 0x02, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x62, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                using (MemoryStream ms = new MemoryStream(data))
                    using (BinaryReader br = new BinaryReader(ms))
                    {
                        W2RigFile = new CR2WFile();
                        w2rigFile.Read(br);
                        CSkeleton skel = W2RigFile.Chunks[0].data as CSkeleton;

                        CArray <SSkeletonBone> bonesorig = skel.Bones;
                        for (int i = 0; i < skeleton.names.Count; i++)
                        {
                            SSkeletonBone newBone = new SSkeletonBone(W2RigFile, bonesorig, "");
                            newBone.Name = new StringAnsi(w2rigFile, newBone, "name").SetValue(skeleton.names[i] + "\0") as StringAnsi;

                            newBone.NameAsCName = new CName(W2RigFile, newBone, "nameAsCName").SetValue(skeleton.names[i]) as CName;

                            bonesorig.AddVariable(newBone);

                            skel.ParentIndices.AddVariable(new CInt16(W2RigFile, skel.ParentIndices, "").SetValue(skeleton.parentIdx[i]));
                        }

                        using (var stream = new MemoryStream())
                        {
                            using (var bw = new BinaryWriter(stream))
                            {
                                for (int i = 0; i < skeleton.nbBones; i++)
                                {
                                    bw.Write(skeleton.positions[i].X);
                                    bw.Write(skeleton.positions[i].Y);
                                    bw.Write(skeleton.positions[i].Z);
                                    bw.Write(1f); // the w component
                                    bw.Write(-skeleton.rotations[i].X);
                                    bw.Write(-skeleton.rotations[i].Y);
                                    bw.Write(-skeleton.rotations[i].Z);
                                    bw.Write(skeleton.rotations[i].W);
                                    bw.Write(skeleton.scales[i].X);
                                    bw.Write(skeleton.scales[i].Y);
                                    bw.Write(skeleton.scales[i].Z);
                                    bw.Write(1f); // the w component
                                }
                            }
                            W2RigFile.Chunks[0].unknownBytes.SetValue(stream.ToArray());
                            //saveToFile();
                        }
                    }
            }
        }
Пример #9
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);
            var cnt = file.ReadVLQInt32();

            for (int i = 0; i < cnt; i++)
            {
                //This is actually a byte-byte pair but no idea why or how anyone would edit this
                var mapping = new CUInt16(cr2w);
                mapping.Read(file, size);
                unicodemapping.AddVariable(mapping);
            }
            linedist.Read(file, size);
            maxglyphheight.Read(file, size);
            kerning.Read(file, size);

            var num = file.ReadVLQInt32();

            for (int i = 0; i < num; i++)
            {
                CArray glyph = new CArray(cr2w)
                {
                    Name = "Glyph - " + i
                };
                // UVs
                CFloat uv00 = new CFloat(cr2w)
                {
                    Name = "UV[0][0]"
                };
                uv00.Read(file, size);
                glyph.AddVariable(uv00);
                CFloat uv01 = new CFloat(cr2w)
                {
                    Name = "UV[0][1]"
                };
                uv01.Read(file, size);
                glyph.AddVariable(uv01);
                CFloat uv10 = new CFloat(cr2w)
                {
                    Name = "UV[1][0]"
                };
                uv10.Read(file, size);
                glyph.AddVariable(uv10);
                CFloat uv11 = new CFloat(cr2w)
                {
                    Name = "UV[1][1]"
                };
                uv11.Read(file, size);
                glyph.AddVariable(uv11);

                CInt32 textureindex = new CInt32(cr2w)
                {
                    Name = "Texture index"
                };
                textureindex.Read(file, size);
                glyph.AddVariable(textureindex);
                CInt32 width = new CInt32(cr2w)
                {
                    Name = "Width"
                };
                width.Read(file, size);
                glyph.AddVariable(width);
                CInt32 height = new CInt32(cr2w)
                {
                    Name = "Height"
                };
                height.Read(file, size);
                glyph.AddVariable(height);
                CInt32 advance_x = new CInt32(cr2w)
                {
                    Name = "Advance X"
                };
                advance_x.Read(file, size);
                glyph.AddVariable(advance_x);
                CInt32 bearing_x = new CInt32(cr2w)
                {
                    Name = "Bearing X"
                };
                bearing_x.Read(file, size);
                glyph.AddVariable(bearing_x);
                CInt32 bearing_y = new CInt32(cr2w)
                {
                    Name = "Bearing Y"
                };
                bearing_y.Read(file, size);
                glyph.AddVariable(bearing_y);

                glyphs.AddVariable(glyph);
            }
        }