bool IResource._Load(string file, AccessLevel al, GameType type)
        {
            if (type == GameType.Bloodborne)
            {
                Hkx = HKX.Read(file, HKX.HKXVariation.HKXBloodBorne);
            }
            else if (type == GameType.DarkSoulsIII)
            {
                DCX.Type t;
                var      decomp = DCX.Decompress(file, out t);
                var      br     = new BinaryReaderEx(false, decomp);
                var      des    = new HKX2.PackFileDeserializer();
                Hkx2 = (hkRootLevelContainer)des.Deserialize(br);
            }
            else
            {
                Hkx = HKX.Read(file);
            }

            if (type == GameType.DarkSoulsIISOTFS || type == GameType.DarkSoulsIII || type == GameType.Bloodborne)
            {
                FrontFace = FrontFace.Clockwise;
            }
            else
            {
                FrontFace = FrontFace.CounterClockwise;
            }

            if (type == GameType.DarkSoulsIII)
            {
                return(LoadInternalNew(al));
            }
            return(LoadInternal(al));
        }
Beispiel #2
0
        bool IResource._Load(byte[] bytes, AccessLevel al, GameType type)
        {
            BinaryReaderEx br  = new BinaryReaderEx(false, bytes);
            var            des = new HKX2.PackFileDeserializer();

            HkxRoot = (hkRootLevelContainer)des.Deserialize(br);
            return(LoadInternal(al));
        }
Beispiel #3
0
 bool IResource._Load(string file, AccessLevel al, GameType type)
 {
     using (var s = File.OpenRead(file))
     {
         var des = new HKX2.PackFileDeserializer();
         HkxRoot = (hkRootLevelContainer)des.Deserialize(new BinaryReaderEx(false, s));
     }
     return(LoadInternal(al));
 }
Beispiel #4
0
        static void Main(string[] args)
        {
            var hkxpath = args[0];

            using (FileStream stream = File.OpenRead(hkxpath))
            {
                BinaryReaderEx br   = new BinaryReaderEx(false, stream);
                var            des  = new HKX2.PackFileDeserializer();
                var            root = (hkRootLevelContainer)des.Deserialize(br);

                // Strip some stuff

                /*var v = (hknpPhysicsSceneData)root.m_namedVariants[0].m_variant;
                 * foreach (fsnpCustomParamCompressedMeshShape s in v.m_systemDatas[0].m_referencedObjects)
                 * {
                 *  var bvh = s.m_data.getMeshBVH();
                 *  s.m_triangleIndexToShapeKey = null;
                 *  s.m_pParam = null;
                 *  s.m_edgeWeldingMap.m_primaryKeyToIndex = null;
                 *  s.m_edgeWeldingMap.m_secondaryKeyMask = 0;
                 *  s.m_edgeWeldingMap.m_sencondaryKeyBits = 0;
                 *  s.m_edgeWeldingMap.m_valueAndSecondaryKeys = null;
                 *  s.m_quadIsFlat.m_storage.m_numBits = 0;
                 *  s.m_quadIsFlat.m_storage.m_words = null;
                 *  s.m_triangleIsInterior.m_storage.m_numBits = 0;
                 *  s.m_triangleIsInterior.m_storage.m_words = null;
                 *  s.m_numShapeKeyBits = 0;
                 *  s.m_data.m_meshTree.m_bitsPerKey = 0;
                 *  s.m_data.m_meshTree.m_maxKeyValue = 0;
                 *  s.m_data.m_meshTree.m_bitsPerKey = 0;
                 *  s.m_data.m_meshTree.m_numPrimitiveKeys = 0;
                 *  s.m_data.m_meshTree.m_domain.m_min.W = 1.0f;
                 *  s.m_data.m_meshTree.m_domain.m_max.W = 1.0f;
                 *  s.m_data.m_simdTree.m_nodes = null;
                 *  foreach (var sec in s.m_data.m_meshTree.m_sections)
                 *  {
                 *      sec.m_leafIndex = 0;
                 *      sec.m_flags = 0;
                 *      var sbvh = sec.getSectionBVH();
                 *  }
                 * }*/

                using (FileStream s2 = File.Create(args[1]))
                {
                    BinaryWriterEx bw = new BinaryWriterEx(false, s2);
                    var            s  = new HKX2.PackFileSerializer();
                    s.Serialize(root, bw);
                }
            }
        }
Beispiel #5
0
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_desiredSpeed = br.ReadSingle();
     m_maximumSpeed = br.ReadSingle();
 }
Beispiel #6
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_material = new hknpMaterial();
     m_material.Read(des, br);
 }
Beispiel #7
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_characterId = br.ReadUInt64();
 }
Beispiel #8
0
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_index      = br.ReadByte();
     m_offset     = br.ReadByte();
     m_conversion = (VectorConversion)br.ReadByte();
 }
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_localPNs         = des.ReadClassArray <hclBoneSpaceDeformerLocalBlockPN>(br);
     m_localUnpackedPNs = des.ReadClassArray <hclBoneSpaceDeformerLocalBlockUnpackedPN>(br);
 }
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_links = des.ReadClassArray <hclStandardLinkConstraintSetLink>(br);
 }
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_entities = des.ReadClassPointerArray <hkpEntity>(br);
 }
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     // Read TYPE_SIMPLEARRAY
 }
Beispiel #13
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_springConstant = br.ReadSingle();
     m_springDamping  = br.ReadSingle();
 }
Beispiel #14
0
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_name = des.ReadStringPointer(br);
     m_type = (VertexChannelType)br.ReadUInt32();
     br.ReadUInt32();
 }
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_start = des.ReadVector4(br);
     m_end   = des.ReadVector4(br);
 }
Beispiel #16
0
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_elements  = des.ReadClassArray <hknpMaterial>(br);
     m_firstFree = br.ReadInt32();
     br.ReadUInt32();
 }
Beispiel #17
0
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_time  = br.ReadSingle();
     m_value = br.ReadInt32();
 }
Beispiel #18
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_bindings = des.ReadClassPointerArray <hkpDisplayBindingDataRigidBody>(br);
     m_system   = des.ReadClassPointer <hkpPhysicsSystem>(br);
 }
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_groundPosition = des.ReadVector4(br);
     br.ReadUInt64();
     br.ReadUInt64();
 }
Beispiel #20
0
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_storage = new hkOffsetBitFieldStoragehkArrayunsignedinthkContainerHeapAllocator();
     m_storage.Read(des, br);
 }
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_rb = des.ReadClassPointer <hkpRigidBody>(br);
     br.ReadUInt64();
     m_localToDisplay = des.ReadTransform(br);
 }
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_texture       = des.ReadClassPointer <hkReferencedObject>(br);
     m_usageHint     = (TextureType)br.ReadInt32();
     m_tcoordChannel = br.ReadInt32();
 }
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
 }
Beispiel #24
0
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_name  = des.ReadStringPointer(br);
     m_value = des.ReadClassPointer <hkReferencedObject>(br);
 }
Beispiel #25
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_data = des.ReadStringPointer(br);
 }
 public virtual void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     m_key   = br.ReadUInt32();
     m_value = br.ReadUInt32();
 }
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_hiData = br.ReadByte();
     m_loData = br.ReadUInt16();
 }
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_data = br.ReadInt32();
     br.ReadUInt32();
 }
Beispiel #29
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_previewInfo = des.ReadClassPointerArray <hkaFootstepAnalysisInfo>(br);
 }
Beispiel #30
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_internalExpressionsData = des.ReadClassArray <hkbEvaluateExpressionModifierInternalExpressionData>(br);
 }