diff --git a/resources/js/index.js b/resources/js/index.js index 128bea9..82a9610 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -380,7 +380,7 @@ async function launchPrivate() { Neutralino.storage.setData('config', JSON.stringify(config)) // Pass IP and game folder to the private server launcher - Neutralino.os.execCommand(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} "${config.genshinImpactFolder}/${await getGenshinExecName()}"`).catch(e => console.log(e)) + Neutralino.os.execCommand(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} "${config.genshinImpactFolder}/${await getGenshinExecName()}" "${NL_CWD}" ${config.enableKillswitch}`).catch(e => console.log(e)) } /** diff --git a/scripts/private_server_launch.cmd b/scripts/private_server_launch.cmd index 7375457..3c46376 100644 --- a/scripts/private_server_launch.cmd +++ b/scripts/private_server_launch.cmd @@ -1,9 +1,11 @@ @echo off +echo Killswitch %4 + :: Ensure admin >nul 2>&1 reg query "HKU\S-1-5-19" || ( set params = %*:"="""% - cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %1 "%2" ""%cd%"" ", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B ) + cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %1 "%2" ""%cd%"" %4", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B ) ) echo Starting Proxy Server @@ -13,6 +15,7 @@ set GAME_PATH=%2 set GAME_PATH=%GAME_PATH:"=% set ORIGIN=%3 set ORIGIN=%ORIGIN:"=% +set ENABLE_KILLSWITCH=%4 set PROXY=true @rem Store original proxy settings @@ -31,12 +34,17 @@ echo Opening %GAME_PATH% :: Allow the proxy server to create the certificates ping 127.0.0.1 -n 5 > nul -For %%A in ("%GAME_PATH%") do ( - Set GAME_EXE=%%~nxA +for %%A in ("%GAME_PATH%") do ( + set GAME_EXE=%%~nxA ) -:: Start killswitch -start /b %ORIGIN%\scripts\killswitch.cmd "%GAME_EXE%" %IP%" +echo Killswitch: %ENABLE_KILLSWITCH% + +if "%ENABLE_KILLSWITCH%" EQU "true" ( + echo Killswitch is enabled! + :: Start killswitch + start /b %ORIGIN%\scripts\killswitch.cmd "%GAME_EXE%" %IP%" +) :: Launch game "%GAME_PATH%"