* gnu/packages/games.scm (teeworlds): New variable. * gnu/packages/patches/teeworlds-use-latest-wavpack.patch: New file. * gnu/local.mk (dist_patch_DATA): Add patch.
		
			
				
	
	
		
			84 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
Downloaded from https://anonscm.debian.org/cgit/pkg-games/teeworlds.git/plain/debian/patches/new-wavpack.patch.
 | 
						|
 | 
						|
This patch lets us build teeworlds with wavpack 5.1.0.
 | 
						|
 | 
						|
--- a/src/engine/client/sound.cpp
 | 
						|
+++ b/src/engine/client/sound.cpp
 | 
						|
@@ -328,17 +328,14 @@ void CSound::RateConvert(int SampleID)
 | 
						|
 	pSample->m_NumFrames = NumFrames;
 | 
						|
 }
 | 
						|
 
 | 
						|
-int CSound::ReadData(void *pBuffer, int Size)
 | 
						|
-{
 | 
						|
-	return io_read(ms_File, pBuffer, Size);
 | 
						|
-}
 | 
						|
-
 | 
						|
 int CSound::LoadWV(const char *pFilename)
 | 
						|
 {
 | 
						|
 	CSample *pSample;
 | 
						|
 	int SampleID = -1;
 | 
						|
 	char aError[100];
 | 
						|
 	WavpackContext *pContext;
 | 
						|
+	char aWholePath[1024];
 | 
						|
+	IOHANDLE File;
 | 
						|
 
 | 
						|
 	// don't waste memory on sound when we are stress testing
 | 
						|
 	if(g_Config.m_DbgStress)
 | 
						|
@@ -351,19 +348,23 @@ int CSound::LoadWV(const char *pFilename
 | 
						|
 	if(!m_pStorage)
 | 
						|
 		return -1;
 | 
						|
 
 | 
						|
-	ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
 | 
						|
-	if(!ms_File)
 | 
						|
+	File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL, aWholePath, sizeof(aWholePath));
 | 
						|
+	if(!File)
 | 
						|
 	{
 | 
						|
 		dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
 | 
						|
 		return -1;
 | 
						|
 	}
 | 
						|
+	else
 | 
						|
+	{
 | 
						|
+		io_close(File);
 | 
						|
+	}
 | 
						|
 
 | 
						|
 	SampleID = AllocID();
 | 
						|
 	if(SampleID < 0)
 | 
						|
 		return -1;
 | 
						|
 	pSample = &m_aSamples[SampleID];
 | 
						|
 
 | 
						|
-	pContext = WavpackOpenFileInput(ReadData, aError);
 | 
						|
+	pContext = WavpackOpenFileInput(aWholePath, aError, OPEN_2CH_MAX, 0);
 | 
						|
 	if (pContext)
 | 
						|
 	{
 | 
						|
 		int m_aSamples = WavpackGetNumSamples(pContext);
 | 
						|
@@ -419,9 +420,6 @@ int CSound::LoadWV(const char *pFilename
 | 
						|
 		dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError);
 | 
						|
 	}
 | 
						|
 
 | 
						|
-	io_close(ms_File);
 | 
						|
-	ms_File = NULL;
 | 
						|
-
 | 
						|
 	if(g_Config.m_Debug)
 | 
						|
 		dbg_msg("sound/wv", "loaded %s", pFilename);
 | 
						|
 
 | 
						|
@@ -527,7 +525,5 @@ void CSound::StopAll()
 | 
						|
 	lock_unlock(m_SoundLock);
 | 
						|
 }
 | 
						|
 
 | 
						|
-IOHANDLE CSound::ms_File = 0;
 | 
						|
-
 | 
						|
 IEngineSound *CreateEngineSound() { return new CSound; }
 | 
						|
 
 | 
						|
--- a/src/engine/client/sound.h
 | 
						|
+++ b/src/engine/client/sound.h
 | 
						|
@@ -21,10 +21,6 @@ public:
 | 
						|
 
 | 
						|
 	static void RateConvert(int SampleID);
 | 
						|
 
 | 
						|
-	// TODO: Refactor: clean this mess up
 | 
						|
-	static IOHANDLE ms_File;
 | 
						|
-	static int ReadData(void *pBuffer, int Size);
 | 
						|
-
 | 
						|
 	virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; }
 | 
						|
 
 | 
						|
 	virtual int LoadWV(const char *pFilename);
 |