#!/bin/sh
set -eu
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/../Resources" && pwd)
if [ "$(uname -m)" != x86_64 ]; then
 /usr/bin/osascript -e 'display alert "SoulPlay" message "This package is for Intel Macs. Apple Silicon support has not been verified." as critical'
 exit 1
fi
for option in JAVA_TOOL_OPTIONS _JAVA_OPTIONS JDK_JAVA_OPTIONS CLASSPATH; do
 if [ -n "$(printenv "$option" || true)" ]; then /usr/bin/osascript -e 'display alert "SoulPlay" message "Unexpected Java startup environment. Remove custom Java options before starting the game." as critical'; exit 1; fi
done
LOG="$HOME/Library/Logs/SoulPlay"
mkdir -p "$LOG"
exec "$ROOT/runtime/Contents/Home/bin/java" -Xmx768m -Dapple.awt.application.name=SoulPlay -Dapple.laf.useScreenMenuBar=false -jar "$ROOT/app/SoulPlay.jar" "$@" >>"$LOG/client.log" 2>&1
