Advertisement
aveyo

GameFixer.bat - outdated!

Oct 29th, 2014
4,693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.62 KB | None | 0 0
  1. :: Game Fixer script by AveYo, release 1.4b - Dota Brute Force Anti Crashing
  2. :: http://dev.dota2.com/showthread.php?t=147852
  3. ::
  4. :: Changelog:
  5. :: v1.1: fixed dota detection for those with custom steam library that did never run dota manually
  6. :: v1.1b: fixed Valve's latest update forbidding custom launch options shortcuts to dota.exe (switched to steam -applaunch)
  7. :: v1.2: less drastical vpk override cleanup - if Verify integrity does not complete some were missing sounds
  8. :: fixed some speedguide tweaks not being applied
  9. :: v1.3: changed launch options for the now 4 troubleshooting shortcuts and activated some autoexec.cfg engine tweaks;
  10. :: test removing existing Steam launch options(not needed before the 1.1b change forced by Valve)
  11. :: test altering other Steam settings - no notifications, disable steam overlay, disable streaming, disable steam cloud
  12. :: v1.4: revised launch options: added hwsync tests, windowed(with border) tests - 14 troubleshooting shortcuts available now!
  13. :: autoset advanced video options - decent-looking minimal preset - high textures, high shadows, 90% renderer, global lights, animate portrait
  14. :: fix rare bug with Steam installed in %COMMONPROGRAMFILES% or %COMMONPROGRAMFILES(X86)% being removed by previous script
  15. :: v1.4b: finalized steam optimization settings that was added as a test in v1.3; disable downloads during gameplay added
  16. :: optimized order of execution, add 2 minutes timeout to wait functions. almost 1000 lines count :D
  17. ::
  18. :: GENERAL FIXES:
  19. :: - Crash at the PLAY menu because user has a Bigfoot Killer Network Adaptor.
  20. :: fix: disable bandwidth control - I don't have such card but I am confident it will succeed.
  21. :: - Crash at the PLAY menu or at loading because user has AMD Quickstream enabled.
  22. :: fix: disable apex virtual adapter that is very similar in function to Killer's bandwidth control.
  23. :: - Network issues and even crashes because of FlowControl etc. enabled in network driver.
  24. :: fix: disable FlowControl, InterruptModeration and activate proper checksum offloading.
  25. :: - Bad network performance when packet loss happens - and it does happen almost every game in the last two months.
  26. :: fix: implemented Speedguide.net tweaks with my own extra fixes.
  27. :: - Various os compatibility issues leading to poor performance or crashes.
  28. :: fix: restore app timeouts so dota won't get killed early, give priority to gaming, enable crash reports, disable data collection & PCA.
  29. :: - Undo tweaks available here. For Killer and Quickstream, undo by reinstallation.
  30. ::
  31. :: DOTA SPECIFIC FIXES:
  32. :: - Attempt to remove run-as-admin compatibility for dota.exe to fix most crash-to-desktop's with scaleformui_4.Dll exception.
  33. :: - Fix audio stutter and slugginess in main menu: remove animated background, use sound engine tweaks for onboard audio device.
  34. :: - Optimize video options with decent-looking minimal preset safe to use as a starting point, and fix rare miss-configuration of gpu features.
  35. :: - Optimize network settings for the current server status: slow tickrate, lagging, packet loss, deficient interpolation.
  36. :: - Optimize other dota autoexec.cfg cvars, existing cfg renamed to personal.cfg and autoloaded, this way filtering "bad" settings.
  37. :: - Optimize some steam preferences: notifications, steam overlay, streaming, steam cloud or downloads during gameplay.
  38. :: - Force repair of steam client service on the next run, it really needs to be set up properly if UAC is active.
  39. :: - Cleanup crash dumps so new ones are easier to spot (record comes from a user that found 2000+ steam crashdumps!!).
  40. :: - Remove custom client mods (-override_vpk) after backing them up into dota\backup folder.
  41. :: - Launch verify integrity of game cache to fix most game file missmatch issues after a patch [wait for it to finish!].
  42. :: - Generate troubleshooting dota shortcuts with custom launch options for displaymode (windowed / windowedfs / noborder / fullscreen),
  43. :: d3d (d3d9ex / nod3d9ex), hwsync (0/1), matqueue (-1/0/1/2)... so that dota might start even with bad drivers/old gpus.
  44. :: - Workaround for a Valve bug: you cannot switch between windowed and noborder using just launch options, so i've added two enable scripts.
  45. :: By default noborder is active and is preffered, activate the windowed mode only in case of issues (not starting).
  46.  
  47. @ECHO OFF &SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
  48. GOTO :CHECK_OS
  49. :_START
  50. rem SET _TRACE=1
  51.  
  52. CALL :XECHO You only need to run this once - but harmless if run multiple times
  53.  
  54. CALL :XTITLE GENERAL FIXES
  55. ::::::::::::::::::::::::::
  56. rem CALL :INFO_DISABLE_FUNCTIONS_BY_STARTING_THE_LINE_WITH_REM_AND_KEEP_DEFAULT_ORDER
  57. CALL :GEN_KILLER_BC_DISABLER
  58. CALL :GEN_AMD_APEX_QUICKSTREAM_DISABLER
  59. CALL :GEN_HW_NIC_TWEAKS
  60. CALL :GEN_OS_SPEEDGUIDE_TWEAKS
  61. CALL :GEN_OS_COMPATIBILITY_TWEAKS
  62. CALL :GEN_OS_VISUALFX_TWEAKS
  63.  
  64. CALL :XTITLE DOTA FIXES
  65. ::::::::::::::::::::::::::
  66. CALL :DOTA_DETECT_PATHS
  67.  
  68. CALL :XECHO Create Desktop\Dota 2 Test shortcuts\ with troubleshooting modes
  69. :: Info shortcutname displaymode(windowed/windowedfs/noborder/fullscreen) d3d(d3d9ex/nod3d9ex) hwsync(0/1) matqueue(-1/0/1/2) threaded(0/1) vsync(0/1)
  70. CALL :DOTA_CREATE_TEST_SHORTCUT test1a windowed nod3d9ex 0 0 0 0
  71. CALL :DOTA_CREATE_TEST_SHORTCUT test1b windowed nod3d9ex 1 -1 0 0
  72. CALL :DOTA_CREATE_TEST_SHORTCUT test2a windowed d3d9ex 0 0 0 0
  73. CALL :DOTA_CREATE_TEST_SHORTCUT test2b windowed d3d9ex 1 -1 0 0
  74. CALL :DOTA_CREATE_TEST_SHORTCUT TEST2C windowedfs d3d9ex 1 -1 0 0
  75. CALL :DOTA_CREATE_TEST_SHORTCUT test3a noborder nod3d9ex 0 0 0 0
  76. CALL :DOTA_CREATE_TEST_SHORTCUT TEST3B noborder nod3d9ex 1 -1 0 0
  77. CALL :DOTA_CREATE_TEST_SHORTCUT test4a noborder d3d9ex 0 0 0 0
  78. CALL :DOTA_CREATE_TEST_SHORTCUT test4b noborder d3d9ex 1 1 0 0
  79. CALL :DOTA_CREATE_TEST_SHORTCUT TEST4C noborder d3d9ex 1 2 1 0
  80. CALL :DOTA_CREATE_TEST_SHORTCUT test5a fullscreen d3d9ex 0 0 0 0
  81. CALL :DOTA_CREATE_TEST_SHORTCUT test5b fullscreen d3d9ex 1 1 0 0
  82. CALL :DOTA_CREATE_TEST_SHORTCUT TEST5C fullscreen d3d9ex 1 2 1 0
  83. CALL :DOTA_CREATE_TEST_SHORTCUT test5d fullscreen d3d9ex 1 2 1 1
  84.  
  85. CALL :DOTA_CREATE_TEST_WINDOWED_NOBORDER_TOGGLE
  86. CALL :DOTA_CREATE_AUTOEXEC
  87. CALL :DOTA_FIX_PERMISSIONS
  88. CALL :DOTA_STEAM_SERVICE
  89. CALL :DOTA_OPTIMIZE_STEAM
  90. CALL :DOTA_OPTIMIZE_GAME
  91. CALL :DOTA_CLEANUP_DUMPS
  92. CALL :DOTA_REMOVE_VPKMODS_FORCES_VERIFY
  93.  
  94. CALL :XECHO Try the Dota 2 Test shortcuts in Desktop folder
  95. CALL :XECHO Test shortcuts naming: a=safe b=fair c=optimal d=special[vsync]
  96. CALL :XECHO Windowed tests require launching coresponding enable script [Valve bug]
  97. CALL :XDONE autoclose in 20s, but verifying integrity of game cache continues
  98. CD /D "%~dp0"
  99. GOTO :eof
  100. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  101.  
  102.  
  103. ::::::::::::::::::::::::::::
  104. :: GENERAL TWEAKS SECTION ::
  105. ::::::::::::::::::::::::::::
  106.  
  107. :GEN_KILLER_BC_DISABLER
  108. CALL :XECHO Killer BandwidthControl disabler
  109. ::1. disable gaming mode
  110. kstat -g 0 >nul 2>&1
  111. xstat -d >nul 2>&1
  112. ::2. stop and uninstall bandwidth control service
  113. TASKKILL /IM "KillerNetManager.exe" >nul 2>&1
  114. SC stop "Qualcomm Atheros Killer Service" >nul 2>&1
  115. NET stop "Qualcomm Atheros Killer Service" >nul 2>&1
  116. SC delete "Qualcomm Atheros Killer Service" >nul 2>&1
  117. SC stop "Bigfoot Networks Killer Service" >nul 2>&1
  118. NET stop "Bigfoot Networks Killer Service" >nul 2>&1
  119. SC delete "Bigfoot Networks Killer Service" >nul 2>&1
  120. NET stop BfLwf >nul 2>&1
  121. SC stop BfLwf >nul 2>&1
  122. IF EXIST "%PROGRAMFILES(X86)%" CD /D "%PROGRAMFILES(X86)%" >nul 2>&1
  123. IF EXIST "%PROGRAMFILES(X86)%" FOR /f "tokens=1* delims=/ eol=?" %%I IN ('DIR /-b/-s BFNSer*.exe^|FINDSTR /l ":"^|FINDSTR /l /v "^ & %% !!"') DO SET "KILLERPATH=%%~dpI"
  124. IF DEFINED KILLERPATH START "" "%KILLERPATH%\BFNService.exe" -k >nul 2>&1
  125. IF DEFINED KILLERPATH RMDIR /S /Q "%KILLERPATH%\bflwf" >nul 2>&1
  126. IF DEFINED KILLERPATH START "" "%KILLERPATH%\BFNService.exe" -u >nul 2>&1
  127. CD /D "%PFVAR%" >nul 2>&1
  128. FOR /f "tokens=1* delims=/ eol=?" %%I IN ('DIR /-b/-s BFNSer*.exe^|FINDSTR /l ":"^|FINDSTR /l /v "^ & %% !!"') DO IF EXIST "%%I" SET "KILLERPATH=%%~dpI" >nul 2>&1
  129. IF DEFINED KILLERPATH START "" "%KILLERPATH%\BFNService.exe" -k >nul 2>&1
  130. IF DEFINED KILLERPATH RMDIR /S /Q "%KILLERPATH%\bflwf" >nul 2>&1
  131. IF DEFINED KILLERPATH START "" "%KILLERPATH%\BFNService.exe" -u >nul 2>&1
  132. SC delete BfLwf >nul 2>&1
  133. ::3. cleanup reg
  134. FOR /F %%I IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}" /s /d /f "BfLwf.ndi"^|FINDSTR /I /L /V "Linkage"^|FINDSTR /I /L "\\Class\\"') DO SET "REGPATH=%%I" >nul 2>&1
  135. IF NOT [%REGPATH%]==[] REG DELETE "%REGPATH%" /f >nul 2>&1
  136. IF NOT [%REGPATH%]==[] SET REGPATH=%REGPATH:CurrentControlSet=ControlSet001% >nul 2>&1
  137. IF NOT [%REGPATH%]==[] REG DELETE "%REGPATH%" /f >nul 2>&1
  138. IF NOT [%REGPATH%]==[] SET REGPATH=%REGPATH:ControlSet001=ControlSet002% >nul 2>&1
  139. IF NOT [%REGPATH%]==[] REG DELETE "%REGPATH%" /f >nul 2>&1
  140. FOR %%I IN (ControlSet002 ControlSet001 CurrentControlSet) DO (
  141. REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\%%I\services\eventlog\System\BfLwf" /f /va >nul 2>&1
  142. REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\%%I\services\BfLwf" /f /va >nul 2>&1
  143. )
  144. FOR /F "tokens=1* delims=_" %%I IN ('REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpLockdownFiles /v /f "bflwf*.sys"^|FINDSTR /I /L "bflwf"') DO SET "REGPATH=%%I" >nul 2>&1
  145. IF NOT [%REGPATH%]==[] SET REGPATH=%REGPATH:~0,-3% &CALL :TRIM REGPATH
  146. IF NOT [%REGPATH%]==[] REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpLockdownFiles /f /v "%REGPATH%" /reg:32 >nul 2>&1
  147. IF NOT [%REGPATH%]==[] REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpLockdownFiles /f /v "%REGPATH%" /reg:64 >nul 2>&1
  148. DEL /F /Q "%SSVAR%\drivers\bflwfx86.sys" >nul 2>&1
  149. DEL /F /Q "%SSVAR%\drivers\bflwfx64.sys" >nul 2>&1
  150. DEL /F /Q "%USERPROFILE%\Start Menu\Programs\Startup\Bigfoot*" >nul 2>&1
  151. DEL /F /Q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup\Bigfoot*" >nul 2>&1
  152. REG DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /f /v "Bigfoot Networks Killer Network Manager" >nul 2>&1
  153. REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /f /v "Bigfoot Networks Killer Network Manager" >nul 2>&1
  154. GOTO :eof
  155. ::END.GEN_KILLER_BC_DISABLER
  156.  
  157. :GEN_AMD_APEX_QUICKSTREAM_DISABLER
  158. CALL :XECHO AMD/APEX Quickstream disabler
  159. TASKKILL /im "appexacceleratorui.exe" >nul 2>&1
  160. TASKKILL /im "AMDQuickStream.exe" >nul 2>&1
  161. NET stop APXACC >nul 2>&1
  162. SC stop APXACC >nul 2>&1
  163. SC delete APXACC >nul 2>&1
  164. FOR /F %%I IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}" /s /d /f "APXACC.ndi"^|FINDSTR /I /L /V "Linkage"^|FINDSTR /I /L "\\Class\\"') DO SET "REGPATH=%%I" >nul 2>&1
  165. IF NOT [%REGPATH%]==[] REG DELETE "%REGPATH%" /f >nul 2>&1
  166. IF NOT [%REGPATH%]==[] SET REGPATH=%REGPATH:CurrentControlSet=ControlSet001% >nul 2>&1
  167. IF NOT [%REGPATH%]==[] REG DELETE "%REGPATH%" /f >nul 2>&1
  168. IF NOT [%REGPATH%]==[] SET REGPATH=%REGPATH:ControlSet001=ControlSet002% >nul 2>&1
  169. IF NOT [%REGPATH%]==[] REG DELETE "%REGPATH%" /f >nul 2>&1
  170. FOR %%I IN (ControlSet002 ControlSet001 CurrentControlSet) DO (
  171. REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\%%I\services\eventlog\System\APXACC" /f /va >nul 2>&1
  172. REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\%%I\services\APXACC" /f /va >nul 2>&1
  173. )
  174. FOR /F "tokens=1* delims=_" %%I IN ('REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpLockdownFiles /v /f "appexD*.sys"^|FINDSTR /I /L "appexD"') DO SET "REGPATH=%%I" >nul 2>&1
  175. IF NOT [%REGPATH%]==[] SET REGPATH=%REGPATH:~0,-3% &CALL :TRIM REGPATH
  176. IF NOT [%REGPATH%]==[] REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpLockdownFiles /f /v "%REGPATH%" /reg:32 >nul 2>&1
  177. IF NOT [%REGPATH%]==[] REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpLockdownFiles /f /v "%REGPATH%" /reg:64 >nul 2>&1
  178. DEL /F /Q "%SSVAR%\drivers\appexDrv.sys" >nul 2>&1
  179. DEL /F /Q "%USERPROFILE%\Start Menu\Programs\Startup\AppEx*" >nul 2>&1
  180. DEL /F /Q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup\AppEx*" >nul 2>&1
  181. REG DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /f /v "AppEx Accelerator UI" >nul 2>&1
  182. REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /f /v "AppEx Accelerator UI" >nul 2>&1
  183. GOTO :eof
  184. ::END.GEN_AMD_APEX_QUICKSTREAM_DISABLER
  185.  
  186. :GEN_HW_NIC_TWEAKS
  187. CALL :XECHO Hw network driver tweaks - flow control, buffers, offload processing
  188. FOR /F "tokens=3*" %%I IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards" /F "ServiceName" /S^|FINDSTR /I /L "ServiceName"') DO (
  189. FOR /F %%A IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}" /F "%%I" /D /E /S ^|FINDSTR /I /L /V "Linkage"^|FINDSTR /I /L "\\Class\\"') DO SET "REGPATH=%%A" >nul 2>&1
  190. FOR %%n IN (#FlowControl #InterruptModeration #LsoV1IPv4 #QOS #WakeOnMagicPacket #WakeOnPattern Ioac_SwoiSupported Moderate Promiscuous ShutdownWake SleepSpeed) DO SET "opt=%%n" &SET "opt=!opt:#=*!" &REG ADD "!REGPATH!" /F /V !opt! /T REG_SZ /D 0 >nul 2>&1
  191. FOR %%m IN (#DeviceSleepOnDisconnect #LsoV2IPv4 #LsoV2IPv6 #PMARPOffload TaskOffload #RSS RSS) DO SET "opt=%%m" &SET "opt=!opt:#=*!" &REG ADD "!REGPATH!" /F /V !opt! /T REG_SZ /D 1 >nul 2>&1
  192. FOR %%o IN (#IPChecksumOffloadIPv4 #TCPChecksumOffloadIPv4 #TCPChecksumOffloadIPv6 #UDPChecksumOffloadIPv4 #UDPChecksumOffloadIPv6) DO SET "opt=%%o" &SET "opt=!opt:#=*!" &REG ADD "!REGPATH!" /F /V !opt! /T REG_SZ /D 3 >nul 2>&1
  193. REG ADD "!REGPATH!" /F /V "*JumboPacket" /T REG_SZ /D 1514 >nul 2>&1
  194. REG ADD "!REGPATH!" /F /V "*ReceiveBuffers" /T REG_SZ /D 512 >nul 2>&1
  195. REG ADD "!REGPATH!" /F /V "*RSSProfile" /T REG_SZ /D 5 >nul 2>&1
  196. REG ADD "!REGPATH!" /F /V "*SSIdleTimeout" /T REG_SZ /D 60 >nul 2>&1
  197. REG ADD "!REGPATH!" /F /V "*TransmitBuffers" /T REG_SZ /D 256 >nul 2>&1
  198. REG ADD "!REGPATH!" /F /V "MaxInterrupt" /T REG_SZ /D 5000 >nul 2>&1
  199. )
  200. GOTO :eof
  201. ::END.GEN_HW_NIC_TWEAKS
  202.  
  203. :GEN_OS_SPEEDGUIDE_TWEAKS
  204. CALL :XECHO OS Speedguide.net tweaks
  205. IF %WINVERSION% GTR 61 (
  206. REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Nsi\{eb004a03-9b1a-11d4-9123-0050047759bc}\0" /F /v 0200 /T REG_BINARY /D 0000000000000100000000000000000000000000000000000000000002000000000000000000000000000000000000?000000ff000000000000000000000000000000000000000000?ff000000000000000000000000000000 >nul 2>&1
  207. REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Nsi\{eb004a03-9b1a-11d4-9123-0050047759bc}\0" /F /v 1700 /T REG_BINARY /D 0000000000000100000000000000000000000000000000000000000002000000000000000000000000000000000000?000000ff000000000000000000000000000000000000000000?ff000000000000000000000000000000 >nul 2>&1
  208. )
  209. NETSH int tcp set heuristics wsh=disabled &NETSH int ip set global taskoffload=enabled
  210. FOR %%I IN ("autotuninglevel=restricted" "chimney=enabled" "congestionprovider=ctcp" "netdma=disabled" "rss=enabled" "timestamps=enabled") DO NETSH int tcp set global %%~I >nul 2>&1
  211. FOR %%I IN (tcp udp) DO netsh int ipv4 set dynamicport %%I start=32767 num=32767 >nul 2>&1
  212. FOR %%I IN (MaxNegativeCacheTtl NegativeCacheTime NegativeSOACacheTime NetFailureCacheTime) DO REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters" /F /v %%I /T REG_DWORD /D 0 >nul 2>&1
  213. FOR /F "tokens=3*" %%I IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards" /F "ServiceName" /S^|FINDSTR /I /L "ServiceName"') DO (
  214. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\%%I" /F /v MTU /T REG_DWORD /D 0x5d4 >nul 2>&1
  215. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\%%I" /F /v TcpAckFrequency /T REG_DWORD /D 1 >nul 2>&1
  216. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\%%I" /F /v TcpDelAckTicks /T REG_DWORD /D 0 >nul 2>&1
  217. )
  218. REG ADD "HKLM\SOFTWARE\Microsoft\MSMQ\Parameters" /F /v TCPNoDelay /T REG_DWORD /D 1 >nul 2>&1
  219. REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /F /v NetworkThrottlingIndex /T REG_DWORD /D 0xffffffff >nul 2>&1
  220. REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /F /v SystemResponsiveness /T REG_DWORD /D 0 >nul 2>&1
  221. REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows\Psched" /F /v NonBestEffortLimit /T REG_DWORD /D 0 >nul 2>&1
  222. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters" /F /v DisableBandwidthThrottling /T REG_DWORD /D 1 >nul 2>&1
  223. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters" /F /v DisableLargeMtu /T REG_DWORD /D 0 >nul 2>&1
  224. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /F /v DefaultTTL /T REG_DWORD /D 0x40 >nul 2>&1
  225. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /F /v DisableLargeMtu /T REG_DWORD /D 0 >nul 2>&1
  226. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /F /v DisableTaskOffload /T REG_DWORD /D 0 >nul 2>&1
  227. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /F /v EnableConnectionRateLimiting /T REG_DWORD /D 0 >nul 2>&1
  228. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /F /v EnableTCPA /T REG_DWORD /D 0 >nul 2>&1
  229. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /F /v EnableWsd /T REG_DWORD /D 0 >nul 2>&1
  230. REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /F /v StrictTimeWaitSeqCheck /T REG_DWORD /D 1 >nul 2>&1
  231. REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /F /v Tcp1323Opts /T REG_DWORD /D 3 >nul 2>&1
  232. REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /F /v TcpCreateAndConnectTcbRateLimitDepth /T REG_DWORD /D 0 >nul 2>&1
  233. REG ADD "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /F /v TCPMaxDataRetransmissions /T REG_DWORD /D 5 >nul 2>&1
  234. REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /F /v TcpTimedWaitDelay /T REG_DWORD /D 0x3c >nul 2>&1
  235. rem REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters" /F /v IgnorePushBitOnReceives /T REG_DWORD /D 1 >nul 2>&1
  236. rem REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters" /F /v NonBlockingSendSpecialBuffering /T REG_DWORD /D 1 >nul 2>&1
  237. SET /A _tcpservpri_=3 &FOR %%I IN (LocalPriority HostsPriority DnsPriority NetbtPriority Class) DO (SET /A _tcpservpri_+=1 &REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /F /v %%I /T REG_DWORD /D !_tcpservpri_! >nul 2>&1)
  238. GOTO :eof
  239. ::END.GEN_OS_SPEEDGUIDE_TWEAKS
  240.  
  241. :GEN_OS_COMPATIBILITY_TWEAKS
  242. CALL :XECHO OS compatibility tweaks - crash, data collection, timeouts, game priority
  243. FOR %%I IN (AitAgent ProgramDataUpdater) DO SCHTASKS /Change /TN "\Microsoft\Windows\Application Experience\%%I" /DISABLE >nul 2>&1
  244. FOR %%I IN (Autochk\Proxy Maintenance\WinSAT WindowsBackup\ConfigNotification DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector) DO SCHTASKS /Change /TN "\Microsoft\Windows\%%I" /DISABLE >nul 2>&1
  245. FOR %%I IN (Consolidator KernelCeipTask UsbCeip) DO SCHTASKS /Change /TN "\Microsoft\Windows\Customer Experience Improvement Program\%%I" /DISABLE >nul 2>&1
  246. REG ADD "HKCU\Control Panel\Desktop" /F /v HungAppTimeout /T REG_SZ /D 5000 >nul 2>&1
  247. REG ADD "HKCU\Control Panel\Desktop" /F /v LowLevelHooksTimeout /T REG_SZ /D 5000 >nul 2>&1
  248. REG ADD "HKCU\Control Panel\Desktop" /F /v WaitToKillAppTimeout /T REG_SZ /D 20000 >nul 2>&1
  249. REG ADD "HKCU\Software\Microsoft\InputPersonalization" /F /v RestrictImplicitInkCollection /T REG_DWORD /D 1 >nul 2>&1
  250. REG ADD "HKCU\Software\Microsoft\InputPersonalization" /F /v RestrictImplicitTextCollection /T REG_DWORD /D 1 >nul 2>&1
  251. REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost" /F /v EnableWebContentEvaluation /T REG_DWORD /D 0 >nul 2>&1
  252. REG ADD "HKCU\Software\Policies\Microsoft\Windows\AppCompat" /F /v DisablePCA /T REG_DWORD /D 1 >nul 2>&1
  253. REG ADD "HKCU\Software\Policies\Microsoft\Windows\EdgeUI" /F /v DisableMFUTracking /T REG_DWORD /D 1 >nul 2>&1
  254. REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /F /v "Affinity" /T REG_DWORD /D 0 >nul 2>&1
  255. REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /F /v "Background Only" /T REG_SZ /D "False" >nul 2>&1
  256. REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /F /v "GPU Priority" /T REG_DWORD /D 1 >nul 2>&1
  257. REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /F /v "Priority" /T REG_DWORD /D 1 >nul 2>&1
  258. REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /F /v "Scheduling Category" /T REG_SZ /D "High" >nul 2>&1
  259. REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /F /v "SFIO Priority" /T REG_SZ /D "High" >nul 2>&1
  260. REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /F /v CrashDumpEnabled /T REG_DWORD /D 3 >nul 2>&1
  261. REG ADD "HKLM\SYSTEM\ControlSet001\Control\CrashControl" /F /v CrashDumpEnabled /T REG_DWORD /D 3 >nul 2>&1
  262. REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /F /v DontVerifyRandomDrivers /T REG_DWORD /D 1 >nul 2>&1
  263. REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl" /F /v IRQ8Priority /T REG_DWORD /D 1 >nul 2>&1
  264. REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\I/O System" /F /v CountOperations /T REG_DWORD /D 0 >nul 2>&1
  265. REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /F /v "DisablePagingExecutive" /T REG_DWORD /D 1 >nul 2>&1
  266. REG DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\App Management" /F /v COMClassStore >nul 2>&1
  267. DEL /F /Q "%SSVAR%\mss32.dll" >nul 2>&1
  268. DEL /F /Q "%WINDIR%\SysWOW64\mss32.dll" >nul 2>&1
  269. SC config "AeLookupSvc" start= demand >nul 2>&1
  270. SC start "AeLookupSvc" >nul 2>&1
  271. GOTO :eof
  272. ::END.GEN_OS_COMPATIBILITY_TWEAKS
  273.  
  274. :GEN_OS_VISUALFX_TWEAKS
  275. CALL :XECHO OS visual fx tweaks - less animations
  276. REG ADD "HKCU\Control Panel\Desktop\WindowMetrics" /F /v VisualFXSetting /T REG_DWORD /D 3 >nul 2>&1
  277. REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" /F /v VisualFXSetting /T REG_DWORD /D 3 >nul 2>&1
  278. REG ADD "HKCU\Control Panel\Desktop" /F /v UserPreferencesMask /T REG_BINARY /D 9812038010000000 >nul 2>&1
  279. FOR %%I IN (CompositionPolicy ListBoxSmoothScrolling TooltipAnimation TaskbarAnimations SelectionFade MenuAnimation ListviewWatermark ListviewShadow ListviewAlphaSelect DropShadow CursorShadow ControlAnimations ComboBoxAnimation AnimateMinMax) DO REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\%%I" /F /v DefaultApplied /T REG_DWORD /D 0 >nul 2>&1
  280. FOR %%I IN (ThumbnailsOrIcon Themes FontSmoothing DragFullWindows) DO REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\%%I" /F /v DefaultApplied /T REG_DWORD /D 1 >nul 2>&1
  281. REG ADD "HKCU\Control Panel\Desktop\WindowMetrics" /F /v MinAnimate /T REG_SZ /D 0 >nul 2>&1
  282. REG ADD "HKCU\Software\Microsoft\Windows\DWM" /F /v Max3DWindows /T REG_DWORD /D 4 >nul 2>&1
  283. GOTO :eof
  284. ::END.GEN_OS_VISUALFX_TWEAKS
  285.  
  286. ::::::::::::::::::
  287. :: DOTA SECTION ::
  288. ::::::::::::::::::
  289.  
  290. :DOTA_DETECT_PATHS
  291. CALL :XECHO Detect Steam and Dota paths
  292. SET "STEAMPATH="
  293. FOR /F delims^=^"^ tokens^=2* %%I IN ('REG QUERY "HKCR\steam\Shell\Open\Command" /ve^|FINDSTR /I /L ":"') DO SET "STEAMREG=%%~I"
  294. FOR /F "tokens=*" %%I IN ("%STEAMREG%") DO SET "CHECKPATH=%%~dpI"
  295. IF EXIST "%CHECKPATH%Steam.exe" SET "STEAMPATH=%CHECKPATH:~0,-1%"
  296. :: Valve why do you use linux paths under windows?!
  297. IF NOT DEFINED STEAMPATH FOR /F "tokens=2* delims=_" %%I IN ('REG QUERY "HKCU\SOFTWARE\Valve\Steam"^|FINDSTR /I /L "SteamPath"') DO SET "STEAMREG=%%~I"
  298. IF NOT DEFINED STEAMPATH SET "STEAMREG=%STEAMREG:~6%"
  299. IF NOT DEFINED STEAMPATH SET "CHECKPATH=%STEAMREG:/=\%"
  300. IF NOT DEFINED STEAMPATH IF EXIST "%CHECKPATH%\Steam.exe" SET "STEAMPATH=%CHECKPATH%"
  301. IF NOT EXIST "%STEAMPATH%\Steam.exe" CALL :XECHO Steam not found, reinstall / clean all except Steam.exe and SteamApps
  302. IF EXIST "%STEAMPATH%\Steam.exe" CALL :XECHO Steam found in %STEAMPATH%
  303. :: detect dota path
  304. SET "DOTAPATH="
  305. FOR /F delims^=^"^ tokens^=2* %%I IN ('REG QUERY "HKCR\Applications\dota.exe\shell\open\command" /ve^|FINDSTR /I /L ":"') DO SET "DOTAREG=%%~I"
  306. FOR /F "tokens=*" %%I IN ("%DOTAREG%") DO SET "CHECKPATH=%%~dpI"
  307. IF EXIST "%CHECKPATH%dota\maps\dota.bsp" SET "DOTAPATH=%CHECKPATH:~0,-1%"
  308. IF NOT DEFINED DOTAPATH FOR /F delims^=^"^ tokens^=2* %%I IN ('REG QUERY "HKCR\dota2\Shell\Open\Command" /ve^|FINDSTR /I /L ":"') DO SET "DOTAREG=%%~I"
  309. IF NOT DEFINED DOTAPATH FOR /F "tokens=*" %%I IN ("%DOTAREG%") DO SET "CHECKPATH=%%~dpI"
  310. IF NOT DEFINED DOTAPATH IF EXIST "%CHECKPATH%dota\maps\dota.bsp" SET "DOTAPATH=%CHECKPATH:~0,-1%"
  311. :: fallback to default steam path
  312. IF NOT DEFINED DOTAPATH SET "DOTAPATH=%STEAMPATH%\SteamApps\common\dota 2 beta"
  313. IF NOT EXIST "%DOTAPATH%\dota\maps\dota.bsp" SET "DOTAPATH="
  314. :: damn valve why don't you have a reg entry for library folders?
  315. IF NOT DEFINED DOTAPATH IF EXIST "%STEAMPATH%\SteamApps\libraryfolders.vdf" (
  316. FOR /F "tokens=2" %%I IN ('FINDSTR /V "LibraryFolders { }" "%STEAMPATH%\SteamApps\libraryfolders.vdf"') DO (
  317. SET "CHECKPATH=%%~I"
  318. SET "CHECKPATH=!CHECKPATH:\\=\!"
  319. IF EXIST "!CHECKPATH!\SteamApps\common\dota 2 beta\dota\maps\dota.bsp" SET "DOTAPATH=!CHECKPATH!\SteamApps\common\dota 2 beta"
  320. ))
  321. IF NOT EXIST "%DOTAPATH%\dota\maps\dota.bsp" CALL :XERR Dota not found, reinstall or add local dota folder to steam library
  322. CALL :XECHO Dota found in %DOTAPATH%
  323. :: cleanup
  324. DEL /F /Q "%USERPROFILE%\Desktop\Dota 2 *.lnk" >nul 2>&1
  325. RMDIR /S /Q "%USERPROFILE%\Desktop\Dota 2 Test shortcuts" >nul 2>&1
  326. RMDIR /S /Q "%STEAMPATH%\appcache" >nul 2>&1
  327. GOTO :eof
  328. ::END.DOTA_DETECT_PATHS
  329.  
  330. :DOTA_CREATE_TEST_SHORTCUT
  331. :: Usage: CALL :DOTA_CREATE_TEST_SHORTCUT shortcutname displaymode(windowed/windowedfs/noborder/fullscreen) d3d(d3d9ex/nod3d9ex) hwsync(0/1) matqueue(-1/0/1/2) threaded(0/1) vsync(0/1)
  332. :: Valve bug: windowed mode is either with border or without border, cannot switch them using launch options, it only works from gui menu - workaround scripts added
  333. IF [%2]==[windowed] (SET "DISPLAYMODE=-windowed") ELSE IF [%2]==[windowedfs] (SET "DISPLAYMODE=-windowed -x -3 -y -25") ELSE IF [%2]==[noborder] (SET "DISPLAYMODE=-noborder") ELSE IF [%2]==[fullscreen] SET "DISPLAYMODE=-fullscreen"
  334. IF [%3]==[d3d9ex] (SET "D3D9EX=") ELSE IF [%3]==[nod3d9ex] SET "D3D9EX= -nod3d9ex"
  335. SET "HWSYNC=%4"
  336. SET "MATQUEUE=%5"
  337. SET "THREADED=%6"
  338. SET "VSYNC=%7"
  339. echo Dota 2 %1 %2_%3.lnk
  340. :: CHOOSE NEW DOTA DESKTOP SHORTCUT's OPTIONS BELOW:
  341. SET MOUSE=-useforcedmparms -noforcemaccel -noforcemspd
  342. SET SYNC= +mat_forcehardwaresync %HWSYNC% +mat_vsync %VSYNC% +mat_triplebuffered %VSYNC%
  343. SET CPU=+mat_queue_mode %MATQUEUE% +cl_threaded_init %THREADED% +cl_threaded_bone_setup %THREADED% +r_queued_decals %THREADED% +r_queued_post_processing %THREADED% +r_threaded_shadow_clip %THREADED%
  344. SET SOUND=+snd_mix_async 1 +snd_pitchquality 0 +dsp_slow_cpu 1
  345. :: create a new dota2 shortcut with troubleshooting launch options
  346. SET "DOTA_LAUNCH_OPTIONS=-applaunch 570 -high -dev -noaafonts %DISPLAYMODE%%D3D9EX% %MOUSE% %SYNC% %CPU% %SOUND% +cl_singleplayernetworkbackdoor 1 +con_enable 1 +dota_embers 0 +developer 0 +exec autoexec.cfg
  347. IF NOT EXIST "%USERPROFILE%\Desktop\Dota 2 Test shortcuts" MD "%USERPROFILE%\Desktop\Dota 2 Test shortcuts" >nul 2>&1
  348. echo Set ws = WScript.CreateObject("WScript.Shell") >"%temp%\~1337lnk.vbs"
  349. echo dota = "%USERPROFILE%\Desktop\Dota 2 Test shortcuts\Dota 2 %1 %2_%3.lnk" >>"%temp%\~1337lnk.vbs"
  350. echo Set lnk = ws.CreateShortcut(dota) >>"%temp%\~1337lnk.vbs"
  351. echo lnk.TargetPath = chr(34) ^& "%STEAMPATH%\Steam.exe" ^& chr(34)>>"%temp%\~1337lnk.vbs"
  352. echo lnk.Arguments = "%DOTA_LAUNCH_OPTIONS%" >>"%temp%\~1337lnk.vbs"
  353. echo lnk.IconLocation = "%DOTAPATH%\dota.exe,0" >>"%temp%\~1337lnk.vbs"
  354. echo lnk.Description = "Dota 2 %1 launch options: %2,%3,hwsync%4,matqueue%5,threaded%6,vsync%7 - GameFixer by aveyo" >>"%temp%\~1337lnk.vbs"
  355. echo lnk.Save >>"%temp%\~1337lnk.vbs"
  356. CALL CSCRIPT //nologo "%temp%\~1337lnk.vbs" &DEL /F /Q "%temp%\~1337lnk.vbs"
  357. GOTO :eof
  358. ::END.DOTA_CREATE_TEST_SHORTCUT
  359.  
  360. :DOTA_CREATE_TEST_WINDOWED_NOBORDER_TOGGLE
  361. CALL :XECHO Create windowed noborder toggle scripts [Valve launch options bug]
  362. :: generate windowed with borders enabler script (because of Valve bug)
  363. echo @echo off ^&SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  364. echo IF NOT EXIST "%DOTAPATH%\dota\cfg\video.txt" GOTO :eof >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  365. echo CD /D "%DOTAPATH%\dota\cfg\" >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  366. echo FOR /f "tokens=1 delims=: eol=?" %%%%I IN ('FINDSTR /N /L nowindowborder "video.txt"') DO SET /A "nowindowborder=%%%%I" >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  367. echo FOR /F "TOKENS=1,2* DELIMS=[]" %%%%H IN ('TYPE "video.txt" ^^^| FIND /V /N ""') DO ( >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  368. echo SET "FOUNDLINE=0" >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  369. echo IF [%%%%H]==[%%nowindowborder%%] ECHO/ "setting.nowindowborder" "0"^>^> video.txt.tmp ^&SET "FOUNDLINE=1" >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  370. echo IF ^^!FOUNDLINE^^! EQU 0 ECHO/%%%%I^>^> video.txt.tmp >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  371. echo ) >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  372. echo DEL /F /Q video.txt ^>nul 2^>^&1 >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  373. echo RENAME video.txt.tmp video.txt ^>nul 2^>^&1 >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable windowed tests.bat"
  374. :: generate noborder enabler script - default (because of Valve bug)
  375. echo @echo off ^&SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  376. echo IF NOT EXIST "%DOTAPATH%\dota\cfg\video.txt" GOTO :eof >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  377. echo CD /D "%DOTAPATH%\dota\cfg\" >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  378. echo FOR /f "tokens=1 delims=: eol=?" %%%%I IN ('FINDSTR /N /L nowindowborder "video.txt"') DO SET /A "nowindowborder=%%%%I" >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  379. echo FOR /F "TOKENS=1,2* DELIMS=[]" %%%%H IN ('TYPE "video.txt" ^^^| FIND /V /N ""') DO ( >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  380. echo SET "FOUNDLINE=0" >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  381. echo IF [%%%%H]==[%%nowindowborder%%] ECHO/ "setting.nowindowborder" "1"^>^> video.txt.tmp ^&SET "FOUNDLINE=1" >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  382. echo IF ^^!FOUNDLINE^^! EQU 0 ECHO/%%%%I^>^> video.txt.tmp >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  383. echo ) >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  384. echo DEL /F /Q video.txt ^>nul 2^>^&1 >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  385. echo RENAME video.txt.tmp video.txt ^>nul 2^>^&1 >>"%USERPROFILE%\Desktop\Dota 2 Test shortcuts\enable noborder tests - default.bat"
  386. GOTO :eof
  387. ::END.DOTA_CREATE_TEST_WINDOWED_NOBORDER_TOGGLE
  388.  
  389. :DOTA_CREATE_AUTOEXEC
  390. CALL :XECHO Create fresh autoexec.cfg with some default fixes
  391. IF NOT EXIST "%DOTAPATH%\dota\cfg\*" MD "%DOTAPATH%\dota\cfg" >nul 2>&1
  392. CD /D "%DOTAPATH%\dota\cfg"
  393. :: Did you previously run dota_troubleshooter? (too many versions, hard to detect and force an update)
  394. FINDSTR /I /L "GENERATED_BY_GAMEFIXER_DO_NOT_REMOVE" personal.cfg >nul 2>&1
  395. IF %ERRORLEVEL% EQU 0 DEL /F /Q "personal.cfg"
  396. FINDSTR /I /L "GENERATED_BY_GAMEFIXER_DO_NOT_REMOVE" autoexec.cfg >nul 2>&1
  397. IF %ERRORLEVEL% EQU 1 IF EXIST "personal.cfg" COPY /Y "autoexec.cfg" "personal%RANDOM%%RANDOM%%RANDOM%.cfg" &DEL /F /Q "autoexec.cfg" &GOTO :_WRITE_AUTOEXEC
  398. IF %ERRORLEVEL% EQU 1 IF NOT EXIST "personal.cfg" COPY /Y "autoexec.cfg" "personal.cfg" &DEL /F /Q "autoexec.cfg" &GOTO :_WRITE_AUTOEXEC
  399. IF %ERRORLEVEL% EQU 0 GOTO :_WRITE_AUTOEXEC
  400. GOTO :eof
  401. :_WRITE_AUTOEXEC
  402. echo //// GENERATED_BY_GAMEFIXER_DO_NOT_REMOVE_OR_EDIT_THIS_SIGNATURE_LINE_TO_PREVENT_OVERWRITES >"autoexec.cfg"
  403. echo echo autoexec.cfg loaded // v%_MYVER% by aveyo>>"autoexec.cfg"
  404. echo //// If you had an autoexec.cfg before, it's now renamed to personal.cfg and autoloaded by this script >>"autoexec.cfg"
  405. echo //// Don't edit this file, instead use personal.cfg to set your aliases, binds, dota_ commands >>"autoexec.cfg"
  406. echo execifexists personal.cfg //autoload personal file first, filtering out overrides >>"autoexec.cfg"
  407. echo. >>"autoexec.cfg"
  408. echo con_enable "1" //Enable console >>"autoexec.cfg"
  409. echo. >>"autoexec.cfg"
  410. echo //cl_showfps "1" //set to 2 to see average fps over many frames >>"autoexec.cfg"
  411. echo //fps_max "0" //if vsync=on, set it to display Hz-2 to lower inputlag, else to display Hz >>"autoexec.cfg"
  412. echo. >>"autoexec.cfg"
  413. echo dota_embers "0" //Fix stuttering/crashes in game menu by turning off flash animated background >>"autoexec.cfg"
  414. echo engine_no_focus_sleep "20" //Limit fps when alt-tab, 0=disable and waste power, 20=default, I'm using 100 with no issues >>"autoexec.cfg"
  415. echo. >>"autoexec.cfg"
  416. echo //// Fix some unnecesarry GPU usage spike and overheating by turning off visual effects on pause/death/shake >>"autoexec.cfg"
  417. echo dota_camera_deatheffect "0" >>"autoexec.cfg"
  418. echo dota_screen_shake "0" >>"autoexec.cfg"
  419. echo. >>"autoexec.cfg"
  420. echo //// Fix crashing after second local lobby creation: http://dev.dota2.com/showthread.php?t=147736 >>"autoexec.cfg"
  421. echo cl_singleplayernetworkbackdoor "1" >>"autoexec.cfg"
  422. echo. >>"autoexec.cfg"
  423. echo //// Manually fix can't connect to any servers if on LAN or if your router/firewall wants a dedicated clientport >>"autoexec.cfg"
  424. echo //// "the default clientport is 27005 and you can only have one game with that port active on the same lan" >>"autoexec.cfg"
  425. echo //// https://support.steampowered.com/kb_article.php?ref=6370-QPHJ-3567 >>"autoexec.cfg"
  426. echo clientport "-1" //Autodetect is -1 Accepts value in ranges 27005-27019 or 27021-27032 >>"autoexec.cfg"
  427. echo clientportany "1" //If you change clientport from -1, you need to also change clientportany to 0 >>"autoexec.cfg"
  428. echo. >>"autoexec.cfg"
  429. echo //// Fix sound stuttering in main menu, improves performance for onboard sound >>"autoexec.cfg"
  430. echo dsp_enhance_stereo "0" >>"autoexec.cfg"
  431. echo dsp_slow_cpu "1" >>"autoexec.cfg"
  432. echo snd_mix_async "1" >>"autoexec.cfg"
  433. echo snd_pitchquality "0" >>"autoexec.cfg"
  434. echo //snd_mute_losefocus "0" // Play sound in desktop 0=yes >>"autoexec.cfg"
  435. echo. >>"autoexec.cfg"
  436. echo //// Preload models to increase fps, mostly for AD/ARDM >>"autoexec.cfg"
  437. echo cl_forcepreload "1" >>"autoexec.cfg"
  438. echo. >>"autoexec.cfg"
  439. echo //// Fix/minimize network issues in online game >>"autoexec.cfg"
  440. echo //// you can get artificial 33ms lerp by cl_interp_ratio 1 and up and cmd rates to 60 >>"autoexec.cfg"
  441. echo cl_allowdownload "0" >>"autoexec.cfg"
  442. echo cl_allowupload "0" >>"autoexec.cfg"
  443. echo cl_cmdrate "30" //server clamped to 30 >>"autoexec.cfg"
  444. echo cl_interp "0" //limited by server tickrate to 0.033333 >>"autoexec.cfg"
  445. echo cl_interp_ratio "2" //set to 3 if constant packet loss>>"autoexec.cfg"
  446. echo cl_lagcompensation "1" >>"autoexec.cfg"
  447. echo cl_lagcomp_errorcheck "1" >>"autoexec.cfg"
  448. echo cl_pred_optimize "2" >>"autoexec.cfg"
  449. echo cl_predictweapons "1" >>"autoexec.cfg"
  450. echo cl_resend "15" >>"autoexec.cfg"
  451. echo cl_smooth "1" >>"autoexec.cfg"
  452. echo cl_smoothtime "0.066666" //try also "0.033333" or def "0.1" >>"autoexec.cfg"
  453. echo cl_timeout "15" >>"autoexec.cfg"
  454. echo cl_updaterate "30" //server clamped to 30 >>"autoexec.cfg"
  455. echo net_compressvoice "1" >>"autoexec.cfg"
  456. echo net_maxcleartime "1.0" //try also 0.066666 or def "4.0" >>"autoexec.cfg"
  457. echo net_max_network_processing_frame_time_ms "20" //try also 16 or 33 or def "20" >>"autoexec.cfg"
  458. echo net_splitrate "2" >>"autoexec.cfg"
  459. echo rate "120000" >>"autoexec.cfg"
  460. echo. >>"autoexec.cfg"
  461. echo //// Net_graph preset >>"autoexec.cfg"
  462. echo alias "setnetgraph" "net_graphproportionalfont 0; net_graphpos 3; net_graphsolid 0; net_graphinsetbottom 0; net_graphinsettop 0; net_graphinsetleft 0; net_graphinsetright 0; net_scale 2000; net_graphmsecs 200; net_graphheight 100; net_graphinsetbottom 360" >>"autoexec.cfg"
  463. echo alias "netgraph_off" "net_graph 0;alias netgraph netgraph_on" >>"autoexec.cfg"
  464. echo alias "netgraph_on" "setnetgraph;net_graph 4;alias netgraph netgraph_off" >>"autoexec.cfg"
  465. echo alias "netgraph" "netgraph_off" >>"autoexec.cfg"
  466. echo //bind "DEL" "netgraph" //or just write netgraph in console to show/hide >>"autoexec.cfg"
  467. echo. >>"autoexec.cfg"
  468. echo //// Misc >>"autoexec.cfg"
  469. echo bugreporter_includebsp "0" //cleaner crash dumps >>"autoexec.cfg"
  470. echo dota_html_panel "0" >>"autoexec.cfg"
  471. echo dota_quit_immediate "1" >>"autoexec.cfg"
  472. echo developer "0" >>"autoexec.cfg"
  473. echo. >>"autoexec.cfg"
  474. echo //// Force advanced video settings by uncommenting the lines below (GUI settings not saved after quit) >>"autoexec.cfg"
  475. echo //// CONSOLE VARIABLE DESCRIPTION TRY INTERVAL >>"autoexec.cfg"
  476. echo mat_monitorgamma_tv_enabled "0" // PC or TV levels PC 0=PC 1=TV >>"autoexec.cfg"
  477. echo //mat_monitorgamma "1.8" // Brightness 1.8 1.8=130 >>"autoexec.cfg"
  478. echo //r_screenspace_aa "0" // Anti-aliasing OF 0=Off 1=On >>"autoexec.cfg"
  479. echo //r_deferred_specular "0" // Specular OF 0=Off 1=On >>"autoexec.cfg"
  480. echo //r_deferred_specular_bloom "0" // Specular bloom OF 0=Off 1=On >>"autoexec.cfg"
  481. echo //dota_cheap_water "1" // High Quality Water OF 0=On 1=Off >>"autoexec.cfg"
  482. echo //r_deferred_height_fog "0" // Athmospheric Fog OF 0=Off 1=On >>"autoexec.cfg"
  483. echo //dota_portrait_animate "1" // Animate portrait ON 0=Off 1=On >>"autoexec.cfg"
  484. echo //r_deferred_additive_pass "0" // Additive light pass OF 0=Off 1=On >>"autoexec.cfg"
  485. echo //r_deferred_simple_light "1" // World lighting ON 0=Off 1=On >>"autoexec.cfg"
  486. echo //r_ssao "0" // Ambient occlusion OF 0=Off 1=On >>"autoexec.cfg"
  487. echo //dota_ambient_creatures "0" // Ambient creatures OF 0=Off 1=On >>"autoexec.cfg"
  488. echo //mat_vsync "0" // Vertical Sync OF 0=Off 1=On >>"autoexec.cfg"
  489. echo //mat_viewportscale "0.9" // Render Quality 90 0.4=40 1=100 >>"autoexec.cfg"
  490. echo //cl_globallight_shadow_mode "2" // Shadows HI 0=Low 1=Med 2=High >>"autoexec.cfg"
  491. echo //mat_picmip "0" // Textures HI 2=Low 1 Med 0=High >>"autoexec.cfg"
  492. echo. >>"autoexec.cfg"
  493. echo //// Engine extra tweaks >>"autoexec.cfg"
  494. echo ai_expression_optimization "1" >>"autoexec.cfg"
  495. echo cl_detaildist "900" >>"autoexec.cfg"
  496. echo cl_detailfade "300" >>"autoexec.cfg"
  497. echo //cl_ejectbrass "0" >>"autoexec.cfg"
  498. echo cl_particle_fallback_base "4" >>"autoexec.cfg"
  499. echo cl_particle_fallback_multiplier "0" >>"autoexec.cfg"
  500. echo dota_ambient_creatures_pop "1" >>"autoexec.cfg"
  501. echo //mat_bloomscale "0" >>"autoexec.cfg"
  502. echo //mat_bumpmap "0" >>"autoexec.cfg"
  503. echo //mat_disable_bloom "1" >>"autoexec.cfg"
  504. echo //mat_filterlightmaps "0" >>"autoexec.cfg"
  505. echo //mat_forcehardwaresync "0" //Intel and Nvidia cards issues >>"autoexec.cfg"
  506. echo //mat_phong "0" >>"autoexec.cfg"
  507. echo mat_reducefillrate "1" >>"autoexec.cfg"
  508. echo mat_reduceparticles "1" >>"autoexec.cfg"
  509. echo //mat_specular "0" >>"autoexec.cfg"
  510. echo ragdoll_sleepaftertime "3" >>"autoexec.cfg"
  511. echo r_3dsky "0" >>"autoexec.cfg"
  512. echo r_forcewaterleaf "1" >>"autoexec.cfg"
  513. echo r_occlusion "1" >>"autoexec.cfg"
  514. echo r_propsmaxdist "900" >>"autoexec.cfg"
  515. echo //r_renderoverlayfragment "0" >>"autoexec.cfg"
  516. echo r_shadow_half_update_rate "1" >>"autoexec.cfg"
  517. echo //r_waterdrawreflection "0" >>"autoexec.cfg"
  518. echo //r_Waterdrawrefraction "0" >>"autoexec.cfg"
  519. echo r_waterforceexpensive "0" >>"autoexec.cfg"
  520. echo r_waterforcereflectentities "0" >>"autoexec.cfg"
  521. echo. >>"autoexec.cfg"
  522. echo //// Dota_ commands >>"autoexec.cfg"
  523. echo dota_ability_quick_cast "1" // Doubletapping to selfcast def=0 >>"autoexec.cfg"
  524. echo //dota_always_show_player_names "0" // Always show player names def=1 >>"autoexec.cfg"
  525. echo dota_camera_accelerate "50" // Decelerating map scroll >>"autoexec.cfg"
  526. echo //dota_camera_disable_zoom "0" // Disables mousewheel zoom def=0 >>"autoexec.cfg"
  527. echo //dota_camera_edgemove "1" // Moves camera when cursor hits edge of screen >>"autoexec.cfg"
  528. echo //dota_camera_hold_select_to_follow "0" // Hold key to follow hero - breaks rune scripts so disable it >>"autoexec.cfg"
  529. echo //dota_camera_reverse "0" // Inverted movements when gripping camera >>"autoexec.cfg"
  530. echo dota_camera_speed "6000" // Scrolling speed dota1-like feels best >>"autoexec.cfg"
  531. echo //dota_disable_range_finder "0" // Range finder on >>"autoexec.cfg"
  532. echo dota_force_right_click_attack "1" // Rightclick deny enabled def=0 >>"autoexec.cfg"
  533. echo //dota_hud_healthbar_number "1" // Health number above the lifebar on >>"autoexec.cfg"
  534. echo dota_minimap_always_draw_hero_icons "1" // Always show hero portrer/text on minimap. def=0 >>"autoexec.cfg"
  535. echo dota_minimap_hero_size "800" // Slightly bigger hero icons on minimap def=600 >>"autoexec.cfg"
  536. echo dota_minimap_misclick_time "0" // Every click on the minimap counts >>"autoexec.cfg"
  537. echo //dota_player_add_summoned_to_selection "1" // Automatically adds summoned creeps in controlled group. def=0 >>"autoexec.cfg"
  538. echo //dota_player_multipler_orders "1" // Control all units with CTRL click def=0 >>"autoexec.cfg"
  539. echo dota_player_teleport_requires_halt "1" // Prevent teleport canceled because of movement def=0 >>"autoexec.cfg"
  540. echo //dota_player_units_auto_attack "0" // Hero autoattack disabled def=1 >>"autoexec.cfg"
  541. echo dota_reset_camera_on_spawn "0" // Don't reset camera on respawn def=1 >>"autoexec.cfg"
  542. echo dota_unit_fly_bonus_height "150" // Flying height of air units >>"autoexec.cfg"
  543. echo dota_unit_use_player_color "1" // Colorize units by player color >>"autoexec.cfg"
  544. GOTO :eof
  545. ::END.DOTA_CREATE_AUTOEXEC
  546.  
  547. :DOTA_FIX_PERMISSIONS
  548. CALL :XECHO Removing compatibility options for steam and dota executables
  549. :: magic starts here
  550. FOR %%I IN ("%STEAMPATH%\Steam.exe" "%STEAMPATH%\bin\steamservice.exe" "%DOTAPATH%\dota.exe") DO (FOR %%J IN (32 64) DO (
  551. REG DELETE "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Persisted" /v %%I /f /reg:%%J >nul 2>&1
  552. REG DELETE "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v %%I /f /reg:%%J >nul 2>&1
  553. REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v %%I /f /reg:%%J >nul 2>&1
  554. ))
  555. GOTO :eof
  556. ::END.DOTA_FIX_PERMISSIONS
  557.  
  558. :DOTA_STEAM_SERVICE
  559. CALL :XECHO Cleaning Steam Service
  560. :: process explorer running results in steamservice install failure
  561. TASKKILL /F /IM procexp.exe /T >nul 2>&1
  562. TASKKILL /F /IM procexp64.exe /T >nul 2>&1
  563. SC DELETE "Steam Client Service" >nul 2>&1
  564. DEL /F /Q "%COMMONPROGRAMFILES%\Steam\SteamService.exe" >nul 2>&1
  565. DEL /F /Q "%COMMONPROGRAMFILES(X86)%\Steam\SteamService.exe" >nul 2>&1
  566. :: below command does not work anymore because of the heartbleed vulnerability so Steam must do the actual repair
  567. CALL "%STEAMPATH%\bin\steamservice.exe" /repair
  568. TITLE %_LABEL%
  569. CALL :XWAIT 5
  570. CALL :XECHO On the next Steam run, click [INSTALL SERVICE] if it prompts you.
  571. GOTO :eof
  572. ::END.DOTA_STEAM_SERVICE
  573.  
  574. :DOTA_OPTIMIZE_STEAM
  575. CALL :XECHO Optimize Steam settings
  576. :: scan default configuration
  577. TASKKILL /F /IM Steam.exe /T >nul 2>&1
  578. CALL :XWAIT 5
  579. CD /D "%STEAMPATH%\config"
  580. FOR /F "tokens=1* delims=/ eol=?" %%I IN ('DIR /-b/-s config.vdf^|FINDSTR /l ":"^|FINDSTR /l /v "^ & %% !!"') DO SET "SDDIR=%%~dpI"
  581. IF EXIST "%SDDIR%\config.vdf" (CD /D "%SDDIR%") ELSE GOTO :eof
  582. IF EXIST config.tmp DEL /F /Q config.tmp >nul 2>&1
  583. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L AllowDownloadsDuringGameplay "config.vdf"') DO SET /A "AllowDownloadsDuringGameplay=%%I"
  584. :: edit default configuration
  585. FOR /F "TOKENS=1,2* DELIMS=[]" %%H IN ('TYPE "config.vdf" ^| FIND /V /N ""') DO (
  586. SET "FOUNDLINE=0"
  587. IF [%%H]==[%AllowDownloadsDuringGameplay%] ECHO/ "AllowDownloadsDuringGameplay" "0">> config.tmp &SET "FOUNDLINE=1"
  588. IF !FOUNDLINE! EQU 0 ECHO/%%I>> config.tmp
  589. )
  590. CALL :VBDOS2UNIX "%SDDIR%\config.tmp" "%SDDIR%\config.vdf"
  591. DEL /F /Q "%SDDIR%\config.tmp"
  592. :: scan shared configuration
  593. CD /D "%STEAMPATH%\userdata"
  594. FOR /F "tokens=1* delims=/ eol=?" %%I IN ('DIR /-b/-s sharedconfig.vdf^|FINDSTR /l ":"^|FINDSTR /l /v "^ & %% !!"') DO SET "SCDIR=%%~dpI"
  595. IF EXIST "%SCDIR%\sharedconfig.vdf" (CD /D "%SCDIR%") ELSE GOTO :eof
  596. IF EXIST sharedconfig.tmp DEL /F /Q sharedconfig.tmp >nul 2>&1
  597. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L SteamDefaultDialog "sharedconfig.vdf"') DO SET /A "SteamDefaultDialog=%%I"
  598. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L cloudenabled "sharedconfig.vdf"') DO SET /A "cloudenabled=%%I"
  599. :: edit shared configuration
  600. FOR /F "TOKENS=1,2* DELIMS=[]" %%H IN ('TYPE "sharedconfig.vdf" ^| FIND /V /N ""') DO (
  601. SET "FOUNDLINE=0"
  602. IF [%%H]==[%SteamDefaultDialog%] ECHO/ "SteamDefaultDialog" "#app_friends">> sharedconfig.tmp &SET "FOUNDLINE=1"
  603. IF [%%H]==[%cloudenabled%] ECHO/ "cloudenabled" "0">> sharedconfig.tmp &SET "FOUNDLINE=1"
  604. IF !FOUNDLINE! EQU 0 ECHO/%%I>> sharedconfig.tmp
  605. )
  606. CALL :VBDOS2UNIX "%SCDIR%\sharedconfig.tmp" "%SCDIR%\sharedconfig.vdf"
  607. DEL /F /Q "%SCDIR%\sharedconfig.tmp"
  608. :: scan local configuration
  609. CD /D "%STEAMPATH%\userdata"
  610. FOR /F "tokens=1* delims=/ eol=?" %%I IN ('DIR /-b/-s localconfig.vdf^|FINDSTR /l ":"^|FINDSTR /l /v "^ & %% !!"') DO SET "LCDIR=%%~dpI"
  611. IF EXIST "%LCDIR%\localconfig.vdf" (CD /D "%LCDIR%") ELSE GOTO :eof
  612. IF EXIST localconfig.tmp DEL /F /Q localconfig.tmp >nul 2>&1
  613. FOR /F "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N } "localconfig.vdf"') DO SET /A "localconfig_eof=%%I"
  614. IF NOT DEFINED localconfig_eof GOTO :eof
  615. FOR /F "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N \^"friends\^" "localconfig.vdf" ^| FINDSTR /V \^"friends\^".') DO SET /A "section_friends=%%I+1"
  616. FOR /F "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N \^"News\^" "localconfig.vdf" ^| FINDSTR /V \^"News\^".') DO SET /A "section_news=%%I+1"
  617. FOR /F "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N \^"system\^" "localconfig.vdf" ^| FINDSTR /V \^"system\^".') DO SET /A "section_system=%%I+1"
  618. FOR /F "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N \^"570\^" "localconfig.vdf" ^| FINDSTR /V \^"570\^".') DO SET /A "app570start=%%I" &SET /A "app570end=%%I+8"
  619. IF DEFINED app570start FOR /F "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L LaunchOptions "localconfig.vdf"') DO IF %%I GTR %app570start% IF %%I LSS %app570end% SET /A "LaunchOptions=%%I"
  620. FOR %%I IN (PersonaStateDesired Notifications_ShowIngame Sounds_PlayIngame Notifications_ShowOnline Sounds_PlayOnline Notifications_ShowMessage Sounds_PlayMessage AutoSignIntoFriends ShowTimeInChatLogCheck AlwaysNewChatWindow ChatFlashMode EnableStreaming NotifyAvailableGames StartupState.Friends HideSharingNotifications EnableGameOverlay InGameOverlayShortcutKey InGameOverlayScreenshotNotification InGameOverlayScreenshotPlaySound InGameOverlayScreenshotSaveUncompressed InGameOverlayScreenshotHotKey NavUrlBar UsePushToTalk PushToTalkKey JumplistSettings JumplistSettingsKnown) DO FOR /f "tokens=1 delims=: eol=?" %%a IN ('FINDSTR /N /L %%I "localconfig.vdf"') DO SET /A "%%I=%%a"
  621. :: edit local configuration
  622. FOR /F "TOKENS=1,2* DELIMS=[]" %%H IN ('TYPE "localconfig.vdf" ^| FIND /V /N ""') DO (
  623. SET "FOUNDLINE=0"
  624. FOR %%a in (%Notifications_ShowIngame% %Sounds_PlayIngame% %Notifications_ShowOnline% %Sounds_PlayOnline% %Notifications_ShowMessage% %Sounds_PlayMessage% %AutoSignIntoFriends% %ShowTimeInChatLogCheck% %AlwaysNewChatWindow% %ChatFlashMode% %NotifyAvailableGames% %HideSharingNotifications% %EnableGameOverlay% %InGameOverlayShortcutKey% %InGameOverlayScreenshotNotification% %InGameOverlayScreenshotPlaySound% %InGameOverlayScreenshotSaveUncompressed% %InGameOverlayScreenshotHotKey% %NavUrlBar% %UsePushToTalk% %PushToTalkKey% %JumplistSettings% %JumplistSettingsKnown%) DO IF %%H GTR 2 IF [%%H]==[%%a] SET "FOUNDLINE=1"
  625. IF %%H GTR 2 IF [%%H]==[%LaunchOptions%] SET "FOUNDLINE=1"
  626. IF %%H GTR 2 IF [%%H]==[%EnableStreaming%] ECHO/ "EnableStreaming" "0">> localconfig.tmp &SET "FOUNDLINE=1"
  627. IF %%H GTR 2 IF [%%H]==[%StartupState.Friends%] (
  628. ECHO/ "StartupState.Friends" "1">> localconfig.tmp
  629. ECHO/ "HideSharingNotifications" "1">> localconfig.tmp
  630. SET "FOUNDLINE=1"
  631. )
  632. IF %%H GTR 2 IF [%%H]==[%section_friends%] (
  633. ECHO/ {>> localconfig.tmp
  634. ECHO/ "AlwaysNewChatWindow" "1">> localconfig.tmp
  635. ECHO/ "AutoSignIntoFriends" "0">> localconfig.tmp
  636. ECHO/ "ChatFlashMode" "1">> localconfig.tmp
  637. ECHO/ "Notifications_ShowIngame" "0">> localconfig.tmp
  638. ECHO/ "Notifications_ShowMessage" "1">> localconfig.tmp
  639. ECHO/ "Notifications_ShowOnline" "0">> localconfig.tmp
  640. ECHO/ "ShowTimeInChatLogCheck" "1">> localconfig.tmp
  641. ECHO/ "Sounds_PlayIngame" "0">> localconfig.tmp
  642. ECHO/ "Sounds_PlayMessage" "1">> localconfig.tmp
  643. ECHO/ "Sounds_PlayOnline" "0">> localconfig.tmp
  644. SET "FOUNDLINE=1"
  645. )
  646. IF %%H GTR 2 IF [%%H]==[%section_news%] (
  647. ECHO/ {>> localconfig.tmp
  648. ECHO/ "NotifyAvailableGames" "0">> localconfig.tmp
  649. SET "FOUNDLINE=1"
  650. )
  651. IF %%H GTR 2 IF [%%H]==[%section_system%] (
  652. ECHO/ {>> localconfig.tmp
  653. ECHO/ "EnableGameOverlay" "0">> localconfig.tmp
  654. ECHO/ "InGameOverlayScreenshotNotification" "0">> localconfig.tmp
  655. ECHO/ "InGameOverlayScreenshotPlaySound" "1">> localconfig.tmp
  656. ECHO/ "InGameOverlayScreenshotSaveUncompressed" "0">> localconfig.tmp
  657. ECHO/ "JumplistSettings" "7744">> localconfig.tmp
  658. ECHO/ "JumplistSettingsKnown" "65535">> localconfig.tmp
  659. ECHO/ "NavUrlBar" "1">> localconfig.tmp
  660. ECHO/ "PushToTalkKey" "145">> localconfig.tmp
  661. ECHO/ "UsePushToTalk" "1">> localconfig.tmp
  662. SET "FOUNDLINE=1"
  663. )
  664. IF %%H EQU %localconfig_eof% IF NOT DEFINED section_system (
  665. ECHO/ "system">> localconfig.tmp
  666. ECHO/ {>> localconfig.tmp
  667. ECHO/ "EnableGameOverlay" "0">> localconfig.tmp
  668. ECHO/ "InGameOverlayScreenshotNotification" "0">> localconfig.tmp
  669. ECHO/ "InGameOverlayScreenshotPlaySound" "1">> localconfig.tmp
  670. ECHO/ "InGameOverlayScreenshotSaveUncompressed" "0">> localconfig.tmp
  671. ECHO/ "JumplistSettings" "7744">> localconfig.tmp
  672. ECHO/ "JumplistSettingsKnown" "65535">> localconfig.tmp
  673. ECHO/ "NavUrlBar" "1">> localconfig.tmp
  674. ECHO/ "PushToTalkKey" "145">> localconfig.tmp
  675. ECHO/ "UsePushToTalk" "1">> localconfig.tmp
  676. ECHO/ }>> localconfig.tmp
  677. ECHO/}>> localconfig.tmp
  678. SET "FOUNDLINE=1"
  679. )
  680. IF !FOUNDLINE! EQU 0 ECHO/%%I>> localconfig.tmp
  681. )
  682. CALL :VBDOS2UNIX "%LCDIR%\localconfig.tmp" "%LCDIR%\localconfig.vdf"
  683. DEL /F /Q "%LCDIR%\localconfig.tmp"
  684. GOTO :eof
  685. ::END.DOTA_OPTIMIZE_STEAM
  686.  
  687. :DOTA_OPTIMIZE_GAME
  688. CALL :XECHO Optimize Dota cvars and video options
  689. CD /D "%STEAMPATH%\userdata"
  690. FOR /f "tokens=1* delims=/ eol=?" %%I IN ('DIR /-b/-s config.cfg^|FINDSTR /l ":"^|FINDSTR /l /v "^ & %% !!"') DO IF EXIST "%%~I" DEL /F /Q "%%~I" >nul 2>&1
  691. IF NOT EXIST "%DOTAPATH%\dota\cfg\*" MD "%DOTAPATH%\dota\cfg" >nul 2>&1
  692. CD /D "%DOTAPATH%\dota\cfg"
  693. DEL /F /Q "config.cfg" >nul 2>&1
  694. DEL /F /Q "video.txt*" >nul 2>&1
  695. :: testrun dota to initiate video options
  696. START "" steam://open/minigameslist
  697. CALL :VBTIMESTAMP
  698. CALL :WAIT_FOR_STEAM
  699. START "" "%STEAMPATH%\Steam.exe" -applaunch 570 -low -dev -condebug -nosound -textmode -windowed -w 1280 -h 720 +sv_lan 1
  700. CALL :VBTIMESTAMP
  701. CALL :WAIT_FOR_DOTA
  702. TASKKILL /F /IM Steam.exe /T >nul 2>&1
  703. CALL :XWAIT 5
  704. :: alter video.txt
  705. IF NOT EXIST video.txt GOTO :eof
  706. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L fullscreen "video.txt"') DO SET /A "fullscreen=%%I"
  707. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L nowindowborder "video.txt"') DO SET /A "nowindowborder=%%I"
  708. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L mat_vsync "video.txt"') DO SET /A "mat_vsync=%%I"
  709. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L defaultres\^" "video.txt"') DO SET /A "defaultres=%%I"
  710. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L defaultresheight "video.txt"') DO SET /A "defaultresheight=%%I"
  711. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L mat_viewportscale "video.txt"') DO SET /A "mat_viewportscale=%%I"
  712. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L r_shadow_half_update_rate "video.txt"') DO SET /A "r_shadow_half_update_rate=%%I"
  713. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L dota_cheap_water "video.txt"') DO SET /A "dota_cheap_water=%%I"
  714. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L r_deferred_height_fog "video.txt"') DO SET /A "r_deferred_height_fog=%%I"
  715. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L r_deferred_simple_light "video.txt"') DO SET /A "r_deferred_simple_light=%%I"
  716. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L r_ssao "video.txt"') DO SET /A "r_ssao=%%I"
  717. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L cl_globallight_shadow_mode "video.txt"') DO SET /A "cl_globallight_shadow_mode=%%I"
  718. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L r_screenspace_aa "video.txt"') DO SET /A "r_screenspace_aa=%%I"
  719. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L r_deferred_additive_pass "video.txt"') DO SET /A "r_deferred_additive_pass=%%I"
  720. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L dota_portrait_animate "video.txt"') DO SET /A "dota_portrait_animate=%%I"
  721. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L r_deferred_specular_bloom "video.txt"') DO SET /A "r_deferred_specular_bloom=%%I"
  722. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L r_deferred_specular "video.txt"') DO SET /A "r_deferred_specular=%%I"
  723. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L dota_ambient_creatures\^" "video.txt"') DO SET /A "dota_ambient_creatures=%%I"
  724. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L dota_ambient_creatures_pop "video.txt"') DO SET /A "dota_ambient_creatures_pop=%%I"
  725. FOR /f "tokens=1 delims=: eol=?" %%I IN ('FINDSTR /N /L mat_picmip "video.txt"') DO SET /A "mat_picmip=%%I"
  726. FOR /F "TOKENS=1,2* DELIMS=[]" %%H IN ('TYPE "video.txt" ^| FIND /V /N ""') DO (
  727. SET "FOUNDLINE=0"
  728. IF [%%H]==[%fullscreen%] ECHO/ "setting.fullscreen" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  729. IF [%%H]==[%nowindowborder%] ECHO/ "setting.nowindowborder" "1">> video.txt.tmp &SET "FOUNDLINE=1"
  730. IF [%%H]==[%mat_vsync%] ECHO/ "setting.mat_vsync" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  731. IF [%%H]==[%defaultres%] ECHO/ "setting.defaultres" "1280">> video.txt.tmp &SET "FOUNDLINE=1"
  732. IF [%%H]==[%defaultresheight%] ECHO/ "setting.defaultresheight" "720">> video.txt.tmp &SET "FOUNDLINE=1"
  733. IF [%%H]==[%mat_viewportscale%] ECHO/ "setting.mat_viewportscale" "0.9">> video.txt.tmp &SET "FOUNDLINE=1"
  734. IF [%%H]==[%r_shadow_half_update_rate%] ECHO/ "setting.r_shadow_half_update_rate" "1">> video.txt.tmp &SET "FOUNDLINE=1"
  735. IF [%%H]==[%dota_cheap_water%] ECHO/ "setting.dota_cheap_water" "1">> video.txt.tmp &SET "FOUNDLINE=1"
  736. IF [%%H]==[%r_deferred_height_fog%] ECHO/ "setting.r_deferred_height_fog" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  737. IF [%%H]==[%r_deferred_simple_light%] ECHO/ "setting.r_deferred_simple_light" "1">> video.txt.tmp &SET "FOUNDLINE=1"
  738. IF [%%H]==[%r_ssao%] ECHO/ "setting.r_ssao" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  739. IF [%%H]==[%cl_globallight_shadow_mode%] ECHO/ "setting.cl_globallight_shadow_mode" "2">> video.txt.tmp &SET "FOUNDLINE=1"
  740. IF [%%H]==[%r_screenspace_aa%] ECHO/ "setting.r_screenspace_aa" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  741. IF [%%H]==[%r_deferred_additive_pass%] ECHO/ "setting.r_deferred_additive_pass" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  742. IF [%%H]==[%dota_portrait_animate%] ECHO/ "setting.dota_portrait_animate" "1">> video.txt.tmp &SET "FOUNDLINE=1"
  743. IF [%%H]==[%r_deferred_specular_bloom%] ECHO/ "setting.r_deferred_specular_bloom" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  744. IF [%%H]==[%r_deferred_specular%] ECHO/ "setting.r_deferred_specular" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  745. IF [%%H]==[%dota_ambient_creatures%] ECHO/ "setting.dota_ambient_creatures" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  746. IF [%%H]==[%dota_ambient_creatures_pop%] ECHO/ "setting.dota_ambient_creatures_pop" "1">> video.txt.tmp &SET "FOUNDLINE=1"
  747. IF [%%H]==[%mat_picmip%] ECHO/ "setting.mat_picmip" "0">> video.txt.tmp &SET "FOUNDLINE=1"
  748. IF !FOUNDLINE! EQU 0 ECHO/%%I>> video.txt.tmp
  749. )
  750. RENAME video.txt video.txt.def >nul 2>&1
  751. RENAME video.txt.tmp video.txt >nul 2>&1
  752. GOTO :eof
  753. :WAIT_FOR_STEAM
  754. ECHO Waiting for Steam window...
  755. CALL :XWAIT 4
  756. TASKLIST /FI "WINDOWTITLE eq Steam" /FI "STATUS eq running"|FINDSTR Steam.exe
  757. IF [%ERRORLEVEL%]==[0] (SET "STEAMRUNS=1") ELSE SET "STEAMRUNS="
  758. IF EXIST "%DOTAPATH%\dota\cfg\video.txt" GOTO :eof
  759. :: added 2 minutes timeout so it wont hang the script
  760. IF DEFINED TIMESTAMP CALL :VBTIMEDIFF "%TIMESTAMP%"
  761. IF DEFINED TIMEDIFF IF %TIMEDIFF% GTR 120 GOTO :eof
  762. IF NOT DEFINED STEAMRUNS ECHO Waiting for Steam window... &GOTO :WAIT_FOR_STEAM
  763. CALL :XWAIT 8
  764. GOTO :eof
  765. :WAIT_FOR_DOTA
  766. ECHO Waiting for Dota window...
  767. CALL :XWAIT 4
  768. TASKLIST /FI "WINDOWTITLE eq %DOTAPATH%\dota.exe" /FI "STATUS eq running"|FINDSTR dota.exe
  769. IF [%ERRORLEVEL%]==[0] (SET "DOTARUNS=1") ELSE SET "DOTARUNS="
  770. IF NOT DEFINED DOTARUNS (
  771. TASKLIST /FI "WINDOWTITLE eq DOTA 2" /FI "STATUS eq running"|FINDSTR dota.exe
  772. IF [%ERRORLEVEL%]==[0] (SET "DOTARUNS=1") ELSE SET "DOTARUNS="
  773. )
  774. IF EXIST "%DOTAPATH%\dota\cfg\video.txt" GOTO :eof
  775. :: added 2 minutes timeout so it wont hang the script
  776. IF DEFINED TIMESTAMP CALL :VBTIMEDIFF "%TIMESTAMP%"
  777. IF DEFINED TIMEDIFF IF %TIMEDIFF% GTR 120 GOTO :eof
  778. IF NOT DEFINED DOTARUNS ECHO Waiting for Dota window... &GOTO :WAIT_FOR_DOTA
  779. GOTO :eof
  780. ::END.DOTA_OPTIMIZE_GAME
  781.  
  782. :DOTA_CLEANUP_DUMPS
  783. CALL :XECHO Cleanup old memory dumps
  784. SET /A STEAMDUMPCOUNT=0 &FOR %%C IN ("%STEAMPATH%\dumps\*.*") DO SET /A STEAMDUMPCOUNT+=1
  785. DEL /F /Q "%STEAMPATH%\dumps\*.*" >nul 2>&1
  786. SET /A DOTADUMPCOUNT=0 &FOR %%C IN ("%DOTAPATH%\dota_*.mdmp") DO SET /A DOTADUMPCOUNT+=1
  787. DEL /F /Q "%DOTAPATH%\dota_*.mdmp" >nul 2>&1
  788. CALL :XECHO Removed %STEAMDUMPCOUNT% dumps from Steam and %DOTADUMPCOUNT% dumps from Dota
  789. :: Remove dll's tampering with dota
  790. DEL /F /Q "%DOTAPATH%\dxgi.dll" >nul 2>&1
  791. DEL /F /Q "%DOTAPATH%\d3d9.dll" >nul 2>&1
  792. GOTO :eof
  793. ::END.DOTA_CLEANUP_DUMPS
  794.  
  795. :DOTA_REMOVE_VPKMODS_FORCES_VERIFY
  796. CALL :XECHO Remove Override_vpk mods, and save them to _BACKUP folder
  797. CD /D "%DOTAPATH%\dota"
  798. MD _BACKUP >nul 2>&1
  799. :: removal was too drastical, this way it wont break sound if verify does not finish
  800. rem FOR %%I IN (cache_*.soc *.cache) DO DEL /F /Q %%I >nul 2>&1
  801. rem FOR %%I IN (materials models particles resource\flash3 scripts sound) DO (
  802. FOR %%I IN (materials models particles scripts) DO (
  803. IF EXIST %%I IF NOT EXIST _BACKUP\%%I\* MOVE /Y %%I _BACKUP\ >nul 2>&1
  804. IF EXIST %%I IF EXIST _BACKUP\%%I\* ROBOCOPY %%I\ _BACKUP\%%I\ /E /IS /MOVE /NFL /NDL /NJH /NJS /nc /ns /np
  805. )
  806. IF NOT EXIST _BACKUP\* RMDIR /S /Q _BACKUP
  807. CALL :XECHO Verifying integrity of game cache for Dota, please let it finish!
  808. START /WAIT "" steam://validate/570
  809. CALL :XWAIT 5
  810. GOTO :eof
  811. ::END.DOTA_REMOVE_VPKMODS_FORCES_VERIFY
  812.  
  813. ::::::::::::::::::::::::::::::::::::::
  814. :: BATCH SCRIPT INTERNAL FUNCTIONS ::
  815. ::::::::::::::::::::::::::::::::::::::
  816. :XWAIT
  817. PING -n %1 127.0.0.1 >nul 2>&1
  818. GOTO :eof
  819. ::END.XWAIT
  820.  
  821. :XDONE
  822. echo/
  823. echo/===========================================================
  824. echo/DONE: %*
  825. echo/
  826. IF DEFINED _TRACE echo Press any key to quit &PAUSE >nul &EXIT
  827. CALL :XWAIT 20 &EXIT
  828. GOTO :eof
  829. ::END.XDONE
  830.  
  831. :XERR
  832. CLS
  833. echo/
  834. echo/ERROR: %*
  835. PAUSE
  836. IF NOT DEFINED _TRACE EXIT
  837. GOTO :eof
  838. ::END.XERR
  839.  
  840. :XECHO
  841. echo/
  842. IF NOT "%1_"=="_" echo/%_nline%:%*
  843. IF DEFINED _TRACE echo/ &PAUSE
  844. SET /A _nline+=1
  845. CALL :XWAIT 2
  846. GOTO :eof
  847. ::END.XECHO
  848.  
  849. :XTITLE
  850. echo/
  851. IF NOT "%1_"=="_" echo/===========================================================
  852. IF NOT "%1_"=="_" echo/ %*
  853. IF NOT "%1_"=="_" echo/===========================================================
  854. SET /A _nline=1
  855. GOTO :eof
  856. ::END.XTITLE
  857.  
  858. :TRIM
  859. :: CALL :TRIM variablename
  860. SETLOCAL ENABLEDELAYEDEXPANSION &CALL SET _STR=%%%1%%
  861. SET _STR=%_STR:!=$1#%
  862. SET _STR=%_STR:^=$6#%
  863. CALL :TRIM_STR
  864. ENDLOCAL &SET _STR=%_STR%
  865. SET _STR=%_STR:$1#=!%
  866. SET _STR=%_STR:$6#=^%
  867. SET %1=%_STR%
  868. GOTO :eof
  869. :TRIM_STR
  870. IF "!_STR:~-1!"==" " SET "_STR=!_STR:~0,-1!" & GOTO :TRIM_STR
  871. IF "!_STR:~0,1!"==" " SET "_STR=!_STR:~1,-1!!_STR:~-1!" & GOTO :TRIM_STR
  872. GOTO :eof
  873. ::END.TRIM
  874.  
  875. :CHECK_OS
  876. :: Usage: GOTO :CHECK_OS [This must run first after @ECHO OFF]
  877. SET _MYVER=1.4b
  878. SET "SSVAR=%WINDIR%\SYSTEM32"
  879. SET "PFVAR=%PROGRAMFILES%"
  880. IF DEFINED ProgramW6432 SET "PFVAR=%ProgramW6432%"
  881. IF DEFINED PROCESSOR_ARCHITEW6432 SET "SSVAR=%WINDIR%\Sysnative"
  882. )
  883. COLOR 70 &SET _LABEL=%~n0 by a^v^ey^o^ v%_MYVER%
  884. FOR /F "tokens=4-5 delims=. " %%i IN ('ver') DO SET WINVERSION=%%i%%j
  885. :: filter OS
  886. rem IF %WINVERSION% LEQ 60 CALL :ERR ONLY FOR WINDOWS 7 OR ABOVE
  887. :: test rights
  888. REG ADD "HKLM\SYSTEM\CurrentControlSET\Control\Session Manager\Environment" /F /v TESTRUNAS /t REG_SZ /d 1 >nul 2>&1
  889. IF NOT ERRORLEVEL 1 SET "ISRUNAS=Y"
  890. CLS &echo. &TITLE %_LABEL%
  891. REG DELETE "HKLM\SYSTEM\CurrentControlSET\Control\Session Manager\Environment" /F /v TESTRUNAS >nul 2>&1
  892. :: stop if dota.exe running
  893. FOR /F "tokens=1*" %%I IN ('tasklist /FI "IMAGENAME eq dota.exe" /NH') DO SET "CHECKRUN=%%I"
  894. IF [%CHECKRUN%]==[dota.exe] CALL :XERR Close Dota before running this script {won't do it for you}
  895. CD /D "%~dp0"
  896. IF "%1"=="_SELF_ADMIN" SHIFT &SHIFT &goto :_START
  897. IF DEFINED ISRUNAS goto :_START
  898. IF NOT DEFINED ISRUNAS CALL :XECHO Requesting admin rights, if it fails, R-click and 'Run As Administrator'
  899. echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\~1337run.vbs"
  900. echo UAC.ShellExecute "%~s0", "_SELF_ADMIN %~s0 %*", "", "runas", 1 >> "%temp%\~1337run.vbs"
  901. CALL %SSVAR%\CSCRIPT.EXE //nologo "%temp%\~1337run.vbs" &DEL /F /Q "%temp%\~1337run.vbs" &EXIT
  902. GOTO :eof
  903. ::END.CHECK_OS
  904.  
  905. :VBDOS2UNIX
  906. :: converts line endings for small text files from dos CR+LF to unix LF
  907. :: Usage: :VBDOS2UNIX filesource fileoutput
  908. FINDSTR "'~1337v%skip%bd%skip%2u" "%~f0">"%temp%\~1337d2u.vbs"
  909. CSCRIPT //nologo "%temp%\~1337d2u.vbs" "%~1" "%~2"
  910. GOTO :eof
  911. On Error Resume Next '~1337vbcf '~1337vbd2u
  912. Set Fso = wscript.CreateObject("Scripting.FileSystemObject") '~1337vbd2u
  913. Set dos2unix=fso.OpenTextFile(WScript.Arguments(0), 1, true) '~1337vbd2u
  914. s=replace(dos2unix.ReadAll,vbCrLf,vbLf) '~1337vbd2u
  915. dos2unix.Close '~1337vbd2u
  916. Set dos2unix=fso.OpenTextFile(WScript.Arguments(1), 2, true) '~1337vbd2u
  917. dos2unix.Write s '~1337vbd2u
  918. dos2unix.Close '~1337vbd2u
  919. Set dos2unix=Nothing '~1337vbd2u
  920. Set Fso=Nothing '~1337vbd2u
  921. Err.Clear '~1337vbd2u
  922. ::END.VBDOS2UNIX
  923.  
  924. :VBTIMESTAMP
  925. :: adds new variable TIMESTAMP having the current date and time
  926. :: Usage: CALL :VBTIMESTAMP
  927. FINDSTR "'~1337ti%skip%s" "%~f0">"%temp%\~1337tis.vbs"
  928. CALL CSCRIPT //nologo "%temp%\~1337tis.vbs" >"%temp%\~1337tis.cmd"
  929. CALL "%temp%\~1337tis.cmd" &DEL /F /Q "%temp%\~1337tis.vbs"
  930. DEL /F /Q "%temp%\~1337tis.cmd"
  931. goto :EOF
  932. On Error Resume Next '~1337tis
  933. WScript.echo "SET TIMESTAMP=" & Now '~1337tis
  934. Err.Clear '~1337tis
  935. ::END.VBTIMESTAMP
  936.  
  937. :VBTIMEDIFF
  938. :: adds new variable TIMEDIFF having nr. of seconds between %TIMESTAMP% and now
  939. :: Usage: CALL :VBTIMEDIFF "%TIMESTAMP%"
  940. FINDSTR "'~1337ti%skip%d" "%~f0">"%temp%\~1337tid.vbs"
  941. CALL CSCRIPT //nologo "%temp%\~1337tid.vbs" %1>"%temp%\~1337tid.cmd"
  942. CALL "%temp%\~1337tid.cmd" &DEL /F /Q "%temp%\~1337tid.vbs"
  943. DEL /F /Q "%temp%\~1337tid.cmd"
  944. goto :EOF
  945. On Error Resume Next '~1337tid
  946. WScript.echo "SET TIMEDIFF=" & DateDiff("s",Wscript.Arguments(0),Now) '~1337tid
  947. Err.Clear '~1337tid
  948. ::END.VBTIMEDIFF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement