Skip to content
Snippets Groups Projects
Verified Commit 70327baa authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: added 2 new dump modes for boot

parent 321e79ba
No related branches found
No related tags found
1 merge request!37Improved support for PyBoy interface
......@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import sys
import binascii
def print_buffer(filename, mode="buffer"):
......@@ -23,6 +24,16 @@ def print_buffer(filename, mode="buffer"):
print("[0x%04x] 0x%02x" % (counter, ord(byte)))
counter += 1
elif mode == "hexbytes":
hex_data = binascii.hexlify(data).decode()
escaped_data = "".join(
"\\x" + hex_data[i : i + 2] for i in range(0, len(hex_data), 2)
)
print("b'%s'" % escaped_data)
elif mode == "bytes":
print(repr(data))
if __name__ == "__main__":
if len(sys.argv) < 2:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment