summaryrefslogtreecommitdiff
path: root/src/Companion.cpp
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2024-03-25 11:57:01 -0600
committerKiritoDv <kiritodev01@gmail.com>2024-03-25 11:57:01 -0600
commit5a6f8adc024e53d5d53cb7abc58009312088dd3d (patch)
treee32e8d8c594a82f5687e5d75360173dfcdcfe192 /src/Companion.cpp
parent2907da7d6162377bb525beec4399eb60a93a6b70 (diff)
Fixed overlap detection and random crash
Diffstat (limited to 'src/Companion.cpp')
-rw-r--r--src/Companion.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp
index 886f152..3228eb4 100644
--- a/src/Companion.cpp
+++ b/src/Companion.cpp
@@ -842,7 +842,10 @@ void Companion::Process() {
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 << "\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);
+ } 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();
@@ -863,11 +866,6 @@ void Companion::Process() {
} 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);
- }
}
}