Data types

I made a gui based editor to edit the save files for a game. I'm in the process of porting it from Win32 to wxWidgets so that it's cross platform, and in the process I thought I'd refactor the part that actually edits the savefile itself. This is C and C++.

Before that though, I wanted to be sure of the data types that are most likely being used. The savefile contains 1 and 2 byte values. I've been using unsigned char for the 1 byte values and unsigned short for the two byte values. I haven't seen any errors as a result of this, but that's no gaurantee. What gives me pause though is how some of the byte values appear in game versus in the file. There is a value in the file that appears as FF, and in the game it is -1. There is value in the game that never goes higher than 127, which shows up in the file as 7F. That makes me think it could actually be a signed char, but then there are other byte values in the game that go up to 153 (valueInGame = valueInFile * 0.6; so 153 = 255 * 0.6). That makes me think of unsigned char again. But then I guess it could also be mixed - some are unsigned char, some are signed.

Like I said, everything has worked fine so far, but I don't want to assume that I'm therefore working with everything in a type-correct manner. Can anyone provide any clear answers to this? What the saturn supports, any standards it might have, etc., to possibly clear this up for me?
 
Back
Top