summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2015-08-16 20:22:22 -0700
committeryenatch <yenatch@gmail.com>2015-08-16 20:22:22 -0700
commitc7c5be19fe0ed1e99242f64f39f98041ba383421 (patch)
tree62a639f687cc67186ab6bbb2f44a24cd35e923e8
parent6ffb47f1af0437c04a50990f4f455c5f7736644e (diff)
Add the current address to the output of Decompressed.command_list.
-rw-r--r--pokemontools/lz.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pokemontools/lz.py b/pokemontools/lz.py
index 334ea1c..f9d1dfe 100644
--- a/pokemontools/lz.py
+++ b/pokemontools/lz.py
@@ -420,13 +420,14 @@ class Decompressed:
text = ''
+ output_address = 0
for name, attrs in self.used_commands:
length = attrs['length']
address = attrs['address']
offset = attrs['offset']
direction = attrs['direction']
- text += '{0}: {1}'.format(name, length)
+ text += '{2:03x} {0}: {1}'.format(name, length, output_address)
text += '\t' + ' '.join(
'{:02x}'.format(int(byte))
for byte in self.lz[ address : address + attrs['cmd_length'] ]
@@ -434,9 +435,12 @@ class Decompressed:
if offset is not None:
repeated_data = self.output[ offset : offset + length * direction : direction ]
+ if name == 'flip':
+ repeated_data = map(bit_flipped.__getitem__, repeated_data)
text += ' [' + ' '.join(map('{:02x}'.format, repeated_data)) + ']'
text += '\n'
+ output_address += length
return text