diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2023-08-19 23:55:59 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2023-08-19 23:55:59 -0600 |
| commit | 15a0cf5498b60fa1442d049dbe5bb856022b5641 (patch) | |
| tree | 16299bd2cb1613297ffdc99ba0a992ebdd2aeac0 /src/factories/BlobFactory.cpp | |
| parent | f3402d8c9fe789d3f8a43edbd2a07e06b17a292b (diff) | |
Added support to extract skyboxes and cake
Diffstat (limited to 'src/factories/BlobFactory.cpp')
| -rw-r--r-- | src/factories/BlobFactory.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/factories/BlobFactory.cpp b/src/factories/BlobFactory.cpp new file mode 100644 index 0000000..c9e52a9 --- /dev/null +++ b/src/factories/BlobFactory.cpp @@ -0,0 +1,34 @@ +#include "BlobFactory.h" + +#include <iostream> +#include <filesystem> +#include "Companion.h" +#include "utils/MIODecoder.h" + +namespace fs = std::filesystem; + +bool BlobFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, std::vector<uint8_t>& buffer) { + auto metadata = data["offsets"]; + if(!metadata[1].contains("us")){ + return false; + } + + WRITE_HEADER(this->type, 0); + + size_t size = metadata[0]; + auto offsets = metadata[1]["us"]; + + auto* blob = new uint8_t[size]; + if(this->isMIOChunk){ + auto mio0 = MIO0Decoder::Decode(buffer, offsets[0]); + memcpy(blob, mio0.data() + offsets[1], size); + } else { + memcpy(blob, buffer.data() + offsets[0], size); + } + + WRITE_U32(size); // Blob Data Size + WRITE_ARRAY(blob, size); // Blob Data + + delete[] blob; + return true; +}
\ No newline at end of file |
