This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from io import BytesIO | |
| import struct | |
| import sys | |
| from typing import BinaryIO, cast, override | |
| # Based on LZSS.C by Haruhiko Okumura | |
| # https://web.archive.org/web/19990203141013/http://oak.oakland.edu/pub/simtelnet/msdos/arcutils/lz_comp2.zip | |
| # Compared to the original, the version used in DOOM is a bit different: | |
| # - The flag bits are inverted (0 = literal, 1 = compressed) | |
| # - The offset is encoded differently |