LowLevelMahn/cc_compression_test

simple CC uncompression unit-test

★ 0Forks 0C++GitHub ↗Compare

README

Background

While reverse engineering AlphaWaves/Continuum (https://www.mobygames.com/game/939/continuum/) i have found out that the game files were compressed. I disassembled the algorithm and found other games of Infogrames Europe SA that uses the same compression method. There is no real use for gamers but maybe that helps people like me have an easier start in reversing/modding some of these games

How did i validate the uncompression code

  • converted the orginal assembler code to semantical identical asm-like functions and then ported step by step - very slow and carefull :)
  • tested my uncompression by hooking into Dosbox - overwriting the original code - doing regression tests and even run the game itself with my code
  • i tried to keep the algorithm as picky as possible to detected any fails or loss of data etc. (any wrong change will normaly leads to endless-recursion or other fails very fast)

What is this repo?

  • Its a unit-test to test my reversed algorithm to uncompression CC0/CC1 files
  • the unit-test gets compressed and uncompressed reference data from the included test_data.bin file (given by commandline) and just uncompress and compare the result
  • the test_data.bin file contains compressed game data but is useless without knowing which part is from what game, unuseable for anything beside this test
  • the unit-test does not contain the file-handling stuff for real CC0/CC1 files but only the uncompression-algorithm
  • C++14, CMake - compiles/runs on Windows/Linux with clang,gcc,cl,CLion,QtCreator,MSVC,...

Games with CC0 or CC1 packed files

Datailed file list: https://github.com/LowLevelMahn/alpha_waves_loader/blob/main/tools/uncompress_cc/known_files.txt

How to find files with this compression?

search for byte pattern of the uncompression code

BF 01 03  mov di, 0x301
33 C0     xor ax, ax
F3 AB     rep stosw word ptr es:[di], ax
5F        pop di
07        pop es

use ripgrep

https://github.com/BurntSushi/ripgrep/releases - ripgrep-13.0.0-x86_64-pc-windows-msvc.zip no installation needed inside the zip is a rg.exe file, a grep like search program that can also search for byte patterns

use it on the command line to find files with the relevant pattern

prints on console

rg.exe -l --binary -uuu (?-u:\xBF\x01\x03\x33\xC0\xF3\xAB\x5F\x07) "c:\all_your_games_folder"

redirects the output to c:\temp\out.txt

rg.exe -l --binary -uuu (?-u:\xBF\x01\x03\x33\xC0\xF3\xAB\x5F\x07) "c:\all_your_games_folder" > c:\temp\out.txt

Contributors

LowLevelMahn

Issues