From dc7c7664995e94829d62432be8410c63b69eb2a6 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Thu, 5 May 2022 20:37:43 -0700 Subject: [PATCH] fix killswitch a lil --- scripts/killswitch.cmd | 8 ++++++-- scripts/private_server_launch.cmd | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/killswitch.cmd b/scripts/killswitch.cmd index 8fd010c..6e4b698 100644 --- a/scripts/killswitch.cmd +++ b/scripts/killswitch.cmd @@ -22,6 +22,9 @@ if "%PROXY_IP%" EQU "localhost" ( ) :loop + :: Wait a couple seconds + ping 127.0.0.1 -n 2 > nul + :: Check if the game is even running :: tasklist /fi "ImageName eq %GAME_EXE_NAME%" /fo csv 2>NUL | find /I "%GAME_EXE_NAME%.exe">NUL :: IF %ERRORLEVEL% NEQ 0 ( @@ -32,6 +35,7 @@ if "%PROXY_IP%" EQU "localhost" ( :: https://stackoverflow.com/questions/162291/how-to-check-if-a-process-is-running-via-a-batch-script tasklist /fi "ImageName eq mitmdump.exe" /fo csv 2>NUL | find /I "mitmdump.exe">NUL if "%ERRORLEVEL%" NEQ "0" ( + echo "mitmdump not running" goto killgame ) @@ -50,6 +54,7 @@ if "%PROXY_IP%" EQU "localhost" ( :: Ensure proxy is enabled, space is there on purpose IF "%PROXY_ENABLED%" NEQ "0x1 " ( + echo "Proxy server disabled in windows" goto killgame ) @@ -59,11 +64,10 @@ if "%PROXY_IP%" EQU "localhost" ( :: There is a space after %PROXY_IP on purpose, Windows is weird if "%CUR_PROXY_IP%" NEQ "%PROXY_IP%:8080 " ( + echo "Cur proxy: %CUR_PROXY_IP% | Proxy: %PROXY_IP%:8080" goto killgame ) - ping 127.0.0.1 -n 2 > nul - goto loop :killgame diff --git a/scripts/private_server_launch.cmd b/scripts/private_server_launch.cmd index d88855c..5f78002 100644 --- a/scripts/private_server_launch.cmd +++ b/scripts/private_server_launch.cmd @@ -60,7 +60,7 @@ echo Killswitch: %ENABLE_KILLSWITCH% if "%ENABLE_KILLSWITCH%" EQU "true" ( echo Killswitch is enabled! :: Start killswitch - start /b %ORIGIN%\scripts\killswitch.cmd "%GAME_EXE%" %IP% + start /b %ORIGIN%\scripts\killswitch.cmd "%GAME_EXE%" 127.0.0.1 ) :: Launch game