forked from Keelrleek/Harbor
Board: Decomp view (progress tiers, function inspector, next up per band, deferred) and RE tools in Health; Verified tier from the emulator
This commit is contained in:
1 parent
a9efc2e5c5
commit
87631bec52
5 files changed
+331
-6
No files matched your search
@@ -161,10 +161,29 @@ class Reverse:
|
||||
if re.fullmatch(r"(0x)?[0-9A-Fa-f]{5,8}", text):
|
||||
return int(text, 16)
|
||||
addr = self.address_of(text)
|
||||
if addr is None:
|
||||
addr = self._mac_index().get(text) or self._mac_index().get(text.replace("::", "_"))
|
||||
if addr is None:
|
||||
raise HarborError(f"{target!r} is neither an address nor a known name")
|
||||
return addr
|
||||
|
||||
def _mac_index(self):
|
||||
"""Original names from the Mac build -> PC address: 'CanCarry', 'TradeMenu::DoTrade', 'TradeMenu_DoTrade'."""
|
||||
def load(p):
|
||||
out = {}
|
||||
if p:
|
||||
for row in csv.DictReader(p.read_text(encoding="utf-8").splitlines()):
|
||||
head = (row.get("demangled") or "").split("(", 1)[0].strip()
|
||||
try:
|
||||
addr = int(row["pc_address"], 16)
|
||||
except (KeyError, ValueError):
|
||||
continue
|
||||
if head:
|
||||
out.setdefault(head, addr)
|
||||
out.setdefault(head.replace("::", "_"), addr)
|
||||
return out
|
||||
return self._load("mac_index", self.mac_names, load)
|
||||
|
||||
def convention(self, addr):
|
||||
"""The calling convention read from the bytes: register inputs (a dataflow pass) and the `ret N` cleanup."""
|
||||
if not self.conventions_path or not self.conventions_path.exists():
|
||||
|
||||
Reference in new issue
Block a user