This is a Library written in (unmanaged) C/C++ that can be used in your .NET (C# example available) applications to decompress and compress the compressed data from the savegame.
Make sure to give credits if used in your application.
Update:
So, lzopro gave me a hard time as it's not ment to be used the way i wanted it. Took some time to fix this but here is a new version that should work as expected.
Example (C#):
Code:
[DllImport("compress.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern uint lzo_decompress([Out] byte[] compressed_buffer, uint compressed_size, [In] byte[] decompressed_buffer, uint decompressed_size, uint method);
[DllImport("compress.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern uint lzo_compress([Out] byte[] decompressed_buffer, uint decompressed_size, [In] byte[] compressed_buffer, uint compressed_size, uint method, uint compress_level);
void MyFunction()
{
UInt32 decompressed_size = <decompressed size>;
byte[] decompressed_buffer = new byte[decompressed_size];
uint compressed_size = <compressed size>;
uint result = lzo_decompress(compressed_buffer, compressed_size, decompressed_buffer, decompressed_size, COMP_LZOPRO1X);
// result now contains the real decompressed size and decompressed_buffer contains the decompressed data.
}
Available compression methods:
Code:
enum {
// decompressors
COMP_NONE = 0, // No compression
COMP_ZLIB, // RFC 1950
COMP_DEFLATE, // RFC 1951
COMP_LZO1, // LZO 1 Freeware
COMP_LZO1A, // LZO 1a Freeware
COMP_LZO1B, // LZO 1b (safe with overrun) Freeware
COMP_LZO1C, // LZO 1c (safe with overrun) Freeware
COMP_LZO1F, // LZO 1f (safe with overrun) Freeware
COMP_LZO1X, // LZO 1x (safe with overrun) Freeware
COMP_LZO1Y, // LZO 1y (safe with overrun) Freeware
COMP_LZO1Z, // LZO 1z (safe with overrun) Freeware
COMP_LZO2A, // LZO 2a (safe with overrun) Freeware
COMP_LZOPRO1X, // LZOPRO 1x (safe with overrun) Freeware
COMP_LZOPRO1Y, // LZOPRO 1y (safe with overrun) Freeware
// compressors
COMP_LZO1_COMPRESS, // LZO 1 Freeware
COMP_LZO1_99_COMPRESS, // better compression ratio at the cost of more memory and time
COMP_LZO1A_COMPRESS, // LZO 1a Freeware
COMP_LZO1A_99_COMPRESS, // better compression ratio at the cost of more memory and time
COMP_LZO1B_COMPRESS, // LZO 1b Freeware (Valid compression level: 1..9)
COMP_LZO1B_99_COMPRESS, // better compression ratio at the cost of more memory and time
COMP_LZO1B_999_COMPRESS,// even better compression ratio at the cost of more memory and time
COMP_LZO1C_COMPRESS, // LZO 1c Freeware (Valid compression level: 1..9)
COMP_LZO1C_99_COMPRESS, // better compression ratio at the cost of more memory and time
COMP_LZO1C_999_COMPRESS,// even better compression ratio at the cost of more memory and time
COMP_LZO1F_COMPRESS, // LZO 1f Freeware
COMP_LZO1F_999_COMPRESS,// even better compression ratio at the cost of more memory and time
COMP_LZO1X_COMPRESS, // LZO 1x Freeware
COMP_LZO1X_999_COMPRESS,// even better compression ratio at the cost of more memory and time
COMP_LZO1Y_COMPRESS, // LZO 1y Freeware
COMP_LZO1Y_999_COMPRESS,// even better compression ratio at the cost of more memory and time
COMP_LZO1Z_COMPRESS, // LZO 1z Freeware
COMP_LZO1Z_999_COMPRESS,// even better compression ratio at the cost of more memory and time
COMP_LZO2A_COMPRESS, // LZO 2a Freeware
COMP_LZO2A_999_COMPRESS, // even better compression ratio at the cost of more memory and time
COMP_LZOPRO1X_COMPRESS, // LZOPRO 1x (Valid compression level: 1..10)
COMP_LZOPRO1Y_COMPRESS, // LZOPRO 1y (Valid compression level: 1..10)
};