-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathparseAnimcmdStart.py
More file actions
37 lines (34 loc) · 1.17 KB
/
parseAnimcmdStart.py
File metadata and controls
37 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from article import Article, ScriptHash
from hash40 import Hash40
class ParseAnimcmdStart:
def __init__(self, text):
self.lines = []
for l in text.split('\r'):
if len(l) > 0 and l != '\n':
a = l.split(';')[0].strip().split(" ")
line = a[len(a)-1][1:]
self.lines.append(line)
#Process
self.address = None
for line in self.lines:
#print(line)
t = line.split(' ')
op = t[0]
val = ''.join(t[1:])
if op == 'bl':
if "0x" in val or "fcn." in val:
self.address = int(val.replace("fcn.", "0x"), 16)
break
class ParseAnimcmdStartJ:
def __init__(self, json):
self.lines = []
self.address = None
for opJson in json:
if "disasm" in opJson:
t = opJson["disasm"].split(' ')
op = t[0]
val = ''.join(t[1:])
if op == 'bl':
if "0x" in val or "fcn." in val:
self.address = int(val.replace("fcn.", "0x"), 16)
break