From e3401f15472c62274f2e3baf0d9de5452206cbdf Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 26 May 2020 02:59:38 +0300 Subject: [PATCH] use a script to output zero-terminated strings instead of bash printf --- Makefile | 3 ++- tools/zeroterm.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tools/zeroterm.py diff --git a/Makefile b/Makefile index c862101d..56404185 100644 --- a/Makefile +++ b/Makefile @@ -607,6 +607,7 @@ EMU_FLAGS = --noosd LOADER = loader64 LOADER_FLAGS = -vwf SHA1SUM = sha1sum +ZEROTERM = $(PYTHON) $(TOOLS_DIR)/zeroterm.py ###################### Dependency Check ##################### @@ -725,7 +726,7 @@ endif # RGBA32, RGBA16, IA16, IA8, IA4, IA1, I8, I4 ifeq ($(EXTERNAL_TEXTURES),1) $(BUILD_DIR)/%: %.png - printf "%s%b" "$(patsubst %.png,%,$^)" '\x00' > $@ + $(ZEROTERM) "$(patsubst %.png,%,$^)" > $@ else $(BUILD_DIR)/%: %.png $(N64GRAPHICS) -i $@ -g $< -f $(lastword $(subst ., ,$@)) diff --git a/tools/zeroterm.py b/tools/zeroterm.py new file mode 100644 index 00000000..7675017a --- /dev/null +++ b/tools/zeroterm.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 +import sys +if len(sys.argv) < 2: + print("usage: zeroterm ") +else: + sys.stdout.buffer.write(bytes(sys.argv[1], 'ascii') + b'\x00')