This is an example of how to decompress .ch and .th binary files.
This is an example of how to list things you need to use the software and how to install them.
import zlib
import sys
with open(sys.argv[1], 'rb') as f:
content = f.read()
decompress = zlib.decompressobj(-zlib.MAX_WBITS)
inflated = decompress.decompress(content[14:])
inflated += decompress.flush()
print(inflated[:-1].decode('utf-8', errors='ignore'))
./decompress.py .\includes\sigawin.ch > sigawin.ch
param (
[string]$filePath
)
Add-Type -AssemblyName System.IO.Compression
$bytes = [System.IO.File]::ReadAllBytes($filePath)
$compressedContent = $bytes[14..($bytes.Length - 1)]
$stream = New-Object System.IO.MemoryStream
$stream.Write($compressedContent, 0, $compressedContent.Length)
$stream.Position = 0
$decompressor = New-Object System.IO.Compression.DeflateStream($stream, [System.IO.Compression.CompressionMode]::Decompress)
$reader = New-Object System.IO.StreamReader($decompressor, [System.Text.Encoding]::UTF8)
$inflated = $reader.ReadToEnd()
$reader.Close()
Write-Output ($inflated.Trim())
pwsh .\decompress.ps1 -filePath ".\includes\sigawin.ch" > .\sigawin.ch
Distributed under the MIT License. See LICENSE.txt
for more information.