From ea1224db081bfadf0c0ea4e1ec6a1e1df884021f Mon Sep 17 00:00:00 2001 From: disinvite Date: Thu, 28 Dec 2023 15:11:03 -0500 Subject: [PATCH] Add temp reference for entrypoints --- LEGO1/library_msvc.h | 11 +++++++++++ tools/isledecomp/isledecomp/bin.py | 8 ++++++++ tools/isledecomp/isledecomp/syminfo.py | 8 ++------ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 656fd6ee..d07ecef2 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -30,6 +30,17 @@ // LIBRARY: LEGO1 0x1008b640 // _rand +// entry +// LIBRARY: ISLE 0x4082e0 +// _WinMainCRTStartup + +// entry +// LIBRARY: LEGO1 0x1008c860 +// __DllMainCRTStartup@12 + +// LIBRARY: ISLE 0x409110 +// __mtinit + // LIBRARY: ISLE 0x409190 // __getptd diff --git a/tools/isledecomp/isledecomp/bin.py b/tools/isledecomp/isledecomp/bin.py index a1cd7854..ca6f13c5 100644 --- a/tools/isledecomp/isledecomp/bin.py +++ b/tools/isledecomp/isledecomp/bin.py @@ -81,6 +81,7 @@ def __init__(self, filename: str, logger=None) -> None: self.filename = filename self.file = None self.imagebase = None + self.entry = None self.sections: List[ImageSectionHeader] = [] self.last_section = None self._relocated_addrs = set() @@ -106,6 +107,8 @@ def __enter__(self): optional_hdr = self.file.read(pe_hdr.SizeOfOptionalHeader) (self.imagebase,) = struct.unpack(" int: section = self._get_section_by_name(name) return section.virtual_address + def get_abs_addr(self, section: int, offset: int) -> int: + """Convenience function for converting section:offset pairs from cvdump + into an absolute vaddr.""" + return self.get_section_offset_by_index(section) + offset + def get_raw_addr(self, vaddr: int) -> int: """Returns the raw offset in the PE binary for the given virtual address.""" self._set_section_for_vaddr(vaddr) diff --git a/tools/isledecomp/isledecomp/syminfo.py b/tools/isledecomp/isledecomp/syminfo.py index 3e33a8f2..1ecf0010 100644 --- a/tools/isledecomp/isledecomp/syminfo.py +++ b/tools/isledecomp/isledecomp/syminfo.py @@ -37,9 +37,7 @@ def __init__(self, pdb, sym_recompfile, sym_logger, base_dir): size = contrib_dict[(pub.section, pub.offset)] info = RecompiledInfo() - info.addr = pub.offset + sym_recompfile.get_section_offset_by_index( - pub.section - ) + info.addr = sym_recompfile.get_abs_addr(pub.section, pub.offset) info.start = 0 info.size = size @@ -52,9 +50,7 @@ def __init__(self, pdb, sym_recompfile, sym_logger, base_dir): continue info = RecompiledInfo() - info.addr = proc.offset + sym_recompfile.get_section_offset_by_index( - proc.section - ) + info.addr = sym_recompfile.get_abs_addr(proc.section, proc.offset) info.start = 0 info.size = proc.size