public void Serialize(NetBitReader reader) { reader.ReadBits(2); //Unknown Id = new NetworkGUID { Value = reader.ReadIntPacked() }; reader.ReadBits(31); //Unknown }
public void Serialize(NetBitReader reader) { _reader = new NetBitReader(reader.ReadBits(reader.GetBitsLeft())); _reader.EngineNetworkVersion = reader.EngineNetworkVersion; TotalBits = _reader.GetBitsLeft(); }
private object[] AsArray() { _reader.Reset(); uint totalElements = _reader.ReadIntPacked(); object[] data = new object[totalElements]; while (true) { uint index = _reader.ReadIntPacked(); if (index == 0) { if (_reader.GetBitsLeft() == 8) { uint terminator = _reader.ReadIntPacked(); if (terminator != 0x00) { //Log error return(null); } } if (_reader.IsError || !_reader.AtEnd()) { return(null); } return(data); } --index; if (index >= totalElements) { return(null); } List <DebuggingHandle> handles = new List <DebuggingHandle>(); bool isExportHandles = false; while (true) { DebuggingHandle debuggingHandle = new DebuggingHandle(); uint handle = _reader.ReadIntPacked(); debuggingHandle.Handle = handle; if (handle == 0) { break; } --handle; uint numBits = _reader.ReadIntPacked(); debuggingHandle.NumBits = numBits; DebuggingObject obj = new DebuggingObject(); NetBitReader tempReader = new NetBitReader(_reader.ReadBits(numBits)); tempReader.EngineNetworkVersion = _reader.EngineNetworkVersion; obj.Serialize(tempReader); data[index] = obj; handles.Add(debuggingHandle); } //Assume it's an export handle if (handles.Count > 0) { data[index] = handles; } } }
/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/c10022aa46e208b1593dd537c2607784aac158f1/Engine/Source/Runtime/Engine/Private/Collision/Collision.cpp#L42 /// </summary> /// <param name="reader"></param> public void Serialize(NetBitReader reader) { // pack bitfield with flags var flags = reader.ReadBits(7); // Most of the time the vectors are the same values, use that as an optimization BlockingHit = flags[0]; StartPenetrating = flags[1]; bool bImpactPointEqualsLocation = flags[2]; bool bImpactNormalEqualsNormal = flags[3]; // Often times the indexes are invalid, use that as an optimization bool bInvalidItem = flags[4]; bool bInvalidFaceIndex = flags[5]; bool bNoPenetrationDepth = flags[6]; Time = reader.ReadSingle(); Location = reader.ReadPackedVector(1, 20); Normal = reader.SerializePropertyVectorNormal(); if (!bImpactPointEqualsLocation) { ImpactPoint = reader.ReadPackedVector(1, 20); } else { ImpactPoint = Location; } if (!bImpactNormalEqualsNormal) { ImpactNormal = reader.SerializePropertyVectorNormal(); } else { ImpactNormal = Normal; } TraceStart = reader.ReadPackedVector(1, 20); TraceEnd = reader.ReadPackedVector(1, 20); if (!bNoPenetrationDepth) { PenetrationDepth = reader.SerializePropertyFloat(); } else { PenetrationDepth = 0.0f; } Distance = (ImpactPoint - TraceStart).Size(); if (!bInvalidItem) { Item = reader.ReadInt32(); } else { Item = 0; } PhysMaterial = reader.SerializePropertyObject(); Actor = reader.SerializePropertyObject(); Component = reader.SerializePropertyObject(); BoneName = reader.SerializePropertyName(); if (!bInvalidFaceIndex) { FaceIndex = reader.ReadInt32(); } else { FaceIndex = 0; } }
public void Serialize(NetBitReader reader) { return; bool[] flags = reader.ReadBits(7); BlockingHit = flags[6]; StartPenetrating = flags[5]; bool impactPointEqualsLocation = flags[4]; bool impactNormalEqualsNormal = flags[3]; bool invalidItem = flags[2]; bool invalidFaceIndex = flags[1]; bool noPenetrationDepth = flags[0]; Time = reader.ReadSingle(); Location = reader.SerializePropertyQuantizeVector(); Normal = reader.SerializePropertyVectorNormal(); if (!impactPointEqualsLocation) { ImpactPoint = reader.SerializePropertyQuantizeVector(); } else { ImpactPoint = Location; } if (!impactNormalEqualsNormal) { ImpactNormal = reader.SerializePropertyVectorNormal(); } else { ImpactNormal = Normal; } TraceStart = reader.SerializePropertyQuantizeVector(); TraceEnd = reader.SerializePropertyQuantizeVector(); if (!noPenetrationDepth) { PenetrationDepth = reader.SerializePropertyFloat(); } else { PenetrationDepth = 0; } Distance = (ImpactPoint - TraceStart).Size(); if (!invalidItem) { Item = reader.ReadBitsToInt(32); } else { Item = -1; } PhysMaterial = reader.SerializePropertyUInt16(); Actor = reader.SerializePropertyUInt16(); Component = reader.SerializePropertyUInt16(); BoneName = reader.ReadFString(); if (!invalidFaceIndex) { FaceIndex = reader.ReadBitsToInt(32); } else { FaceIndex = -1; } }
private DebuggingObject[] AsArray() { _reader.Reset(); uint totalElements = _reader.ReadIntPacked(); DebuggingObject[] data = new DebuggingObject[totalElements]; while (true) { uint index = _reader.ReadIntPacked(); if (index == 0) { if (index == 0) { if (_reader.GetBitsLeft() == 8) { uint terminator = _reader.ReadIntPacked(); if (terminator != 0x00) { //Log error return(null); } } if (_reader.IsError || !_reader.AtEnd()) { return(null); } return(data); } } --index; if (index >= totalElements) { return(null); } while (true) { uint handle = _reader.ReadIntPacked(); if (handle == 0) { break; } --handle; uint numBits = _reader.ReadIntPacked(); DebuggingObject obj = new DebuggingObject(); NetBitReader tempReader = new NetBitReader(_reader.ReadBits(numBits)); tempReader.EngineNetworkVersion = _reader.EngineNetworkVersion; obj.Serialize(tempReader); data[index] = obj; } } }