endianness test is now done at runtime and not at compile time; this allows cross-compilation and makes some stuff quite easier (namely cross-building universal binaries on mac)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3548 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-05-29 00:55:43 +00:00
parent f16339fc9f
commit 21c5795deb
3 changed files with 12 additions and 8 deletions

View File

@ -33,7 +33,7 @@
MusicOggStream::MusicOggStream() MusicOggStream::MusicOggStream()
{ {
//m_oggStream= NULL; //m_oggStream= NULL;
m_soundBuffers[0]= m_soundBuffers[1]= 0; m_soundBuffers[0] = m_soundBuffers[1]= 0;
m_soundSource= 0; m_soundSource= 0;
m_pausedMusic= true; m_pausedMusic= true;
} // MusicOggStream } // MusicOggStream

View File

@ -140,11 +140,15 @@ void SFXManager::loadSfx()
} // loadSfx } // loadSfx
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#if defined(WORDS_BIGENDIAN) // the ogg loader needs to know about endianness so do a simple test.
#define OGG_ENDIAN 1 // 0 : little endian
#else // 1 : big endian
#define OGG_ENDIAN 0 // I'm doing it at runtime rather than at compile-time to be friendly with
#endif // cross-compilation (universal binaries on mac, namely)
static const int endianness_test = 0x01000000;
static const char* endianness_test_ptr = (const char*)&endianness_test;
// in little-endian, byte 0 will be 0. in big endian, byte 0 will be 1
static const int ogg_endianness = endianness_test_ptr[0];
// Load a vorbis file into an OpenAL buffer // Load a vorbis file into an OpenAL buffer
// based on a routine by Peter Mulholland, used with permission (quote : "Feel free to use") // based on a routine by Peter Mulholland, used with permission (quote : "Feel free to use")
@ -181,7 +185,7 @@ bool loadVorbisBuffer(const char *name, ALuint buffer)
while (todo) while (todo)
{ {
int read = ov_read(&oggFile, bufpt, todo, OGG_ENDIAN, 2, 1, &bs); int read = ov_read(&oggFile, bufpt, todo, ogg_endianness, 2, 1, &bs);
todo -= read; todo -= read;
bufpt += read; bufpt += read;
} }

View File

@ -2035,7 +2035,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "# copy data files\n\necho \"Copying Data Files\"\n\nif [ \"${CONFIGURATION}\" = \"Release\" ]\nthen\n\nmkdir -p ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources/data\ncp -rf ${PROJECT_DIR}/../../../data ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources/\nfind ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/. -name \".svn\" -exec rm -rf '{}' > /dev/null \\; 2> /dev/null\n\nfi"; shellScript = "# copy data files\n\necho \"Copying Data Files\"\n\nif [ \"${CONFIGURATION}\" = \"Release\" ]\nthen\n\nmkdir -p ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources/data\ncp -rf ${PROJECT_DIR}/../../../data ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources/\n\nfi";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */