Skip to content

Commit

Permalink
DFReader: Fix some missing bitmask info in dump verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
shancock884 authored and peterbarker committed Jun 1, 2024
1 parent 988c696 commit 5d0496a
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions DFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,30 +327,26 @@ def dump_verbose_bitmask(self, f, c, val, field_metadata):
if bit_offset > highest:
highest = bit_offset

for i in range(bit_offset):
for i in range(highest+1):
bit_value = 1 << i
if val & bit_value:
bang = " "
else:
bang = "!"
done = False
for bit in bitmask.bit:
if bit["value"] != bit_value:
continue
if val & bit_value:
bang = ""
else:
bang = "!"
bit_name = bit.get('name')
bit_desc = None
try:
bit_desc = bit["description"]
except KeyError:
pass
if bit_desc is None:
f.write(" %s%s\n" % (bang, bit_name,))
f.write(" %s %s" % (bang, bit_name,))
if hasattr(bit, 'description'):
f.write(" (%s)\n" % bit["description"])
else:
f.write(" %s%s (%s)\n" % (bang, bit_name, bit_desc))
f.write("\n")
done = True
break
if not done:
f.write(" %{s}UNKNOWN_BIT%s\n" % (bang, str(i)))
f.write(" %s UNKNOWN_BIT%d\n" % (bang, i))
except Exception as e:
# print(e)
pass
Expand Down

0 comments on commit 5d0496a

Please sign in to comment.