mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-16 21:11:15 +00:00
fixed script on windows
This commit is contained in:
parent
5ede6c4b39
commit
ae7d04e0e7
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -58,7 +58,6 @@ jobs:
|
|||||||
- name: Summarize Accuracy
|
- name: Summarize Accuracy
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
dir /s /b
|
|
||||||
C:\msys64\usr\bin\wget.exe https://legoisland.org/download/ISLE.EXE
|
C:\msys64\usr\bin\wget.exe https://legoisland.org/download/ISLE.EXE
|
||||||
C:\msys64\usr\bin\wget.exe https://legoisland.org/download/LEGO1.DLL
|
C:\msys64\usr\bin\wget.exe https://legoisland.org/download/LEGO1.DLL
|
||||||
pip install capstone
|
pip install capstone
|
||||||
|
|||||||
@ -90,7 +90,6 @@ def read(self, offset, size):
|
|||||||
return self.file.read(size)
|
return self.file.read(size)
|
||||||
|
|
||||||
line_dump = None
|
line_dump = None
|
||||||
sym_dump = None
|
|
||||||
|
|
||||||
origfile = Bin(original)
|
origfile = Bin(original)
|
||||||
recompfile = Bin(recomp)
|
recompfile = Bin(recomp)
|
||||||
@ -110,7 +109,7 @@ def get_wine_path(fn):
|
|||||||
|
|
||||||
# Load source lines from PDB
|
# Load source lines from PDB
|
||||||
if not line_dump:
|
if not line_dump:
|
||||||
call = ['cvdump', '-l', '-s']
|
call = [os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'cvdump'), '-l', '-s']
|
||||||
|
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
# Run cvdump through wine and convert path to Windows-friendly wine path
|
# Run cvdump through wine and convert path to Windows-friendly wine path
|
||||||
@ -119,7 +118,7 @@ def get_wine_path(fn):
|
|||||||
else:
|
else:
|
||||||
call.append(syms)
|
call.append(syms)
|
||||||
|
|
||||||
line_dump = subprocess.check_output(call, cwd=os.path.dirname(os.path.abspath(sys.argv[0]))).decode('utf-8').split('\r\n')
|
line_dump = subprocess.check_output(call).decode('utf-8').split('\r\n')
|
||||||
|
|
||||||
# Find requested filename/line in PDB
|
# Find requested filename/line in PDB
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
@ -129,6 +128,7 @@ def get_wine_path(fn):
|
|||||||
#print('Looking for ' + filename + ' line ' + str(line))
|
#print('Looking for ' + filename + ' line ' + str(line))
|
||||||
|
|
||||||
addr = None
|
addr = None
|
||||||
|
found = False
|
||||||
|
|
||||||
for i, s in enumerate(line_dump):
|
for i, s in enumerate(line_dump):
|
||||||
if s.startswith(' ' + filename):
|
if s.startswith(' ' + filename):
|
||||||
@ -136,14 +136,14 @@ def get_wine_path(fn):
|
|||||||
if line == int(lines[0]):
|
if line == int(lines[0]):
|
||||||
# Found address
|
# Found address
|
||||||
addr = int(lines[1], 16)
|
addr = int(lines[1], 16)
|
||||||
|
found = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if addr:
|
if found:
|
||||||
# Find size of function
|
# Find size of function
|
||||||
for i, s in enumerate(line_dump):
|
for i, s in enumerate(line_dump):
|
||||||
if 'S_GPROC32' in s:
|
if 'S_GPROC32' in s:
|
||||||
if int(s[26:34], 16) == addr:
|
if int(s[26:34], 16) == addr:
|
||||||
|
|
||||||
obj = RecompiledInfo()
|
obj = RecompiledInfo()
|
||||||
obj.addr = addr + recompfile.imagebase + recompfile.textvirt
|
obj.addr = addr + recompfile.imagebase + recompfile.textvirt
|
||||||
obj.size = int(s[41:49], 16)
|
obj.size = int(s[41:49], 16)
|
||||||
@ -171,7 +171,7 @@ def parse_asm(file, addr, size):
|
|||||||
|
|
||||||
for subdir, dirs, files in os.walk(source):
|
for subdir, dirs, files in os.walk(source):
|
||||||
for file in files:
|
for file in files:
|
||||||
srcfilename = os.path.join(subdir, file)
|
srcfilename = os.path.join(os.path.abspath(subdir), file)
|
||||||
srcfile = open(srcfilename, 'r')
|
srcfile = open(srcfilename, 'r')
|
||||||
line_no = 0
|
line_no = 0
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ def parse_asm(file, addr, size):
|
|||||||
|
|
||||||
diff = difflib.SequenceMatcher(None, origasm, recompasm)
|
diff = difflib.SequenceMatcher(None, origasm, recompasm)
|
||||||
ratio = diff.ratio()
|
ratio = diff.ratio()
|
||||||
print('%s (%s) is %.2f%% similar to the original' % (recinfo.name, hex(addr), ratio * 100))
|
print('%s (%s / %s) is %.2f%% similar to the original' % (recinfo.name, hex(addr), hex(recinfo.addr), ratio * 100))
|
||||||
|
|
||||||
function_count += 1
|
function_count += 1
|
||||||
total_accuracy += ratio
|
total_accuracy += ratio
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user