aboutsummaryrefslogtreecommitdiff
path: root/tools/embedded.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/embedded.sh')
-rwxr-xr-xtools/embedded.sh17
1 files changed, 6 insertions, 11 deletions
diff --git a/tools/embedded.sh b/tools/embedded.sh
index 6acbfab..ca70127 100755
--- a/tools/embedded.sh
+++ b/tools/embedded.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# This file generate all the embedded binary resources required for OChess to run properly
-
+
########## RESOURCES ##########
ressources=$(cat <<-EndOfResources
assets/boards/chesscom_8bits.png
@@ -17,7 +17,7 @@ EndOfResources
set -e
wai=$(dirname $(readlink -f "$0")) # Current script directory
-dst="${wai}/../src/binres/"
+dst="${wai}/../src/binres/binary_data.hpp"
# Binary to C headers
# $1 is the resource file and $2 the variable name to use in the C code
@@ -26,17 +26,12 @@ bin2c () {
}
# Generate headers
-includes=""
+echo -n > "$dst"
for res in $ressources
do
ext="${res##*.}"
name="$(basename $res .${ext})"
- name_std=${name}_${ext}.hpp # Header name standard
- out="${dst}/${name_std}"
- echo "- Generating ${name_std} resource..."
- bin2c "$res" "${name}_${ext}" > "$out"
- [ -z "$includes" ] && includes="${name_std}" || includes="${includes} ${name_std}"
+ echo "Generating resources for ${name}.${ext}..."
+ bin2c "$res" "${name}_${ext}" >> "$dst"
done
-echo "Please update the binres.cpp and binres.hpp to reflect these changes."
-echo "$includes"|tr "[:space:]" "\n"|awk '{print("#include \""$1"\"")}'
-
+echo "Done! The generated resources are accessible here: \"$dst\""