Files
local_machine/scripts/games/gog/run-ja3.sh

86 lines
3.2 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Запуск Jagged Alliance 3 (GOG) без Steam client — Whisky GOG-Install.
set -euo pipefail
GOG_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck source=config.sh
source "${GOG_DIR}/config.sh"
# shellcheck source=gog-process.sh
source "${GOG_DIR}/gog-process.sh"
JA3_WIN='C:\GOG Games\Jagged Alliance 3\JA3.exe'
JA3_UNIX="${BOTTLE_DIR}/drive_c/GOG Games/Jagged Alliance 3"
JA3_EXE="${JA3_UNIX}/JA3.exe"
GALAXY_SVC='C:\Program Files (x86)\GOG Galaxy\GalaxyClientService.exe'
if [[ ! -f "${JA3_EXE}" ]]; then
echo "❌ Нет ${JA3_EXE}"
echo " Установите: bash ${GOG_DIR}/install-ja3-innoextract.sh"
exit 1
fi
bash "${GOG_DIR}/emergency-stop.sh" >/dev/null 2>&1 || gog_kill_all
sleep 2
if [[ "${JA3_IGNORE_SWAP:-0}" == "1" ]]; then
echo "⚠️ JA3_IGNORE_SWAP=1 — swap $(gog_swap_used_mb 2>/dev/null || echo '?')MB"
elif ! gog_swap_guard_ja3_launch "${JA3_SWAP_SOFT_MB:-1200}" "${JA3_SWAP_HARD_MB:-4096}"; then
used="$(gog_swap_used_mb 2>/dev/null || echo '?')"
echo ""
echo "Swap ~${used}MB — bash ${GOG_DIR}/reset-ja3-whisky.sh или reboot Mac"
echo "Или: JA3_IGNORE_SWAP=1 bash ${GOG_DIR}/run-ja3.sh"
exit 1
fi
gog_assert_no_steam_client || exit 1
if ! ja3_gptk_available && ! ja3_bottle_uses_d3dmetal; then
if [[ -d "/Applications/Game Porting Toolkit.app" ]]; then
bash "${GOG_DIR}/install-gptk-whisky.sh" >/dev/null 2>&1 || true
bash "${GOG_DIR}/configure-ja3-d3dmetal.sh" >/dev/null 2>&1 || true
else
echo ""
echo "⚠️ JA3 нужен D3D12 (GPTK). Установите:"
echo " brew install --cask gcenx/wine/game-porting-toolkit"
echo " bash ${GOG_DIR}/install-gptk-whisky.sh && bash ${GOG_DIR}/configure-ja3-d3dmetal.sh"
echo ""
fi
fi
if ja3_gptk_available || ja3_bottle_uses_d3dmetal; then
bash "${GOG_DIR}/prepare-ja3-d3dmetal.sh" >/dev/null 2>&1 || true
fi
bash "${GOG_DIR}/finish-ja3-layout.sh" >/dev/null 2>&1 || true
if ja3_gptk_available || ja3_bottle_uses_d3dmetal; then
:
else
bash "${GOG_DIR}/force-ja3-d3d11.sh" >/dev/null 2>&1 || true
fi
export_wine_env_ja3
gog_wine_check
# Фоновый Galaxy service (Music/Matchmaking wrapper — не Steam)
if [[ -f "${BOTTLE_DIR}/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClientService.exe" ]]; then
if ! pgrep -f 'GalaxyClientService' >/dev/null 2>&1; then
nohup "${WINE64}" "${GALAXY_SVC}" >>/tmp/ja3-galaxy-service.log 2>&1 &
sleep 2
fi
fi
if ja3_gptk_available || ja3_bottle_uses_d3dmetal; then
echo "Запуск JA3 (Whisky + D3DMetal)…"
else
echo "Запуск JA3 (Whisky, DXVK D3D11 fallback; без Steam.app)…"
fi
echo "Cmd+Tab → wine64. В графике: отключить heat haze."
echo "(лог «Steam … GOG» = GOG API-шим, не Steam client)"
if ja3_gptk_available || ja3_bottle_uses_d3dmetal; then
_ja3_args="${JA3_EXTRA_ARGS:--unpacked}"
export MTL_HUD_ENABLED="${MTL_HUD_ENABLED:-0}"
else
_ja3_args="${JA3_EXTRA_ARGS:--unpacked -graphicsapi d3d11}"
fi
# start /d — CWD = папка игры (CommonLua/, иначе «graphics subsystem»/autorun.lua из Whisky Run)
# shellcheck disable=SC2086
exec "${WINE64}" start /d "C:\\GOG Games\\Jagged Alliance 3" "${JA3_WIN}" ${_ja3_args}