This repository contains code to read files within an archive format called LS. This format is used by KOEI in the game Sangokushi Sōsōden and potentially other games, though I don't have access to verify this.
spdlog
is used for logging. googletest
is used for test.
This archive format and the decompression algorithm is first reverse-engineered by van from a Chinese game forum. Maxwell from the same forum explained the algorithm in detail. Please note both links are to posts in Chinese language. Functions getBits
, getCode
, and decode
are originally written by van.
The LS archive format supports both compressed and uncompressed data. The file structure consists of four parts:
- The first 16 bytes of the file.
- Possible values: "Ls11" or "Ls12".
- The next 256 bytes.
- Used for decompressing data.
- A group of 12-byte entries, each providing size information for embedded files.
- Each entry consists of:
-
- 4 bytes for the compressed size.
-
- 4 bytes for the original size.
-
- 4 bytes for the offset of the file data within the archive.
- This section ends with 4 bytes of 0.
- Contains the actual data of the files included in the archive.
This file is a valid LS archive. It has four files of which two are compressed.