From f9ef4e1a3544ed346d124737f0f31081ec58ab52 Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Sat, 25 May 2019 15:03:32 +0800 Subject: [PATCH] Fix NewWorld 1.x image generation --- tbxi/bootinfo_build.py | 4 +++- tbxi/bootinfo_dump.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tbxi/bootinfo_build.py b/tbxi/bootinfo_build.py index fdcb559..76c6b35 100644 --- a/tbxi/bootinfo_build.py +++ b/tbxi/bootinfo_build.py @@ -22,6 +22,8 @@ def build(src): except (NotADirectoryError, FileNotFoundError): raise dispatcher.WrongFormat + has_checksum = (b'adler32' in booter) + constants = dict() constant_spans = dict() for m in re.finditer(rb'h#\s+([A-Fa-f0-9]+)\s+constant\s+([-\w]+)', booter): @@ -72,6 +74,6 @@ def build(src): assert start + len(insert) == stop booter[start:stop] = insert - append_checksum(booter) + if has_checksum: append_checksum(booter) return bytes(booter) diff --git a/tbxi/bootinfo_dump.py b/tbxi/bootinfo_dump.py index f3a4feb..8a79f5c 100644 --- a/tbxi/bootinfo_dump.py +++ b/tbxi/bootinfo_dump.py @@ -2,6 +2,8 @@ import os from os import path import re +from .slow_lzss import decompress + from . import dispatcher