summaryrefslogtreecommitdiff
path: root/src/Companion.cpp
diff options
context:
space:
mode:
authorinspectredc <inspectredc@gmail.com>2025-06-19 14:36:00 +0100
committerLywx <kiritodev01@gmail.com>2025-07-04 17:41:27 -0600
commit59773d06d9ee0fcd6e61d204869c9816f59216b0 (patch)
tree2b0a93f0d4e0b65d11cb1777c3742335a747dc0d /src/Companion.cpp
parent5e334dc8c7dfc055a7a6bfadaee43735d4ab6692 (diff)
Support Vtx Overlaps
Diffstat (limited to 'src/Companion.cpp')
-rw-r--r--src/Companion.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp
index e16a99f..7815498 100644
--- a/src/Companion.cpp
+++ b/src/Companion.cpp
@@ -1405,12 +1405,7 @@ std::optional<std::uint32_t> Companion::GetFileOffsetFromSegmentedAddr(const uin
return std::nullopt;
}
-std::optional<std::tuple<std::string, YAML::Node>> Companion::GetNodeByAddr(uint32_t addr){
- if(!this->gAddrMap.contains(this->gCurrentFile)){
- return std::nullopt;
- }
-
- // HACK: Adjust address to rom address if virtual address
+uint32_t Companion::PatchVirtualAddr(uint32_t addr) {
if (addr & 0x80000000) {
if (gVirtualAddrMap.contains(gCurrentFile)) {
addr -= std::get<0>(gVirtualAddrMap[gCurrentFile]);
@@ -1418,6 +1413,17 @@ std::optional<std::tuple<std::string, YAML::Node>> Companion::GetNodeByAddr(uint
}
}
+ return addr;
+}
+
+std::optional<std::tuple<std::string, YAML::Node>> Companion::GetNodeByAddr(uint32_t addr){
+ if(!this->gAddrMap.contains(this->gCurrentFile)){
+ return std::nullopt;
+ }
+
+ // HACK: Adjust address to rom address if virtual address
+ addr = PatchVirtualAddr(addr);
+
if(!this->gAddrMap[this->gCurrentFile].contains(addr)){
for (auto &file : this->gCurrentExternalFiles) {
if (!this->gAddrMap.contains(file)) {