[Scummvm-cvs-logs] SF.net SVN: scummvm:[47145] scummvm/trunk/backends/platform/n64

Hkz at users.sourceforge.net Hkz at users.sourceforge.net
Fri Jan 8 01:05:48 CET 2010


Revision: 47145
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47145&view=rev
Author:   Hkz
Date:     2010-01-08 00:05:48 +0000 (Fri, 08 Jan 2010)

Log Message:
-----------
Nintendo64: some cleanup, added a workaround in case audio buffers get depleted

Modified Paths:
--------------
    scummvm/trunk/backends/platform/n64/Makefile
    scummvm/trunk/backends/platform/n64/osys_n64_base.cpp
    scummvm/trunk/backends/platform/n64/osys_n64_utilities.cpp

Modified: scummvm/trunk/backends/platform/n64/Makefile
===================================================================
--- scummvm/trunk/backends/platform/n64/Makefile	2010-01-07 23:50:18 UTC (rev 47144)
+++ scummvm/trunk/backends/platform/n64/Makefile	2010-01-08 00:05:48 UTC (rev 47145)
@@ -18,6 +18,7 @@
 LIBS += -lpakfs -lframfs -ln64 -ln64utils -lromfs 
 
 DEFINES += -D_ENABLE_DEBUG_
+#DEFINES += -D_NORMAL_N64_DELAY_
 
 USE_LIBMAD=0
 USE_LIBOGG=1

Modified: scummvm/trunk/backends/platform/n64/osys_n64_base.cpp
===================================================================
--- scummvm/trunk/backends/platform/n64/osys_n64_base.cpp	2010-01-07 23:50:18 UTC (rev 47144)
+++ scummvm/trunk/backends/platform/n64/osys_n64_base.cpp	2010-01-08 00:05:48 UTC (rev 47145)
@@ -737,7 +737,22 @@
 }
 
 void OSystem_N64::delayMillis(uint msecs) {
+#ifndef _NORMAL_N64_DELAY_
+	// In some cases a game might hang waiting for audio being
+	// played. This is a workaround for all the situations i
+	// found (kyra 1 & 2 DOS).
+
+	uint32 oldTime = getMilliTick();
+	refillAudioBuffers();
+	uint32 pastMillis = (getMilliTick() - oldTime);
+
+	if (pastMillis >= msecs)
+		return;
+	else
+		delay(msecs - pastMillis);
+#else
 	delay(msecs);
+#endif
 }
 
 OSystem::MutexRef OSystem_N64::createMutex(void) {

Modified: scummvm/trunk/backends/platform/n64/osys_n64_utilities.cpp
===================================================================
--- scummvm/trunk/backends/platform/n64/osys_n64_utilities.cpp	2010-01-07 23:50:18 UTC (rev 47144)
+++ scummvm/trunk/backends/platform/n64/osys_n64_utilities.cpp	2010-01-08 00:05:48 UTC (rev 47145)
@@ -52,9 +52,9 @@
 	OSystem_N64 *osys = (OSystem_N64*)g_system;
 	Audio::MixerImpl *_localmixer = (Audio::MixerImpl*)osys->getMixer();
 
-	uint32 samples = 4096; // 4096 bytes -> 2048 samples.
+	uint32 sampleBufferSize = 3072;
 
-	initAudioInterface(osys->_viClockRate, DEFAULT_SOUND_SAMPLE_RATE, 16, samples);
+	initAudioInterface(osys->_viClockRate, DEFAULT_SOUND_SAMPLE_RATE, 16, sampleBufferSize);
 	osys->_audioBufferSize = getAIBufferSize();
 
 	if (_firstRun) {
@@ -81,14 +81,11 @@
 	// Switch display buffer
 	switchDisplayBuffer();
 
-#if 1
-	// If audio buffer got depleted, refill it.
+	// If audio buffer got depleted, ask for more slots to refill.
 	if (_audioEnabled && !AI_busy() && !_requiredSoundSlots) {
 		sndCallback();
 		sndCallback();
 	}
-#endif
-
 }
 
 void sndCallback() {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list