diff options
author | Fabio Battaglia | 2010-01-08 00:05:48 +0000 |
---|---|---|
committer | Fabio Battaglia | 2010-01-08 00:05:48 +0000 |
commit | ad5e1e7c0309df7676ce42e7dacd5ee17fb97ef4 (patch) | |
tree | 123d40af7413b3c7642ea26e650c77c4d55438ba /backends/platform/n64 | |
parent | a5adbb851a2a16bf7b8edc918be27faf2e46cea9 (diff) | |
download | scummvm-rg350-ad5e1e7c0309df7676ce42e7dacd5ee17fb97ef4.tar.gz scummvm-rg350-ad5e1e7c0309df7676ce42e7dacd5ee17fb97ef4.tar.bz2 scummvm-rg350-ad5e1e7c0309df7676ce42e7dacd5ee17fb97ef4.zip |
Nintendo64: some cleanup, added a workaround in case audio buffers get depleted
svn-id: r47145
Diffstat (limited to 'backends/platform/n64')
-rw-r--r-- | backends/platform/n64/Makefile | 1 | ||||
-rw-r--r-- | backends/platform/n64/osys_n64_base.cpp | 15 | ||||
-rw-r--r-- | backends/platform/n64/osys_n64_utilities.cpp | 9 |
3 files changed, 19 insertions, 6 deletions
diff --git a/backends/platform/n64/Makefile b/backends/platform/n64/Makefile index b5e0d2d6a4..a016e39233 100644 --- a/backends/platform/n64/Makefile +++ b/backends/platform/n64/Makefile @@ -18,6 +18,7 @@ DEFINES += -D__N64__ -DLIMIT_FPS -DNONSTANDARD_PORT -DDISABLE_DEFAULT_SAVEFILEMA LIBS += -lpakfs -lframfs -ln64 -ln64utils -lromfs DEFINES += -D_ENABLE_DEBUG_ +#DEFINES += -D_NORMAL_N64_DELAY_ USE_LIBMAD=0 USE_LIBOGG=1 diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index c5fa1a5d58..10c943b2cf 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -737,7 +737,22 @@ uint32 OSystem_N64::getMillis() { } 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) { diff --git a/backends/platform/n64/osys_n64_utilities.cpp b/backends/platform/n64/osys_n64_utilities.cpp index ae309638ac..969cbb8560 100644 --- a/backends/platform/n64/osys_n64_utilities.cpp +++ b/backends/platform/n64/osys_n64_utilities.cpp @@ -52,9 +52,9 @@ void enableAudioPlayback(void) { 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 @@ void vblCallback(void) { // 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() { |