diff --git a/src/factories/AnimFactory.cpp b/src/factories/AnimFactory.cpp index 3ba83fe..7727220 100644 --- a/src/factories/AnimFactory.cpp +++ b/src/factories/AnimFactory.cpp @@ -9,7 +9,7 @@ namespace fs = std::filesystem; void WriteAnimationHeader(LUS::BinaryWriter* writer, nlohmann::json& offsets, std::vector& buffer) { - LUS::BinaryReader reader((char*) buffer.data() + offsets[0], offsets[1]); + LUS::BinaryReader reader((char*) buffer.data() + (size_t)offsets[0], offsets[1]); reader.SetEndianness(LUS::Endianness::Big); auto flags = reader.ReadInt16(); @@ -33,7 +33,7 @@ void WriteAnimationHeader(LUS::BinaryWriter* writer, nlohmann::json& offsets, st } void WriteAnimationIndex(LUS::BinaryWriter* writer, nlohmann::json& offsets, std::vector& buffer) { - LUS::BinaryReader reader((char*) buffer.data() + offsets[0], offsets[1]); + LUS::BinaryReader reader((char*) buffer.data() + (size_t)offsets[0], offsets[1]); reader.SetEndianness(LUS::Endianness::Big); size_t entries = ((size_t) offsets[1]); WRITE_U32(entries); @@ -44,7 +44,7 @@ void WriteAnimationIndex(LUS::BinaryWriter* writer, nlohmann::json& offsets, std } void WriteAnimationValues(LUS::BinaryWriter* writer, nlohmann::json& offsets, std::vector& buffer) { - LUS::BinaryReader reader((char*) buffer.data() + offsets[0], offsets[1]); + LUS::BinaryReader reader((char*) buffer.data() + (size_t)offsets[0], offsets[1]); reader.SetEndianness(LUS::Endianness::Big); size_t entries = ((size_t) offsets[1]); WRITE_U32(entries); @@ -64,4 +64,4 @@ bool AnimFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, std:: WriteAnimationValues(writer, metadata["values"], buffer); return true; -} \ No newline at end of file +} diff --git a/src/factories/BlobFactory.cpp b/src/factories/BlobFactory.cpp index b70c4e7..7071a45 100644 --- a/src/factories/BlobFactory.cpp +++ b/src/factories/BlobFactory.cpp @@ -25,9 +25,9 @@ bool BlobFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, std:: auto* blob = new uint8_t[size]; if(this->isMIOChunk){ auto mio0 = MIO0Decoder::Decode(buffer, offsets[0]); - memcpy(blob, mio0.data() + offsets[1], size); + memcpy(blob, mio0.data() + (size_t)offsets[1], size); } else { - memcpy(blob, buffer.data() + offsets[0], size); + memcpy(blob, buffer.data() + (size_t)offsets[0], size); } WRITE_U32(size); // Blob Data Size @@ -35,4 +35,4 @@ bool BlobFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, std:: delete[] blob; return true; -} \ No newline at end of file +} diff --git a/src/factories/TextureFactory.cpp b/src/factories/TextureFactory.cpp index 9fd431a..4c37fd5 100644 --- a/src/factories/TextureFactory.cpp +++ b/src/factories/TextureFactory.cpp @@ -64,9 +64,9 @@ bool TextureFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, st if(offsets.size() > 1){ auto mio0 = MIO0Decoder::Decode(buffer, offsets[0]); - memcpy(texture, mio0.data() + offsets[1], size); + memcpy(texture, mio0.data() + (size_t)offsets[1], size); } else { - memcpy(texture, buffer.data() + offsets[0], size); + memcpy(texture, buffer.data() + (size_t)offsets[0], size); } WRITE_U32(size); // Texture Data Size @@ -74,4 +74,4 @@ bool TextureFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, st delete[] texture; return true; -} \ No newline at end of file +} diff --git a/src/utils/MIODecoder.cpp b/src/utils/MIODecoder.cpp index 14f8eff..0a1698e 100644 --- a/src/utils/MIODecoder.cpp +++ b/src/utils/MIODecoder.cpp @@ -4,6 +4,7 @@ extern "C" { #include } #include +#include std::unordered_map> MIO0Decoder::gCachedChunks; @@ -25,4 +26,4 @@ std::vector& MIO0Decoder::Decode(std::vector& buffer, uint32_t of void MIO0Decoder::ClearCache() { gCachedChunks.clear(); -} \ No newline at end of file +} diff --git a/src/utils/MIODecoder.h b/src/utils/MIODecoder.h index 3e92cc0..0d60ef9 100644 --- a/src/utils/MIODecoder.h +++ b/src/utils/MIODecoder.h @@ -2,10 +2,11 @@ #include #include +#include class MIO0Decoder { public: static std::unordered_map> gCachedChunks; static std::vector& Decode(std::vector& buffer, uint32_t offset); static void ClearCache(); -}; \ No newline at end of file +};