@echo off
rem ============================================================
rem  Live queue display panel - 300x800 dark overlay
rem  Double-click to open a borderless 300x800 window.
rem  In Douyin Live Partner: Add source - Window - pick it.
rem
rem  To change server later: edit the SERVER line below.
rem  (This file is ASCII-only on purpose: zero encoding issues.)
rem ============================================================

set "SERVER=http://124.222.86.241:8787"
if not "%GQ_SERVER%"=="" set "SERVER=%GQ_SERVER%"
set "URL=%SERVER%/overlay"
set "W=300"
set "H=800"

echo.
echo   Genshin Queue - Live Display Panel
echo   --------------------------------------
echo   URL  : %URL%
echo   Size : %W% x %H%
echo.

set "BROWSER="
for %%P in (
  "%ProgramFiles%\Google\Chrome\Application\chrome.exe"
  "%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe"
  "%LocalAppData%\Google\Chrome\Application\chrome.exe"
  "%ProgramFiles%\Microsoft\Edge\Application\msedge.exe"
  "%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe"
  "%ProgramFiles%\BraveSoftware\Brave-Browser\Application\brave.exe"
) do (
  if exist %%P if not defined BROWSER set "BROWSER=%%~P"
)

if not defined BROWSER (
  echo   [X] Chrome / Edge / Brave not found.
  echo       Install Google Chrome or Edge, then run this again.
  echo       Or open this URL in any browser:
  echo       %URL%
  echo.
  pause
  exit /b 1
)

echo   Browser: %BROWSER%
echo   Opening window...

start "" "%BROWSER%" ^
  --app="%URL%" ^
  --window-size=%W%,%H% ^
  --window-position=40,80 ^
  --no-first-run ^
  --no-default-browser-check ^
  --disable-backgrounding-occluded-windows ^
  --disable-renderer-backgrounding ^
  --disable-background-timer-throttling ^
  --disable-features=Translate,CalculateNativeWinOcclusion ^
  --user-data-dir="%USERPROFILE%\.genshin-queue-display"

timeout /t 3 >nul

echo   [OK] Display window should be open now.
echo.
echo   --------------------------------------
echo   In Douyin Live Partner:
echo     Add source  -  Window  -  pick this window
echo     Drag it where you want. NO chroma key needed.
echo.
echo   The panel updates by itself.
echo   Do NOT minimize the window - hiding it behind
echo   the game is fine, minimizing is not.
echo.
pause
