Example #1
0
        /// <summary>
        /// https://github.com/EpicGames/UnrealEngine/blob/70bc980c6361d9a7d23f6d23ffe322a2d6ef16fb/Engine/Source/Runtime/Engine/Private/PackageMapClient.cpp#L1579
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public virtual bool ParseNetExportGUIDs(ChunkArchive reader)
        {
            uint guidCount = reader.ReadIntPacked();

            for (int i = 0; i < guidCount; i++)
            {
                reader.ReadBytes(reader.ReadInt32());  //burn.
            }
            return(true);
        }
Example #2
0
 /// <summary>
 /// https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp#L2106
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 public virtual bool ParseExternalData(ChunkArchive reader)
 {
     while (true)
     {
         uint externalDataBitsCount = reader.ReadIntPacked();
         if (externalDataBitsCount == 0)
         {
             return(true);
         }
         uint netGuid = reader.ReadIntPacked();
         reader.ReadBytes((int)(externalDataBitsCount + 7) >> 3);  //TODO: We dont do anything with it yet. We burn byte now.
     }
 }
Example #3
0
        public virtual int ParsePacket(ChunkArchive reader)
        {
            const int MaxBufferSize = 2 * 1024;
            int       outBufferSize = reader.ReadInt32();

            if (outBufferSize > MaxBufferSize || outBufferSize < 0)
            {
                throw new InvalidDataException("Invalid packet size");
            }
            if (outBufferSize == 0)
            {
                return(outBufferSize);
            }
            var outBuffer = reader.ReadBytes(outBufferSize);

            ProcessRawPacket(new BitReader(outBuffer.ToArray()));     //TODO avoid array alloc
            return(outBufferSize);
        }