use a script to output zero-terminated strings instead of bash printf

This commit is contained in:
fgsfds 2020-05-26 02:59:38 +03:00
parent 9f9e79ed9d
commit e3401f1547
2 changed files with 8 additions and 1 deletions

View file

@ -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 ., ,$@))

6
tools/zeroterm.py Normal file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env python3
import sys
if len(sys.argv) < 2:
print("usage: zeroterm <string>")
else:
sys.stdout.buffer.write(bytes(sys.argv[1], 'ascii') + b'\x00')