Closed kevinvdburgt closed 5 years ago
Figured it out, Facepunch is using this library, which is not fully compatible with the original LZ4 (https://github.com/MiloszKrajewski/lz4net#compatibility).
Currently learning more about how LZ4 works, so i can make the decoder in Node and continue on the webbased map editor :)
@kevinvdburgt Have you figured it out? I'm trying to decode and serialize it from java, and writing JNI for and old lib doesn't sound applealing
As i am messing around, building a web based map editor, i have some issues decoding the LZ4 compression.
As the data from a map is:
The first 4 bytes are for the version (https://github.com/Facepunch/Rust.World/blob/master/Assets/Plugins/Rust.World/WorldSerialization.cs#L216) which should be 8 (
<Buffer 08 00 00 00>
), but after those 4 bytes, it starts with:What should be decoded by LZ4 (https://github.com/Facepunch/Rust.World/blob/master/Assets/Plugins/Rust.World/WorldSerialization.cs#L220). However, when i checkout the documentation for LZ4 the frame should start with a magic number
0x184D2204
(see: https://github.com/lz4/lz4/wiki/lz4_Frame_format.md#general-structure-of-lz4-frame-format).So, how can i read the map files?
Example
As i am writing this in the backend of a NodeJS application, this is how i try to decode it now: