From bae788fc45a73174aeb48754a7254d3e0f3a7c2c Mon Sep 17 00:00:00 2001 From: disinvite Date: Sat, 23 Mar 2024 17:06:58 -0400 Subject: [PATCH] Simplify vtable name check --- tools/isledecomp/isledecomp/compare/db.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/isledecomp/isledecomp/compare/db.py b/tools/isledecomp/isledecomp/compare/db.py index 5eda5be2..f758be0c 100644 --- a/tools/isledecomp/isledecomp/compare/db.py +++ b/tools/isledecomp/isledecomp/compare/db.py @@ -358,21 +358,24 @@ def match_function(self, addr: int, name: str) -> bool: def match_vtable( self, addr: int, name: str, base_class: Optional[str] = None ) -> bool: - temp_base = base_class if base_class is not None else name - - name_option0 = f"{name}::`vftable'" - name_option1 = f"{name}::`vftable'{{for `{temp_base}'}}" + # Only allow a match against "Class:`vftable'" + # if this is the derived class. + name = ( + f"{name}::`vftable'" + if base_class is None or base_class == name + else f"{name}::`vftable'{{for `{base_class}'}}" + ) row = self._db.execute( """ SELECT recomp_addr FROM `symbols` WHERE orig_addr IS NULL - AND (name = ? OR name = ?) + AND name = ? AND (compare_type = ?) LIMIT 1 """, - (name_option0, name_option1, SymbolType.VTABLE.value), + (name, SymbolType.VTABLE.value), ).fetchone() if row is not None and self.set_pair(addr, row[0], SymbolType.VTABLE):