GithubHelp home page GithubHelp logo

hengle / zstd-totk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrmystery-official/zstd-totk

0.0 1.0 0.0 1.01 MB

A C++ library to read and write files of The Legend of Zelda: Tears of the Kingdom, that are compressed with ZStd.

License: Apache License 2.0

C++ 11.27% C 88.73%

zstd-totk's Introduction

ZStd de/compressor for The Legend of Zelda: Tears of the Kingdom

A C++ library to read and write files compressed with ZStd.

Usage

First of all, include the ZStdFile.h header file. You have to create the required dictionaries, to do this, call the Initialize function and pass the path to the RomFS of TotK and add /Pack/ZsDic.pack.zs to it:

#include "ZStdFile.h"

int main()
{
    ZStdFile::Initialize("C:/Path/to/dump/Pack/ZsDic.pack.zs");
    return 0;
}

To decompress a file, use the Decompress function. Then you can write it to a new file or get the bytes:

#include "ZStdFile.h"

int main()
{
    ZStdFile::Initialize("C:/Path/to/dump/Pack/ZsDic.pack.zs");
    ZStdFile::Result Result = ZStdFile::Decompress("DgnObj_Small_CandlePoleC_04.pack.zs", ZStdFile::Dictionary::Pack);
    Result.WriteToFile("DgnObj_Small_CandlePoleC_04.pack"); //Decompressed file
    std::vector<unsigned char> Data = Result.Data; //Get the bytes of the decompressed file
    return 0;
}

To compress a file, call the Compress function.

int main()
{
    ZStdFile::Initialize("C:/Path/to/dump/Pack/ZsDic.pack.zs");
    ZStdFile::Compress(DecompressedBytes, ZStdFile::Dictionary::Pack).WriteToFile("DgnObj_Small_CandlePoleC_04.pack.zs");
    return 0;
}

You can use the following dictionaries:

  • None (hardly ever used)
  • Pack (for archive files)
  • BcettByaml (for all map files)
  • Base (for everything else)

zstd-totk's People

Contributors

mrmystery-official avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.