H-uru / Plasma

Cyan Worlds's Plasma game engine
http://h-uru.github.io/Plasma/
GNU General Public License v3.0
203 stars 80 forks source link

pnNcCli should consistently convert to little endian #1473

Closed dpogue closed 11 months ago

dpogue commented 12 months ago

There are 3 special cases that are not handled here:

dpogue commented 11 months ago

This is now sufficient for the plFilePatcher command-line to work on Mac OS X 10.5 Leopard PowerPC (big endian) and download files.

dpogue commented 11 months ago

I think I am coming around to your sense of malaise around all of the manual endianness work in the file messages. I'm especially unhappy with the temporary copy of certain messages from the file server being used solely for byte swapping, which could probably be done in-place (assuming the buffer is not const). It's basically a wasted copy on LE machines.

yeah, I don't like the extra copy, particularly since it's not needed for almost all cases... I thought about putting it behind some sort of HS_BIG_ENDIAN ifdef but that also seemed ugly.

Hypothetically there should be no issue making the messages non-const and modifying the data directly...

dpogue commented 11 months ago

Updated to do the byte swapping directly on the buffer data, and confirmed that it's still working on both LE and BE architectures.