From e3758839ed841c51e168a1498025ef4ffc3d5121 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 24 Feb 2020 23:28:27 +1000 Subject: [PATCH] Remove pigz dependency --- README.md | 1 - tools/mkgamezips | 11 +++-------- tools/rarezip | 8 +------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index f5d4e81bf..a79855712 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,6 @@ There is also a stagetable.txt in the repository root which includes multiplayer * make * mips build tools (Debian/Ubuntu: binutils-mips-linux-gnu, Arch: mips64-elf-binutils from AUR) * Python 3 -* pigz - a zlib compression tool ## Extracting the base ROM diff --git a/tools/mkgamezips b/tools/mkgamezips index 1de09fa89..32ccc2429 100755 --- a/tools/mkgamezips +++ b/tools/mkgamezips @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import os -import subprocess +import zlib """ mkgamezips - Creates the ucode/gamezips.bin from ucode/game.bin @@ -70,13 +70,8 @@ def get_zips(): return [zip(part) for part in parts] def zip(binary): - fd = open('build/part.bin', 'wb') - fd.write(binary) - fd.close() - - zipped = subprocess.check_output(['tools/rarezip', 'build/part.bin', '--game']) - os.remove('build/part.bin') - return zipped + obj = zlib.compressobj(level=9, wbits=-15) + return b'\x11\x73' + len(binary).to_bytes(3, 'big') + obj.compress(binary) + obj.flush() checksumsmaybe = [ 0x94f1, 0xb0c7, 0x6f10, 0x0d50, 0x2361, 0xe64a, 0x7c32, 0xf8f5, diff --git a/tools/rarezip b/tools/rarezip index 1b080c19e..c1fcbd68e 100755 --- a/tools/rarezip +++ b/tools/rarezip @@ -4,10 +4,4 @@ size=$(stat --format="%s" $1) printf "0: 1173 %.6x" $size | xxd -r -g0 -if [[ "$2" == '--game' ]]; then - # Use pigz, which uses the zlib library - pigz -c --no-name --best $1 | head --bytes=-8 | tail --bytes=+11 -else - # Use gzip, which uses their own deflate implementation - tools/gzip -c --no-name --best $1 | head --bytes=-8 | tail --bytes=+11 -fi +tools/gzip -c --no-name --best $1 | head --bytes=-8 | tail --bytes=+11