mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-21 13:53:49 -07:00
MacOS OTR (#973)
This commit is contained in:
parent
ad3efccb88
commit
9bc6aac81e
3 changed files with 281 additions and 202 deletions
|
@ -1,8 +1,69 @@
|
|||
#!/bin/sh
|
||||
BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/.*//'`"
|
||||
RESOURCES="$BUNDLE/Contents/Resources"
|
||||
#!/bin/bash
|
||||
|
||||
export DYLD_FRAMEWORK_PATH=$RESOURCES/Frameworks
|
||||
export DYLD_LIBRARY_PATH=$RESOURCES/bin
|
||||
SNAME="$(dirname $0)"
|
||||
export DATA_SHARE="$HOME/Library/Application Support/com.shipofharkinian.soh"
|
||||
export SNAME
|
||||
export RESPATH="${SNAME%/MacOS*}/Resources"
|
||||
export LIBPATH="${SNAME%/MacOS*}/Frameworks"
|
||||
export DYLD_FALLBACK_LIBRARY_PATH="$LIBPATH"
|
||||
|
||||
exec "$RESOURCES/soh-macos"
|
||||
while [ ! -e "$DATA_SHARE/oot.otr" ]; do
|
||||
ASSETDIR="$(mktemp -d /tmp/assets-XXXXX)"
|
||||
export ASSETDIR
|
||||
cp -r "$RESPATH/assets" "$ASSETDIR"
|
||||
mkdir -p "$ASSETDIR"/tmp
|
||||
mkdir -p "$ASSETDIR"/Extract/assets
|
||||
DROPROM="$(osascript -ss - "$ASSETDIR" <<-EOF
|
||||
set romFile to choose file of type {"b64","n64","v64","z64"} with prompt "Please select your ROM:"
|
||||
set destinationFolder to POSIX file "$ASSETDIR"
|
||||
tell application "Finder"
|
||||
duplicate romFile to destinationFolder
|
||||
end tell
|
||||
EOF
|
||||
)"
|
||||
"$DROPROM"
|
||||
for rom in "$ASSETDIR"/*.*64
|
||||
do
|
||||
if [ ! -e "$rom" ]; then
|
||||
echo "no ROM"
|
||||
osascript -e 'display dialog "Select ROM to generate OTR" giving up after 5'
|
||||
rm -r "$ASSETDIR"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
cp "$ASSETDIR"/*.*64 "$ASSETDIR"/tmp/rom.z64
|
||||
cp -r "$ASSETDIR"/assets/game/ship_of_harkinian "$ASSETDIR"/Extract/assets/
|
||||
cd "$ASSETDIR" || return
|
||||
ROMHASH="$(shasum "$ASSETDIR"/tmp/rom.z64 | awk '{ print $1 }')"
|
||||
case "$ROMHASH" in
|
||||
cee6bc3c2a634b41728f2af8da54d9bf8cc14099)
|
||||
export ROM=GC_NMQ_D;;
|
||||
0227d7c0074f2d0ac935631990da8ec5914597b4)
|
||||
export ROM=GC_NMQ_PAL_F;;
|
||||
*)
|
||||
WRONGHASH="$(osascript -ss - "$ROMHASH" <<-EOF
|
||||
display dialog "Incompatible ROM hash $ROMHASH" \
|
||||
with title "Incompatible ROM hash" \
|
||||
with icon caution \
|
||||
giving up after 5
|
||||
EOF
|
||||
)"
|
||||
"$WRONGHASH"
|
||||
rm -r "$ASSETDIR"
|
||||
exit;;
|
||||
esac
|
||||
echo "$ROM"
|
||||
|
||||
osascript -e 'display notification "Processing OTR..." with title "SOH: Generating OTR"'
|
||||
assets/extractor/ZAPD.out ed -i assets/extractor/xmls/"${ROM}" -b tmp/rom.z64 -fl assets/extractor/filelists -o placeholder -osf placeholder -gsf 1 -rconf assets/extractor/Config_"${ROM}".xml -se OTR
|
||||
if [ -e "$PWD"/oot.otr ]; then
|
||||
osascript -e 'display notification "OTR Successfully Generated" with title "SOH: Generating OTR"'
|
||||
if [ ! -e "$DATA_SHARE" ]; then mkdir "$DATA_SHARE"; fi
|
||||
cp "$ASSETDIR"/oot.otr "$DATA_SHARE"
|
||||
rm -r "$ASSETDIR"
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
"$RESPATH"/soh-macos
|
||||
exit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue