SHARE
TWEET

steam_dota_fix

aveyo Apr 21st, 2017 (edited) 203 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. goto="init" /* %~nx0 v3
  2. :start [ Batch main function ]
  3. echo.
  4. echo   -------------------------------------------------------------
  5. echo  ^|                  AVEYO`S STEAM / DOTA FIX                   ^|
  6. echo  ^|-------------------------------------------------------------^|
  7. echo  ^|  Warning! This will forcefuly close Steam Games             ^|
  8. echo  ^|  Press Alt+F4 to cancel                                     ^|
  9. echo   -------------------------------------------------------------
  10. echo.
  11. timeout /t 10
  12. call :set_dota
  13. echo User = %STEAMDATA%
  14. echo DOTA = %DOTA%
  15. taskkill /t /f /im steam.exe >nul 2>nul
  16. echo Please wait while repairing temporary file permissions..
  17. for %%a in (workshop downloading temp) do (
  18. takeown /f "%STEAMAPPS%\%%a" /r /d y >nul 2>nul
  19. icacls "%STEAMAPPS%\%%a" /reset /t /q >nul 2>nul
  20. attrib -r "%STEAMAPPS%\%%a" /s /d >nul 2>nul
  21. )
  22. echo Please wait while repairing Steam Service..
  23. set "sservice=%CommonProgramFiles(x86)%\Steam\SteamService.exe"
  24. if exist "%STEAMPATH%\bin\SteamService.exe" start "w" /MIN /WAIT "%STEAMPATH%\bin\SteamService.exe" /repair
  25. if not exist "%STEAMPATH%\bin\SteamService.exe" if exist "%sservice%" start "w" /MIN /WAIT "%sservice%" /repair
  26. echo Please wait while removing current Steam configuration..
  27. set ".=%USERPROFILE%\AppData\Local\Steam"
  28. del /f/s/q "%.%" >nul 2>nul &rmdir /s/q "%.%" >nul 2>nul
  29. cd/d "%STEAMPATH%"
  30. for /f %%a in ('dir /a:-D /b ^| findstr /i /v steam.exe') do del /f/q "%%a" >nul 2>nul
  31. for /f %%a in ('dir /a:D /b ^| findstr /i /v steamapps') do del /f/q "%%a" >nul 2>nul &rmdir /s/q "%%a" >nul 2>nul
  32. del /f /q steamfix.exe >nul 2>nul &ren steam.exe steamfix.exe >nul 2>nul
  33. echo Please wait while removing current DOTA configuration..
  34. cd/d "%DOTA%\game\dota"
  35. for /f %%a in ('dir /a:-D /b ^| findstr /i /v .vpk') do del /f/q "%%a" >nul 2>nul
  36. del /f/q cfg\vide*.txt >nul 2>nul
  37. del /f/q cfg\*.vcfg >nul 2>nul
  38. del /f/q cfg\*.vcfg >nul 2>nul
  39. :: workshop files
  40. del /f/s/q "%STEAMAPPS%\workshop\content\570" >nul 2>nul &rmdir /s/q "%STEAMAPPS%\workshop\content\570" >nul 2>nul
  41. :: remove compatibility options
  42. set "regkey=Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
  43. for %%a in (HKCU HKLM) do (
  44. reg delete "%%a\%regkey%" /v "%DOTA%\game\bin\win64\dota2.exe" /f /reg:64 >nul 2>nul  
  45. reg delete "%%a\%regkey%" /v "%DOTA%\game\bin\win64\dota2.exe" /f /reg:32 >nul 2>nul
  46. reg delete "%%a\%regkey%" /v "%DOTA%\game\bin\win32\dota2.exe" /f /reg:64 >nul 2>nul  
  47. reg delete "%%a\%regkey%" /v "%DOTA%\game\bin\win32\dota2.exe" /f /reg:32 >nul 2>nul
  48. )
  49. :: remove image execution options and disable sehop
  50. set "regkey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\dota2.exe"
  51. reg delete "%regkey%" /va /f /reg:32 >nul 2>nul &reg delete "%regkey%" /va /f /reg:64 >nul 2>nul
  52. reg add "%regkey%" /v "DisableExceptionChainValidation" /t REG_DWORD /d 1 /f /reg:32 >nul 2>nul
  53. reg add "%regkey%" /v "DisableExceptionChainValidation" /t REG_DWORD /d 1 /f /reg:64 >nul 2>nul
  54. :: prevent launching the game before verification is finished + force exe refresh
  55. del /f/q "%DOTA%\game\dota\bin\win64\*.dll" >nul 2>nul
  56. del /f/q "%DOTA%\game\dota\bin\win32\*.dll" >nul 2>nul
  57. del /f/q "%DOTA%\game\bin\win64\dota2.exe" >nul 2>nul
  58. del /f/q "%DOTA%\game\bin\win32\dota2.exe" >nul 2>nul
  59. del /f/q "%DOTA%\game\bin\vidcfg.bin" >nul 2>nul
  60. echo.
  61. echo Verification of DOTA files will be done automatically
  62. echo check progress in Steam library, it takes a few minutes
  63. echo.
  64. echo Please wait while starting Steam with admin rights - you need to login
  65. set launchoptions= -console -forceservice -tcp +app_set_update_flag 570 +app_mark_validation 570 1 +app_start_validation 570
  66. start "w" "%STEAMPATH%\steamfix.exe" %launchoptions%
  67. :: done!
  68. call :end DONE!
  69. goto :eof
  70.  
  71. :: [ Batch utility ]
  72. :set_dota outputs %STEAMPATH% %STEAMAPPS% %STEAMDATA% %DOTA%                       ||:i AveYo:" Override detection below if needed "
  73. set "STEAMPATH=C:\Steam" &set "DOTA=C:\Games\steamapps\common\dota 2 beta"
  74. if not exist "%STEAMPATH%\Steam.exe" call :reg_query "HKCU\SOFTWARE\Valve\Steam" "SteamPath" STEAMPATH
  75. if not exist "%STEAMPATH%\Steam.exe" call :end ! Cannot find SteamPath in registry
  76. if exist "%DOTA%\game\dota\maps\dota.vpk" set "STEAMAPPS=%DOTA:\common\dota 2 beta=%" &goto :set_steamid
  77. for %%s in ("%STEAMPATH%") do set "STEAMPATH=%%~dpns" &set "libfilter=LibraryFolders { TimeNextStatsReport ContentStatsID }"
  78. if not exist "%STEAMPATH%\SteamApps\libraryfolders.vdf" call :end ! Cannot find "%STEAMPATH%\SteamApps\libraryfolders.vdf"
  79. for /f usebackq^ delims^=^"^ tokens^=4 %%s in (`findstr /v "%libfilter%" "%STEAMPATH%\SteamApps\libraryfolders.vdf"`) do (
  80. if exist "%%s\steamapps\appmanifest_570.acf" if exist "%%s\steamapps\common\dota 2 beta\game\dota\maps\dota.vpk" set "libfs=%%s" )
  81. set "STEAMAPPS=%STEAMPATH%\steamapps" &if defined libfs set "STEAMAPPS=%libfs:\\=\%\steamapps"
  82. if not exist "%STEAMAPPS%\common\dota 2 beta\game\dota\maps\dota.vpk" call :end ! Cannot find "%STEAMAPPS%\common\dota 2 beta"
  83. set "DOTA=%STEAMAPPS%\common\dota 2 beta" &cd /d "%STEAMAPPS%\common\dota 2 beta\game\dota"
  84. :set_steamid
  85. call :reg_query "HKCU\SOFTWARE\Valve\Steam\ActiveProcess" "ActiveUser" STEAMUSER &set /a "STEAMID=STEAMUSER" >nul 2>nul
  86. if defined STEAMID if exist "%STEAMPATH%\userdata\%STEAMID%\config\localconfig.vdf" set "STEAMDATA=%STEAMPATH%\userdata\%STEAMID%"
  87. if not defined STEAMDATA for /f delims^=^ eol^= %%b in ('dir /a:-d /b /o:d /t:w cache_*.soc 2^>nul') do set "usercache=%%~nb"
  88. if not defined STEAMDATA if defined usercache set "STEAMDATA=%steampath%\userdata\%usercache:cache_=%"
  89. if defined STEAMDATA if not exist "%STEAMDATA%\config\localconfig.vdf" set "STEAMDATA=" &rem call :end ! Cannot find STEAMDATA
  90. goto :eof
  91. :reg_query %1:KeyName %2:ValueName %3:OutputVariable %4:other_options[example: "/t REG_DWORD"]
  92. setlocal &for /f "skip=2 delims=" %%s in ('reg query "%~1" /v "%~2" /z 2^>nul') do set "rq=%%s" &call set "rv=%%rq:*)    =%%"
  93. endlocal &call set "%~3=%rv%" &goto :eof                         ||:i AveYo - Usage:" call :reg_query "HKCU\MyKey" "MyValue" MyVar "
  94. :end %1:Message[Delayed termination with status message - prefix with ! to signal failure]
  95. echo. &if "%~1"=="!" ( color 4f & echo ERROR%* &timeout /t 32 &exit ) else echo %* &timeout /t 20 &exit
  96. :noop [does_nothing]
  97. goto :eof
  98.  
  99. :"init" [ Batch entry function ]
  100. @echo off & setlocal disabledelayedexpansion &title AveYo's %~nx0 &color 0B &cls & if "%1"=="_SELF_ADMIN" shift &shift & goto :start
  101. reg query "HKEY_USERS\S-1-5-20\Environment" /v temp 1>nul 2>nul && goto :start || echo Requesting admin rights.. & color 4f
  102. call cscript /nologo /e:JScript "%~f0" get_rights "%1" & exit & goto :eof
  103.  
  104. *//* [ JScript functions ] all lines above are ignored by starting script with a js comment */
  105. function get_rights(fn) {WSH.CreateObject("Shell.Application").ShellExecute(fn,"_SELF_ADMIN "+fn+" "+WSH.Arguments(1),"","runas",1)}
  106. if (WSH.Arguments.length>=1) {if (WSH.Arguments(0)=="get_rights") get_rights(WSH.ScriptFullName)}
  107. //
RAW Paste Data
Top