Facepunch / Rust.World

SDK to support the creation of custom map tools for Rust
MIT License
79 stars 15 forks source link

Update LZ4 library #5

Open realkarmakun opened 2 years ago

realkarmakun commented 2 years ago

The old lz4net lib that is used in Rust is not maintained, and not compatible with official LZ4 Frame format specification. This produce a really obscure situation: Map files can not be decompressed outside of C# environment (they can be serialized though, protobuf is available almost everywhere)

Newer version of lz4 library is available here: https://github.com/MiloszKrajewski/K4os.Compression.LZ4 (it is recommended by lz4net archived README). Legacy access method is already in the lib itself, which you can use to implement migration mechanism. Link: https://github.com/MiloszKrajewski/K4os.Compression.LZ4#legacy-lz4net-compatibility

I hope you will look into this for the sake of Rust being more open to modding

Dezinater commented 1 year ago

@realkarmakun If you're still looking for a way to decompress map files outside of C#, I recreated the lz4net implementation in Javascript. It shouldn't be too hard to do it in other languages too. As long as you parse the custom header from the data block you will be able to decompress the rest with any LZ4 library that can read LZ4 blocks.

Here's the library I made if you want to take a look at how I recreated it https://github.com/Dezinater/RustWorldJS

realkarmakun commented 1 year ago

@Dezinater Thanks! I don't need it but since you linked your project I decided to do the same thing. I just needed properly compressed map from Rust dedicated server and wrote a plugin that copies current map to new format that later can be parsed by any other lz4 lib on other languages. https://github.com/MeProjectStudio/truelz4