Skip to content

Commit

Permalink
Ensure get_all.sh script runs within its own directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Stealthii committed Nov 17, 2023
1 parent 79faa5d commit 8a8e669
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/bmov_to_fm2_data/get_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
set -e
set -x

# Determine the directory of this script
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Store current working directory
CWD="$(pwd)"
tilt_dir="$1"
if [ ! -d "$tilt_dir" ]; then
echo "USAGE: $0 TILT_DIR"
exit 1
fi
# Get absolute path of tilt_dir
tilt_dir="$(cd "$tilt_dir" && pwd)"
# Change to the directory of this script
cd "$script_dir"

xa_bin="${XA_BIN:-xa}"

Expand Down Expand Up @@ -76,3 +84,6 @@ tail -c +17 "$tilt_dir"/tilt_no_network_unrom_\(E\).nes | md5sum | cut -d' ' -f1

# Entry point in the ROM
echo $((16#$(grep ' forever ' /tmp/tilt_no_network_unrom_\(E\).lst | grep -Eo 'A:[0-9a-f]+' | grep -Eo '[0-9a-f]+'))) > entry_point.dat

# Restore working directory
cd "$CWD"

0 comments on commit 8a8e669

Please sign in to comment.