diff options
| author | inspectredc <inspectredc@gmail.com> | 2025-07-02 18:55:50 +0100 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2025-07-04 17:40:01 -0600 |
| commit | 8b5ef9129c2106564f0cfbc7f6dd934b5b5884ae (patch) | |
| tree | eeae600d95c2a2b2c3e2aeea75937a2b9a2b8c83 /src/utils/Decompressor.cpp | |
| parent | bc2736adb1b3b3fc7e110cb3a518a7bbe8af65d8 (diff) | |
ma2d1 support
Diffstat (limited to 'src/utils/Decompressor.cpp')
| -rw-r--r-- | src/utils/Decompressor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils/Decompressor.cpp b/src/utils/Decompressor.cpp index 1fee382..5139fcc 100644 --- a/src/utils/Decompressor.cpp +++ b/src/utils/Decompressor.cpp @@ -7,6 +7,7 @@ extern "C" { #include <libmio0/mio0.h> #include <libyay0/yay0.h> +#include <libyay0/yay1.h> #include <libmio0/tkmk00.h> } @@ -43,6 +44,17 @@ DataChunk* Decompressor::Decode(const std::vector<uint8_t>& buffer, const uint32 gCachedChunks[offset] = new DataChunk{ decompressed, size }; return gCachedChunks[offset]; } + case CompressionType::YAY1: { + uint32_t size = 0; + uint8_t* decompressed = yay1_decode(in_buf, &size); + + if(!decompressed){ + throw std::runtime_error("Failed to decode YAY1"); + } + + gCachedChunks[offset] = new DataChunk{ decompressed, size }; + return gCachedChunks[offset]; + } default: throw std::runtime_error("Unknown compression type"); } @@ -106,6 +118,7 @@ DecompressedData Decompressor::AutoDecode(YAML::Node& node, std::vector<uint8_t> // Extract a compressed file which contains many assets. switch(type) { case CompressionType::YAY0: + case CompressionType::YAY1: case CompressionType::MIO0: { offset = ASSET_PTR(offset); @@ -181,6 +194,10 @@ CompressionType Decompressor::GetCompressionType(std::vector<uint8_t>& buffer, c return CompressionType::YAY0; } + if (header == "Yay1") { + return CompressionType::YAY1; + } + if (header == "Yaz0") { return CompressionType::YAZ0; } |
