summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2023-08-25 00:58:20 -0600
committerKiritoDv <kiritodev01@gmail.com>2023-08-25 00:58:20 -0600
commitf8e30c6b96947730f4a67d873de7914adb8186d2 (patch)
tree3298447112e086b852502766d730f96e99952b85 /src
parent64eddebf4d45b4775f6e9f248cbfaa1cb3ab55f2 (diff)
Fixed linux compilation
Diffstat (limited to 'src')
-rw-r--r--src/factories/AnimFactory.cpp8
-rw-r--r--src/factories/BlobFactory.cpp6
-rw-r--r--src/factories/TextureFactory.cpp6
-rw-r--r--src/utils/MIODecoder.cpp3
-rw-r--r--src/utils/MIODecoder.h3
5 files changed, 14 insertions, 12 deletions
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<uint8_t>& 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<uint8_t>& 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<uint8_t>& 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 <libmio0/mio0.h>
}
#include <stdexcept>
+#include <cstdint>
std::unordered_map<uint32_t, std::vector<char>> MIO0Decoder::gCachedChunks;
@@ -25,4 +26,4 @@ std::vector<char>& MIO0Decoder::Decode(std::vector<uint8_t>& 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 <vector>
#include <unordered_map>
+#include <cstdint>
class MIO0Decoder {
public:
static std::unordered_map<uint32_t, std::vector<char>> gCachedChunks;
static std::vector<char>& Decode(std::vector<uint8_t>& buffer, uint32_t offset);
static void ClearCache();
-}; \ No newline at end of file
+};