-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathgenh
More file actions
executable file
·30 lines (25 loc) · 902 Bytes
/
Copy pathgenh
File metadata and controls
executable file
·30 lines (25 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
if ! command -v xxd >/dev/null; then
if command -v dnf > /dev/null; then
echo "Root privilages are required to install dependencies:"
sudo dnf -y update
sudo dnf -y install vim-common
fi
fi
cd "$(dirname "$0")"/ppf-patches
rm -rf ../ppf-c
mkdir ../ppf-c
rm -f ../template-code.txt
rm -f ../patches.h
for f in *.PPF; do
#generate headers and includes
xxd -i "$f" ../ppf-c/"$f".h
sed -i -e 's|unsigned char|const unsigned char|g' ../ppf-c/"$f".h
echo "#include \""ppf-c/"$f".h""\" >> ../patches.h
base=$(basename -s .PPF "$f")
# change XXXX_XXX.XX to XXXX_XXX_XX
header=$(echo "$base" | sed 's/\(.\{8\}\)./\1_/')
echo -e "\telse if((strcmp(bootfile, \""$base"\") == 0))\n\t{\n\t\tapply_ppf("$header"_PPF, "$header"_PPF_len, bin);\n\t}\n" >> ../template-code.txt
count=$((count+1))
done
echo "Generated $count headers"