launcher.bat 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. @echo off
  2. REM Notice: This file is overwritten for each patch for safety reasons.
  3. REM Hence, any manual changes will be overwritten by the next patch.
  4. REM ============ AVOID CHANGES HERE ============
  5. REM DOMAIN_CHECK_BEGIN
  6. SET perr1=1
  7. SET perr2=1
  8. SET perr=0
  9. setlocal EnableDelayedExpansion
  10. FOR /f "delims=" %%i IN ('ping -n 1 -w 1 log-upload-os.hoyoverse.com') DO (
  11. echo %%i | find "[0.0.0.0]" >nul
  12. IF !ERRORLEVEL! EQU 0 SET "perr1=0"
  13. echo %%i | find "could not find host" >nul
  14. IF !ERRORLEVEL! EQU 0 SET "perr1=0"
  15. )
  16. FOR /f "delims=" %%i IN ('ping -n 1 -w 1 sg-public-data-api.hoyoverse.com') DO (
  17. echo %%i | find "[0.0.0.0]" >nul
  18. IF !ERRORLEVEL! EQU 0 SET "perr2=0"
  19. echo %%i | find "could not find host" >nul
  20. IF !ERRORLEVEL! EQU 0 SET "perr2=0"
  21. )
  22. REM There's no OR operator for "IF"
  23. IF %perr1% EQU 1 SET perr=1
  24. IF %perr2% EQU 1 SET perr=1
  25. IF %perr% NEQ 0 (
  26. REM Show the message to the user
  27. echo ERROR: You opted to block the analytics servers but they are reachable. Please re-run the patch script. >_error.txt
  28. notepad _error.txt
  29. del _error.txt
  30. exit
  31. )
  32. REM DOMAIN_CHECK_END
  33. REM Try to emulate the game behaviour
  34. copy mhyprot3.sys "%TEMP%\"
  35. copy HoYoKProtect.sys "%WINDIR%\system32\"
  36. regedit mhyprot2_running.reg
  37. REM Disable crash reporting
  38. IF EXIST GenshinImpact_Data\upload_crash.exe (
  39. move "GenshinImpact_Data\upload_crash.exe" "GenshinImpact_Data\upload_crash.exe.bak"
  40. )
  41. IF EXIST GenshinImpact_Data\Plugins\crashreport.exe (
  42. move "GenshinImpact_Data\Plugins\crashreport.exe" "GenshinImpact_Data\Plugins\crashreport.exe.bak"
  43. )
  44. REM ============= Launch the game =============
  45. REM https://docs.unity3d.com/Manual/PlayerCommandLineArguments.html
  46. REM Append the arguments to the command: launcher.bat arg1 arg2 ...
  47. start GenshinImpact.exe %*