launcher.bat 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 perr3=1
  9. SET perr=0
  10. setlocal EnableDelayedExpansion
  11. FOR /f "delims=" %%i IN ('ping -n 1 -w 1 log-upload-os.hoyoverse.com') DO (
  12. echo %%i | find "[0.0.0.0]" >nul
  13. IF !ERRORLEVEL! EQU 0 SET "perr1=0"
  14. echo %%i | find "could not find host" >nul
  15. IF !ERRORLEVEL! EQU 0 SET "perr1=0"
  16. )
  17. FOR /f "delims=" %%i IN ('ping -n 1 -w 1 sg-public-data-api.hoyoverse.com') DO (
  18. echo %%i | find "[0.0.0.0]" >nul
  19. IF !ERRORLEVEL! EQU 0 SET "perr2=0"
  20. echo %%i | find "could not find host" >nul
  21. IF !ERRORLEVEL! EQU 0 SET "perr2=0"
  22. )
  23. FOR /f "delims=" %%i IN ('ping -n 1 -w 1 overseauspider.yuanshen.com') DO (
  24. echo %%i | find "[0.0.0.0]" >nul
  25. IF !ERRORLEVEL! EQU 0 SET "perr3=0"
  26. echo %%i | find "could not find host" >nul
  27. IF !ERRORLEVEL! EQU 0 SET "perr3=0"
  28. )
  29. REM There's no OR operator for "IF"
  30. IF %perr1% EQU 1 SET perr=1
  31. IF %perr2% EQU 1 SET perr=1
  32. IF %perr3% EQU 1 SET perr=1
  33. IF %perr% NEQ 0 (
  34. REM Show the message to the user
  35. echo ERROR: You opted to block the analytics servers but they are reachable. Please re-run the patch script. >_error.txt
  36. notepad _error.txt
  37. del _error.txt
  38. exit
  39. )
  40. REM DOMAIN_CHECK_END
  41. REM Try to emulate the game behaviour
  42. copy mhyprot3.sys "%TEMP%\"
  43. copy HoYoKProtect.sys "%WINDIR%\system32\"
  44. regedit mhyprot2_running.reg
  45. REM Disable crash reporting
  46. IF EXIST GenshinImpact_Data\upload_crash.exe (
  47. move "GenshinImpact_Data\upload_crash.exe" "GenshinImpact_Data\upload_crash.exe.bak"
  48. )
  49. IF EXIST GenshinImpact_Data\Plugins\crashreport.exe (
  50. move "GenshinImpact_Data\Plugins\crashreport.exe" "GenshinImpact_Data\Plugins\crashreport.exe.bak"
  51. )
  52. REM ============= Launch the game =============
  53. REM https://docs.unity3d.com/Manual/PlayerCommandLineArguments.html
  54. REM Append the arguments to the command: launcher.bat arg1 arg2 ...
  55. start GenshinImpact.exe %*