mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
fixed the demo recorder so it padds the data to 4 byte alignment so the compression works like it should
This commit is contained in:
parent
619c309779
commit
530dace4c9
|
@ -114,8 +114,14 @@ static void demorec_record_write(int type, const void *data, int size)
|
||||||
if(!record_file)
|
if(!record_file)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size = intpack_compress(data, size, buffer);
|
|
||||||
size = netcommon_compress(buffer, size, buffer2, sizeof(buffer2));
|
/* pad the data with 0 so we get an alignment of 4,
|
||||||
|
else the compression won't work and miss some bytes */
|
||||||
|
mem_copy(buffer2, data, size);
|
||||||
|
while(size&3)
|
||||||
|
buffer2[size++] = 0;
|
||||||
|
size = intpack_compress(buffer2, size, buffer); /* buffer2 -> buffer */
|
||||||
|
size = netcommon_compress(buffer, size, buffer2, sizeof(buffer2)); /* buffer -> buffer2 */
|
||||||
|
|
||||||
|
|
||||||
chunk[0] = ((type&0x3)<<5);
|
chunk[0] = ((type&0x3)<<5);
|
||||||
|
|
Loading…
Reference in a new issue