Skip to main content
GameDev.net gamedev.net
🔒 Locked

inverse byte order

Started by bjogio Nov 3, 2004 at 10:33 AM 1 replies 900+ views
Original Post
bjogio
bjogio
Tonight I was bored to die everytime at the boss of my favourite 2d-fighting game (GGXX #reload) so I decide to do a little hack in the save data file of the game in order to unlock somo secrets. Now I was looking for something easy to find (it's a binary file) so I decided to look over top score table. I found at address 0x00001798 these bytes: 47 47 58 00 and I can say that this is a standard serialization for the string "GGX", now I looked the word after and it is: 50 C3 00 00 (in decimal: 20675) this is not right cause I know that this MUST be 50000(decimal). After 20 second of panic I realize that sammy wrote byte in inverse order cause: 00 00 C3 50 is 50000 in esadecimal. Now the question is: Why they write bytes in inverse (respect to human reading) order? Is there something that I miss? It's a standard way to go? There are functions in the stdc that can read this kind of serialization without manual shifting of tha data? Sorry for my ignorance and thanks in advance for your help.
[ILTUOMONDOFUTURO]
Rebooted
Rebooted
On a little endian system (such as x86) bytes are stored in this way. On big endian systems such as PowerPC, they are stored as you would expect. This can cause problems when trying a read a file writen on PC from a Mac for example, unless functions are used that "flip" the data. If you read the data using a program on a little endian system, you should have no problems.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.