mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-06-23 14:07:41 +00:00
Improve embedded binary data and debug checkmate
This commit is contained in:
parent
ddc0c7aee0
commit
c8f72aeaac
11 changed files with 3647 additions and 3657 deletions
tools
|
@ -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\""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue