165 lines
5.6 KiB
Batchfile
165 lines
5.6 KiB
Batchfile
@echo off
|
|
title GaC hkrpg GO Server (4.6.53)
|
|
cd /d "%~dp0"
|
|
|
|
echo ==============================================================================
|
|
echo [ GaC hkrpg GO ] StarRail 4.6.53 Server and Launcher
|
|
echo gameserver : UDP 23301 (KCP Gateway)
|
|
echo sdkserver : HTTP 21000 (Dispatch / Login / SRTools)
|
|
echo ==============================================================================
|
|
echo.
|
|
echo [1] Start Server and Star Rail Game / Proxy (Default)
|
|
echo [2] Start Both Servers (gameserver + sdkserver)
|
|
echo [3] Start SDK Server ONLY (HTTP 21000)
|
|
echo [4] Start Game Server ONLY (UDP 23301)
|
|
echo [5] Start Server and Gay Proxy
|
|
echo [6] Build / Rebuild binaries (Go)
|
|
echo [7] Exit
|
|
echo.
|
|
echo ==============================================================================
|
|
|
|
set "choice=%~1"
|
|
if not defined choice set /p choice="Select [1-7] (Press Enter for 1): "
|
|
if not defined choice set "choice=1"
|
|
set "choice=%choice: =%"
|
|
if not defined choice set "choice=1"
|
|
|
|
if "%choice%"=="1" goto opt_game
|
|
if "%choice%"=="2" goto opt_servers_only
|
|
if "%choice%"=="3" goto opt_sdk_only
|
|
if "%choice%"=="4" goto opt_gs_only
|
|
if "%choice%"=="5" goto opt_gay_proxy
|
|
if "%choice%"=="6" goto opt_build
|
|
if "%choice%"=="7" exit /b 0
|
|
|
|
if /i "%choice%"=="sdk" goto opt_sdk_only
|
|
if /i "%choice%"=="gs" goto opt_gs_only
|
|
if /i "%choice%"=="servers" goto opt_servers_only
|
|
if /i "%choice%"=="game" goto opt_game
|
|
if /i "%choice%"=="proxy" goto opt_gay_proxy
|
|
if /i "%choice%"=="build" goto opt_build
|
|
|
|
echo Unknown option "%choice%", starting servers only...
|
|
goto opt_servers_only
|
|
|
|
:start_core_servers
|
|
if not exist "gameserver-go.exe" (
|
|
echo [ERROR] gameserver-go.exe not found! Please build first - Option 6
|
|
pause
|
|
exit /b 1
|
|
)
|
|
if not exist "sdkserver-go.exe" (
|
|
echo [ERROR] sdkserver-go.exe not found! Please build first - Option 6
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo [*] Cleaning old server processes...
|
|
taskkill /f /im sdkserver-go.exe >nul 2>&1
|
|
taskkill /f /im gameserver-go.exe >nul 2>&1
|
|
|
|
echo [*] Starting SDK Server [Port 21000]...
|
|
start "GaC GO - SDK Server [Port 21000]" /d "%~dp0" cmd /k sdkserver-go.exe
|
|
|
|
echo [*] Starting Game Server [Port 23301]...
|
|
start "GaC GO - Game Server [Port 23301]" /d "%~dp0" cmd /k gameserver-go.exe
|
|
exit /b 0
|
|
|
|
:opt_sdk_only
|
|
if not exist "sdkserver-go.exe" (
|
|
echo [ERROR] sdkserver-go.exe not found! Please build first - Option 6
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo [*] Cleaning old sdkserver process...
|
|
taskkill /f /im sdkserver-go.exe >nul 2>&1
|
|
|
|
echo [*] Starting SDK Server [Port 21000]...
|
|
start "GaC GO - SDK Server [Port 21000]" /d "%~dp0" cmd /k sdkserver-go.exe
|
|
goto finish
|
|
|
|
:opt_gs_only
|
|
if not exist "gameserver-go.exe" (
|
|
echo [ERROR] gameserver-go.exe not found! Please build first - Option 6
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo [*] Cleaning old gameserver process...
|
|
taskkill /f /im gameserver-go.exe >nul 2>&1
|
|
|
|
echo [*] Starting Game Server [Port 23301]...
|
|
start "GaC GO - Game Server [Port 23301]" /d "%~dp0" cmd /k gameserver-go.exe
|
|
goto finish
|
|
|
|
:opt_game
|
|
call :start_core_servers
|
|
if errorlevel 1 goto :eof
|
|
|
|
echo.
|
|
echo [*] Launching Star Rail Client / Proxy...
|
|
set "GAME_DIR="
|
|
if exist "%USERPROFILE%\Desktop\StarRail_4.6.53_OS\StarRail.exe" set "GAME_DIR=%USERPROFILE%\Desktop\StarRail_4.6.53_OS"
|
|
if not defined GAME_DIR if exist "%~dp0..\StarRail_4.6.53_OS\StarRail.exe" set "GAME_DIR=%~dp0..\StarRail_4.6.53_OS"
|
|
if not defined GAME_DIR if exist "%USERPROFILE%\Desktop\StarRail_4.6.51_OS\StarRail.exe" set "GAME_DIR=%USERPROFILE%\Desktop\StarRail_4.6.51_OS"
|
|
if not defined GAME_DIR if exist "D:\HoYoPlay\games\Star Rail Games\StarRail.exe" set "GAME_DIR=D:\HoYoPlay\games\Star Rail Games"
|
|
if not defined GAME_DIR if exist "%~dp0..\StarRail_4.6.51_OS\StarRail.exe" set "GAME_DIR=%~dp0..\StarRail_4.6.51_OS"
|
|
|
|
if defined GAME_DIR (
|
|
echo [*] Found game client at: %GAME_DIR%
|
|
if exist "%GAME_DIR%\GaCy Launcher.exe" (
|
|
echo [*] Starting GaCy Launcher...
|
|
start "GaCy Launcher" /d "%GAME_DIR%" "%GAME_DIR%\GaCy Launcher.exe"
|
|
) else if exist "%GAME_DIR%\launcher.exe" (
|
|
echo [*] Starting Launcher...
|
|
start "Proxy Launcher" /d "%GAME_DIR%" "%GAME_DIR%\launcher.exe"
|
|
) else if exist "%GAME_DIR%\StarRail.exe" (
|
|
echo [*] Starting StarRail.exe...
|
|
start "Star Rail Client" /d "%GAME_DIR%" "%GAME_DIR%\StarRail.exe"
|
|
)
|
|
) else (
|
|
echo [!] Game client not found automatically. Please open StarRail manually.
|
|
)
|
|
goto finish
|
|
|
|
:opt_gay_proxy
|
|
call :start_core_servers
|
|
if errorlevel 1 goto :eof
|
|
|
|
echo.
|
|
echo [*] Launching Gay Proxy...
|
|
set "PROXY_BAT="
|
|
if exist "%USERPROFILE%\Desktop\Gay Proxy\run_proxy.bat" set "PROXY_BAT=%USERPROFILE%\Desktop\Gay Proxy\run_proxy.bat"
|
|
if not defined PROXY_BAT if exist "%~dp0..\Gay Proxy\run_proxy.bat" set "PROXY_BAT=%~dp0..\Gay Proxy\run_proxy.bat"
|
|
|
|
if defined PROXY_BAT (
|
|
start "Gay Proxy" cmd /k "%PROXY_BAT%"
|
|
) else (
|
|
echo [!] Gay Proxy not found.
|
|
)
|
|
goto finish
|
|
|
|
:opt_servers_only
|
|
call :start_core_servers
|
|
if errorlevel 1 goto :eof
|
|
goto finish
|
|
|
|
:opt_build
|
|
where go >nul 2>nul || set "PATH=%PATH%;C:\Program Files\Go\bin"
|
|
echo [*] Building gameserver-go.exe...
|
|
go build -o gameserver-go.exe ./cmd/gameserver || (pause & goto :eof)
|
|
echo [*] Building sdkserver-go.exe...
|
|
go build -o sdkserver-go.exe ./cmd/sdkserver || (pause & goto :eof)
|
|
echo [OK] Build successful!
|
|
pause
|
|
goto :eof
|
|
|
|
:finish
|
|
echo.
|
|
echo ==============================================================================
|
|
echo [OK] Started successfully!
|
|
echo Close server windows to stop them.
|
|
echo Closing this launcher window in 5 seconds...
|
|
echo ==============================================================================
|
|
timeout /t 5 >nul 2>&1 || ping 127.0.0.1 -n 6 >nul
|
|
exit
|