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/MIODecoder.cpp | |
| parent | 242f8acf212d143443dc2ce846507bdb82571902 (diff) | |
Refactored code and added per file config
Diffstat (limited to 'src/utils/MIODecoder.cpp')
| -rw-r--r-- | src/utils/MIODecoder.cpp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/utils/MIODecoder.cpp b/src/utils/MIODecoder.cpp deleted file mode 100644 index 7574e55..0000000 --- a/src/utils/MIODecoder.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "MIODecoder.h" -#include <stdexcept> - -extern "C" { -#include <libmio0/mio0.h> -} - -std::unordered_map<uint32_t, std::vector<uint8_t>> MIO0Decoder::gCachedChunks; - -std::vector<uint8_t>& MIO0Decoder::Decode(std::vector<uint8_t>& buffer, uint32_t offset) { - const unsigned char* in_buf = buffer.data() + offset; - - mio0_header_t head; - if(!mio0_decode_header(in_buf, &head)){ - throw std::runtime_error("Failed to decode MIO0 header"); - } - - auto decompressed = new uint8_t[head.dest_size]; - mio0_decode(in_buf, decompressed, nullptr); - gCachedChunks[offset] = std::vector<uint8_t>(decompressed, decompressed + head.dest_size); - - delete[] decompressed; - return gCachedChunks[offset]; -} - -void MIO0Decoder::ClearCache() { - gCachedChunks.clear(); -} |
