diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2023-09-21 09:52:11 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2023-09-21 09:52:11 -0600 |
| commit | bd9816ff4d47c11f5444afe6d47c2f61d126e154 (patch) | |
| tree | f9932c68c57133f4e2bb21aff935eb833d4f200b /src | |
| parent | 290d99632885b34bf38dd657309d148b7193d9b7 (diff) | |
Renamed a few textures and added mio0 debug factory
Diffstat (limited to 'src')
| -rw-r--r-- | src/Companion.cpp | 6 | ||||
| -rw-r--r-- | src/factories/debug/MIO0Factory.cpp | 22 | ||||
| -rw-r--r-- | src/factories/debug/MIO0Factory.h | 9 |
3 files changed, 36 insertions, 1 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp index c8ae0d5..8582c40 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -4,6 +4,7 @@ #include "utils/MIODecoder.h" #include "factories/RawFactory.h" #include "factories/BlobFactory.h" +#include "factories/debug/MIO0Factory.h" #include "factories/AudioHeaderFactory.h" #include "factories/SequenceFactory.h" #include "factories/SampleFactory.h" @@ -28,8 +29,11 @@ void Companion::Init() { this->RegisterFactory("BLOB", new BlobFactory()); // SM64 Specific - this->RegisterFactory("SM64:ANIM", new AnimFactory()); + + // Debug + this->RegisterFactory("MIO0", new MIO0Factory()); + this->Process(); } diff --git a/src/factories/debug/MIO0Factory.cpp b/src/factories/debug/MIO0Factory.cpp new file mode 100644 index 0000000..dd73f12 --- /dev/null +++ b/src/factories/debug/MIO0Factory.cpp @@ -0,0 +1,22 @@ +#include "MIO0Factory.h" +#include "utils/MIODecoder.h" + +namespace fs = std::filesystem; + +bool MIO0Factory::process(LUS::BinaryWriter* writer, YAML::Node& data, std::vector<uint8_t>& buffer) { + +// WRITE_HEADER(LUS::ResourceType::Blob, 0); + + auto offset = data["offset"].as<size_t>(); + + auto decoded = MIO0Decoder::Decode(buffer, offset); + auto size = decoded.size(); + auto* blob = new uint8_t[size]; + memcpy(blob, decoded.data(), size); + +// WRITE_U32(size); // MIO0 Data Size + WRITE_ARRAY(blob, size); // MIO0 Data + + delete[] blob; + return true; +} diff --git a/src/factories/debug/MIO0Factory.h b/src/factories/debug/MIO0Factory.h new file mode 100644 index 0000000..7df6ee9 --- /dev/null +++ b/src/factories/debug/MIO0Factory.h @@ -0,0 +1,9 @@ +#pragma once + +#include "../RawFactory.h" + +class MIO0Factory : public RawFactory { +public: + MIO0Factory() = default; + bool process(LUS::BinaryWriter* write, YAML::Node& data, std::vector<uint8_t>& buffer) override; +};
\ No newline at end of file |
