aagl-unlockfps/unlockfps.bat

78 lines
2.3 KiB
Batchfile
Raw Normal View History

2022-07-16 21:04:30 +08:00
@echo off
REM Notice: This file is overwritten for each patch for safety reasons.
REM Hence, any manual changes will be overwritten by the next patch.
REM ============ AVOID CHANGES HERE ============
2022-10-04 04:59:55 +08:00
REM DOMAIN_CHECK_BEGIN
2022-07-16 21:04:30 +08:00
SET perr1=1
SET perr2=1
2022-10-04 04:59:55 +08:00
SET perr3=1
2022-07-16 21:04:30 +08:00
SET perr=0
setlocal EnableDelayedExpansion
FOR /f "delims=" %%i IN ('ping -n 1 -w 1 log-upload-os.hoyoverse.com') DO (
echo %%i | find "[0.0.0.0]" >nul
IF !ERRORLEVEL! EQU 0 SET "perr1=0"
echo %%i | find "could not find host" >nul
IF !ERRORLEVEL! EQU 0 SET "perr1=0"
)
2022-10-04 04:59:55 +08:00
FOR /f "delims=" %%i IN ('ping -n 1 -w 1 sg-public-data-api.hoyoverse.com') DO (
2022-07-16 21:04:30 +08:00
echo %%i | find "[0.0.0.0]" >nul
IF !ERRORLEVEL! EQU 0 SET "perr2=0"
echo %%i | find "could not find host" >nul
IF !ERRORLEVEL! EQU 0 SET "perr2=0"
)
2022-10-04 04:59:55 +08:00
FOR /f "delims=" %%i IN ('ping -n 1 -w 1 overseauspider.yuanshen.com') DO (
echo %%i | find "[0.0.0.0]" >nul
IF !ERRORLEVEL! EQU 0 SET "perr3=0"
echo %%i | find "could not find host" >nul
IF !ERRORLEVEL! EQU 0 SET "perr3=0"
)
2022-07-16 21:04:30 +08:00
REM There's no OR operator for "IF"
IF %perr1% EQU 1 SET perr=1
IF %perr2% EQU 1 SET perr=1
2022-10-04 04:59:55 +08:00
IF %perr3% EQU 1 SET perr=1
2022-07-16 21:04:30 +08:00
IF %perr% NEQ 0 (
REM Show the message to the user
2022-10-04 04:59:55 +08:00
echo ERROR: You opted to block the analytics servers but they are reachable. Please re-run the patch script. >_error.txt
2022-07-16 21:04:30 +08:00
notepad _error.txt
del _error.txt
exit
)
2022-10-04 04:59:55 +08:00
REM DOMAIN_CHECK_END
2022-07-16 21:04:30 +08:00
REM Emulate the games behaviour
2022-10-04 04:59:55 +08:00
copy mhyprot3.sys "%TEMP%\"
2022-07-16 21:04:30 +08:00
regedit mhyprot2_running.reg
REM Disable crash reporting
IF EXIST GenshinImpact_Data\upload_crash.exe (
move "GenshinImpact_Data\upload_crash.exe" "GenshinImpact_Data\upload_crash.exe.bak"
)
IF EXIST GenshinImpact_Data\Plugins\crashreport.exe (
move "GenshinImpact_Data\Plugins\crashreport.exe" "GenshinImpact_Data\Plugins\crashreport.exe.bak"
)
REM cd into fpsunlock directory, so it doesn't execute in same working directory as Genshin, otherwise it will complain.
set "your_dir=..\fpsunlock"
pushd %cd%
cd %your_dir%
start unlockfps.exe %*
REM Only start first time, so unlockfps can detect game location. Subsequent launches can be done from unlockfps's GUI or it's autostart.
IF NOT EXIST fps_config.json (
popd
start GenshinImpact.exe %*
)
REM This is a check for the old file generated by an older version of unlockfps
REM IF NOT EXIST fps_config.ini (
REM start GenshinImpact.exe %*
REM )