diff --git a/asm/.gitignore b/asm/.gitignore index 378eac2..5eb58a5 100644 --- a/asm/.gitignore +++ b/asm/.gitignore @@ -1 +1,2 @@ build +lips diff --git a/asm/common.sh b/asm/common.sh index 720c35b..05a4a5d 100644 --- a/asm/common.sh +++ b/asm/common.sh @@ -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 diff --git a/asm/mm-bq b/asm/mm-bq index 4ac5bd5..fb20e57 100755 --- a/asm/mm-bq +++ b/asm/mm-bq @@ -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 diff --git a/asm/oot-dbg-comp b/asm/oot-dbg-comp index 1973ed9..279bd6d 100644 --- a/asm/oot-dbg-comp +++ b/asm/oot-dbg-comp @@ -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 diff --git a/asm/oot-spawner b/asm/oot-spawner index 5b89a91..e578749 100755 --- a/asm/oot-spawner +++ b/asm/oot-spawner @@ -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" diff --git a/asm/oot-widescreen b/asm/oot-widescreen index bb12e0b..ec2fddb 100755 --- a/asm/oot-widescreen +++ b/asm/oot-widescreen @@ -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"