byte swap update

This commit is contained in:
Glenn Maynard
2004-06-13 07:35:08 +00:00
parent 59fc237f79
commit 1efd594730
6 changed files with 11 additions and 19 deletions
-1
View File
@@ -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"
+1 -2
View File
@@ -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;
+1 -3
View File
@@ -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 )
+5 -7
View File
@@ -3,8 +3,6 @@
#include "RageLog.h"
#include "RageUtil.h"
#include <SDL_endian.h>
#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
}
-1
View File
@@ -3,7 +3,6 @@
#include "RageUtil.h"
#include "RageLog.h"
#include "SDL_utils.h"
#include "SDL_endian.h"
#include "RageFile.h"
#include <setjmp.h>
+4 -5
View File
@@ -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) );