]> git.nihav.org Git - nihav.git/commitdiff
vmd: fix RLE decoding
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 15 Apr 2020 13:33:50 +0000 (15:33 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 15 Apr 2020 13:33:50 +0000 (15:33 +0200)
nihav-game/src/codecs/vmd.rs

index b81b4f5f1cf19d4ae41744d0da50702968a56448..520b57ce8ef6af3a7f7da8866ac4c967ac903570 100644 (file)
@@ -85,9 +85,11 @@ fn rle_unpack(br: &mut ByteReader, len: usize, dst: &mut [u8]) -> DecoderResult<
             let dst = &mut dst[dpos..][..len];
             br.read_buf(dst)?;
         } else {
-            let val = br.read_byte()?;
-            for i in 0..len {
-                dst[dpos + i] = val;
+            let val1 = br.read_byte()?;
+            let val2 = br.read_byte()?;
+            for i in (0..len).step_by(2) {
+                dst[dpos + i] = val1;
+                dst[dpos + i + 1] = val2;
             }
         }
         dpos += len;