diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-01-30 23:03:23 -0600 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2024-01-31 12:05:40 -0600 |
| commit | 4668cf08fb240da4abaafc073ba08d9d13ac0fa5 (patch) | |
| tree | 8ef2781da88920eeb1267225e73406e25a3c17b6 /src/utils/Decompressor.h | |
| parent | 242f8acf212d143443dc2ce846507bdb82571902 (diff) | |
Refactored code and added per file config
Diffstat (limited to 'src/utils/Decompressor.h')
| -rw-r--r-- | src/utils/Decompressor.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/utils/Decompressor.h b/src/utils/Decompressor.h new file mode 100644 index 0000000..1bd5c05 --- /dev/null +++ b/src/utils/Decompressor.h @@ -0,0 +1,36 @@ +#pragma once + +#include <vector> +#include <cstdint> +#include <unordered_map> +#include <yaml-cpp/yaml.h> + +enum class CompressionType { + MIO0, + Yay0, + Yaz0, + None, +}; + + +struct DataChunk { + uint8_t* data; + size_t size; +}; + +struct DecompressedData { + DataChunk* root; + DataChunk segment; +}; + +class Decompressor { +public: + static DataChunk* Decode(const std::vector<uint8_t>& buffer, uint32_t offset, CompressionType type); + static DecompressedData AutoDecode(YAML::Node& node, std::vector<uint8_t>& buffer); + static uint32_t TranslateAddr(uint32_t addr); + static bool IsSegmented(uint32_t addr); + static bool IsCompressed(YAML::Node& node); + static void CopyCompression(YAML::Node& from, YAML::Node& to); + + static void ClearCache(); +};
\ No newline at end of file |
