Everybody loves a good yearly or so update

This commit is contained in:
KholdFuzion
2025-04-25 10:11:31 -04:00
parent 02bad2cca4
commit 414a8feb8e
373 changed files with 46731 additions and 50709 deletions
+178
View File
@@ -0,0 +1,178 @@
#!/bin/bash
COUNTRY_CODE=""
OUTFILE=""
usage() {
echo "$0 usage:"
echo ""
echo "$0 -v u [-o results_file]"
echo ""
echo " -o output filename. Optional. Defaults to full_hashtable_{version}.csv"
echo " -v version. Supported options are: US,u, JP,j, EU,e"
echo ""
exit 0;
}
[ $# -eq 0 ] && usage
while getopts "o:hv:" arg; do
case $arg in
v) # version
if [ "${OPTARG,,}" = "us" ]; then
COUNTRY_CODE="u"
elif [ "${OPTARG,,}" = "u" ]; then
COUNTRY_CODE="u"
elif [ "${OPTARG,,}" = "jp" ]; then
COUNTRY_CODE="j"
elif [ "${OPTARG,,}" = "j" ]; then
COUNTRY_CODE="j"
elif [ "${OPTARG,,}" = "eu" ]; then
COUNTRY_CODE="e"
elif [ "${OPTARG,,}" = "e" ]; then
COUNTRY_CODE="e"
fi
ARG_VERSION="${OPTARG}"
;;
o) # out file
OUTFILE="${OPTARG}"
;;
h | *) # Display help.
usage
exit 0
;;
esac
done
if ! command -v "mips-linux-gnu-objcopy" &> /dev/null
then
echo "command mips-linux-gnu-objcopy not found"
exit 1
fi
if [ "${OUTFILE}" = "" ] ; then
OUTFILE="full_hashtable_${version}.csv"
fi
TMP=$(mktemp /tmp/ge_test_files.XXXXXX)
rm -f "${OUTFILE}"
touch "${OUTFILE}"
# output format is simple csv, one entry per line
# 32 character md5, name of section extracted from ELF binary, and path to file relative from repo root (where this script is)
#
# escaped csv, quotes or commas in filenames are not supported.
for FILE in build/${COUNTRY_CODE}/src/*.o
do
echo "adding ${FILE}"
mips-linux-gnu-objcopy -j .text -O binary "${FILE}" "${TMP}"
printf "%s,.text,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .code -O binary "${FILE}" "${TMP}"
printf "%s,.code,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .bss -O binary "${FILE}" "${TMP}"
printf "%s,.bss,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .data -O binary "${FILE}" "${TMP}"
printf "%s,.data,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .rodata -O binary "${FILE}" "${TMP}"
printf "%s,.rodata,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
done
for FILE in build/${COUNTRY_CODE}/src/game/*.o
do
echo "adding ${FILE}"
mips-linux-gnu-objcopy -j .text -O binary "${FILE}" "${TMP}"
printf "%s,.text,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .code -O binary "${FILE}" "${TMP}"
printf "%s,.code,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .bss -O binary "${FILE}" "${TMP}"
printf "%s,.bss,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .data -O binary "${FILE}" "${TMP}"
printf "%s,.data,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .rodata -O binary "${FILE}" "${TMP}"
printf "%s,.rodata,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
done
for FILE in build/${COUNTRY_CODE}/assets/obseg/bg/*.o
do
echo "adding ${FILE}"
mips-linux-gnu-objcopy -j .bss -O binary "${FILE}" "${TMP}"
printf "%s,.bss,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .data -O binary "${FILE}" "${TMP}"
printf "%s,.data,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .rodata -O binary "${FILE}" "${TMP}"
printf "%s,.rodata,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
done
for FILE in build/${COUNTRY_CODE}/assets/obseg/brief/*.o
do
echo "adding ${FILE}"
mips-linux-gnu-objcopy -j .bss -O binary "${FILE}" "${TMP}"
printf "%s,.bss,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .data -O binary "${FILE}" "${TMP}"
printf "%s,.data,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .rodata -O binary "${FILE}" "${TMP}"
printf "%s,.rodata,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
done
for FILE in build/${COUNTRY_CODE}/assets/obseg/setup/*.o
do
echo "adding ${FILE}"
mips-linux-gnu-objcopy -j .bss -O binary "${FILE}" "${TMP}"
printf "%s,.bss,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .data -O binary "${FILE}" "${TMP}"
printf "%s,.data,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .rodata -O binary "${FILE}" "${TMP}"
printf "%s,.rodata,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
done
for FILE in build/${COUNTRY_CODE}/assets/obseg/stan/*.o
do
echo "adding ${FILE}"
mips-linux-gnu-objcopy -j .bss -O binary "${FILE}" "${TMP}"
printf "%s,.bss,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .data -O binary "${FILE}" "${TMP}"
printf "%s,.data,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .rodata -O binary "${FILE}" "${TMP}"
printf "%s,.rodata,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
done
for FILE in build/${COUNTRY_CODE}/assets/obseg/text/*.o
do
echo "adding ${FILE}"
mips-linux-gnu-objcopy -j .bss -O binary "${FILE}" "${TMP}"
printf "%s,.bss,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .data -O binary "${FILE}" "${TMP}"
printf "%s,.data,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
mips-linux-gnu-objcopy -j .rodata -O binary "${FILE}" "${TMP}"
printf "%s,.rodata,%s\n" $(md5sum -b "${TMP}" | cut -c -32) "${FILE}" >> "${OUTFILE}"
done
rm -f "${TMP}"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# arg1: make command passthrough, per make user manual.
MAKECMD=$1
if [ -z ${MAKECMD} ]; then echo "$0: missing argument: MAKECMD"; exit 1; fi
$MAKECMD -s -C tools >&2
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Failed to build tools"
fi
exit $retVal
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ -f "$SCRIPT_DIR"/local/checksum.sh ]; then
"$SCRIPT_DIR"/local/checksum.sh "$1" "$2" "$3"
else
"$SCRIPT_DIR"/default/checksum.sh "$1" "$2"
fi
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# this is a partial extension of "make clean".
# this should be invoked along with regular make clean.
#
# arg 1: ALLOWED_COUNTRYCODE; this should be a string of country codes separated by space.
# arg 2: BUILD_DIR_BASE
ALLOWED_COUNTRYCODE=$1
BUILD_DIR_BASE=$2
# quote to allow space characters
if [ -z "${ALLOWED_COUNTRYCODE}" ]; then echo "$0: missing argument: ALLOWED_COUNTRYCODE"; exit 1; fi
if [ -z "${BUILD_DIR_BASE}" ]; then echo "$0: missing argument: BUILD_DIR_BASE"; exit 1; fi
echo "deleting build folders and files"
# dont quote to split on space characters
for cc in ${ALLOWED_COUNTRYCODE[@]}; do
rm -r -f -d "${BUILD_DIR_BASE}/${cc}"
done
echo "deleting bin / rsp / asp"
rm -r -f -d bin/
rm -r -f -d assets/images/split/
# delete binary files according to current source control directory structure.
# fixes issues if directory structure changes ...
echo "deleting assets"
rm -r -f "assets/music/*.bin" "assets/obseg/bg/*.bin" "assets/obseg/brief/*.bin" "assets/obseg/chr/*.bin" "assets/obseg/gun/*.bin" "assets/obseg/prop/*.bin" "assets/obseg/setup/*.bin" "assets/obseg/setup/e/*.bin" "assets/obseg/setup/u/*.bin" "assets/obseg/setup/j/*.bin" "assets/obseg/stan/*.bin" "assets/obseg/text/*.bin" "assets/obseg/text/e/*.bin" "assets/obseg/text/u/*.bin" "assets/obseg/text/j/*.bin" "assets/ramrom/*.bin" "assets/ramrom/e/*.bin" "assets/ramrom/u/*.bin" "assets/ramrom/j/*.bin"
+65
View File
@@ -0,0 +1,65 @@
#!/bin/bash
# $1: BUILD_DIR
# $2: country code
echo "creating required build directories"
BUILD_DIR=$1
COUNTRYCODE=$2
if [ -z ${BUILD_DIR} ]; then echo "$0: missing argument: BUILD_DIR"; exit 1; fi
if [ -z ${COUNTRYCODE} ]; then echo "$0: missing argument: COUNTRYCODE"; exit 1; fi
dirs=(
rsp
src
src/game
src/inflate
src/libultra
src/libultra/audio
src/libultra/gt
src/libultra/gu
src/libultra/io
src/libultra/libc
src/libultra/os
src/libultra/rg
src/libultra/sched
src/libultra/sp
src/libultrare
src/libultrare/audio
src/libultrare/gt
src/libultrare/gu
src/libultrare/io
src/libultrare/libc
src/libultrare/os
src/libultrare/rg
src/libultrare/sched
src/libultrare/sp
assets assets/obseg
assets/obseg/brief
assets/obseg/chr
assets/obseg/gun
assets/obseg/prop
assets/obseg/text
assets/obseg/bg
assets/obseg/setup
assets/obseg/setup/${COUNTRYCODE}
assets/obseg/stan
assets/music
assets/ramrom
assets/images
assets/images/split
assets/font
assets/embedded
assets/embedded/skeletons
assets/embedded/player_gait_object
)
mkdir -p "${BUILD_DIR}"
for dir in "${dirs[@]}"; do
mkdir -p "${BUILD_DIR}/${dir}"
done
exit 0
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
SHA1SUM=$1
OUTCODE=$2
# quote to allow space
if [ -z "${SHA1SUM}" ]; then echo "$0: missing argument: SHA1SUM"; exit 1; fi
if [ -z "${OUTCODE}" ]; then echo "$0: missing argument: OUTCODE"; exit 1; fi
# no quotes on SHA1SUM to allow padding command line arguments from parent
${SHA1SUM} -c ge007.${OUTCODE}.sha1
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "\n\n ERROR: NOT MATCH!\n\n"
else
echo -e "\n\n MATCH!\n\n"
fi
exit $retVal
+65
View File
@@ -0,0 +1,65 @@
#!/bin/bash
SHA1SUM=$1
OUTCODE=$2
# quote to allow space
if [ -z "${SHA1SUM}" ]; then echo "$0: missing argument: SHA1SUM"; exit 1; fi
if [ -z "${OUTCODE}" ]; then echo "$0: missing argument: OUTCODE"; exit 1; fi
# no quotes on SHA1SUM to allow padding command line arguments from parent
${SHA1SUM} -c ge007.${OUTCODE}.sha1
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "\n\n\033[1;41;37m"
echo -e " "
echo -e " ERROR: NOT MATCH! "
echo -e " \033[m"
echo -e "\n\n"
RESPONSE=0
read -t 5 -p "Do you want to check Source Files (y/n)? " choice
case "$choice" in
y|Y ) RESPONSE=1; ;;
n|N ) RESPONSE=2; ;;
* ) RESPONSE=3; ;;
esac
echo ""
if [ $RESPONSE -eq 1 ]; then
echo "Please wait while we determine which files are affected..."
# scripts file relative to root source control directory
./scripts/test_files.sh -c -i scripts/ge007.${OUTCODE}-test_basis.csv
echo "Dumping map diff..."
diff --suppress-common-lines build/${OUTCODE}-match/ge007.${OUTCODE}.map build/${OUTCODE}/ge007.${OUTCODE}.map
fi
else
echo -e "\n\n\033[1;42;37m"
echo -e " "
echo -e " MATCH! "
echo -e " \033[m"
echo -e "\n\n"
RESPONSE=0
read -t 5 -p "Do you want to update the matching hashtable (recommended but slow) (y/n)?" choice
case "$choice" in
y|Y ) RESPONSE=1; ;;
n|N ) RESPONSE=2; ;;
* ) RESPONSE=3; ;;
esac
echo ""
if [ $RESPONSE -eq 1 ]; then
echo "Please wait while we rebuild the hashtable..."
cp -r build/${OUTCODE}/* build/${OUTCODE}-match
# cp build/${OUTCODE}/ge007.${OUTCODE}.map build/${OUTCODE}-match/ge007.$(OUTCODE).map
# scripts file relative to root source control directory
./scripts/make/build_hashtable.sh -v ${OUTCODE} -o scripts/ge007.${OUTCODE}-test_basis.csv
fi
fi
exit $retVal
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# This script should execute from root source control directory.
result=$(basename "$PWD")
if [ $result = "scripts" ] ; then
cd ..
fi
./scripts/make/build_hashtable.sh -v u -o scripts/ge007.u-test_basis.csv
./scripts/make/build_hashtable.sh -v j -o scripts/ge007.j-test_basis.csv
./scripts/make/build_hashtable.sh -v e -o scripts/ge007.e-test_basis.csv