1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-05-05 16:43:24 -07:00

reduce build dir clutter and cwd confusion

This commit is contained in:
Connor Olding 2016-10-03 15:21:43 -07:00
parent 3f1815d5a3
commit 60b55aa676
6 changed files with 31 additions and 33 deletions

1
asm/.gitignore vendored
View File

@ -1 +1,2 @@
build
lips

View File

@ -13,17 +13,20 @@ rom="$(readlink -f "$rom")"
mkdir -p build
quiet=0
[ ! -s "$YAZ0" ] && cc -O3 "${YAZ0}.c" -o "$YAZ0"
patchme="build/patchme"
#[ ! -s "$YAZ0" ] && cc -O3 "${YAZ0}.c" -o "$YAZ0"
dump() {
(cd "$(dirname "$DUMP")"; ./z64dump.py "$@")
#(cd "$(dirname "$DUMP")"; ./z64dump.py "$@")
"$DUMP" "$@"
}
if [ $fast -eq 0 ] || [ ! -d patchme ]; then
if [ $fast -eq 0 ] || [ ! -d "$patchme" ]; then
if [ -n "$sha1" ]; then
[ -d build/patchme ] && rm -r build/patchme
[ -d "$patchme" ] && rm -r "$patchme"
dump -c "$rom"
mv ../"$sha1" build/patchme
mv "$sha1" "$patchme"
else
cp "$rom" "build/$out"
fi
@ -34,7 +37,7 @@ ratio() {
local len2="$(wc -c < "$2")"
if [ $len1 -eq 0 ]; then
[ $quiet -le 0 ] && echo emptIy
[ $quiet -le 0 ] && echo empty
else
let percent=(len2*100)/len1
[ $quiet -le 0 ] && echo "ratio: $percent%"
@ -43,19 +46,19 @@ ratio() {
}
unc() {
local in=patchme/"$1".Yaz0
local out=patchme/"$1"
local in="$patchme"/"$1".Yaz0
local out="$patchme"/"$1"
[ -e "$in" ] || return 0
"$YAZ0" "$in" > "$out"
[ $quiet -le 0 ] && echo "uncompressed $1"
ratio "$out" "$in" || true
rm patchme/"$1".Yaz0
rm "$patchme"/"$1".Yaz0
}
comp() {
local in=patchme/"$1"
local out=patchme/"$1".Yaz0
local in="$patchme"/"$1"
local out="$patchme"/"$1".Yaz0
[ -e "$in" ] || return 0
"$YAZ0" "$in" > "$out"
@ -69,14 +72,9 @@ comp() {
}
copy_rom() {
dd if=patchme.z64 of="$1" bs=$((1024*1024)) count="${2:-32}" status=none
dd if="$patchme".z64 of="$1" bs=$((1024*1024)) count="${2:-32}" status=none
}
cp *.lua build/
cp *.asm build/
#cp *.bin build/
cd build
# don't copy entire dir; avoid copying dotfiles (.git)
mkdir -p lips
cp "$lips"/* lips

View File

@ -2,7 +2,6 @@
set -e
sha1=d6133ace5afaa0882cf214cf88daba39e266c078
#extracted=../dump/mm-US10-"$sha1"
rom=../../roms/everything/"Legend of Zelda, The - Majora's Mask (U) [!].z64"
out=mm-bq.z64
@ -15,16 +14,16 @@ unc "$code"
dd if=/dev/zero of=extra bs=370688 count=1 2>/dev/null
luajit patch.lua -e labels.lua -b 0x80780000 "$@" extra.asm extra
luajit patch.lua -i labels.lua "$@" code.asm patchme/"$code"
luajit patch.lua -e build/labels.lua -b 0x80780000 "$@" extra.asm extra
luajit patch.lua -i build/labels.lua "$@" code.asm build/patchme/"$code"
# ensure the file is the proper size (Lua seems to expand it?)
dd if=extra of=patchme/"$extra" bs=370688 count=1 2>/dev/null
dd if=extra of=build/patchme/"$extra" bs=370688 count=1 2>/dev/null
rm extra
if [ $fast -ne 2 ]; then
comp "$code"
comp "$extra"
dump asm/build/patchme
copy_rom "$out" 32
dump "$patchme"
copy_rom "build/$out" 32
fi

View File

@ -46,8 +46,8 @@ for f in \
"1516 V035B3000 test01_scene" \
"1517 V035B7000 test01_room_0" \
; do
rm patchme/"$f"
touch patchme/"$f"
rm "$patchme"/"$f"
touch "$patchme"/"$f"
echo "deleted $f"
done
@ -63,8 +63,8 @@ for f in \
"0985 V01E26000 vr_IPVR_static" \
"0999 V01F2D000 vr_LBVR_static" \
; do
rm patchme/"$f"
touch patchme/"$f"
rm "$patchme"/"$f"
touch "$patchme"/"$f"
echo "deleted $f"
done
@ -313,7 +313,7 @@ if [ $fast -ne 2 ]; then
# comp "$title"
# z64dump.py doesn't have compression support rn
# so we'll do this ourselves
for f in patchme/*; do
for f in "$patchme"/*; do
ext="${f##*.}" # warning: not robust
dirless="${f##*/}" # warning: not robust
n="${dirless:0:4}"
@ -325,6 +325,6 @@ if [ $fast -ne 2 ]; then
quiet=0
fi
done
dump asm/build/patchme
dump "$patchme"
copy_rom "$out" 32
fi

View File

@ -9,6 +9,6 @@ out=oot-spawner.z64
luajit patch.lua \
-O 0x035D0000 -b $((0x80700000 - 0x035D0000)) \
'spawn O EUDB MQ.asm' "$out"
'spawn O EUDB MQ.asm' "build/$out"
dump -f asm/build/"$out"
dump -f "build/$out"

View File

@ -9,6 +9,6 @@ out=oot-widescreen.z64
luajit patch.lua \
-O 0x035D0000 -b $((0x80700000 - 0x035D0000)) \
widescreen-inline-rom.asm "$out"
widescreen-inline-rom.asm "build/$out"
dump -f asm/build/"$out"
dump -f "build/$out"