mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 00:31:16 +00:00
run linter + formatter
This commit is contained in:
parent
36d6167057
commit
f906c2c355
@ -228,7 +228,6 @@ def log_and_track_failure(
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
if GLOBALS.running_from_ghidra:
|
if GLOBALS.running_from_ghidra:
|
||||||
origfile_name = getProgramFile().getName()
|
origfile_name = getProgramFile().getName()
|
||||||
|
|
||||||
@ -237,7 +236,9 @@ def main():
|
|||||||
elif origfile_name in ["LEGO1D.DLL", "BETA10.DLL"]:
|
elif origfile_name in ["LEGO1D.DLL", "BETA10.DLL"]:
|
||||||
module = SupportedModules.BETA10
|
module = SupportedModules.BETA10
|
||||||
else:
|
else:
|
||||||
raise Lego1Exception(f"Unsupported file name in import script: {origfile_name}")
|
raise Lego1Exception(
|
||||||
|
f"Unsupported file name in import script: {origfile_name}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
module = SupportedModules.LEGO1
|
module = SupportedModules.LEGO1
|
||||||
|
|
||||||
@ -262,7 +263,9 @@ def main():
|
|||||||
with Bin(str(origfile_path), find_str=True) as origfile, Bin(
|
with Bin(str(origfile_path), find_str=True) as origfile, Bin(
|
||||||
str(recompiledfile_path)
|
str(recompiledfile_path)
|
||||||
) as recompfile:
|
) as recompfile:
|
||||||
isle_compare = IsleCompare(origfile, recompfile, str(pdbfile_path), str(repo_root))
|
isle_compare = IsleCompare(
|
||||||
|
origfile, recompfile, str(pdbfile_path), str(repo_root)
|
||||||
|
)
|
||||||
|
|
||||||
logger.info("Comparison complete.")
|
logger.info("Comparison complete.")
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
class PdbFunctionImporter(ABC):
|
class PdbFunctionImporter(ABC):
|
||||||
"""A representation of a function from the PDB with each type replaced by a Ghidra type instance."""
|
"""A representation of a function from the PDB with each type replaced by a Ghidra type instance."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
api: FlatProgramAPI,
|
api: FlatProgramAPI,
|
||||||
@ -71,10 +72,12 @@ def build(api: FlatProgramAPI, func: PdbFunction, type_importer: "PdbTypeImporte
|
|||||||
)
|
)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def matches_ghidra_function(self, ghidra_function: Function) -> bool: ...
|
def matches_ghidra_function(self, ghidra_function: Function) -> bool:
|
||||||
|
...
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def overwrite_ghidra_function(self, ghidra_function: Function): ...
|
def overwrite_ghidra_function(self, ghidra_function: Function):
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
class ThunkPdbFunctionImport(PdbFunctionImporter):
|
class ThunkPdbFunctionImport(PdbFunctionImporter):
|
||||||
@ -101,6 +104,7 @@ def overwrite_ghidra_function(self, ghidra_function: Function):
|
|||||||
# pylint: disable=too-many-instance-attributes
|
# pylint: disable=too-many-instance-attributes
|
||||||
class FullPdbFunctionImporter(PdbFunctionImporter):
|
class FullPdbFunctionImporter(PdbFunctionImporter):
|
||||||
"""For importing functions into Ghidra where all information are available."""
|
"""For importing functions into Ghidra where all information are available."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
api: FlatProgramAPI,
|
api: FlatProgramAPI,
|
||||||
|
|||||||
@ -80,9 +80,11 @@ def create_ghidra_namespace(
|
|||||||
namespace = api.createNamespace(namespace, part)
|
namespace = api.createNamespace(namespace, part)
|
||||||
return namespace
|
return namespace
|
||||||
|
|
||||||
|
|
||||||
# These appear in debug builds
|
# These appear in debug builds
|
||||||
THUNK_OF_RE = re.compile(r"^Thunk of '(.*)'$")
|
THUNK_OF_RE = re.compile(r"^Thunk of '(.*)'$")
|
||||||
|
|
||||||
|
|
||||||
def sanitize_name(name: str) -> str:
|
def sanitize_name(name: str) -> str:
|
||||||
"""
|
"""
|
||||||
Takes a full class or function name and replaces characters not accepted by Ghidra.
|
Takes a full class or function name and replaces characters not accepted by Ghidra.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user