1 Attachment(s)
Minecraft XBLA Compression Library
Due to the little time i can spend on development and research i decided to release this beta version of my Minecraft XBLA Compression Library.
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.
Example (C#):
Code:
[DllImport("libminecraft.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern uint decompress([Out] byte[] compressed_buffer, uint compressed_size, [In] byte[] decompressed_buffer, uint decompressed_size);
public static extern uint compress([Out] byte[] decompressed_buffer, uint decompressed_size, [In] byte[] compressed_buffer, uint compressed_size);
void MyFunction()
{
UInt32 decompressed_size = <decompressed size>;
byte[] decompressed_buffer = new byte[decompressed_size];
uint compressed_size = <compressed size>;
uint result = decompress(compressed_buffer, compressed_size, decompressed_buffer, decompressed_size);
// result now contains the real decompressed size and decompressed_buffer contains the decompressed data.
}
Re: Minecraft XBLA Compression Library
great work done as always fairchild :D
Re: Minecraft XBLA Compression Library
Thanks, this is amazing. Is there anyway we should know what the decompressed size is, or do we have to guess for now?
Re: Minecraft XBLA Compression Library
Quote:
Originally Posted by
maskedstick
Thanks, this is amazing. Is there anyway we should know what the decompressed size is, or do we have to guess for now?
The decompressed size is in the header, or you can simply guess and then trim the byte array after you decompressed using the real decompressed size.
I implemented this in NBTExplorer, but now i want to know which is the best map editor that is open source so that i can modify that to use xbox360 savegames. :)
Re: Minecraft XBLA Compression Library
Okay, I have a few questions. Assuming that for each chunk, the chunk data starts with decimal value 128 (that seems to be common to every chunk), how many bytes after that does the header take up (where does the actual compressed data start relative to the beginning of the chunk)? And am I supposed to be passing the whole chunk, including the header, to your methods? Or should I only be passing the compressed data?
Re: Minecraft XBLA Compression Library
Damn dude. Good shit as always fairchild :3
Re: Minecraft XBLA Compression Library
Quote:
Originally Posted by
maskedstick
Okay, I have a few questions. Assuming that for each chunk, the chunk data starts with decimal value 128 (that seems to be common to every chunk), how many bytes after that does the header take up (where does the actual compressed data start relative to the beginning of the chunk)? And am I supposed to be passing the whole chunk, including the header, to your methods? Or should I only be passing the compressed data?
Ok, this is how the chunk headers looks like.
Code:
Magic= 0x80, 0x00
ChunkSize=<short / uint16>
Could be one of these two:
DecompSize=<long / uint32>
Or:
Version=<short / uint16>
DecompSize=<short / uint16>
CompressedData=starts with 0xFF...
You should only send the compressed data in the compressed_buffer nothing else.