From 4f966a0222c11335ec2bd9fa17bf0d66fd168b12 Mon Sep 17 00:00:00 2001
From: Rudolf Polzer <divVerent@xonotic.org>
Date: Wed, 15 Dec 2010 12:54:59 +0100
Subject: [PATCH] make the fourcchack actually work for nonsupporting
 compressors

---
 misc/tools/compress-texture | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/misc/tools/compress-texture b/misc/tools/compress-texture
index 36aa0281..93d5c494 100755
--- a/misc/tools/compress-texture
+++ b/misc/tools/compress-texture
@@ -12,6 +12,7 @@ dst=$1; shift
 
 c=
 f=
+
 fourcchack=
 case "$tool" in
 	compressonator-dxtc)
@@ -29,6 +30,13 @@ case "$tool" in
 		esac
 		;;
 esac
+
+if [ -n "$fourcchack" ]; then
+	fourcchack_dir=`mktemp -d`
+	convert "$src" -fx "u*u.a" "$fourcchack_dir/src.$ext"
+	src="$fourcchack_dir/src.$ext"
+fi
+
 case "$tool" in
 	compressonator-dxtc|compressonator-atic)
 		case "$tool" in
@@ -70,4 +78,5 @@ esac
 if [ -n "$fourcchack" ]; then
 	# use dd to hack in the right FOURCC
 	echo -n "$fourcchack" | dd of="$dst" bs=1 count=4 seek=84
+	rm -rf "$fourcchack_dir"
 fi
-- 
2.39.5