From 1efd59473075ca294db524f8cbb7a4b7a9960d45 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 13 Jun 2004 07:35:08 +0000 Subject: [PATCH] byte swap update --- stepmania/src/RageBitmapTexture.cpp | 1 - stepmania/src/RageDisplay_OGL.cpp | 3 +-- stepmania/src/RageSoundReader_Vorbisfile.cpp | 4 +--- stepmania/src/RageSoundReader_WAV.cpp | 12 +++++------- stepmania/src/RageSurface_Load_JPEG.cpp | 1 - stepmania/src/RageSurface_Load_PNG.cpp | 9 ++++----- 6 files changed, 11 insertions(+), 19 deletions(-) diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 301424b886..7b487c1d8e 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -10,7 +10,6 @@ #include "PrefsManager.h" #include "SDL.h" -#include "SDL_endian.h" #include "SDL_rotozoom.h" #include "SDL_utils.h" #include "SDL_dither.h" diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index a98741ee6d..efea9c4374 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -67,7 +67,6 @@ static struct GLExt_t #include "GameConstantsAndTypes.h" #include "StepMania.h" #include "RageUtil.h" -#include "SDL_endian.h" #include "arch/arch.h" #include "arch/LowLevelWindow/LowLevelWindow.h" @@ -254,7 +253,7 @@ struct GLPixFmtInfo_t { static void FixLilEndian() { -#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#if defined(ENDIAN_LITTLE) static bool Initialized = false; if( Initialized ) return; diff --git a/stepmania/src/RageSoundReader_Vorbisfile.cpp b/stepmania/src/RageSoundReader_Vorbisfile.cpp index 57c15d8f2b..bb94aae8c4 100644 --- a/stepmania/src/RageSoundReader_Vorbisfile.cpp +++ b/stepmania/src/RageSoundReader_Vorbisfile.cpp @@ -2,7 +2,6 @@ #include "RageUtil.h" #include "SDL_utils.h" -#include "SDL_endian.h" #include "RageSoundReader_Vorbisfile.h" #include "RageLog.h" @@ -58,7 +57,6 @@ static long OggRageFile_tell_func( void *datasource ) const int channels = 2; -/* The amount of data to read from SDL_sound at once. */ const int read_block_size = 1024; @@ -223,7 +221,7 @@ bool RageSoundReader_Vorbisfile::FillBuf() #if defined(INTEGER_VORBIS) ret = ov_read( vf, tmpbuf, sizeof(tmpbuf), &bstream ); #else // float vorbis decoder - ret = ov_read( vf, tmpbuf, sizeof(tmpbuf), (SDL_BYTEORDER == SDL_BIG_ENDIAN)?1:0, 2, 1, &bstream ); + ret = ov_read( vf, tmpbuf, sizeof(tmpbuf), (BYTE_ORDER == BIG_ENDIAN)?1:0, 2, 1, &bstream ); #endif if( ret == OV_HOLE ) diff --git a/stepmania/src/RageSoundReader_WAV.cpp b/stepmania/src/RageSoundReader_WAV.cpp index 40c84d9f5e..bcdb165ae1 100644 --- a/stepmania/src/RageSoundReader_WAV.cpp +++ b/stepmania/src/RageSoundReader_WAV.cpp @@ -3,8 +3,6 @@ #include "RageLog.h" #include "RageUtil.h" -#include - #define BAIL_IF_MACRO(c, e, r) if (c) { SetError(e); return r; } #define RETURN_IF_MACRO(c, r) if (c) return r; @@ -53,7 +51,7 @@ bool RageSoundReader_WAV::read_le16( RageFile &f, int16_t *si16 ) const SetError( ret >= 0? "end of file": f.GetError().c_str() ); return false; } - *si16 = SDL_SwapLE16( *si16 ); + *si16 = Swap16LE( *si16 ); return true; } @@ -65,7 +63,7 @@ bool RageSoundReader_WAV::read_le16( RageFile &f, uint16_t *ui16 ) const SetError( ret >= 0? "end of file": f.GetError().c_str() ); return false; } - *ui16 = SDL_SwapLE16(*ui16); + *ui16 = Swap16LE(*ui16); return true; } @@ -79,7 +77,7 @@ bool RageSoundReader_WAV::read_le32( RageFile &f, int32_t *si32 ) const SetError( ret >= 0? "end of file": f.GetError().c_str() ); return false; } - *si32 = SDL_SwapLE32( *si32 ); + *si32 = Swap32LE( *si32 ); return true; } @@ -91,7 +89,7 @@ bool RageSoundReader_WAV::read_le32( RageFile &f, uint32_t *ui32 ) const SetError( ret >= 0? "end of file": f.GetError().c_str() ); return false; } - *ui32 = SDL_SwapLE32( *ui32 ); + *ui32 = Swap32LE( *ui32 ); return true; } @@ -552,7 +550,7 @@ int RageSoundReader_WAV::Read(char *buf, unsigned len) const int cnt = len / sizeof(int16_t); int16_t *tbuf = (int16_t *) buf; for( int i = 0; i < cnt; ++i ) - tbuf[i] = SDL_Swap16( tbuf[i] ); + tbuf[i] = Swap16( tbuf[i] ); #endif } diff --git a/stepmania/src/RageSurface_Load_JPEG.cpp b/stepmania/src/RageSurface_Load_JPEG.cpp index 39313b17e9..080a9a004e 100644 --- a/stepmania/src/RageSurface_Load_JPEG.cpp +++ b/stepmania/src/RageSurface_Load_JPEG.cpp @@ -3,7 +3,6 @@ #include "RageUtil.h" #include "RageLog.h" #include "SDL_utils.h" -#include "SDL_endian.h" #include "RageFile.h" #include diff --git a/stepmania/src/RageSurface_Load_PNG.cpp b/stepmania/src/RageSurface_Load_PNG.cpp index 1473e142fb..33cc1f7d21 100644 --- a/stepmania/src/RageSurface_Load_PNG.cpp +++ b/stepmania/src/RageSurface_Load_PNG.cpp @@ -3,7 +3,6 @@ #include "RageUtil.h" #include "RageLog.h" #include "SDL_utils.h" -#include "SDL_endian.h" #include "RageFile.h" #if defined(WIN32) @@ -209,10 +208,10 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro case RGBX: case RGBA: img = SDL_CreateRGBSurfaceSane( SDL_SWSURFACE, width, height, 32, - SDL_SwapBE32( 0xFF000000 ), - SDL_SwapBE32( 0x00FF0000 ), - SDL_SwapBE32( 0x0000FF00 ), - SDL_SwapBE32( type == RGBA? 0x000000FF:0x00000000 ) ); + Swap32BE( 0xFF000000 ), + Swap32BE( 0x00FF0000 ), + Swap32BE( 0x0000FF00 ), + Swap32BE( type == RGBA? 0x000000FF:0x00000000 ) ); break; default: FAIL_M(ssprintf( "%i", type) );