Usecode pseudocode
This commit is contained in:
parent
f92d1504fa
commit
c12bb39437
1362 changed files with 71072 additions and 38056 deletions
56
tools/unkcoffs/check_unkoff_dupes.py
Normal file
56
tools/unkcoffs/check_unkoff_dupes.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/env python
|
||||
from struct import unpack
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
#mode = 'u8'
|
||||
#mode = 'remorse'
|
||||
mode = 'regret'
|
||||
|
||||
if mode == 'u8':
|
||||
from u8_ints import intrinsics
|
||||
off_file = 'u8_UNKCOFF.DAT'
|
||||
elif mode == 'remorse':
|
||||
from remorse_ints import intrinsics
|
||||
off_file = 'remorse_UNKCOFF.DAT'
|
||||
#off_file = 'rem_es_UNKCOFF.DAT'
|
||||
else:
|
||||
off_file = 'regret_UNKCOFF.DAT'
|
||||
from regret_ints import intrinsics
|
||||
|
||||
def print_dupes(ostrs):
|
||||
vals = defaultdict(list)
|
||||
for i, ostr in enumerate(ostrs):
|
||||
vals[ostr].append(i)
|
||||
lists = list(vals.values())
|
||||
lists.sort()
|
||||
for l in lists:
|
||||
if len(l) > 1:
|
||||
print(", ".join('%03X' % x for x in l))
|
||||
|
||||
|
||||
def print_compare(vals):
|
||||
for ino, (v, i) in enumerate(zip(vals, intrinsics)):
|
||||
print("%s: (Int%03X) %s" % (v, ino, i))
|
||||
|
||||
|
||||
def load_vals():
|
||||
f = open(off_file, "rb")
|
||||
offsets = f.read()
|
||||
nints = len(offsets)/4
|
||||
ioff = unpack('i' * nints, offsets)
|
||||
ostrs = []
|
||||
for i in ioff:
|
||||
seg = (i & 0xffff0000) >> 16
|
||||
off = i & 0xffff
|
||||
ostr = 'Code%03d %04x:%04x' % (seg, 0x1000 + (seg - 1)*8, off)
|
||||
ostrs.append(ostr)
|
||||
return ostrs
|
||||
|
||||
|
||||
def main():
|
||||
vals = load_vals()
|
||||
#print_dupes(vals)
|
||||
print_compare(vals)
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue