コード例 #1
0
        public static void Unpack(string path)
        {
            Debug.WriteLine(path);

            using (var reader = new BinaryReader(File.OpenRead(path)))
            {
                var count   = reader.ReadInt32();
                var unknown = reader.ReadInt32();
                var length  = reader.ReadInt32();

                var list = new List <SlotSubItem>();

                while (true)
                {
                    var key   = reader.ReadUInt32();
                    var value = reader.ReadUInt32();


                    if (list.Count > 0)
                    {
                        if (list.Last().Offset > value)
                        {
                        }
                        var itemLength = value - list[list.Count - 1].Offset;

                        list[list.Count - 1].Length = itemLength;
                    }
                    if (key == 0x7F000000)
                    {
                        break;
                    }

                    var item = new SlotSubItem {
                        Key = key, Offset = value
                    };
                    var extension = ExtensionUtility.GetExtension((byte)(key >> 24));
                    if (extension == EntityExtensions.Unknown)
                    {
                    }
                    item.Extension = extension;
                    list.Add(item);
                }

                SerializationHelper.Save(list, path + ".xml");

                var prefix = path.RemoveExtension(1);

                foreach (var item in list)
                {
                    reader.BaseStream.Position = item.Offset + 0x800;
                    var data = reader.ReadBytes((int)item.Length);

                    var output = string.Format("{0}_{1:X6}.{2}", prefix, item.Key & 0xFFFFFF, item.Extension);

                    Debug.WriteLine("- " + Path.GetFileName(output));
                    File.WriteAllBytes(output, data);
                }
            }
        }
コード例 #2
0
        private static EntityExtensions ResolveExtension(int hash1, int hash2)
        {
            var hash = hash2;

            if (hash1 != 0)
            {
                var temp = (hash1 >> 4) ^ (hash1 << 4);
                temp ^= 0x10EA;
                temp  = ~temp;

                hash = temp ^ hash2;
            }

            return(ExtensionUtility.GetExtension((byte)(hash >> 24)));
        }