On Sunday, 19 August 2007 at 17:35, anonymous wrote:
> The patch Giel did should be revoked immediately!
Or use little instead of big endian. I've converted all BE functions to
LE (as an aside, I think having functions called PHYSFS_... in the
Warzone code is a bad idea) and it seems to work. Patch attached.
diff -r 96d259d05600 lib/framework/frame.h
--- a/lib/framework/frame.h Sat Aug 18 23:37:37 2007 +0200
+++ b/lib/framework/frame.h Sun Aug 19 18:40:03 2007 +0200
@@ -251,4 +251,28 @@ static inline bool PHYSFS_readBEFloat(PH
return (PHYSFS_readUBE32(file, readValue) != 0);
}
-#endif
+// little endian versions
+
+// defines since 8bit is endian-neutral
+#define PHYSFS_writeSLE8 PHYSFS_writeSBE8
+#define PHYSFS_writeULE8 PHYSFS_writeUBE8
+#define PHYSFS_readSLE8 PHYSFS_readSBE8
+#define PHYSFS_readULE8 PHYSFS_readUBE8
+
+static inline bool PHYSFS_writeLEFloat(PHYSFS_file* file, float val)
+{
+ union {
+ float f;
+ uint32_t i;
+ } writeValue;
+ writeValue.f = val;
+ return (PHYSFS_writeULE32(file, writeValue.i) != 0);
+}
+
+static inline bool PHYSFS_readLEFloat(PHYSFS_file* file, float* val)
+{
+ uint32_t* readValue = (uint32_t*)val;
+ return (PHYSFS_readULE32(file, readValue) != 0);
+}
+
+#endif
diff -r 96d259d05600 src/effects.c
--- a/src/effects.c Sat Aug 18 23:37:37 2007 +0200
+++ b/src/effects.c Sun Aug 19 18:40:03 2007 +0200
@@ -2708,36 +2708,36 @@ static bool serializeFXData(PHYSFS_file*
imdHashedNumber = 0;
}
- return (PHYSFS_writeUBE8 (fileHandle, serializeEffect-> control)
- && PHYSFS_writeUBE8 (fileHandle, serializeEffect-> group)
- && PHYSFS_writeUBE8 (fileHandle, serializeEffect-> type)
- && PHYSFS_writeUBE8 (fileHandle, serializeEffect-> frameNumber)
- && PHYSFS_writeUBE16(fileHandle, serializeEffect-> size)
- && PHYSFS_writeUBE8 (fileHandle, serializeEffect-> baseScale)
- && PHYSFS_writeUBE8 (fileHandle, serializeEffect-> specific)
+ return (PHYSFS_writeULE8 (fileHandle, serializeEffect-> control)
+ && PHYSFS_writeULE8 (fileHandle, serializeEffect-> group)
+ && PHYSFS_writeULE8 (fileHandle, serializeEffect-> type)
+ && PHYSFS_writeULE8 (fileHandle, serializeEffect-> frameNumber)
+ && PHYSFS_writeULE16(fileHandle, serializeEffect-> size)
+ && PHYSFS_writeULE8 (fileHandle, serializeEffect-> baseScale)
+ && PHYSFS_writeULE8 (fileHandle, serializeEffect-> specific)
// Write Vector3f types
- && PHYSFS_writeBEFloat(fileHandle, serializeEffect->position.x)
- && PHYSFS_writeBEFloat(fileHandle, serializeEffect->position.y)
- && PHYSFS_writeBEFloat(fileHandle, serializeEffect->position.z)
- && PHYSFS_writeBEFloat(fileHandle, serializeEffect->velocity.x)
- && PHYSFS_writeBEFloat(fileHandle, serializeEffect->velocity.y)
- && PHYSFS_writeBEFloat(fileHandle, serializeEffect->velocity.z)
+ && PHYSFS_writeLEFloat(fileHandle, serializeEffect->position.x)
+ && PHYSFS_writeLEFloat(fileHandle, serializeEffect->position.y)
+ && PHYSFS_writeLEFloat(fileHandle, serializeEffect->position.z)
+ && PHYSFS_writeLEFloat(fileHandle, serializeEffect->velocity.x)
+ && PHYSFS_writeLEFloat(fileHandle, serializeEffect->velocity.y)
+ && PHYSFS_writeLEFloat(fileHandle, serializeEffect->velocity.z)
// Write Vector3i types
- && PHYSFS_writeSBE32(fileHandle, serializeEffect-> rotation.x)
- && PHYSFS_writeSBE32(fileHandle, serializeEffect-> rotation.y)
- && PHYSFS_writeSBE32(fileHandle, serializeEffect-> rotation.z)
- && PHYSFS_writeSBE32(fileHandle, serializeEffect-> spin.x)
- && PHYSFS_writeSBE32(fileHandle, serializeEffect-> spin.y)
- && PHYSFS_writeSBE32(fileHandle, serializeEffect-> spin.z)
-
- && PHYSFS_writeUBE32(fileHandle, serializeEffect-> birthTime)
- && PHYSFS_writeUBE32(fileHandle, serializeEffect-> lastFrame)
- && PHYSFS_writeUBE16(fileHandle, serializeEffect-> frameDelay)
- && PHYSFS_writeUBE16(fileHandle, serializeEffect-> lifeSpan)
- && PHYSFS_writeUBE16(fileHandle, serializeEffect-> radius)
- && PHYSFS_writeUBE32(fileHandle, imdHashedNumber));
+ && PHYSFS_writeSLE32(fileHandle, serializeEffect-> rotation.x)
+ && PHYSFS_writeSLE32(fileHandle, serializeEffect-> rotation.y)
+ && PHYSFS_writeSLE32(fileHandle, serializeEffect-> rotation.z)
+ && PHYSFS_writeSLE32(fileHandle, serializeEffect-> spin.x)
+ && PHYSFS_writeSLE32(fileHandle, serializeEffect-> spin.y)
+ && PHYSFS_writeSLE32(fileHandle, serializeEffect-> spin.z)
+
+ && PHYSFS_writeULE32(fileHandle, serializeEffect-> birthTime)
+ && PHYSFS_writeULE32(fileHandle, serializeEffect-> lastFrame)
+ && PHYSFS_writeULE16(fileHandle, serializeEffect-> frameDelay)
+ && PHYSFS_writeULE16(fileHandle, serializeEffect-> lifeSpan)
+ && PHYSFS_writeULE16(fileHandle, serializeEffect-> radius)
+ && PHYSFS_writeULE32(fileHandle, imdHashedNumber));
}
/** Read an EFFECT from the given file with endianness swapped correctly
@@ -2749,35 +2749,35 @@ static bool deserializeFXData(PHYSFS_fil
{
uint32_t imdHashedNumber;
- if (!PHYSFS_readUBE8 (fileHandle, &serializeEffect-> control)
- || !PHYSFS_readUBE8 (fileHandle, &serializeEffect-> group)
- || !PHYSFS_readUBE8 (fileHandle, &serializeEffect-> type)
- || !PHYSFS_readUBE8 (fileHandle, &serializeEffect-> frameNumber)
- || !PHYSFS_readUBE16(fileHandle, &serializeEffect-> size)
- || !PHYSFS_readUBE8 (fileHandle, &serializeEffect-> baseScale)
- || !PHYSFS_readUBE8 (fileHandle, &serializeEffect-> specific)
+ if (!PHYSFS_readULE8 (fileHandle, &serializeEffect-> control)
+ || !PHYSFS_readULE8 (fileHandle, &serializeEffect-> group)
+ || !PHYSFS_readULE8 (fileHandle, &serializeEffect-> type)
+ || !PHYSFS_readULE8 (fileHandle, &serializeEffect-> frameNumber)
+ || !PHYSFS_readULE16(fileHandle, &serializeEffect-> size)
+ || !PHYSFS_readULE8 (fileHandle, &serializeEffect-> baseScale)
+ || !PHYSFS_readULE8 (fileHandle, &serializeEffect-> specific)
// Write Vector3f types
- || !PHYSFS_readBEFloat(fileHandle, &serializeEffect->position.x)
- || !PHYSFS_readBEFloat(fileHandle, &serializeEffect->position.y)
- || !PHYSFS_readBEFloat(fileHandle, &serializeEffect->position.z)
- || !PHYSFS_readBEFloat(fileHandle, &serializeEffect->velocity.x)
- || !PHYSFS_readBEFloat(fileHandle, &serializeEffect->velocity.y)
- || !PHYSFS_readBEFloat(fileHandle, &serializeEffect->velocity.z)
+ || !PHYSFS_readLEFloat(fileHandle, &serializeEffect->position.x)
+ || !PHYSFS_readLEFloat(fileHandle, &serializeEffect->position.y)
+ || !PHYSFS_readLEFloat(fileHandle, &serializeEffect->position.z)
+ || !PHYSFS_readLEFloat(fileHandle, &serializeEffect->velocity.x)
+ || !PHYSFS_readLEFloat(fileHandle, &serializeEffect->velocity.y)
+ || !PHYSFS_readLEFloat(fileHandle, &serializeEffect->velocity.z)
// Write Vector3i types
- || !PHYSFS_readSBE32(fileHandle, &serializeEffect-> rotation.x)
- || !PHYSFS_readSBE32(fileHandle, &serializeEffect-> rotation.y)
- || !PHYSFS_readSBE32(fileHandle, &serializeEffect-> rotation.z)
- || !PHYSFS_readSBE32(fileHandle, &serializeEffect-> spin.x)
- || !PHYSFS_readSBE32(fileHandle, &serializeEffect-> spin.y)
- || !PHYSFS_readSBE32(fileHandle, &serializeEffect-> spin.z)
- || !PHYSFS_readUBE32(fileHandle, &serializeEffect-> birthTime)
- || !PHYSFS_readUBE32(fileHandle, &serializeEffect-> lastFrame)
- || !PHYSFS_readUBE16(fileHandle, &serializeEffect-> frameDelay)
- || !PHYSFS_readUBE16(fileHandle, &serializeEffect-> lifeSpan)
- || !PHYSFS_readUBE16(fileHandle, &serializeEffect-> radius)
- || !PHYSFS_readUBE32(fileHandle, &imdHashedNumber))
+ || !PHYSFS_readSLE32(fileHandle, &serializeEffect-> rotation.x)
+ || !PHYSFS_readSLE32(fileHandle, &serializeEffect-> rotation.y)
+ || !PHYSFS_readSLE32(fileHandle, &serializeEffect-> rotation.z)
+ || !PHYSFS_readSLE32(fileHandle, &serializeEffect-> spin.x)
+ || !PHYSFS_readSLE32(fileHandle, &serializeEffect-> spin.y)
+ || !PHYSFS_readSLE32(fileHandle, &serializeEffect-> spin.z)
+ || !PHYSFS_readULE32(fileHandle, &serializeEffect-> birthTime)
+ || !PHYSFS_readULE32(fileHandle, &serializeEffect-> lastFrame)
+ || !PHYSFS_readULE16(fileHandle, &serializeEffect-> frameDelay)
+ || !PHYSFS_readULE16(fileHandle, &serializeEffect-> lifeSpan)
+ || !PHYSFS_readULE16(fileHandle, &serializeEffect-> radius)
+ || !PHYSFS_readULE32(fileHandle, &imdHashedNumber))
{
return false;
}
@@ -2826,8 +2826,8 @@ bool writeFXData(const char* fileName)
}
if (PHYSFS_write(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_writeUBE32(fileHandle, fileHeader.version)
- || !PHYSFS_writeUBE32(fileHandle, fileHeader.entries))
+ || !PHYSFS_writeULE32(fileHandle, fileHeader.version)
+ || !PHYSFS_writeULE32(fileHandle, fileHeader.entries))
{
debug(LOG_ERROR, "writeFXData: could not write to %s; PHYSFS error: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle);
@@ -2876,8 +2876,8 @@ bool readFXData(const char* fileName)
// Read the header from the file
if (PHYSFS_read(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_readUBE32(fileHandle, &fileHeader.version)
- || !PHYSFS_readUBE32(fileHandle, &fileHeader.entries))
+ || !PHYSFS_readULE32(fileHandle, &fileHeader.version)
+ || !PHYSFS_readULE32(fileHandle, &fileHeader.entries))
{
debug(LOG_ERROR, "readFXData: error while reading file: %s", PHYSFS_getLastError());
PHYSFS_close(fileHandle);
diff -r 96d259d05600 src/game.c
--- a/src/game.c Sat Aug 18 23:37:37 2007 +0200
+++ b/src/game.c Sun Aug 19 18:40:03 2007 +0200
@@ -275,30 +275,30 @@ typedef struct _savePower
static bool serializeSavePowerData(PHYSFS_file* fileHandle, const SAVE_POWER* serializePower)
{
- return (PHYSFS_writeUBE32(fileHandle, serializePower->currentPower)
- && PHYSFS_writeUBE32(fileHandle, serializePower->extractedPower));
+ return (PHYSFS_writeULE32(fileHandle, serializePower->currentPower)
+ && PHYSFS_writeULE32(fileHandle, serializePower->extractedPower));
}
static bool deserializeSavePowerData(PHYSFS_file* fileHandle, SAVE_POWER* serializePower)
{
- return (PHYSFS_readUBE32(fileHandle, &serializePower->currentPower)
- && PHYSFS_readUBE32(fileHandle, &serializePower->extractedPower));
+ return (PHYSFS_readULE32(fileHandle, &serializePower->currentPower)
+ && PHYSFS_readULE32(fileHandle, &serializePower->extractedPower));
}
static bool serializeVector3i(PHYSFS_file* fileHandle, const Vector3i* serializeVector)
{
- return (PHYSFS_writeSBE32(fileHandle, serializeVector->x)
- && PHYSFS_writeSBE32(fileHandle, serializeVector->y)
- && PHYSFS_writeSBE32(fileHandle, serializeVector->z));
+ return (PHYSFS_writeSLE32(fileHandle, serializeVector->x)
+ && PHYSFS_writeSLE32(fileHandle, serializeVector->y)
+ && PHYSFS_writeSLE32(fileHandle, serializeVector->z));
}
static bool deserializeVector3i(PHYSFS_file* fileHandle, Vector3i* serializeVector)
{
int32_t x, y, z;
- if (!PHYSFS_readSBE32(fileHandle, &x)
- || !PHYSFS_readSBE32(fileHandle, &y)
- || !PHYSFS_readSBE32(fileHandle, &z))
+ if (!PHYSFS_readSLE32(fileHandle, &x)
+ || !PHYSFS_readSLE32(fileHandle, &y)
+ || !PHYSFS_readSLE32(fileHandle, &z))
return false;
serializeVector-> x = x;
@@ -310,16 +310,16 @@ static bool deserializeVector3i(PHYSFS_f
static bool serializeVector2i(PHYSFS_file* fileHandle, const Vector2i* serializeVector)
{
- return (PHYSFS_writeSBE32(fileHandle, serializeVector->x)
- && PHYSFS_writeSBE32(fileHandle, serializeVector->y));
+ return (PHYSFS_writeSLE32(fileHandle, serializeVector->x)
+ && PHYSFS_writeSLE32(fileHandle, serializeVector->y));
}
static bool deserializeVector2i(PHYSFS_file* fileHandle, Vector2i* serializeVector)
{
int32_t x, y;
- if (!PHYSFS_readSBE32(fileHandle, &x)
- || !PHYSFS_readSBE32(fileHandle, &y))
+ if (!PHYSFS_readSLE32(fileHandle, &x)
+ || !PHYSFS_readSLE32(fileHandle, &y))
return false;
serializeVector-> x = x;
@@ -343,64 +343,64 @@ static bool serializeRunData(PHYSFS_file
static bool serializeRunData(PHYSFS_file* fileHandle, const RUN_DATA* serializeRun)
{
return (serializeVector2i(fileHandle, &serializeRun->sPos)
- && PHYSFS_writeUBE8(fileHandle, serializeRun->forceLevel)
- && PHYSFS_writeUBE8(fileHandle, serializeRun->healthLevel)
- && PHYSFS_writeUBE8(fileHandle, serializeRun->leadership));
+ && PHYSFS_writeULE8(fileHandle, serializeRun->forceLevel)
+ && PHYSFS_writeULE8(fileHandle, serializeRun->healthLevel)
+ && PHYSFS_writeULE8(fileHandle, serializeRun->leadership));
}
static bool deserializeRunData(PHYSFS_file* fileHandle, RUN_DATA* serializeRun)
{
return (deserializeVector2i(fileHandle, &serializeRun->sPos)
- && PHYSFS_readUBE8(fileHandle, &serializeRun->forceLevel)
- && PHYSFS_readUBE8(fileHandle, &serializeRun->healthLevel)
- && PHYSFS_readUBE8(fileHandle, &serializeRun->leadership));
+ && PHYSFS_readULE8(fileHandle, &serializeRun->forceLevel)
+ && PHYSFS_readULE8(fileHandle, &serializeRun->healthLevel)
+ && PHYSFS_readULE8(fileHandle, &serializeRun->leadership));
}
static bool serializeLandingZoneData(PHYSFS_file* fileHandle, const LANDING_ZONE* serializeLandZone)
{
- return (PHYSFS_writeUBE8(fileHandle, serializeLandZone->x1)
- && PHYSFS_writeUBE8(fileHandle, serializeLandZone->y1)
- && PHYSFS_writeUBE8(fileHandle, serializeLandZone->x2)
- && PHYSFS_writeUBE8(fileHandle, serializeLandZone->y2));
+ return (PHYSFS_writeULE8(fileHandle, serializeLandZone->x1)
+ && PHYSFS_writeULE8(fileHandle, serializeLandZone->y1)
+ && PHYSFS_writeULE8(fileHandle, serializeLandZone->x2)
+ && PHYSFS_writeULE8(fileHandle, serializeLandZone->y2));
}
static bool deserializeLandingZoneData(PHYSFS_file* fileHandle, LANDING_ZONE* serializeLandZone)
{
- return (PHYSFS_readUBE8(fileHandle, &serializeLandZone->x1)
- && PHYSFS_readUBE8(fileHandle, &serializeLandZone->y1)
- && PHYSFS_readUBE8(fileHandle, &serializeLandZone->x2)
- && PHYSFS_readUBE8(fileHandle, &serializeLandZone->y2));
+ return (PHYSFS_readULE8(fileHandle, &serializeLandZone->x1)
+ && PHYSFS_readULE8(fileHandle, &serializeLandZone->y1)
+ && PHYSFS_readULE8(fileHandle, &serializeLandZone->x2)
+ && PHYSFS_readULE8(fileHandle, &serializeLandZone->y2));
}
static bool serializeMultiplayerGame(PHYSFS_file* fileHandle, const MULTIPLAYERGAME* serializeMulti)
{
unsigned int i;
- if (!PHYSFS_writeUBE8(fileHandle, serializeMulti->type)
+ if (!PHYSFS_writeULE8(fileHandle, serializeMulti->type)
|| PHYSFS_write(fileHandle, serializeMulti->map, 1, 128) != 128
|| PHYSFS_write(fileHandle, serializeMulti->version, 1, 8) != 8
- || !PHYSFS_writeUBE8(fileHandle, serializeMulti->maxPlayers)
+ || !PHYSFS_writeULE8(fileHandle, serializeMulti->maxPlayers)
|| PHYSFS_write(fileHandle, serializeMulti->name, 1, 128) != 128
- || !PHYSFS_writeSBE32(fileHandle, serializeMulti->fog)
- || !PHYSFS_writeUBE32(fileHandle, serializeMulti->power)
-// || !PHYSFS_writeUBE8(fileHandle, serializeMulti->techLevel)
- || !PHYSFS_writeUBE8(fileHandle, serializeMulti->base)
- || !PHYSFS_writeUBE8(fileHandle, serializeMulti->alliance)
- || !PHYSFS_writeUBE8(fileHandle, serializeMulti->limit)
- || !PHYSFS_writeUBE16(fileHandle, serializeMulti->bytesPerSec)
- || !PHYSFS_writeUBE8(fileHandle, serializeMulti->packetsPerSec)
- || !PHYSFS_writeUBE8(fileHandle, serializeMulti->encryptKey))
+ || !PHYSFS_writeSLE32(fileHandle, serializeMulti->fog)
+ || !PHYSFS_writeULE32(fileHandle, serializeMulti->power)
+// || !PHYSFS_writeULE8(fileHandle, serializeMulti->techLevel)
+ || !PHYSFS_writeULE8(fileHandle, serializeMulti->base)
+ || !PHYSFS_writeULE8(fileHandle, serializeMulti->alliance)
+ || !PHYSFS_writeULE8(fileHandle, serializeMulti->limit)
+ || !PHYSFS_writeULE16(fileHandle, serializeMulti->bytesPerSec)
+ || !PHYSFS_writeULE8(fileHandle, serializeMulti->packetsPerSec)
+ || !PHYSFS_writeULE8(fileHandle, serializeMulti->encryptKey))
return false;
// for (i = 0; i < MAX_PLAYERS; ++i)
// {
-// if (!PHYSFS_writeUBE8(fileHandle, serializeMulti->skirmishPlayers[i]))
+// if (!PHYSFS_writeULE8(fileHandle, serializeMulti->skirmishPlayers[i]))
// return false;
// }
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE8(fileHandle, serializeMulti->skDiff[i]))
+ if (!PHYSFS_writeULE8(fileHandle, serializeMulti->skDiff[i]))
return false;
}
@@ -412,34 +412,34 @@ static bool deserializeMultiplayerGame(P
unsigned int i;
int32_t boolFog;
- if (!PHYSFS_readUBE8(fileHandle, &serializeMulti->type)
+ if (!PHYSFS_readULE8(fileHandle, &serializeMulti->type)
|| PHYSFS_read(fileHandle, serializeMulti->map, 1, 128) != 128
|| PHYSFS_read(fileHandle, serializeMulti->version, 1, 8) != 8
- || !PHYSFS_readUBE8(fileHandle, &serializeMulti->maxPlayers)
+ || !PHYSFS_readULE8(fileHandle, &serializeMulti->maxPlayers)
|| PHYSFS_read(fileHandle, serializeMulti->name, 1, 128) != 128
- || !PHYSFS_readSBE32(fileHandle, &boolFog)
- || !PHYSFS_readUBE32(fileHandle, &serializeMulti->power)
-// || !PHYSFS_readUBE8(fileHandle, &serializeMulti->techLevel)
- || !PHYSFS_readUBE8(fileHandle, &serializeMulti->base)
- || !PHYSFS_readUBE8(fileHandle, &serializeMulti->alliance)
- || !PHYSFS_readUBE8(fileHandle, &serializeMulti->limit)
-
- || !PHYSFS_readUBE16(fileHandle, &serializeMulti->bytesPerSec)
- || !PHYSFS_readUBE8(fileHandle, &serializeMulti->packetsPerSec)
- || !PHYSFS_readUBE8(fileHandle, &serializeMulti->encryptKey))
+ || !PHYSFS_readSLE32(fileHandle, &boolFog)
+ || !PHYSFS_readULE32(fileHandle, &serializeMulti->power)
+// || !PHYSFS_readULE8(fileHandle, &serializeMulti->techLevel)
+ || !PHYSFS_readULE8(fileHandle, &serializeMulti->base)
+ || !PHYSFS_readULE8(fileHandle, &serializeMulti->alliance)
+ || !PHYSFS_readULE8(fileHandle, &serializeMulti->limit)
+
+ || !PHYSFS_readULE16(fileHandle, &serializeMulti->bytesPerSec)
+ || !PHYSFS_readULE8(fileHandle, &serializeMulti->packetsPerSec)
+ || !PHYSFS_readULE8(fileHandle, &serializeMulti->encryptKey))
return false;
serializeMulti->fog = boolFog;
// for (i = 0; i < MAX_PLAYERS; ++i)
// {
-// if (!PHYSFS_readUBE8(fileHandle, &serializeMulti->skirmishPlayers[i]))
+// if (!PHYSFS_readULE8(fileHandle, &serializeMulti->skirmishPlayers[i]))
// return false;
// }
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE8(fileHandle, &serializeMulti->skDiff[i]))
+ if (!PHYSFS_readULE8(fileHandle, &serializeMulti->skDiff[i]))
return false;
}
@@ -448,28 +448,28 @@ static bool deserializeMultiplayerGame(P
static bool serializeSessionDesc(PHYSFS_file* fileHandle, const SESSIONDESC* serializeDesc)
{
- return (PHYSFS_writeSBE32(fileHandle, serializeDesc->dwSize)
- && PHYSFS_writeSBE32(fileHandle, serializeDesc->dwFlags)
+ return (PHYSFS_writeSLE32(fileHandle, serializeDesc->dwSize)
+ && PHYSFS_writeSLE32(fileHandle, serializeDesc->dwFlags)
&& PHYSFS_write(fileHandle, serializeDesc->host, 1, 16) == 16
- && PHYSFS_writeSBE32(fileHandle, serializeDesc->dwMaxPlayers)
- && PHYSFS_writeSBE32(fileHandle, serializeDesc->dwCurrentPlayers)
- && PHYSFS_writeSBE32(fileHandle, serializeDesc->dwUser1)
- && PHYSFS_writeSBE32(fileHandle, serializeDesc->dwUser2)
- && PHYSFS_writeSBE32(fileHandle, serializeDesc->dwUser3)
- && PHYSFS_writeSBE32(fileHandle, serializeDesc->dwUser4));
+ && PHYSFS_writeSLE32(fileHandle, serializeDesc->dwMaxPlayers)
+ && PHYSFS_writeSLE32(fileHandle, serializeDesc->dwCurrentPlayers)
+ && PHYSFS_writeSLE32(fileHandle, serializeDesc->dwUser1)
+ && PHYSFS_writeSLE32(fileHandle, serializeDesc->dwUser2)
+ && PHYSFS_writeSLE32(fileHandle, serializeDesc->dwUser3)
+ && PHYSFS_writeSLE32(fileHandle, serializeDesc->dwUser4));
}
static bool deserializeSessionDesc(PHYSFS_file* fileHandle, SESSIONDESC* serializeDesc)
{
- return (PHYSFS_readSBE32(fileHandle, &serializeDesc->dwSize)
- && PHYSFS_readSBE32(fileHandle, &serializeDesc->dwFlags)
+ return (PHYSFS_readSLE32(fileHandle, &serializeDesc->dwSize)
+ && PHYSFS_readSLE32(fileHandle, &serializeDesc->dwFlags)
&& PHYSFS_read(fileHandle, serializeDesc->host, 1, 16) == 16
- && PHYSFS_readSBE32(fileHandle, &serializeDesc->dwMaxPlayers)
- && PHYSFS_readSBE32(fileHandle, &serializeDesc->dwCurrentPlayers)
- && PHYSFS_readSBE32(fileHandle, &serializeDesc->dwUser1)
- && PHYSFS_readSBE32(fileHandle, &serializeDesc->dwUser2)
- && PHYSFS_readSBE32(fileHandle, &serializeDesc->dwUser3)
- && PHYSFS_readSBE32(fileHandle, &serializeDesc->dwUser4));
+ && PHYSFS_readSLE32(fileHandle, &serializeDesc->dwMaxPlayers)
+ && PHYSFS_readSLE32(fileHandle, &serializeDesc->dwCurrentPlayers)
+ && PHYSFS_readSLE32(fileHandle, &serializeDesc->dwUser1)
+ && PHYSFS_readSLE32(fileHandle, &serializeDesc->dwUser2)
+ && PHYSFS_readSLE32(fileHandle, &serializeDesc->dwUser3)
+ && PHYSFS_readSLE32(fileHandle, &serializeDesc->dwUser4));
}
static bool serializeGameStruct(PHYSFS_file* fileHandle, const GAMESTRUCT* serializeGame)
@@ -486,18 +486,18 @@ static bool deserializeGameStruct(PHYSFS
static bool serializePlayer(PHYSFS_file* fileHandle, const PLAYER* serializePlayer)
{
- return (PHYSFS_writeUBE32(fileHandle, serializePlayer->dpid)
+ return (PHYSFS_writeULE32(fileHandle, serializePlayer->dpid)
&& PHYSFS_write(fileHandle, serializePlayer->name, StringSize, 1) == 1
- && PHYSFS_writeUBE32(fileHandle, serializePlayer->bHost)
- && PHYSFS_writeUBE32(fileHandle, serializePlayer->bSpectator));
+ && PHYSFS_writeULE32(fileHandle, serializePlayer->bHost)
+ && PHYSFS_writeULE32(fileHandle, serializePlayer->bSpectator));
}
static bool deserializePlayer(PHYSFS_file* fileHandle, PLAYER* serializePlayer)
{
- return (PHYSFS_readUBE32(fileHandle, &serializePlayer->dpid)
+ return (PHYSFS_readULE32(fileHandle, &serializePlayer->dpid)
&& PHYSFS_read(fileHandle, serializePlayer->name, StringSize, 1) == 1
- && PHYSFS_readUBE32(fileHandle, &serializePlayer->bHost)
- && PHYSFS_readUBE32(fileHandle, &serializePlayer->bSpectator));
+ && PHYSFS_readULE32(fileHandle, &serializePlayer->bHost)
+ && PHYSFS_readULE32(fileHandle, &serializePlayer->bSpectator));
}
static bool serializeNetPlay(PHYSFS_file* fileHandle, const NETPLAY* serializeNetPlay)
@@ -516,13 +516,13 @@ static bool serializeNetPlay(PHYSFS_file
return false;
}
- return (PHYSFS_writeUBE32(fileHandle, serializeNetPlay->bComms)
- && PHYSFS_writeUBE32(fileHandle, serializeNetPlay->bHost)
- && PHYSFS_writeUBE32(fileHandle, serializeNetPlay->bLobbyLaunched)
- && PHYSFS_writeUBE32(fileHandle, serializeNetPlay->bSpectator)
- && PHYSFS_writeUBE32(fileHandle, serializeNetPlay->bCaptureInUse)
- && PHYSFS_writeUBE32(fileHandle, serializeNetPlay->bAllowCaptureRecord)
- && PHYSFS_writeUBE32(fileHandle, serializeNetPlay->bAllowCapturePlay));
+ return (PHYSFS_writeULE32(fileHandle, serializeNetPlay->bComms)
+ && PHYSFS_writeULE32(fileHandle, serializeNetPlay->bHost)
+ && PHYSFS_writeULE32(fileHandle, serializeNetPlay->bLobbyLaunched)
+ && PHYSFS_writeULE32(fileHandle, serializeNetPlay->bSpectator)
+ && PHYSFS_writeULE32(fileHandle, serializeNetPlay->bCaptureInUse)
+ && PHYSFS_writeULE32(fileHandle, serializeNetPlay->bAllowCaptureRecord)
+ && PHYSFS_writeULE32(fileHandle, serializeNetPlay->bAllowCapturePlay));
}
static bool deserializeNetPlay(PHYSFS_file* fileHandle, NETPLAY* serializeNetPlay)
@@ -541,13 +541,13 @@ static bool deserializeNetPlay(PHYSFS_fi
return false;
}
- return (PHYSFS_readUBE32(fileHandle, &serializeNetPlay->bComms)
- && PHYSFS_readUBE32(fileHandle, &serializeNetPlay->bHost)
- && PHYSFS_readUBE32(fileHandle, &serializeNetPlay->bLobbyLaunched)
- && PHYSFS_readUBE32(fileHandle, &serializeNetPlay->bSpectator)
- && PHYSFS_readUBE32(fileHandle, &serializeNetPlay->bCaptureInUse)
- && PHYSFS_readUBE32(fileHandle, &serializeNetPlay->bAllowCaptureRecord)
- && PHYSFS_readUBE32(fileHandle, &serializeNetPlay->bAllowCapturePlay));
+ return (PHYSFS_readULE32(fileHandle, &serializeNetPlay->bComms)
+ && PHYSFS_readULE32(fileHandle, &serializeNetPlay->bHost)
+ && PHYSFS_readULE32(fileHandle, &serializeNetPlay->bLobbyLaunched)
+ && PHYSFS_readULE32(fileHandle, &serializeNetPlay->bSpectator)
+ && PHYSFS_readULE32(fileHandle, &serializeNetPlay->bCaptureInUse)
+ && PHYSFS_readULE32(fileHandle, &serializeNetPlay->bAllowCaptureRecord)
+ && PHYSFS_readULE32(fileHandle, &serializeNetPlay->bAllowCapturePlay));
}
#define GAME_SAVE_V7 \
@@ -566,23 +566,23 @@ typedef struct save_game_v7
static bool serializeSaveGameV7Data(PHYSFS_file* fileHandle, const SAVE_GAME_V7* serializeGame)
{
- return (PHYSFS_writeUBE32(fileHandle, serializeGame->gameTime)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->GameType)
- && PHYSFS_writeSBE32(fileHandle, serializeGame->ScrollMinX)
- && PHYSFS_writeSBE32(fileHandle, serializeGame->ScrollMinY)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->ScrollMaxX)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->ScrollMaxY)
+ return (PHYSFS_writeULE32(fileHandle, serializeGame->gameTime)
+ && PHYSFS_writeULE32(fileHandle, serializeGame->GameType)
+ && PHYSFS_writeSLE32(fileHandle, serializeGame->ScrollMinX)
+ && PHYSFS_writeSLE32(fileHandle, serializeGame->ScrollMinY)
+ && PHYSFS_writeULE32(fileHandle, serializeGame->ScrollMaxX)
+ && PHYSFS_writeULE32(fileHandle, serializeGame->ScrollMaxY)
&& PHYSFS_write(fileHandle, serializeGame->levelName, MAX_LEVEL_SIZE, 1) == 1);
}
static bool deserializeSaveGameV7Data(PHYSFS_file* fileHandle, SAVE_GAME_V7* serializeGame)
{
- return (PHYSFS_readUBE32(fileHandle, &serializeGame->gameTime)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->GameType)
- && PHYSFS_readSBE32(fileHandle, &serializeGame->ScrollMinX)
- && PHYSFS_readSBE32(fileHandle, &serializeGame->ScrollMinY)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->ScrollMaxX)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->ScrollMaxY)
+ return (PHYSFS_readULE32(fileHandle, &serializeGame->gameTime)
+ && PHYSFS_readULE32(fileHandle, &serializeGame->GameType)
+ && PHYSFS_readSLE32(fileHandle, &serializeGame->ScrollMinX)
+ && PHYSFS_readSLE32(fileHandle, &serializeGame->ScrollMinY)
+ && PHYSFS_readULE32(fileHandle, &serializeGame->ScrollMaxX)
+ && PHYSFS_readULE32(fileHandle, &serializeGame->ScrollMaxY)
&& PHYSFS_read(fileHandle, serializeGame->levelName, MAX_LEVEL_SIZE, 1) == 1);
}
@@ -661,15 +661,15 @@ static bool serializeSaveGameV12Data(PHY
static bool serializeSaveGameV12Data(PHYSFS_file* fileHandle, const SAVE_GAME_V12* serializeGame)
{
return (serializeSaveGameV11Data(fileHandle, (const SAVE_GAME_V11*) serializeGame)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->missionTime)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->saveKey));
+ && PHYSFS_writeULE32(fileHandle, serializeGame->missionTime)
+ && PHYSFS_writeULE32(fileHandle, serializeGame->saveKey));
}
static bool deserializeSaveGameV12Data(PHYSFS_file* fileHandle, SAVE_GAME_V12* serializeGame)
{
return (deserializeSaveGameV11Data(fileHandle, (SAVE_GAME_V11*) serializeGame)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->missionTime)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->saveKey));
+ && PHYSFS_readULE32(fileHandle, &serializeGame->missionTime)
+ && PHYSFS_readULE32(fileHandle, &serializeGame->saveKey));
}
#define GAME_SAVE_V14 \
@@ -698,53 +698,53 @@ static bool serializeSaveGameV14Data(PHY
unsigned int i;
if (!serializeSaveGameV12Data(fileHandle, (const SAVE_GAME_V12*) serializeGame)
- || !PHYSFS_writeSBE32(fileHandle, serializeGame->missionOffTime)
- || !PHYSFS_writeSBE32(fileHandle, serializeGame->missionETA)
- || !PHYSFS_writeUBE16(fileHandle, serializeGame->missionHomeLZ_X)
- || !PHYSFS_writeUBE16(fileHandle, serializeGame->missionHomeLZ_Y)
- || !PHYSFS_writeSBE32(fileHandle, serializeGame->missionPlayerX)
- || !PHYSFS_writeSBE32(fileHandle, serializeGame->missionPlayerY))
+ || !PHYSFS_writeSLE32(fileHandle, serializeGame->missionOffTime)
+ || !PHYSFS_writeSLE32(fileHandle, serializeGame->missionETA)
+ || !PHYSFS_writeULE16(fileHandle, serializeGame->missionHomeLZ_X)
+ || !PHYSFS_writeULE16(fileHandle, serializeGame->missionHomeLZ_Y)
+ || !PHYSFS_writeSLE32(fileHandle, serializeGame->missionPlayerX)
+ || !PHYSFS_writeSLE32(fileHandle, serializeGame->missionPlayerY))
return false;
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE16(fileHandle, serializeGame->iTranspEntryTileX[i]))
+ if (!PHYSFS_writeULE16(fileHandle, serializeGame->iTranspEntryTileX[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE16(fileHandle, serializeGame->iTranspEntryTileY[i]))
+ if (!PHYSFS_writeULE16(fileHandle, serializeGame->iTranspEntryTileY[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE16(fileHandle, serializeGame->iTranspExitTileX[i]))
+ if (!PHYSFS_writeULE16(fileHandle, serializeGame->iTranspExitTileX[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE16(fileHandle, serializeGame->iTranspExitTileY[i]))
+ if (!PHYSFS_writeULE16(fileHandle, serializeGame->iTranspExitTileY[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE32(fileHandle, serializeGame->aDefaultSensor[i]))
+ if (!PHYSFS_writeULE32(fileHandle, serializeGame->aDefaultSensor[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE32(fileHandle, serializeGame->aDefaultECM[i]))
+ if (!PHYSFS_writeULE32(fileHandle, serializeGame->aDefaultECM[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE32(fileHandle, serializeGame->aDefaultRepair[i]))
+ if (!PHYSFS_writeULE32(fileHandle, serializeGame->aDefaultRepair[i]))
return false;
}
@@ -756,53 +756,53 @@ static bool deserializeSaveGameV14Data(P
unsigned int i;
if (!deserializeSaveGameV12Data(fileHandle, (SAVE_GAME_V12*) serializeGame)
- || !PHYSFS_readSBE32(fileHandle, &serializeGame->missionOffTime)
- || !PHYSFS_readSBE32(fileHandle, &serializeGame->missionETA)
- || !PHYSFS_readUBE16(fileHandle, &serializeGame->missionHomeLZ_X)
- || !PHYSFS_readUBE16(fileHandle, &serializeGame->missionHomeLZ_Y)
- || !PHYSFS_readSBE32(fileHandle, &serializeGame->missionPlayerX)
- || !PHYSFS_readSBE32(fileHandle, &serializeGame->missionPlayerY))
+ || !PHYSFS_readSLE32(fileHandle, &serializeGame->missionOffTime)
+ || !PHYSFS_readSLE32(fileHandle, &serializeGame->missionETA)
+ || !PHYSFS_readULE16(fileHandle, &serializeGame->missionHomeLZ_X)
+ || !PHYSFS_readULE16(fileHandle, &serializeGame->missionHomeLZ_Y)
+ || !PHYSFS_readSLE32(fileHandle, &serializeGame->missionPlayerX)
+ || !PHYSFS_readSLE32(fileHandle, &serializeGame->missionPlayerY))
return false;
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE16(fileHandle, &serializeGame->iTranspEntryTileX[i]))
+ if (!PHYSFS_readULE16(fileHandle, &serializeGame->iTranspEntryTileX[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE16(fileHandle, &serializeGame->iTranspEntryTileY[i]))
+ if (!PHYSFS_readULE16(fileHandle, &serializeGame->iTranspEntryTileY[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE16(fileHandle, &serializeGame->iTranspExitTileX[i]))
+ if (!PHYSFS_readULE16(fileHandle, &serializeGame->iTranspExitTileX[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE16(fileHandle, &serializeGame->iTranspExitTileY[i]))
+ if (!PHYSFS_readULE16(fileHandle, &serializeGame->iTranspExitTileY[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE32(fileHandle, &serializeGame->aDefaultSensor[i]))
+ if (!PHYSFS_readULE32(fileHandle, &serializeGame->aDefaultSensor[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE32(fileHandle, &serializeGame->aDefaultECM[i]))
+ if (!PHYSFS_readULE32(fileHandle, &serializeGame->aDefaultECM[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE32(fileHandle, &serializeGame->aDefaultRepair[i]))
+ if (!PHYSFS_readULE32(fileHandle, &serializeGame->aDefaultRepair[i]))
return false;
}
@@ -828,22 +828,22 @@ static bool serializeSaveGameV15Data(PHY
unsigned int i, j;
if (!serializeSaveGameV14Data(fileHandle, (const SAVE_GAME_V14*) serializeGame)
- || !PHYSFS_writeSBE32(fileHandle, serializeGame->offWorldKeepLists))
+ || !PHYSFS_writeSLE32(fileHandle, serializeGame->offWorldKeepLists))
return false;
for (i = 0; i < MAX_PLAYERS; ++i)
{
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
{
- if (!PHYSFS_writeUBE8(fileHandle, serializeGame->aDroidExperience[i][j]))
+ if (!PHYSFS_writeULE8(fileHandle, serializeGame->aDroidExperience[i][j]))
return false;
}
}
- return (PHYSFS_writeUBE32(fileHandle, serializeGame->RubbleTile)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->WaterTile)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->fogColour)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->fogState));
+ return (PHYSFS_writeULE32(fileHandle, serializeGame->RubbleTile)
+ && PHYSFS_writeULE32(fileHandle, serializeGame->WaterTile)
+ && PHYSFS_writeULE32(fileHandle, serializeGame->fogColour)
+ && PHYSFS_writeULE32(fileHandle, serializeGame->fogState));
}
static bool deserializeSaveGameV15Data(PHYSFS_file* fileHandle, SAVE_GAME_V15* serializeGame)
@@ -852,7 +852,7 @@ static bool deserializeSaveGameV15Data(P
int32_t boolOffWorldKeepLists;
if (!deserializeSaveGameV14Data(fileHandle, (SAVE_GAME_V14*) serializeGame)
- || !PHYSFS_readSBE32(fileHandle, &boolOffWorldKeepLists))
+ || !PHYSFS_readSLE32(fileHandle, &boolOffWorldKeepLists))
return false;
serializeGame->offWorldKeepLists = boolOffWorldKeepLists;
@@ -861,15 +861,15 @@ static bool deserializeSaveGameV15Data(P
{
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
{
- if (!PHYSFS_readUBE8(fileHandle, &serializeGame->aDroidExperience[i][j]))
+ if (!PHYSFS_readULE8(fileHandle, &serializeGame->aDroidExperience[i][j]))
return false;
}
}
- return (PHYSFS_readUBE32(fileHandle, &serializeGame->RubbleTile)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->WaterTile)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->fogColour)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->fogState));
+ return (PHYSFS_readULE32(fileHandle, &serializeGame->RubbleTile)
+ && PHYSFS_readULE32(fileHandle, &serializeGame->WaterTile)
+ && PHYSFS_readULE32(fileHandle, &serializeGame->fogColour)
+ && PHYSFS_readULE32(fileHandle, &serializeGame->fogState));
}
#define GAME_SAVE_V16 \
@@ -925,13 +925,13 @@ static bool serializeSaveGameV17Data(PHY
static bool serializeSaveGameV17Data(PHYSFS_file* fileHandle, const SAVE_GAME_V17* serializeGame)
{
return (serializeSaveGameV16Data(fileHandle, (const SAVE_GAME_V16*) serializeGame)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->objId));
+ && PHYSFS_writeULE32(fileHandle, serializeGame->objId));
}
static bool deserializeSaveGameV17Data(PHYSFS_file* fileHandle, SAVE_GAME_V17* serializeGame)
{
return (deserializeSaveGameV16Data(fileHandle, (SAVE_GAME_V16*) serializeGame)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->objId));
+ && PHYSFS_readULE32(fileHandle, &serializeGame->objId));
}
#define GAME_SAVE_V18 \
@@ -949,16 +949,16 @@ static bool serializeSaveGameV18Data(PHY
{
return (serializeSaveGameV17Data(fileHandle, (const SAVE_GAME_V17*) serializeGame)
&& PHYSFS_write(fileHandle, serializeGame->buildDate, MAX_STR_LENGTH, 1) == 1
- && PHYSFS_writeUBE32(fileHandle, serializeGame->oldestVersion)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->validityKey));
+ && PHYSFS_writeULE32(fileHandle, serializeGame->oldestVersion)
+ && PHYSFS_writeULE32(fileHandle, serializeGame->validityKey));
}
static bool deserializeSaveGameV18Data(PHYSFS_file* fileHandle, SAVE_GAME_V18* serializeGame)
{
return (deserializeSaveGameV17Data(fileHandle, (SAVE_GAME_V17*) serializeGame)
&& PHYSFS_read(fileHandle, serializeGame->buildDate, MAX_STR_LENGTH, 1) == 1
- && PHYSFS_readUBE32(fileHandle, &serializeGame->oldestVersion)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->validityKey));
+ && PHYSFS_readULE32(fileHandle, &serializeGame->oldestVersion)
+ && PHYSFS_readULE32(fileHandle, &serializeGame->validityKey));
}
#define GAME_SAVE_V19 \
@@ -983,18 +983,18 @@ static bool serializeSaveGameV19Data(PHY
{
for (j = 0; j < MAX_PLAYERS; ++j)
{
- if (!PHYSFS_writeUBE8(fileHandle, serializeGame->alliances[i][j]))
+ if (!PHYSFS_writeULE8(fileHandle, serializeGame->alliances[i][j]))
return false;
}
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE8(fileHandle, serializeGame->playerColour[i]))
+ if (!PHYSFS_writeULE8(fileHandle, serializeGame->playerColour[i]))
return false;
}
- return PHYSFS_writeUBE8(fileHandle, serializeGame->radarZoom);
+ return PHYSFS_writeULE8(fileHandle, serializeGame->radarZoom);
}
static bool deserializeSaveGameV19Data(PHYSFS_file* fileHandle, SAVE_GAME_V19* serializeGame)
@@ -1008,18 +1008,18 @@ static bool deserializeSaveGameV19Data(P
{
for (j = 0; j < MAX_PLAYERS; ++j)
{
- if (!PHYSFS_readUBE8(fileHandle, &serializeGame->alliances[i][j]))
+ if (!PHYSFS_readULE8(fileHandle, &serializeGame->alliances[i][j]))
return false;
}
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE8(fileHandle, &serializeGame->playerColour[i]))
+ if (!PHYSFS_readULE8(fileHandle, &serializeGame->playerColour[i]))
return false;
}
- return PHYSFS_readUBE8(fileHandle, &serializeGame->radarZoom);
+ return PHYSFS_readULE8(fileHandle, &serializeGame->radarZoom);
}
#define GAME_SAVE_V20 \
@@ -1037,7 +1037,7 @@ static bool serializeSaveGameV20Data(PHY
unsigned int i;
if (!serializeSaveGameV19Data(fileHandle, (const SAVE_GAME_V19*) serializeGame)
- || !PHYSFS_writeUBE8(fileHandle, serializeGame->bDroidsToSafetyFlag))
+ || !PHYSFS_writeULE8(fileHandle, serializeGame->bDroidsToSafetyFlag))
return false;
for (i = 0; i < MAX_PLAYERS; ++i)
@@ -1054,7 +1054,7 @@ static bool deserializeSaveGameV20Data(P
unsigned int i;
if (!deserializeSaveGameV19Data(fileHandle, (SAVE_GAME_V19*) serializeGame)
- || !PHYSFS_readUBE8(fileHandle, &serializeGame->bDroidsToSafetyFlag))
+ || !PHYSFS_readULE8(fileHandle, &serializeGame->bDroidsToSafetyFlag))
return false;
for (i = 0; i < MAX_PLAYERS; ++i)
@@ -1123,21 +1123,21 @@ static bool serializeSaveGameV24Data(PHY
static bool serializeSaveGameV24Data(PHYSFS_file* fileHandle, const SAVE_GAME_V24* serializeGame)
{
return (serializeSaveGameV22Data(fileHandle, (const SAVE_GAME_V22*) serializeGame)
- && PHYSFS_writeUBE32(fileHandle, serializeGame->reinforceTime)
- && PHYSFS_writeUBE8(fileHandle, serializeGame->bPlayCountDown)
- && PHYSFS_writeUBE8(fileHandle, serializeGame->bPlayerHasWon)
- && PHYSFS_writeUBE8(fileHandle, serializeGame->bPlayerHasLost)
- && PHYSFS_writeUBE8(fileHandle, serializeGame->dummy3));
+ && PHYSFS_writeULE32(fileHandle, serializeGame->reinforceTime)
+ && PHYSFS_writeULE8(fileHandle, serializeGame->bPlayCountDown)
+ && PHYSFS_writeULE8(fileHandle, serializeGame->bPlayerHasWon)
+ && PHYSFS_writeULE8(fileHandle, serializeGame->bPlayerHasLost)
+ && PHYSFS_writeULE8(fileHandle, serializeGame->dummy3));
}
static bool deserializeSaveGameV24Data(PHYSFS_file* fileHandle, SAVE_GAME_V24* serializeGame)
{
return (deserializeSaveGameV22Data(fileHandle, (SAVE_GAME_V22*) serializeGame)
- && PHYSFS_readUBE32(fileHandle, &serializeGame->reinforceTime)
- && PHYSFS_readUBE8(fileHandle, &serializeGame->bPlayCountDown)
- && PHYSFS_readUBE8(fileHandle, &serializeGame->bPlayerHasWon)
- && PHYSFS_readUBE8(fileHandle, &serializeGame->bPlayerHasLost)
- && PHYSFS_readUBE8(fileHandle, &serializeGame->dummy3));
+ && PHYSFS_readULE32(fileHandle, &serializeGame->reinforceTime)
+ && PHYSFS_readULE8(fileHandle, &serializeGame->bPlayCountDown)
+ && PHYSFS_readULE8(fileHandle, &serializeGame->bPlayerHasWon)
+ && PHYSFS_readULE8(fileHandle, &serializeGame->bPlayerHasLost)
+ && PHYSFS_readULE8(fileHandle, &serializeGame->dummy3));
}
/*
@@ -1169,7 +1169,7 @@ static bool serializeSaveGameV27Data(PHY
{
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
{
- if (!PHYSFS_writeUBE16(fileHandle, serializeGame->awDroidExperience[i][j]))
+ if (!PHYSFS_writeULE16(fileHandle, serializeGame->awDroidExperience[i][j]))
return false;
}
}
@@ -1188,7 +1188,7 @@ static bool deserializeSaveGameV27Data(P
{
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
{
- if (!PHYSFS_readUBE16(fileHandle, &serializeGame->awDroidExperience[i][j]))
+ if (!PHYSFS_readULE16(fileHandle, &serializeGame->awDroidExperience[i][j]))
return false;
}
}
@@ -1211,19 +1211,19 @@ static bool serializeSaveGameV29Data(PHY
static bool serializeSaveGameV29Data(PHYSFS_file* fileHandle, const SAVE_GAME_V29* serializeGame)
{
return (serializeSaveGameV27Data(fileHandle, (const SAVE_GAME_V27*) serializeGame)
- && PHYSFS_writeUBE16(fileHandle, serializeGame->missionScrollMinX)
- && PHYSFS_writeUBE16(fileHandle, serializeGame->missionScrollMinY)
- && PHYSFS_writeUBE16(fileHandle, serializeGame->missionScrollMaxX)
- && PHYSFS_writeUBE16(fileHandle, serializeGame->missionScrollMaxY));
+ && PHYSFS_writeULE16(fileHandle, serializeGame->missionScrollMinX)
+ && PHYSFS_writeULE16(fileHandle, serializeGame->missionScrollMinY)
+ && PHYSFS_writeULE16(fileHandle, serializeGame->missionScrollMaxX)
+ && PHYSFS_writeULE16(fileHandle, serializeGame->missionScrollMaxY));
}
static bool deserializeSaveGameV29Data(PHYSFS_file* fileHandle, SAVE_GAME_V29* serializeGame)
{
return (deserializeSaveGameV27Data(fileHandle, (SAVE_GAME_V27*) serializeGame)
- && PHYSFS_readUBE16(fileHandle, &serializeGame->missionScrollMinX)
- && PHYSFS_readUBE16(fileHandle, &serializeGame->missionScrollMinY)
- && PHYSFS_readUBE16(fileHandle, &serializeGame->missionScrollMaxX)
- && PHYSFS_readUBE16(fileHandle, &serializeGame->missionScrollMaxY));
+ && PHYSFS_readULE16(fileHandle, &serializeGame->missionScrollMinX)
+ && PHYSFS_readULE16(fileHandle, &serializeGame->missionScrollMinY)
+ && PHYSFS_readULE16(fileHandle, &serializeGame->missionScrollMaxX)
+ && PHYSFS_readULE16(fileHandle, &serializeGame->missionScrollMaxY));
}
#define GAME_SAVE_V30 \
@@ -1241,19 +1241,19 @@ static bool serializeSaveGameV30Data(PHY
static bool serializeSaveGameV30Data(PHYSFS_file* fileHandle, const SAVE_GAME_V30* serializeGame)
{
return (serializeSaveGameV29Data(fileHandle, (const SAVE_GAME_V29*) serializeGame)
- && PHYSFS_writeSBE32(fileHandle, serializeGame->scrGameLevel)
- && PHYSFS_writeUBE8(fileHandle, serializeGame->bExtraVictoryFlag)
- && PHYSFS_writeUBE8(fileHandle, serializeGame->bExtraFailFlag)
- && PHYSFS_writeUBE8(fileHandle, serializeGame->bTrackTransporter));
+ && PHYSFS_writeSLE32(fileHandle, serializeGame->scrGameLevel)
+ && PHYSFS_writeULE8(fileHandle, serializeGame->bExtraVictoryFlag)
+ && PHYSFS_writeULE8(fileHandle, serializeGame->bExtraFailFlag)
+ && PHYSFS_writeULE8(fileHandle, serializeGame->bTrackTransporter));
}
static bool deserializeSaveGameV30Data(PHYSFS_file* fileHandle, SAVE_GAME_V30* serializeGame)
{
return (deserializeSaveGameV29Data(fileHandle, (SAVE_GAME_V29*) serializeGame)
- && PHYSFS_readSBE32(fileHandle, &serializeGame->scrGameLevel)
- && PHYSFS_readUBE8(fileHandle, &serializeGame->bExtraVictoryFlag)
- && PHYSFS_readUBE8(fileHandle, &serializeGame->bExtraFailFlag)
- && PHYSFS_readUBE8(fileHandle, &serializeGame->bTrackTransporter));
+ && PHYSFS_readSLE32(fileHandle, &serializeGame->scrGameLevel)
+ && PHYSFS_readULE8(fileHandle, &serializeGame->bExtraVictoryFlag)
+ && PHYSFS_readULE8(fileHandle, &serializeGame->bExtraFailFlag)
+ && PHYSFS_readULE8(fileHandle, &serializeGame->bTrackTransporter));
}
//extra code for the patch - saves out whether cheated with the mission timer
@@ -1270,13 +1270,13 @@ static bool serializeSaveGameV31Data(PHY
static bool serializeSaveGameV31Data(PHYSFS_file* fileHandle, const SAVE_GAME_V31* serializeGame)
{
return (serializeSaveGameV30Data(fileHandle, (const SAVE_GAME_V30*) serializeGame)
- && PHYSFS_writeSBE32(fileHandle, serializeGame->missionCheatTime));
+ && PHYSFS_writeSLE32(fileHandle, serializeGame->missionCheatTime));
}
static bool deserializeSaveGameV31Data(PHYSFS_file* fileHandle, SAVE_GAME_V31* serializeGame)
{
return (deserializeSaveGameV30Data(fileHandle, (SAVE_GAME_V30*) serializeGame)
- && PHYSFS_readSBE32(fileHandle, &serializeGame->missionCheatTime));
+ && PHYSFS_readSLE32(fileHandle, &serializeGame->missionCheatTime));
}
// alexl. skirmish saves
@@ -1301,14 +1301,14 @@ static bool serializeSaveGameV33Data(PHY
if (!serializeSaveGameV31Data(fileHandle, (const SAVE_GAME_V31*) serializeGame)
|| !serializeMultiplayerGame(fileHandle, &serializeGame->sGame)
|| !serializeNetPlay(fileHandle, &serializeGame->sNetPlay)
- || !PHYSFS_writeUBE32(fileHandle, serializeGame->savePlayer)
+ || !PHYSFS_writeULE32(fileHandle, serializeGame->savePlayer)
|| !PHYSFS_write(fileHandle, serializeGame->sPName, 1, 32) == 32
- || !PHYSFS_writeSBE32(fileHandle, serializeGame->multiPlayer))
+ || !PHYSFS_writeSLE32(fileHandle, serializeGame->multiPlayer))
return false;
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_writeUBE32(fileHandle, serializeGame->sPlayer2dpid[i]))
+ if (!PHYSFS_writeULE32(fileHandle, serializeGame->sPlayer2dpid[i]))
return false;
}
@@ -1323,16 +1323,16 @@ static bool deserializeSaveGameV33Data(P
if (!deserializeSaveGameV31Data(fileHandle, (SAVE_GAME_V31*) serializeGame)
|| !deserializeMultiplayerGame(fileHandle, &serializeGame->sGame)
|| !deserializeNetPlay(fileHandle, &serializeGame->sNetPlay)
- || !PHYSFS_readUBE32(fileHandle, &serializeGame->savePlayer)
+ || !PHYSFS_readULE32(fileHandle, &serializeGame->savePlayer)
|| PHYSFS_read(fileHandle, serializeGame->sPName, 1, 32) != 32
- || !PHYSFS_readSBE32(fileHandle, &boolMultiPlayer))
+ || !PHYSFS_readSLE32(fileHandle, &boolMultiPlayer))
return false;
serializeGame->multiPlayer = boolMultiPlayer;
for (i = 0; i < MAX_PLAYERS; ++i)
{
- if (!PHYSFS_readUBE32(fileHandle, &serializeGame->sPlayer2dpid[i]))
+ if (!PHYSFS_readULE32(fileHandle, &serializeGame->sPlayer2dpid[i]))
return false;
}
@@ -4010,7 +4010,7 @@ bool gameLoad(const char* fileName)
// Read the header from the file
if (PHYSFS_read(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_readUBE32(fileHandle, &fileHeader.version))
+ || !PHYSFS_readULE32(fileHandle, &fileHeader.version))
{
debug(LOG_ERROR, "gameLoad: error while reading header from file (%s): %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle);
@@ -4109,7 +4109,7 @@ UDWORD getCampaign(const char* fileName)
// Read the header from the file
if (PHYSFS_read(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_readUBE32(fileHandle, &fileHeader.version))
+ || !PHYSFS_readULE32(fileHandle, &fileHeader.version))
{
debug(LOG_ERROR, "getCampaign: error while reading header from file (%s): %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle);
@@ -4761,7 +4761,7 @@ static bool writeGameFile(const char* fi
fileHeader.version = CURRENT_VERSION_NUM;
if (PHYSFS_write(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_writeUBE32(fileHandle, fileHeader.version))
+ || !PHYSFS_writeULE32(fileHandle, fileHeader.version))
{
debug(LOG_ERROR, "game.c:writeGameFile: could not write header to %s; PHYSFS error: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle);
diff -r 96d259d05600 src/map.c
--- a/src/map.c Sat Aug 18 23:37:37 2007 +0200
+++ b/src/map.c Sun Aug 19 18:40:03 2007 +0200
@@ -918,7 +918,7 @@ bool writeVisibilityData(const char* fil
// Write out the current file header
if (PHYSFS_write(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_writeUBE32(fileHandle, fileHeader.version))
+ || !PHYSFS_writeULE32(fileHandle, fileHeader.version))
{
debug(LOG_ERROR, "writeVisibilityData: could not write header to %s; PHYSFS error: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle);
@@ -927,7 +927,7 @@ bool writeVisibilityData(const char* fil
for (i = 0; i < mapWidth * mapHeight; ++i)
{
- if (!PHYSFS_writeUBE8(fileHandle, psMapTiles[i].tileVisBits))
+ if (!PHYSFS_writeULE8(fileHandle, psMapTiles[i].tileVisBits))
{
debug(LOG_ERROR, "writeVisibilityData: could not write to %s; PHYSFS error: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle);
@@ -956,7 +956,7 @@ bool readVisibilityData(const char* file
// Read the header from the file
if (PHYSFS_read(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_readUBE32(fileHandle, &fileHeader.version))
+ || !PHYSFS_readULE32(fileHandle, &fileHeader.version))
{
debug(LOG_ERROR, "readVisibilityData: error while reading header from file: %s", PHYSFS_getLastError());
PHYSFS_close(fileHandle);
@@ -994,7 +994,7 @@ bool readVisibilityData(const char* file
for(i=0; i<mapWidth*mapHeight; i++)
{
/* Get the visibility data */
- if (!PHYSFS_readUBE8(fileHandle, &psMapTiles[i].tileVisBits))
+ if (!PHYSFS_readULE8(fileHandle, &psMapTiles[i].tileVisBits))
{
debug(LOG_ERROR, "readVisibilityData: could not read from %s; PHYSFS error: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle);
diff -r 96d259d05600 src/scores.c
--- a/src/scores.c Sat Aug 18 23:37:37 2007 +0200
+++ b/src/scores.c Sun Aug 19 18:40:03 2007 +0200
@@ -532,17 +532,17 @@ void fillUpStats( void )
*/
static bool serializeScoreData(PHYSFS_file* fileHandle, const MISSION_DATA* serializeScore)
{
- return (PHYSFS_writeUBE32(fileHandle, serializeScore->unitsBuilt)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->unitsKilled)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->unitsLost)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->strBuilt)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->strKilled)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->strLost)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->artefactsFound)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->missionStarted)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->shotsOnTarget)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->shotsOffTarget)
- && PHYSFS_writeUBE32(fileHandle, serializeScore->babasMowedDown));
+ return (PHYSFS_writeULE32(fileHandle, serializeScore->unitsBuilt)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->unitsKilled)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->unitsLost)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->strBuilt)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->strKilled)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->strLost)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->artefactsFound)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->missionStarted)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->shotsOnTarget)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->shotsOffTarget)
+ && PHYSFS_writeULE32(fileHandle, serializeScore->babasMowedDown));
}
/** Read a MISSION_DATA from the given file with endianness swapped correctly
@@ -552,17 +552,17 @@ static bool serializeScoreData(PHYSFS_fi
*/
static bool deserializeScoreData(PHYSFS_file* fileHandle, MISSION_DATA* serializeScore)
{
- return (PHYSFS_readUBE32(fileHandle, &serializeScore->unitsBuilt)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->unitsKilled)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->unitsLost)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->strBuilt)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->strKilled)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->strLost)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->artefactsFound)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->missionStarted)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->shotsOnTarget)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->shotsOffTarget)
- && PHYSFS_readUBE32(fileHandle, &serializeScore->babasMowedDown));
+ return (PHYSFS_readULE32(fileHandle, &serializeScore->unitsBuilt)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->unitsKilled)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->unitsLost)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->strBuilt)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->strKilled)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->strLost)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->artefactsFound)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->missionStarted)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->shotsOnTarget)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->shotsOffTarget)
+ && PHYSFS_readULE32(fileHandle, &serializeScore->babasMowedDown));
}
// -----------------------------------------------------------------------------------
@@ -587,8 +587,8 @@ bool writeScoreData(const char* fileName
// Write out the current file header
if (PHYSFS_write(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_writeUBE32(fileHandle, fileHeader.version)
- || !PHYSFS_writeUBE32(fileHandle, fileHeader.entries))
+ || !PHYSFS_writeULE32(fileHandle, fileHeader.version)
+ || !PHYSFS_writeULE32(fileHandle, fileHeader.entries))
{
debug(LOG_ERROR, "writeScoreData: could not write header to %s; PHYSFS error: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(fileHandle);
@@ -627,8 +627,8 @@ bool readScoreData(const char* fileName)
// Read the header from the file
if (PHYSFS_read(fileHandle, fileHeader.aFileType, sizeof(fileHeader.aFileType), 1) != 1
- || !PHYSFS_readUBE32(fileHandle, &fileHeader.version)
- || !PHYSFS_readUBE32(fileHandle, &fileHeader.entries))
+ || !PHYSFS_readULE32(fileHandle, &fileHeader.version)
+ || !PHYSFS_readULE32(fileHandle, &fileHeader.entries))
{
debug(LOG_ERROR, "readScoreData: error while reading header from file: %s", PHYSFS_getLastError());
PHYSFS_close(fileHandle);
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev