From 70327baae0c371149a29cec5fc9ce2ff37a2980b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 19 Nov 2023 22:24:52 +0000
Subject: [PATCH] chore: added 2 new dump modes for boot

---
 res/boot/boot_dump.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/res/boot/boot_dump.py b/res/boot/boot_dump.py
index 35cacb0a..d70a4818 100644
--- a/res/boot/boot_dump.py
+++ b/res/boot/boot_dump.py
@@ -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:
-- 
GitLab