#!/usr/bin/env bash
# Реестр после innoextract — web-installer видит установленный Galaxy.
set -euo pipefail
GOG_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck source=config.sh
source "${GOG_DIR}/config.sh"

GOG_PF='C:\Program Files (x86)\GOG Galaxy'
CLIENT="${GOG_PF}\\GalaxyClient.exe"
SERVICE="${GOG_PF}\\GalaxyClientService.exe"

gog_wine_check
export_wine_env_gog

"${WINE64}" reg add 'HKLM\Software\WOW6432Node\GOG.com\GalaxyClient' /v version /t REG_SZ /d '2.0.100.1' /f
"${WINE64}" reg add 'HKLM\Software\WOW6432Node\GOG.com\GalaxyClient\paths' /v GalaxyClientExePath /t REG_SZ /d "${CLIENT}" /f
"${WINE64}" reg add 'HKLM\Software\WOW6432Node\GOG.com\GalaxyClient\paths' /v GalaxyClientServiceExePath /t REG_SZ /d "${SERVICE}" /f
"${WINE64}" reg add 'HKCU\Software\GOG.com\Galaxy' /f 2>/dev/null || true

echo "OK: GalaxyClient paths → ${CLIENT}"
