@echo off
setlocal EnableExtensions

set "PROJECT_DIR=%~dp0.."
set "PACKAGE_DIR=%PROJECT_DIR%\Builds\WindowsDevelopment"
set "DEMO_EXE=%PACKAGE_DIR%\AgrarianGame.exe"
set "CAPTURE_ROOT=%PROJECT_DIR%\Saved\VisualQA\GpuStartup"

if not exist "%DEMO_EXE%" (
	echo ERROR: Packaged demo executable not found: "%DEMO_EXE%"
	exit /b 2
)

sc query SunshineService | find /I "RUNNING" >nul 2>nul
if errorlevel 1 (
	echo ERROR: SunshineService is not running. Start Sunshine before the GPU visual test.
	exit /b 3
)

if /I "%~1"=="--check-tools" (
	echo READY: packaged demo exists and SunshineService is running.
	exit /b 0
)

if not exist "%CAPTURE_ROOT%" mkdir "%CAPTURE_ROOT%" >nul 2>nul

echo.
echo Agrarian packaged-client real-GPU startup visual test
echo -----------------------------------------------------
echo Package: "%PACKAGE_DIR%"
echo Capture root: "%CAPTURE_ROOT%"
echo.
echo Use Sunshine plus Moonlight or an equivalent real GPU desktop capture path.
echo Do not use QEMU guest-agent screenshots for this visual gate.
echo.
echo Required capture labels:
echo   01-startup-credits
echo   02-character-selection
echo   03-server-join
echo   04-loading
echo   05-first-spawn
echo   06-pause-menu
echo   07-save-quit
echo   08-terrain
echo   09-vegetation
echo   10-water
echo   11-campfire
echo   12-shelter
echo.
echo Create visual-startup-check.txt in the capture folder with package path,
echo launcher used, capture method, tester, pass/fail result, and notes.
echo.
exit /b 0
