From 4c53e1d44d0930dccceb2a1034b4f30adf09ac7d Mon Sep 17 00:00:00 2001 From: drekion Date: Sun, 22 Sep 2024 18:04:11 +0200 Subject: [PATCH] Update vbfdecode.py Add line checking --- vbfdecode.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vbfdecode.py b/vbfdecode.py index a1ddd79..ba3c49f 100644 --- a/vbfdecode.py +++ b/vbfdecode.py @@ -48,7 +48,9 @@ def __init__(self, data): if b"data_format_identifier" in line: self.data_format_identifier = int(line[line.find(b" = ")+3:line.find(b";")].replace(b" ", b"").replace(b"\"", b"").decode(), 16) if b"ecu_address" in line: - self.ecu_address = int(line[line.find(b" = 0x")+5:line.find(b";")].replace(b" ", b"").replace(b"\"", b"").decode(), 16) + line = line.split(b"//")[0] + if b"0x" in line: + self.ecu_address = int(line[line.find(b" = 0x")+5:line.find(b";")].replace(b" ", b"").replace(b"\"", b"").decode(), 16) if b"verification_block_start" in line: self.verification_block_start = int(line[line.find(b" = 0x")+5:line.find(b";")].replace(b" ", b"").replace(b"\"", b"").decode(), 16) if b"frame_format" in line: @@ -124,3 +126,4 @@ def dump(self, dst): print("%8X.bin " % (x[0])) with open(("%8X.bin" % (x[0])).replace(" ", ""), "wb") as f: f.write(x[1]) +