Files
source/ext/libsmacker
83b637aa73 libsmacker: allow overlapping copies in the 0x40 palette opcode
The color-shift opcode copies a run of palette entries from the previous
frame's palette to the current one. libsmacker rejected the copy when the
source and destination ranges overlapped, aborting the whole palette decode
and leaving the palette half-updated -- so every frame from the first such
opcode on rendered with a mix of the new and stale palette.

The overlap check is bogus: the copy reads from oldPalette, a snapshot taken
at the top of the function, and writes into s->palette, a separate buffer, so
overlapping ranges are harmless (and it is a memmove regardless). ffmpeg and
the original SMACKW32.DLL have no such check.

Several of the videos that ship with the game (Rebel_cr, Omerta, Prague) use
these overlapping copies, and showed washed-out colours with the previous
frame's palette bleeding through. Drop the overlap clause, keep the real
256-entry bounds checks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 19:01:37 -03:00
..
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00
2026-07-23 19:01:37 -03:00

libsmacker
A C library for decoding .smk Smacker Video files

version 1.2.0
2021-06-02

(c) Greg Kennedy 2013-2021
http://libsmacker.sourceforge.net
----

---
Introduction
---
libsmacker is a cross-platform C library which can be used for decoding Smacker Video files produced by RAD Game Tools. Smacker Video was the king of video middleware in the 1990s, and its 256-color compressed video format was used in over 2600 software titles.

libsmacker implements the minimum feature set required from smackw32.dll to get an smk off a disk and the frames / audio into a buffer in the correct order.

---
License
---
libsmacker is released under the Lesser GNU Public License, v2.1.  See the file COPYING for more information.

---
Usage
---
See the webpage for sample code and function documentation.  The source package additionally includes a pair of driver programs:
* driver.c - dumps all frames of a file to a bmp/ subdirectory, and all audio as raw streams to out_*.raw files in CWD
* smk2avi.c - converts smk file(s) to AVI files - uncompressed 24-bit color and PCM audio stream.

Though the libraries are "bulletproofed" the sample apps are not: be cautious if you plan to implement in some critical environment.

---
Changelog
---
1.2.0
* Major refactor of data structures for performance
* Merge all files into a single unified .c source file
* Support audio-only .smk files
1.1.1
* Re-license under LGPL 2.1
1.1
* Switch to autotools-based build
* Incorporates patches from Dalerank Slim, Gennady Trafimenkov, and Bianca van Schaik
* Performance improvements and code cleanup / safety.
1.0
* Initial revision

---
Contact
---
Questions/comments:
* by email: kennedy.greg@gmail.com
* by website: http://libsmacker.sourceforge.net

Enjoy!