aveyo

DOTA2_OFFLINE

Dec 11th, 2016 (edited)
1,695
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 10.16 KB | None | 0 0
  1. @(echo off% <#%) & goto :start DOTA2 offline
  2.  
  3.   config for local play with bots when not having any internet connection available
  4.  
  5. #>)["AveYo, 2024.02.20"]
  6.  
  7. #:: To force lower res than native in exclusive mode, edit the 0 below - or add launch options like: -w 1360 -h 768
  8. $force_w = 0
  9. $force_h = 0
  10.  
  11. $offline = @'
  12. log_flags GCClient SteamNetSockets +donotecho | grep %
  13.  
  14. dota_bot_set_difficulty 3
  15. dota_local_bot_match_difficulty 3
  16. dota_local_bot_match_script_index 0
  17. dota_force_gamemode 11
  18.  
  19. map_enable_background_maps 0
  20. host_limitlocal 1 //: apply cl_cmdrate etc. rules RIP
  21. net_usesocketsforloopback 1 //: RIP
  22. net_p2p_api_game 2 //: 0=old sessions, 1=new session, 2=new socket RIP
  23. net_p2p_api_client_to_client 1 //: 0=old 1=new RIP
  24. net_option IpAllowWithoutAuth 1 //: tx Gaben!
  25. net_option IPLocalHost_AllowWithoutAuth 1
  26. net_option TimeoutSecondsConnected 20
  27. net_option TimeoutSecondsInitial 20
  28. net_force_steamdatagram 0
  29. net_p2p_listen_dedicated 1 //: 0=old 1=new 1
  30. dota_start_ai_game 0
  31. dota_bot_disable 0
  32. dota_bot_match_solo 1
  33. dota_heropicker_ap_select_time 999 // :D
  34. dota_surrender_on_disconnect 0
  35. dota_quit_after_game 0
  36. dota_quit_on_hibernate_after_lobby 0
  37. sv_hibernate_when_empty 0
  38. sv_lan 1
  39. top_bar_message "OFFLINE" 1; sleep 12000; showconsole
  40. alias BB "hideconsole; dota_start_ai_game 1; map dota loopback=1; status"
  41. alias GG "hideconsole; dota_start_ai_game 0; map dota loopback=1; status"
  42. alias DD "hideconsole; dota_start_ai_game 0; disconnect"
  43. alias aa0 "map_enable_background_maps 0;alias AA aa1;echoln [Animations]=0 Enter AA to switch..";
  44. alias aa1 "map_enable_background_maps 1;alias AA aa0;echoln [Animations]=1 Enter AA to switch.."; alias AA aa1
  45. log_color General 00FF00FF | grep %; echoln " "; echoln " "; echoln " "; echoln " "
  46. echoln "                      Dota 2 offline play helper by AveYo                  "
  47. echoln "     --------------------------------------------------------------------- "
  48. echoln "    :   Console command                :   Description                    :"
  49. echoln "    :---------------------------------------------------------------------:"
  50. echoln "    :   MAP DOTA LOOPBACK=1            :   Start LOCAL (loopback)         :"
  51. echoln "    :   MAP DOTA                       :   Start LAN server               :"
  52. echoln "    :   CONNECT   192.168.xxx.xxx      :   Join  LAN server from other PC :"
  53. echoln "    :   DISCONNECT                     :   Leave LAN server               :"
  54. echoln "    :   CHANGELEVEL DOTA               :   Quick LAN server reload        :"
  55. echoln "    :   STATUS                         :   Print LAN ip:port for connect  :"
  56. echoln "    :   dota_bot_populate              :   Add bots for missing slots     :"
  57. echoln "    :   EXEC_ASYNC OFFLINE             :   Run this offline.cfg again     :"
  58. echoln "    :---------------------------------------------------------------------:"
  59. echoln "    :   BB                             :   start local with bots          :"
  60. echoln "    :   GG                             :   start local with player(s)     :"
  61. echoln "    :   DD                             :   stop local or disconnect       :"
  62. echoln "    :   AA                             :   toggle ui animations / models  :"
  63. echoln "     --------------------------------------------------------------------- "
  64. echoln "  - use a single net adaptor connected to a router or phone hotspot without internet "
  65. echoln "  - disable os firewall; set connection type to work/home - all pc's should reply to ping "
  66. echoln "  - start Steam in offline mode before launching the game or use dota_offline.bat script "
  67. echoln "  - player that started the server should not pick a team until all others have done it "
  68. echoln "  - all players should wait until everybody is in the pick screen to select a hero "
  69. log_color General 00000000 | grep %; echoln " "; echoln " "
  70. top_bar_message 0
  71. '@
  72.  
  73. $video = @{
  74.   "setting.defaultres" = "0"
  75.   "setting.defaultresheight" = "0"
  76.   "setting.refreshrate_numerator" = "0"
  77.   "setting.refreshrate_denominator" = "0"
  78.  
  79.   "setting.fullscreen" = "0"
  80.   "setting.coop_fullscreen" = "1"
  81.   "setting.nowindowborder" = "0"
  82.  
  83.   #"setting.mat_vsync" = "0"
  84.   "setting.fullscreen_min_on_focus_loss" = "0"
  85.   #"setting.high_dpi" = "0"
  86.   #"setting.cl_particle_fallback_base" = "2"
  87.   #"setting.cl_particle_fallback_multiplier" = "4.000000"
  88.   #"setting.dota_cheap_water" = "true"
  89.   #"setting.r_deferred_height_fog" = "false"
  90.   #"setting.r_deferred_simple_light" = "1"
  91.   #"setting.r_ssao" = "false"
  92.   #"setting.cl_globallight_shadow_mode" = "1"
  93.   #"setting.r_dota_fxaa" = "false"
  94.   #"setting.r_deferred_additive_pass" = "false"
  95.   #"setting.dota_portrait_animate" = "false"
  96.   #"setting.r_deferred_specular_bloom" = "false"
  97.   #"setting.r_deferred_specular" = "false"
  98.   #"setting.dota_ambient_creatures" = "false"
  99.   #"setting.dota_ambient_cloth" = "true"
  100.   #"setting.r_texture_stream_mip_bias" = "0"
  101.   #"setting.r_dota_normal_maps" = "true"
  102.   #"setting.r_dashboard_render_quality" = "false"
  103.   "setting.shaderquality" = "0"
  104.   #"setting.r_grass_quality" = "0"
  105.   #"setting.r_dota_allow_wind_on_trees" = "false"
  106.   #"setting.r_dota_allow_parallax_mapping" = "false"
  107.   #"setting.r_dota_bloom_compute_shader" = "1"
  108.   #"setting.r_depth_of_field" = "0"
  109.   #"setting.mat_viewportscale" = "0.810000"
  110.   #"setting.r_fullscreen_gamma" = "2.200000"
  111.   #"setting.r_dota_fsr_upsample" = "0"
  112.   "setting.r_low_latency" = "2"
  113.   "setting.useadvanced" = "1"
  114.   "setting.aspectratiomode" = "0"
  115. }
  116.  
  117. <# -------------------------------------------------------------------------------------------------------------------------------
  118. :start batch script section
  119. title %~n0 & color 0b
  120.  
  121. set "APPID=570"
  122. set "PROGR=dota 2 beta\game\bin\win64\dota2.exe"
  123. set "FILES=dota 2 beta\game\dota"
  124. set "UCVAR=user_convars_0_slot0.vcfg"
  125. set "MCVAR=machine_convars.vcfg"
  126. set "VCVAR=video.txt"
  127. :: detect STEAM path
  128. for /f "tokens=2*" %%R in ('reg query HKCU\SOFTWARE\Valve\Steam /v SteamPath 2^>nul') do set "steam_reg=%%S"
  129. for %%S in ("%steam_reg%") do set "STEAM=%%~fS"
  130. :: detect GAME path
  131. set STEAMAPPS=& for /f usebackq^ delims^=^"^ tokens^=4 %%s in (`findstr /c:":\\" "%STEAM%\steamapps\libraryfolders.vdf"`) do (
  132.   if exist "%%s\steamapps\appmanifest_%APPID%.acf" (if exist "%%s\steamapps\common\%PROGR%" set "lib=%%s"))
  133. if defined lib (set "STEAMAPPS=%lib:\\=\%\steamapps") else echo; ERROR! steamapps folder not found & pause & exit /b
  134. set "ACF=%STEAMAPPS%\appmanifest_%APPID%.acf" & set "FILES=%STEAMAPPS%\common\%FILES%" & set "PROGR=%STEAMAPPS%\common\%PROGR%"
  135. :: detect CLOUD path
  136. for /f "tokens=* delims=" %%v in ('dir /b /a:d /o:-n "%STEAM%\userdata"') do set "CLOUD=%STEAM%\userdata\%%v"
  137.  
  138. echo; steam = %STEAM%
  139. echo; progr = %PROGR%
  140. echo; files = %FILES%
  141. echo; cloud = %CLOUD%
  142. echo;
  143. echo; preparing offline settings...
  144.  
  145. set 1=%*& set "0=%~f0" & powershell -nop -c iex ([io.file]::ReadAllText($env:0)) & exit /b
  146. :end batch script section
  147. ------------------------------------------------------------------------------------------------------------------------------- #>
  148.  
  149. $env:CD = split-path $env:0
  150. $env:USRLOCAL='E:\Steam\userdata\23719382\570\local'
  151. [environment]::SetEnvironmentVariable('USRLOCAL','E:\Steam\userdata\23719382\570\local',0)
  152.  
  153. #:: current res
  154. $vc = Get-WmiObject -class "Win32_VideoController"
  155. $auto_w = $vc.CurrentHorizontalResolution; $auto_h = $vc.CurrentVerticalResolution; $auto_r = $vc.CurrentRefreshRate; $force = !1
  156. " native = $auto_w x $auto_h @${auto_r}Hz "
  157.  
  158. #:: force res if set in the script or via game launch options
  159. if ($force_w -eq 0 -and $force_h -eq 0) {
  160.   $lo = (gc "$env:CLOUD\config\localconfig.vdf") -join "`n"
  161.   $lo = (($lo -split '\n\s{5}"' + $env:APPID + '"\n\s{5}{\n')[1] -split '\n\s{5}}\n')[0]
  162.   $lo = (($lo -split '\n\s{6}"LaunchOptions"\s+"')[1] -split '"\n')[0]
  163.   $lw = $lo -match '-w(idth)?\s+(\d+)';  if ($lw) { $_w = $matches[2] }
  164.   $lh = $lo -match '-h(eight)?\s+(\d+)'; if ($lh) { $_h = $matches[2] }
  165.   if ($_w -gt 0 -and $_h -gt 0) { $force_w = $_w; $force_h = $_h }
  166. }
  167. if ($force_w -gt 0 -and $force_h -gt 0) { $video.defaultres = $force_w; $video.defaultresheight = $force_h; $force = !0 }
  168.  
  169. #:: prepare video mode options
  170. $coop = "-force_allow_coop_fullscreen -coop_fullscreen -width $auto_w -height $auto_h"
  171. $excl = "-force_allow_excl_fullscreen -fullscreen -width $force_w -height $force_h"
  172. $mode = @($coop,$excl)[$force]
  173. " change = $mode`n"
  174.  
  175. #:: prepare quick steam options / offline options
  176. $quick = '-quicklogin -skipinitialbootstrap -skipstreamingdrivers -vrdisable -nofriendsui -oldtraymenu -cef-disable-gpu -silent'
  177. $launch_options  = "$QUICK -applaunch $env:APPID -novid $mode +exec_async cloud"
  178. $offline_options = "-insecure -hushsteam -steamnetworkingsockets_use_steamclient -console -novid $mode +exec_async cloud"
  179.  
  180. #:: update video settings txt file
  181. $VIDEO_TXT = "$env:CLOUD\$env:APPID\local\cfg\$env:VCVAR"
  182. (gc $VIDEO_TXT) |foreach { foreach ($k in $video.Keys) { if ($_ -like "*$k`"*") {
  183.   $_ = $_ -replace "(`"$k`"\s+)(`"[^`"]+`")","`$1`"$($video.$k)`"" } }; $_ } | sc $VIDEO_TXT -force -ea 0
  184.  
  185. #:: export configs in steam cloud folder back to game files
  186. robocopy "$env:CLOUD\570\local/" "$env:FILES/" *.* /E /J /NFL /NDL /NP /NJS /R:1 /W:0 /SJ /SL >''
  187. robocopy "$env:CLOUD\570\remote/" "$env:FILES/" *.* /E /J /NFL /NDL /NP /NJS /R:1 /W:0 /SJ /SL >''
  188.  
  189. #:: export steam cloud folder settings to cloud.cfg in game cfg folder - then can exec cloud to restore missing settings
  190. sc "$env:FILES\cfg\cloud.cfg" "// steam cloud settings from $env:MCVAR & $env:UCVAR`r`n" -force -ea 0
  191. gc "$env:CLOUD\$env:APPID\local\cfg\$env:MCVAR" |foreach { $l = $_ -split '"'; if ($l.count -eq 5) {
  192.   ac -Path "$env:FILES\cfg\cloud.cfg" -Value $($l[1].Split('$')[0] + ' "' + $l[3] + '"') } }
  193. gc "$env:CLOUD\$env:APPID\local\cfg\$env:UCVAR" |foreach { $l = $_ -split '"'; if ($l.count -eq 5) {
  194.   ac -Path "$env:FILES\cfg\cloud.cfg" -Value $($l[1] + ' "' + $l[3] + '"') } }
  195.  
  196. #:: export offline.cfg
  197. sc "$env:FILES\cfg\offline.cfg" $offline -force
  198. ac -Path "$env:FILES\cfg\cloud.cfg" -Value "`nclear; exec_async offline`n"
  199.  
  200. #:: kill app
  201. 'dota2','cs2','steamwebhelper','steam' |foreach {kill -name $_ -force -ea 0}; sleep 3; del "$STEAM\.crash" -force -ea 0
  202.  
  203. #:: start offline
  204. start "$env:PROGR" -args "$offline_options"
  205.  
  206. #:: done
Add Comment
Please, Sign In to add comment