From cfd4fc112471ba73fccc0b286a2ef3f1812412b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Noel?= Date: Mon, 24 Feb 2025 10:58:09 +0100 Subject: [PATCH] fix build on big endian architectures --- Sources/Engine/Base/Types.h | 4 ++++ Sources/GameMP/Game.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/Engine/Base/Types.h b/Sources/Engine/Base/Types.h index de4a4fb..c796675 100755 --- a/Sources/Engine/Base/Types.h +++ b/Sources/Engine/Base/Types.h @@ -759,6 +759,9 @@ inline __uint64 BYTESWAP64_unsigned(__uint64 x) val = *((SLONG *) &uval); } +/** + * BOOL is int32_t , just like SLONG + * so don't define the same function twice static inline void BYTESWAP(BOOL &val) { // !!! FIXME: reinterpret_cast ? @@ -766,6 +769,7 @@ inline __uint64 BYTESWAP64_unsigned(__uint64 x) BYTESWAP(uval); val = *((BOOL *) &uval); } +*/ static inline void BYTESWAP(FLOAT &val) { diff --git a/Sources/GameMP/Game.cpp b/Sources/GameMP/Game.cpp index c78cd7b..f3322b6 100755 --- a/Sources/GameMP/Game.cpp +++ b/Sources/GameMP/Game.cpp @@ -1534,7 +1534,7 @@ void CGame::UnpackHighScoreTable(SLONG slSize) gm_ahseHighScores[i].hse_strPlayer = (const char*)pub; pub += MAX_HIGHSCORENAME+1; memcpy(&gm_ahseHighScores[i].hse_gdDifficulty, pub, sizeof(INDEX)); - BYTESWAP(gm_ahseHighScores[i].hse_gdDifficulty); + BYTESWAP((int&)gm_ahseHighScores[i].hse_gdDifficulty); pub += sizeof(INDEX); memcpy(&gm_ahseHighScores[i].hse_tmTime , pub, sizeof(FLOAT)); BYTESWAP(gm_ahseHighScores[i].hse_tmTime);