Fix the byte order on big-endian targets other than PowerPC: GCC defines __BIG_ENDIAN__ only on some architectures (PowerPC), not on MIPS or SPARC, so there the little-endian data files are read unswapped and the engine stops at the first pak header (IP30 Octane, mips64 big-endian): 256.0 megabyte heap Error: Hunk_AllocName_Raw: bad size: -1201766400 (pak0.pak dirlen 0x000054c0 read as 0xc0540000). Use the compiler's __BYTE_ORDER__ for the common.h swaps, the software renderer span loop, the SDL surface masks and the OSS sample format. Signed-off-by: René Rebe --- a/common/d_scan.c +++ b/common/d_scan.c @@ -914,7 +914,7 @@ D_DrawZSpans(espan_t *pspan) if ((doublecount = count >> 1) > 0) { do { -#ifdef __BIG_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ltemp = izi & 0xFFFF0000; izi += izistep; ltemp |= izi >> 16; --- a/common/sdl_common.c +++ b/common/sdl_common.c @@ -50,7 +50,7 @@ VID_SDL_SetIcon() #ifndef DISABLE_ICON SDL_Surface *surface; -#ifdef __BIG_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ const uint32_t rmask = 0xff000000; const uint32_t gmask = 0x00ff0000; const uint32_t bmask = 0x0000ff00; --- a/common/snd_oss.c +++ b/common/snd_oss.c @@ -42,7 +42,7 @@ static const int tryrates[] = { 48000, 2 static const unsigned num_tryrates = sizeof(tryrates) / sizeof(int); /* Request sound format as signed 16-bit (host-endian) */ -#ifdef __BIG_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #define TYRQ_AFMT_S16 AFMT_S16_BE #else #define TYRQ_AFMT_S16 AFMT_S16_LE --- a/include/common.h +++ b/include/common.h @@ -118,7 +118,7 @@ static inline int bswap32(int l) | (((l >> 24) & 255) << 0); } -#ifdef __BIG_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ static inline short BigShort(short s) { return s; } static inline int BigLong(int l) { return l; } static inline float BigFloat(float f) { return f; }