diff options
Diffstat (limited to 'games-action/teeworlds/files/0.6/02-fixed-wavpack-sound-loading.patch')
-rw-r--r-- | games-action/teeworlds/files/0.6/02-fixed-wavpack-sound-loading.patch | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/games-action/teeworlds/files/0.6/02-fixed-wavpack-sound-loading.patch b/games-action/teeworlds/files/0.6/02-fixed-wavpack-sound-loading.patch deleted file mode 100644 index e207a4a354bf..000000000000 --- a/games-action/teeworlds/files/0.6/02-fixed-wavpack-sound-loading.patch +++ /dev/null @@ -1,109 +0,0 @@ -commit b96981f5f23b4269108afb465f29a23abbd32ae2 -Author: hasufell <hasufell@gentoo.org> -Date: Thu Sep 5 12:31:19 2013 +0200 - - Fixing wavpack sound loading. Based on Gentoo Bugzilla - - From: Azamat H. Hackimov <azamat.hackimov@gmail.com> - - https://bugs.gentoo.org/show_bug.cgi?id=363395 - -diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp -index e32cac9..2a4c653 100644 ---- a/src/engine/client/sound.cpp -+++ b/src/engine/client/sound.cpp -@@ -51,6 +51,55 @@ struct CVoice - int m_X, m_Y; - } ; - -+#ifdef WAVPACK_H -+static int32_t ReadBytes(void *pFile, void *pBuffer, int32_t Size) -+{ -+ return (int32_t)io_read((IOHANDLE)pFile, pBuffer, Size); -+} -+static uint32_t GetPos(void *pFile) -+{ -+ return (uint32_t)io_tell((IOHANDLE)pFile); -+} -+static int SetPosAbs(void *pFile, uint32_t Offset) -+{ -+ return io_seek((IOHANDLE)pFile, Offset, IOSEEK_START); -+} -+static int SetPosRel(void *pFile, int32_t Offset, int Mode) -+{ -+ switch(Mode) -+ { -+ case SEEK_SET: -+ Mode = IOSEEK_START; -+ break; -+ case SEEK_CUR: -+ Mode = IOSEEK_CUR; -+ break; -+ case SEEK_END: -+ Mode = IOSEEK_END; -+ } -+ return io_seek((IOHANDLE)pFile, Offset, Mode); -+} -+ -+//TODO: Fix if 'real' functionality is needed by the wavpack header -+static int PushBackByte(void *pFile, int Char) -+{ -+ return io_seek((IOHANDLE)pFile, -1, IOSEEK_CUR); -+} -+static uint32_t GetLength(void *pFile) -+{ -+ return (uint32_t)io_length((IOHANDLE)pFile); -+} -+// Essentially assuming this to always be true, should fix if this isn't the case -+static int CanSeek(void *pFile) -+{ -+ return pFile != NULL; -+} -+static WavpackStreamReader CWavpackReader = { -+ ReadBytes, GetPos, SetPosAbs, SetPosRel, PushBackByte, GetLength, CanSeek, 0 -+}; -+#endif -+ -+ - static CSample m_aSamples[NUM_SAMPLES] = { {0} }; - static CVoice m_aVoices[NUM_VOICES] = { {0} }; - static CChannel m_aChannels[NUM_CHANNELS] = { {255, 0} }; -@@ -351,14 +400,12 @@ int CSound::LoadWV(const char *pFilename) - if(!m_pStorage) - return -1; - -- #ifndef WAVPACK_H - ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL); - if(!ms_File) - { - dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename); - return -1; - } -- #endif - - SampleID = AllocID(); - if(SampleID < 0) -@@ -368,7 +415,7 @@ int CSound::LoadWV(const char *pFilename) - #ifndef WAVPACK_H - pContext = WavpackOpenFileInput(ReadData, aError); - #else -- pContext = WavpackOpenFileInput(pFilename, aError, 0, 0); -+ pContext = WavpackOpenFileInputEx(&CWavpackReader, ms_File, 0, aError, 0, 0); - #endif - if (pContext) - { -@@ -422,13 +469,11 @@ int CSound::LoadWV(const char *pFilename) - } - else - { -- dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError); -+ dbg_msg("sound/wv", "failed to open '%s': %s", pFilename, aError); - } - -- #ifndef WAVPACK_H - io_close(ms_File); - ms_File = NULL; -- #endif - - if(g_Config.m_Debug) - dbg_msg("sound/wv", "loaded %s", pFilename); |