Skip to content

Commit

Permalink
Merge pull request #13 from ohreteam/pk1
Browse files Browse the repository at this point in the history
fix bug of AsmLiteral.py and add nactotac
  • Loading branch information
Penkace authored Jan 28, 2025
2 parents db94f66 + eec585e commit b4ab677
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ohre/abcre/dis/AsmLiteral.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,21 @@ def _process_normal_literal(self, lines: List[str]):
if 'method' in element_content and 'method_affiliate' in element_content:
cnt = 0
while cnt < len(array_split_list):
if 'string' in array_split_list[cnt]:
if 'string' in array_split_list[cnt] and 'method' in array_split_list[cnt+1]:
method_string = array_split_list[cnt].split(':')[
1].strip()[1:-1]
method_name = array_split_list[cnt + 1].split(':')[1].strip()
method_aff = array_split_list[cnt + 2].split(':')[1].strip()
method_dict[method_string] = {
'method': method_name, 'method_affiliate': method_aff}
cnt += 3
elif 'string' in array_split_list[cnt] and 'method' not in array_split_list[cnt+1]:
variable_string = array_split_list[cnt].split(':')[1].replace('"', '').strip()
variable_value = array_split_list[cnt+1].split(':')[1].replace('"', '').strip()
if 'null_value' in array_split_list[cnt+1]:
variable_value = 'null_value'
method_dict[variable_string] = variable_value
cnt += 2
else:
cnt += 1
method_amount = array_split_list[-1].split(':')[1]
Expand All @@ -73,9 +80,10 @@ def _process_normal_literal(self, lines: List[str]):
if element_amount % 2 == 1:
array_len -= 1
while cnt < array_len:
variable_string = array_split_list[cnt].split(':')[1].strip()
if '"' in variable_string:
variable_string = variable_string.replace('"', '')
variable_string = array_split_list[cnt].split(':')[1].strip().replace('"', '')
if len(variable_string) == 0:
cnt += 2
continue
variable_value = array_split_list[cnt + 1]
if 'null_value' in variable_value:
variable_value = 'null_value'
Expand Down
6 changes: 6 additions & 0 deletions ohre/abcre/dis/NACtoTAC.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ def toTAC(self, nac: NAC, meth: AsmMethod, dis_file: DisFile) -> Union[TAC, List
return TAC.tac_assign(
AsmArg.ACC(), AsmArg.build_object(None, name=utils.strip_sted_str(nac.args[1])),
log=f"// todo: check tryldglobalbyname, not throw now")
if (nac.op == "trystglobalbyname"):
return TAC.tac_assign(
AsmArg.build_object(None, name=utils.strip_sted_str(nac.args[1])),
AsmArg.ACC(),
log = f"// todo: check trystglobalbyname, not throw now"
)
if (nac.op == "ldexternalmodulevar"):
index = int(nac.args[0], base=16)
module_name = dis_file.get_external_module_name(index, meth.file_class_name)
Expand Down

0 comments on commit b4ab677

Please sign in to comment.