mirror of
https://github.com/izzy2lost/Torch.git
synced 2026-07-06 00:18:35 -07:00
Support virtual addrs lookup
This commit is contained in:
+14
-1
@@ -405,6 +405,11 @@ void Companion::ParseCurrentFileConfig(YAML::Node node) {
|
||||
}
|
||||
}
|
||||
|
||||
if (node["virtual"]) {
|
||||
auto virtualAddrMap = node["virtual"];
|
||||
gVirtualAddrMap[gCurrentFile] = std::make_tuple<uint32_t, uint32_t>(virtualAddrMap[0].as<uint32_t>(), virtualAddrMap[1].as<uint32_t>());
|
||||
}
|
||||
|
||||
if(node["header"]) {
|
||||
auto header = node["header"];
|
||||
switch (this->gConfig.exporterType) {
|
||||
@@ -1400,11 +1405,19 @@ std::optional<std::uint32_t> Companion::GetFileOffsetFromSegmentedAddr(const uin
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<std::tuple<std::string, YAML::Node>> Companion::GetNodeByAddr(const uint32_t 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
|
||||
if (addr & 0x80000000) {
|
||||
if (gVirtualAddrMap.contains(gCurrentFile)) {
|
||||
addr -= std::get<0>(gVirtualAddrMap[gCurrentFile]);
|
||||
addr += std::get<1>(gVirtualAddrMap[gCurrentFile]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!this->gAddrMap[this->gCurrentFile].contains(addr)){
|
||||
for (auto &file : this->gCurrentExternalFiles) {
|
||||
if (!this->gAddrMap.contains(file)) {
|
||||
|
||||
Reference in New Issue
Block a user