Categorygithub.com/amaanq/sc-compression
repositorypackage
0.0.0-20220326210801-13b121db4dda
Repository: https://github.com/amaanq/sc-compression.git
Documentation: pkg.go.dev

# README

A Go package to decompress Supercell game asset files

Installation

go get -u github.com/amaanq/sc-compression

Usage

Let's say you have a Supercell game file called "missions.csv" located in the project directory and you'd like to decompress it, here's how to do it:

package main

import (
    "ioutil"
    "os"

    "github.com/amaanq/sc-compression"
)

func main() {
    fd, err := os.Open("missions.csv")
	if err != nil {
		panic(err)
	}
	defer fd.Close()

    decompressor := ScCompression.NewDecompressor(fd)
    data, err := decompressor.Decompress()
    if err != nil {
        panic(err)
    }

    data_bytes, err := ioutil.ReadAll(data)
    fmt.Println(string(data_bytes))

    decompFile, err := os.Create("missions_decompressed.csv")
    if err != nil {
        panic(err)
    }
    defer decompFile.Close()
    decompFile.Write(data_bytes)
}

Want to Contribute?

Submit a pull request or reach out to me (check my profile)


TODO

- [x] Use readers instead of byte arrays to prevent out of memory panics

- [ ] Implement LZHAM for the SCLZ signature

- [ ] Add compressor capability



Special Credits to @jeanbmar as his tool in Javascript was most helpful in making this myself: sc-compression