Files
EGameTools/_IDAScripts/ExportClassH/IDAUtils.py

40 lines
1.6 KiB
Python
Raw Normal View History

2025-03-19 03:14:20 +02:00
from functools import cache
2025-03-16 10:25:30 +02:00
import idc
from ExportClassH import Utils
# def GetDemangledExportedSigs() -> list[str]:
# """
# Generate a list of demangled function signatures from IDA's database.
# Uses a set to avoid duplicate entries.
# """
# sigs_set = set()
# entry_qty = idc.get_entry_qty()
# for i in range(entry_qty):
# ea: int = idc.get_entry(i)
# exportedSig: str = idc.get_func_name(ea) or idc.get_name(ea)
# if not exportedSig:
# continue
# demangledExportedSig: str = Utils.DemangleSig(exportedSig)
# if demangledExportedSig and "~" not in demangledExportedSig and not demangledExportedSig.endswith("::$TSS0") and "::`vftable'" not in demangledExportedSig:
# sigs_set.add(demangledExportedSig)
# return list(sigs_set)
def GetDemangledExportedSigs() -> list[str]:
"""
Generate a list of demangled function signatures from IDA's database.
Uses a set to avoid duplicate entries based on (ordinal, signature).
"""
sigs_set = set()
entry_qty = idc.get_entry_qty()
for i in range(entry_qty):
ea: int = idc.get_entry(i)
2025-03-19 03:14:20 +02:00
#exportedSig: str = idc.get_func_name(ea) or idc.get_name(ea)
2025-03-16 10:25:30 +02:00
exportedSig = idc.get_entry_name(i)
if not exportedSig:
continue
demangledExportedSig: str = Utils.DemangleSig(exportedSig)
if demangledExportedSig and "~" not in demangledExportedSig and not demangledExportedSig.endswith("::$TSS0") and "::`vftable'" not in demangledExportedSig:
sigs_set.add((i + 1, demangledExportedSig))
return [sig for _, sig in sorted(sigs_set)]