From 8d9dc0237436c6f8a9720cb9b8d9cc59e6382326 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 23 May 2022 23:21:42 +0300 Subject: [PATCH] SCUMM: Change the HE lipsync timer math to a cleaner and safer version --- engines/scumm/he/sound_he.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 9e3b3e8c454..37303347bb0 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -658,7 +658,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags, // can do without it, using a LoopingAudioStream. if (_heChannel[heChannel].timer) - _heChannel[heChannel].timer = size / nChan * samplesPerBlock / blockAlign * 1000 / rate; + _heChannel[heChannel].timer = (int)(((int64)size * samplesPerBlock * 1000) / ((int64)rate * blockAlign * nChan)); byte *sound = (byte *)malloc(size * 4); /* On systems where it matters, malloc will return