From 4a3068686a6a271d7a2fc67d90699f16ba82e523 Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Sat, 3 Apr 2021 05:26:48 +0000 Subject: [PATCH] Fix help display and fix skipping padding bytes ('x' character). --- bemani/utils/struct.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bemani/utils/struct.py b/bemani/utils/struct.py index 3385fd4..324308d 100644 --- a/bemani/utils/struct.py +++ b/bemani/utils/struct.py @@ -148,10 +148,11 @@ class StructPrinter: else: size = struct.calcsize(prefix + spec) chunk = self.data[offset:(offset + size)] - if dohex: - line.append(hex(struct.unpack(prefix + spec, chunk)[0])) - else: - line.append(struct.unpack(prefix + spec, chunk)[0]) + if spec != 'x': + if dohex: + line.append(hex(struct.unpack(prefix + spec, chunk)[0])) + else: + line.append(struct.unpack(prefix + spec, chunk)[0]) offset += size else: chunk = self.data[offset:(offset + 4)] @@ -201,7 +202,7 @@ def main() -> None: "for details. Additionally, prefixing a format specifier with * allows dereferencing pointers. " "Surround a chunk of format specifiers with parenthesis to dereference complex structures. For " "ease of unpacking C string pointers, the specifier \"z\" is recognzied to mean null-terminated " - "string. A % preceeding a format specifier means that we should convert to hex before displaying." + "string. A & preceeding a format specifier means that we should convert to hex before displaying." ), type=str, default=None,