Skip to content

Instantly share code, notes, and snippets.

@bnnm
bnnm / icelib.c
Created September 23, 2022 23:21
/* Decodes Inti Creates' BIGRP files with custom codecs, found in games using their current
* "Inti Creates Engine" ("ICE") / "Imperial Engine" ('IMP'?). Engine's name is said to be
* the latter (ICE being the earlier iteration) but debug info still shows the former.
* Reverse engineered from various exes (if you use this as a base credit it, please).
*
* This code tries to follow the original closely for documentation purposes, with some extra
* error control (original doesn't check zlib errors or buf sizes) plus a few extra structs/functions
* that were likely inline'd (such as bitreaders). */
//TODO change to streaming decoder
@bnnm
bnnm / cwav.c
Created January 23, 2021 12:17
// Decompresses CWAV
#include <math.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
/* Decodes CWav (CompressWave) audio codec, based on original delphi/pascal source code by Ko-Ta:
// Decompresses XPCM codec 1/3 (just a test tool for vgmstream).
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
//#define XPCM_ALT 1
/* Decodes Circus's audio codec, reverse engineered from various .exe.
@bnnm
bnnm / lz4.c
Created March 7, 2020 00:14
LZ4 from XNB decompressor
// Decompresses LZ4 found in XNB (just a test tool for vgmstream).
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
/* Decompresses LZ4 from MonoGame. The original C lib has a lot of modes and configs, but
* MonoGame only uses the core 'block' part, which is a fairly simple LZ77 (has one command
* to copy literal and window values, with variable copy lengths).
@bnnm
bnnm / lzxexe.c
Created March 7, 2020 00:12
LZX from XNB decompressor
// Decompresses LZX found in XNB (just a test tool for vgmstream, may be of use for XMemCompress testing).
// Needs lzx.c/h, see below
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
/* lib from https://github.com/sumatrapdfreader/chmlib
* which is a cleaned-up version of https://github.com/jedwing/CHMLib */
@bnnm
bnnm / dec.c
Created December 27, 2019 01:24
Relic Codec dec.exe decompilation
/* Relic's dec.exe decompilation (by bnnm)
*
* Decodes .AIF files using Relic Codec (Homeworld 1/2, Warhammer 40000).
* dec.exe and the codec was presumably written by Janik Joire (he did
* the Winamp plugin and sound programming).
*
* Program should decode nearly identical to the original, with minor +-1 sample
* differences that probably depend on using the original Intel compiler and flags
* or minor double/float differences.
*