Fixed not copying trailing bits from dem_stringtables
This commit is contained in:
parent
65089f3585
commit
cfc6498c25
@ -127,6 +127,15 @@ namespace DemHandlers
|
||||
{
|
||||
StringTable_BitRead(bitbuf, &table);
|
||||
}
|
||||
|
||||
// copy trailing bits for binary completeness
|
||||
const unsigned int numBitsLeft = bitbuf.GetNumBitsLeft();
|
||||
assert(numBitsLeft < 8);
|
||||
data->numTrailingBits = numBitsLeft;
|
||||
if (numBitsLeft > 0)
|
||||
{
|
||||
data->trailingBitsValue = bitbuf.ReadUBitLong(numBitsLeft);
|
||||
}
|
||||
return !bitbuf.IsOverflowed();
|
||||
}
|
||||
|
||||
@ -142,6 +151,10 @@ namespace DemHandlers
|
||||
{
|
||||
StringTable_BitWrite(bitbuf, &table);
|
||||
}
|
||||
if (data->numTrailingBits > 0)
|
||||
{
|
||||
bitbuf.WriteUBitLong(data->trailingBitsValue, data->numTrailingBits);
|
||||
}
|
||||
demofile.WriteRawData(bitbuf.GetBasePointer(), bitbuf.GetNumBytesWritten());
|
||||
return !bitbuf.IsOverflowed();
|
||||
}
|
||||
@ -162,6 +175,15 @@ namespace DemHandlers
|
||||
jsonbuf.EndObject();
|
||||
}
|
||||
jsonbuf.EndArray();
|
||||
jsonbuf.WriteUInt32("numTrailingBits", data->numTrailingBits);
|
||||
if (data->numTrailingBits > 0)
|
||||
{
|
||||
jsonbuf.WriteUInt32("trailingBitsValue", data->trailingBitsValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonbuf.WriteNull("trailingBitsValue");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ namespace DemMsg
|
||||
};
|
||||
|
||||
Array<StringTable> stringtables;
|
||||
uint16_t numTrailingBits;
|
||||
uint16_t trailingBitsValue;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user