Skip to content

Commit

Permalink
FINALLY got enum setting working
Browse files Browse the repository at this point in the history
  • Loading branch information
Flipout50 committed Nov 21, 2023
1 parent f3a6a7a commit f556ad0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions yodalib/decompilers/ghidra/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,10 @@ def _set_enum(self, enum: Enum, **kwargs) -> bool:
handler = self.ghidra.import_module_object("ghidra.program.model.data", "DataTypeConflictHandler")
enumType = self.ghidra.import_module_object("ghidra.program.model.data", "EnumDataType")
categoryPath = self.ghidra.import_module_object("ghidra.program.model.data", "CategoryPath")
path = categoryPath(enum.name)
outer_path = categoryPath(path.getPath())
ghidra_enum = enumType(outer_path, path.getName(), 4)
parts = enum.name.split('/')
path = categoryPath('/'.join(parts[:-1]))
plain_name = parts[-1]
ghidra_enum = enumType(path, plain_name, 4)
for member_name in enum.members.keys():
ghidra_enum.add(member_name, enum.members[member_name])
try:
Expand Down

0 comments on commit f556ad0

Please sign in to comment.