mirror of
https://github.com/notwa/mm
synced 2024-11-04 22:39:02 -08:00
ad-hoc building in a build directory
This commit is contained in:
parent
e50dd330b8
commit
c38ac76ba6
4 changed files with 35 additions and 22 deletions
7
patch/.gitignore
vendored
7
patch/.gitignore
vendored
|
@ -1,6 +1 @@
|
|||
patchme
|
||||
lips
|
||||
entrances.asm
|
||||
crc32.asm
|
||||
widescreen-either.asm
|
||||
labels.lua
|
||||
build
|
||||
|
|
27
patch/mm-bq
27
patch/mm-bq
|
@ -10,6 +10,7 @@ sha1=d6133ace5afaa0882cf214cf88daba39e266c078
|
|||
extracted=../dump/mm-US10-"$sha1"
|
||||
rom=../roms/everything/"Legend of Zelda, The - Majora's Mask (U) [!].z64"
|
||||
lips=../Lua/lib/lips
|
||||
out=mm-bq.z64
|
||||
|
||||
code="0031 V00B3C000"
|
||||
extra="1552 V02EE7040"
|
||||
|
@ -23,7 +24,7 @@ ratio() {
|
|||
|
||||
unc() {
|
||||
[ -e patchme/"$1".Yaz0 ] || return 0
|
||||
../z64yaz0 patchme/"$1".Yaz0 > patchme/"$1"
|
||||
../../z64yaz0 patchme/"$1".Yaz0 > patchme/"$1"
|
||||
echo "uncompressed $1"
|
||||
ratio patchme/"$1" patchme/"$1".Yaz0
|
||||
rm patchme/"$1".Yaz0
|
||||
|
@ -31,26 +32,34 @@ unc() {
|
|||
|
||||
comp() {
|
||||
[ -e patchme/"$1" ] || return 0
|
||||
../z64yaz0 patchme/"$1" > patchme/"$1".Yaz0
|
||||
../../z64yaz0 patchme/"$1" > patchme/"$1".Yaz0
|
||||
echo "compressed $1"
|
||||
ratio patchme/"$1" patchme/"$1".Yaz0
|
||||
rm patchme/"$1"
|
||||
}
|
||||
|
||||
[ ! -s ../z64yaz0 ] && cc -O3 ../z64yaz0.c -o ../z64yaz0
|
||||
mkdir -p build
|
||||
cp *.lua build/
|
||||
cd build
|
||||
|
||||
[ ! -s ../../z64yaz0 ] && cc -O3 ../../z64yaz0.c -o ../../z64yaz0
|
||||
|
||||
if [ $fast -eq 0 ] || [ ! -d patchme ]; then
|
||||
[ -d patchme ] && rm -r patchme
|
||||
(cd ..; ./z64dump.py -c "$rom")
|
||||
mv ../"$sha1" patchme
|
||||
(cd ../../; ./z64dump.py -c "$rom")
|
||||
mv ../../"$sha1" patchme
|
||||
fi
|
||||
|
||||
unc "$code"
|
||||
|
||||
# don't copy entire dir; avoid copying dotfiles (.git)
|
||||
mkdir -p lips
|
||||
cp "$lips"/* lips
|
||||
cp "$inject/"{crc32,entrances}.asm .
|
||||
cp ../"$lips"/* lips
|
||||
|
||||
cp ../"$inject/"{crc32,entrances}.asm .
|
||||
cp ../extra.asm .
|
||||
cp ../common.asm .
|
||||
cp ../code.asm .
|
||||
|
||||
dd if=/dev/zero of=extra bs=370688 count=1 2>/dev/null
|
||||
|
||||
|
@ -64,6 +73,6 @@ rm extra
|
|||
if [ $fast -ne 2 ]; then
|
||||
comp "$code"
|
||||
comp "$extra"
|
||||
(cd ..; ./z64dump.py patch/patchme)
|
||||
dd if=patchme.z64 of=mm-bq.z64 bs=$((1024*1024)) count=32 status=none
|
||||
(cd ../..; ./z64dump.py patch/build/patchme)
|
||||
dd if=patchme.z64 of="$out" bs=$((1024*1024)) count=32 status=none
|
||||
fi
|
||||
|
|
|
@ -4,14 +4,23 @@ set -e
|
|||
inject=../Lua/inject
|
||||
rom=../roms/everything/"Legend of Zelda, The - Ocarina of Time - Master Quest (E) (Debug) [f1].z64"
|
||||
lips=../Lua/lib/lips
|
||||
out=oot-widescreen.z64
|
||||
|
||||
(cd ..; cp "$rom" patch/oot-widescreen.z64)
|
||||
mkdir -p build
|
||||
cp *.lua build/
|
||||
cd build
|
||||
|
||||
cp ../../"$rom" "$out"
|
||||
|
||||
# don't copy entire dir; avoid copying dotfiles (.git)
|
||||
mkdir -p lips
|
||||
cp "$lips"/* lips
|
||||
cp "$inject/"widescreen-either.asm .
|
||||
cp ../"$lips"/* lips
|
||||
|
||||
luajit patch.lua -o 0 --extra-rom 0x035D0000 --extra-ram 0x80700000 widescreen-inline.asm oot-widescreen.z64
|
||||
cp ../"$inject/"widescreen-either.asm .
|
||||
cp ../widescreen-inline.asm .
|
||||
|
||||
(cd ..; ./z64dump.py -f patch/oot-widescreen.z64)
|
||||
luajit patch.lua -o 0 \
|
||||
--extra-rom 0x035D0000 --extra-ram 0x80700000 \
|
||||
widescreen-inline.asm "$out"
|
||||
|
||||
(cd ../../; ./z64dump.py -f patch/build/"$out")
|
||||
|
|
|
@ -34,8 +34,6 @@ local function inject(args)
|
|||
end
|
||||
f:seek('set', pos)
|
||||
|
||||
-- TODO: write hex dump format of written bytes
|
||||
|
||||
f:write(string.char(b))
|
||||
end
|
||||
|
||||
|
@ -60,12 +58,14 @@ end
|
|||
|
||||
local ap = argparse("patch", "patch a binary file with assembly")
|
||||
|
||||
-- TODO: option to dump hex or gs codes when no output is given
|
||||
ap:argument("input", "input assembly file")
|
||||
ap:argument("output", "output binary file")
|
||||
ap:option("-o --offset", "offset to pass to lips", "0"):convert(parsenum)
|
||||
ap:option("-i --import", "import state file(s) containing labels"):count("*")
|
||||
ap:option("-e --export", "export state file containing labels")
|
||||
--ap:option("-s --state", "--import and --export to this file")
|
||||
-- TODO: replace this with a lua table import of associated addresses
|
||||
ap:option("--extra-rom", "dumb stuff"):convert(parsenum)
|
||||
ap:option("--extra-ram", "dumb stuff"):convert(parsenum)
|
||||
|
||||
|
|
Loading…
Reference in a new issue