aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/coktel_decoder.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp
index 905ffd6ff2..daebbd3ea9 100644
--- a/video/coktel_decoder.cpp
+++ b/video/coktel_decoder.cpp
@@ -2617,7 +2617,14 @@ int DPCMStream::readBuffer(int16 *buffer, const int numSamples) {
else
_buffer[i] += tableDPCM[data];
- *buffer++ = _buffer[i] = CLIP<int32>(_buffer[i], -32768, 32767);
+ // Emulating x86 16-bit signed register overflow
+ if (_buffer[i] > 32767) {
+ _buffer[i] -= 65536;
+ } else if (_buffer[i] < -32768) {
+ _buffer[i] += 65536;
+ }
+
+ *buffer++ = _buffer[i];
}
samples += _channels;