Skip to content

ristcdecrunchlib

This library has one function, STCDecrunch, which unpacks a data file packed with StoneCracker 4.04 (a file that begins with the letters S404) that is already in memory. It unpacks the file either over itself or to a separate block of memory the program provides. It is the counterpart of the RI StoneCracker library, whose functions tell the sizes needed and where the data are after unpacking in place. It works in Amiga and Blitz mode.

For damaged data the unpacking code writes nothing outside the destination and returns 0; it does not check what it reads, so such data can unpack wrong. It is a little faster than the original’s: about 4 % on a large file, and a call on a tiny file about 7 %.

The fixed bugs of the libraries are listed in Fixes in ristonecrackerlib and ristcdecrunchlib.

Based on the RI STCDecrunch Lib guide by Reflective Images.

Library number 18.

Commands

STCDecrunch

Unpacks the StoneCracker 4.04 file at source in memory. With only source, it unpacks the file over itself and returns the address of the unpacked data; with dest, it unpacks to dest and returns 1. Both forms return 0 if source holds no such file, and for damaged data that would write outside the destination.

Statement or function, result .l. Help text: source[,dest]
2 forms:

  • .l
  • .l, .l

Unpacking in place needs a block of at least STCSafeLen bytes, and the data begin at the address the function returns, the same as STCStart. A dest block must hold the unpacked length, which STCLength tells.