Advertisement
aveyo

reset_Dota2

Apr 28th, 2016 (edited)
9,332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 4.19 KB | Gaming | 0 0
  1. @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit /b SAVE as .bat OR .ps1 / ENTER in powershell
  2. #::  click copy / raw / download buttons on pastebin, otherwise the syntax highlight preview might break the script
  3.  
  4. $host.ui.RawUI.WindowTitle = "reset_Dota2" #:: 2024 v4 modernization: using powershell; keep hero grids
  5. write-host
  6. write-host "    INSTRUCTIONS:                                                                                   "
  7. write-host " 1. Make sure you launch Dota 2 at least once with the account having troubles,                     "
  8. write-host "    else this script will use the last logged on account                                            "
  9. write-host " 2. Run this script - you might need to right-click it and Run as Administrator                     "
  10. write-host " 3. After launching Dota 2, chose 'Local Save' at the Cloud Sync Conflict prompt then 'Play Anyway' "
  11. write-host " 4. Adjust your settings, then restart Dota 2. Did it stick? Repeat procedure with Cloud On and Off "
  12. write-host
  13.  
  14. #:: find steam
  15. $APPID    = "570"
  16. $APPNAME  = "dota2"
  17. $GAMENAME = "dota 2 beta"
  18. $GAMEROOT = "dota"
  19. $LAUNCHER = "bin\win64\$APPNAME.exe"
  20. $STEAM = resolve-path (gpv "HKCU:\SOFTWARE\Valve\Steam" SteamPath); $APPMANIFEST = ''; $STEAMAPPS = ''; $GAME = '';
  21. gc "$STEAM\steamapps\libraryfolders.vdf" |foreach {$_ -split '"',5} |? {$_ -like '*:\\*'} |% {
  22.  $l = resolve-path $_; $a = "$l\steamapps\appmanifest_${APPID}.acf"; $g = "$l\steamapps\common\$GAMENAME\game"
  23.  if (test-path "$g\$LAUNCHER") {$APPMANIFEST = $a; $STEAMAPPS = split-path $a; $GAME = $g}
  24. }
  25. pushd "$STEAM\userdata"
  26. $CLOUD = split-path (dir "localconfig.vdf" -File -Recurse | sort LastWriteTime -Descending | Select -First 1).DirectoryName
  27. " STEAM = $STEAM`n GAME  = $GAME`n CLOUD = $CLOUD"
  28. "`n $APPNAME will start automatically after a while ..."
  29. timeout /t 10
  30.  
  31. #:: force close steam & dota2
  32. 'dota2','steamwebhelper','steam' |% {kill -name $_ -force -ea 0} ; sleep 3; del "$STEAM\.crash" -force -ea 0
  33.  
  34. #:: clear any verify integrity flags
  35. if (test-path $APPMANIFEST) {
  36.  $ACF = [io.file]::ReadAllText($APPMANIFEST)
  37.  if ($ACF -match '"FullValidateAfterNextUpdate"\s+"1"' -or $ACF -notmatch '"StateFlags"\s+"4"') {
  38.    $ACF = $ACF -replace '("FullValidateAfterNextUpdate"\s+)("\d+")',"`$1`"0`"" -replace '("StateFlags"\s+)("\d+")',"`$1`"4`""
  39.    [io.file]::WriteAllText($APPMANIFEST, $ACF)
  40.  }
  41. } else {
  42.  $ACF = "`"AppState`"`n{`n `"AppID`" `"$APPID`"`n `"Universe`" `"1`"`n `"installdir`" `"$GAMENAME`"`n `"StateFlags`" `"4`"`n}`n"
  43.  [io.file]::WriteAllText($APPMANIFEST, $ACF)
  44. }
  45.  
  46. #:: clear cfg settings keeping autoexec.cfg
  47. $cfg = ''; if (test-path "$GAME\$GAMEROOT\cfg\autoexec.cfg") { $cfg = [io.file]::ReadAllText("$GAME\$GAMEROOT\cfg\autoexec.cfg") }
  48. rmdir -recurse "$GAME\$GAMEROOT\cfg" -force -ea 0; mkdir "$GAME\$GAMEROOT\cfg" -force -ea 0 >''
  49. if ($cfg -ne '') { [io.file]::WriteAllText("$GAME\$GAMEROOT\cfg\autoexec.cfg", $cfg) }
  50. $vcfg = "`"config`"`n{`n`t`"bindings`"`n`t{`n`t`t`t`"\`"`t`t`"toggleconsole`"`n`t}`n}`n"
  51. [io.file]::WriteAllText("$GAME\$GAMEROOT\cfg\user_keys_default.vcfg", $vcfg)
  52. rmdir -recurse "$GAME\$GAMEROOT\core" -force -ea 0; del "$GAME\core\cfg\*.json","$GAME\core\cfg\*.bin" -force -ea 0
  53.  
  54. #:: clear cloud settings keeping hero grids, hero builds, control groups, hotkeys
  55. takeown /f "$CLOUD" /r /d y >'' 2>''; icacls "$CLOUD" /reset /t /q >'' 2>''; attrib -r "$CLOUD" /s /d >'' 2>''
  56. del "$CLOUD\$APPID\remotecache.vdf" -force -ea 0
  57. pushd "$CLOUD\$APPID"
  58. dir -recurse -file -exclude '*.png','*.jpg','dotakeys_personal.lst','control_groups.txt','herobuilds.cfg',
  59.  'hero_grid_config.json'<#,'voice_ban.dt'#> |% { process { [io.file]::WriteAllText($_, '') } }
  60.  
  61. #:: clear shader and inventory cache
  62. rmdir -recurse "$GAME\$GAMEROOT\shadercache" -force -ea 0; mkdir "$GAME\$GAMEROOT\shadercache" -force -ea 0 >''
  63. rmdir -recurse "$STEAMAPPS\shadercache\$APPID" -force -ea 0
  64. del "$GAME\$GAMEROOT\cache_$(split-path $CLOUD -leaf)*.soc" -force -ea 0
  65.  
  66. #:: launch game
  67. $quick = '-quicklogin -skipinitialbootstrap -skipstreamingdrivers -vrdisable -nofriendsui -oldtraymenu -cef-disable-gpu -silent'
  68. powershell.exe -nop -c "Start-Process \`"$STEAM\steam.exe\`" \`"$quick -applaunch $APPID \`""
  69.  
Tags: DOTA2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement