Cuberite Forum
PAK files and endianness - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: PAK files and endianness (/thread-477.html)



PAK files and endianness - xoft - 06-10-2012

I have just realized, when trying to update the information on PAK format in the wiki, that there's a fundamental flaw in the format design. It doesn't take endianness into account at all. When reading and writing the number of chunks and the chunk header, no endianness conversions are performed, meaning that a file saved on one platform is unusable on another platform.

Traditionally, MCServer has been used on Intel, so we probably could declare that it uses little-endian formatting, and fix the code to that. What do you think?


RE: PAK files and endianness - Luksor - 06-10-2012

If it gives more compatibility - sure, why not?Tongue


RE: PAK files and endianness - FakeTruth - 06-10-2012

Isn't the pak format deprecated?

Why not leave it as it is for the moment, and set anvil as the default saving scheme


RE: PAK files and endianness - xoft - 06-10-2012

It does not, necessarily - if anyone's using PAK files on a big-endian platform (older Macs, I think ARM is big-endian, too), they will lose their worlds with such a change.
PAK is actually the default now (if you don't set [Storage].Schema or set it to "Default", PAK is used)


RE: PAK files and endianness - FakeTruth - 06-10-2012

Why would they lose their worlds? I'm talking about NO change, only set the default saving to Anvil. If they already have a world, that world's saving scheme is set to PAK, and that won't change by changing the default scheme.


RE: PAK files and endianness - xoft - 06-10-2012

The first half was an answer to Luksor - if we changed the PAK format to be forcefully little-endian, gyus on big-endian platforms would lose their worlds, since their PAK files couldn't be read by the server anymore.

Of course, setting the default storage to Anvil is pretty harmless, but it still doesn't solve the issue of incompatible PAK files across platforms.

Do we want to say that PAK is so deprecated that we won't fix this? Smile


RE: PAK files and endianness - Luksor - 06-10-2012

I think changing the default to Anvil is much better idea. MCServer will be compatible with vanilla by default and you don't need to deal with endianness.Tongue


RE: PAK files and endianness - FakeTruth - 06-10-2012

(06-10-2012, 09:24 PM)xoft Wrote: Do we want to say that PAK is so deprecated that we won't fix this? Smile

Yes, let's not support formats that have no benefits over Anvil, and nobody is gonna use now anyway