summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2024-03-27 09:35:45 -0600
committerKiritoDv <kiritodev01@gmail.com>2024-03-27 09:35:45 -0600
commit039c94a00787c720750fa07ba9840a3b6806a1f1 (patch)
treeb48df2972e74b875284a911a8fdfcbe72c2ce5bd
parent8196258d2b06afcb06bd71b4b95d4db6e9be0208 (diff)
Fixed overlap detection
-rw-r--r--src/Companion.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp
index e3d32d6..1f95e63 100644
--- a/src/Companion.cpp
+++ b/src/Companion.cpp
@@ -784,13 +784,16 @@ void Companion::Process() {
}
if(hasSize && i < entries.size() - 1 && this->gConfig.exporterType == ExportType::Code){
- uint32_t startptr = ASSET_PTR(result.endptr.value());
- uint32_t end = ASSET_PTR(entries[i + 1].addr);
+ int32_t startptr = ASSET_PTR(result.endptr.value());
+ int32_t end = ASSET_PTR(entries[i + 1].addr);
uint32_t alignment = entries[i + 1].alignment;
int32_t gap = end - startptr;
- if(gap < 0x10 && gap >= alignment && end % 0x10 == 0 && this->gEnablePadGen) {
+ if(gap < 0) {
+ stream << "// WARNING: Overlap detected between 0x" << std::hex << startptr << " and 0x" << end << " with size 0x" << std::abs(gap) << "\n";
+ SPDLOG_WARN("Overlap detected between 0x{:X} and 0x{:X} with size 0x{:X} on file {}", startptr, end, gap, this->gCurrentFile);
+ } else if(gap < 0x10 && gap >= alignment && end % 0x10 == 0 && this->gEnablePadGen) {
SPDLOG_WARN("Gap detected between 0x{:X} and 0x{:X} with size 0x{:X} on file {}", startptr, end, gap, this->gCurrentFile);
SPDLOG_WARN("Creating pad of 0x{:X} bytes", gap);
const auto padfile = this->gCurrentDirectory.filename().string();
@@ -809,12 +812,7 @@ void Companion::Process() {
stream << "\n";
}
} else if(gap > 0x10) {
- stream << "\n// WARNING: Gap detected between 0x" << std::hex << startptr << " and 0x" << end << " with size 0x" << gap << "\n";
- }
-
- if(gap < 0) {
- stream << "\n// WARNING: Overlap detected between 0x" << std::hex << startptr << " and 0x" << end << "\n";
- SPDLOG_WARN("Overlap detected between 0x{:X} and 0x{:X}", startptr, end);
+ stream << "// WARNING: Gap detected between 0x" << std::hex << startptr << " and 0x" << end << " with size 0x" << gap << "\n";
}
}
}