Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @(echo off% <#%) & goto :start DOTA2 offline
- config for local play with bots when not having any internet connection available
- #>)["AveYo, 2024.02.20"]
- #:: To force lower res than native in exclusive mode, edit the 0 below - or add launch options like: -w 1360 -h 768
- $force_w = 0
- $force_h = 0
- $offline = @'
- log_flags GCClient SteamNetSockets +donotecho | grep %
- dota_bot_set_difficulty 3
- dota_local_bot_match_difficulty 3
- dota_local_bot_match_script_index 0
- dota_force_gamemode 11
- map_enable_background_maps 0
- host_limitlocal 1 //: apply cl_cmdrate etc. rules RIP
- net_usesocketsforloopback 1 //: RIP
- net_p2p_api_game 2 //: 0=old sessions, 1=new session, 2=new socket RIP
- net_p2p_api_client_to_client 1 //: 0=old 1=new RIP
- net_option IpAllowWithoutAuth 1 //: tx Gaben!
- net_option IPLocalHost_AllowWithoutAuth 1
- net_option TimeoutSecondsConnected 20
- net_option TimeoutSecondsInitial 20
- net_force_steamdatagram 0
- net_p2p_listen_dedicated 1 //: 0=old 1=new 1
- dota_start_ai_game 0
- dota_bot_disable 0
- dota_bot_match_solo 1
- dota_heropicker_ap_select_time 999 // :D
- dota_surrender_on_disconnect 0
- dota_quit_after_game 0
- dota_quit_on_hibernate_after_lobby 0
- sv_hibernate_when_empty 0
- sv_lan 1
- top_bar_message "OFFLINE" 1; sleep 12000; showconsole
- alias BB "hideconsole; dota_start_ai_game 1; map dota loopback=1; status"
- alias GG "hideconsole; dota_start_ai_game 0; map dota loopback=1; status"
- alias DD "hideconsole; dota_start_ai_game 0; disconnect"
- alias aa0 "map_enable_background_maps 0;alias AA aa1;echoln [Animations]=0 Enter AA to switch..";
- alias aa1 "map_enable_background_maps 1;alias AA aa0;echoln [Animations]=1 Enter AA to switch.."; alias AA aa1
- log_color General 00FF00FF | grep %; echoln " "; echoln " "; echoln " "; echoln " "
- echoln " Dota 2 offline play helper by AveYo "
- echoln " --------------------------------------------------------------------- "
- echoln " : Console command : Description :"
- echoln " :---------------------------------------------------------------------:"
- echoln " : MAP DOTA LOOPBACK=1 : Start LOCAL (loopback) :"
- echoln " : MAP DOTA : Start LAN server :"
- echoln " : CONNECT 192.168.xxx.xxx : Join LAN server from other PC :"
- echoln " : DISCONNECT : Leave LAN server :"
- echoln " : CHANGELEVEL DOTA : Quick LAN server reload :"
- echoln " : STATUS : Print LAN ip:port for connect :"
- echoln " : dota_bot_populate : Add bots for missing slots :"
- echoln " : EXEC_ASYNC OFFLINE : Run this offline.cfg again :"
- echoln " :---------------------------------------------------------------------:"
- echoln " : BB : start local with bots :"
- echoln " : GG : start local with player(s) :"
- echoln " : DD : stop local or disconnect :"
- echoln " : AA : toggle ui animations / models :"
- echoln " --------------------------------------------------------------------- "
- echoln " - use a single net adaptor connected to a router or phone hotspot without internet "
- echoln " - disable os firewall; set connection type to work/home - all pc's should reply to ping "
- echoln " - start Steam in offline mode before launching the game or use dota_offline.bat script "
- echoln " - player that started the server should not pick a team until all others have done it "
- echoln " - all players should wait until everybody is in the pick screen to select a hero "
- log_color General 00000000 | grep %; echoln " "; echoln " "
- top_bar_message 0
- '@
- $video = @{
- "setting.defaultres" = "0"
- "setting.defaultresheight" = "0"
- "setting.refreshrate_numerator" = "0"
- "setting.refreshrate_denominator" = "0"
- "setting.fullscreen" = "0"
- "setting.coop_fullscreen" = "1"
- "setting.nowindowborder" = "0"
- #"setting.mat_vsync" = "0"
- "setting.fullscreen_min_on_focus_loss" = "0"
- #"setting.high_dpi" = "0"
- #"setting.cl_particle_fallback_base" = "2"
- #"setting.cl_particle_fallback_multiplier" = "4.000000"
- #"setting.dota_cheap_water" = "true"
- #"setting.r_deferred_height_fog" = "false"
- #"setting.r_deferred_simple_light" = "1"
- #"setting.r_ssao" = "false"
- #"setting.cl_globallight_shadow_mode" = "1"
- #"setting.r_dota_fxaa" = "false"
- #"setting.r_deferred_additive_pass" = "false"
- #"setting.dota_portrait_animate" = "false"
- #"setting.r_deferred_specular_bloom" = "false"
- #"setting.r_deferred_specular" = "false"
- #"setting.dota_ambient_creatures" = "false"
- #"setting.dota_ambient_cloth" = "true"
- #"setting.r_texture_stream_mip_bias" = "0"
- #"setting.r_dota_normal_maps" = "true"
- #"setting.r_dashboard_render_quality" = "false"
- "setting.shaderquality" = "0"
- #"setting.r_grass_quality" = "0"
- #"setting.r_dota_allow_wind_on_trees" = "false"
- #"setting.r_dota_allow_parallax_mapping" = "false"
- #"setting.r_dota_bloom_compute_shader" = "1"
- #"setting.r_depth_of_field" = "0"
- #"setting.mat_viewportscale" = "0.810000"
- #"setting.r_fullscreen_gamma" = "2.200000"
- #"setting.r_dota_fsr_upsample" = "0"
- "setting.r_low_latency" = "2"
- "setting.useadvanced" = "1"
- "setting.aspectratiomode" = "0"
- }
- <# -------------------------------------------------------------------------------------------------------------------------------
- :start batch script section
- title %~n0 & color 0b
- set "APPID=570"
- set "PROGR=dota 2 beta\game\bin\win64\dota2.exe"
- set "FILES=dota 2 beta\game\dota"
- set "UCVAR=user_convars_0_slot0.vcfg"
- set "MCVAR=machine_convars.vcfg"
- set "VCVAR=video.txt"
- :: detect STEAM path
- for /f "tokens=2*" %%R in ('reg query HKCU\SOFTWARE\Valve\Steam /v SteamPath 2^>nul') do set "steam_reg=%%S"
- for %%S in ("%steam_reg%") do set "STEAM=%%~fS"
- :: detect GAME path
- set STEAMAPPS=& for /f usebackq^ delims^=^"^ tokens^=4 %%s in (`findstr /c:":\\" "%STEAM%\steamapps\libraryfolders.vdf"`) do (
- if exist "%%s\steamapps\appmanifest_%APPID%.acf" (if exist "%%s\steamapps\common\%PROGR%" set "lib=%%s"))
- if defined lib (set "STEAMAPPS=%lib:\\=\%\steamapps") else echo; ERROR! steamapps folder not found & pause & exit /b
- set "ACF=%STEAMAPPS%\appmanifest_%APPID%.acf" & set "FILES=%STEAMAPPS%\common\%FILES%" & set "PROGR=%STEAMAPPS%\common\%PROGR%"
- :: detect CLOUD path
- for /f "tokens=* delims=" %%v in ('dir /b /a:d /o:-n "%STEAM%\userdata"') do set "CLOUD=%STEAM%\userdata\%%v"
- echo; steam = %STEAM%
- echo; progr = %PROGR%
- echo; files = %FILES%
- echo; cloud = %CLOUD%
- echo;
- echo; preparing offline settings...
- set 1=%*& set "0=%~f0" & powershell -nop -c iex ([io.file]::ReadAllText($env:0)) & exit /b
- :end batch script section
- ------------------------------------------------------------------------------------------------------------------------------- #>
- $env:CD = split-path $env:0
- $env:USRLOCAL='E:\Steam\userdata\23719382\570\local'
- [environment]::SetEnvironmentVariable('USRLOCAL','E:\Steam\userdata\23719382\570\local',0)
- #:: current res
- $vc = Get-WmiObject -class "Win32_VideoController"
- $auto_w = $vc.CurrentHorizontalResolution; $auto_h = $vc.CurrentVerticalResolution; $auto_r = $vc.CurrentRefreshRate; $force = !1
- " native = $auto_w x $auto_h @${auto_r}Hz "
- #:: force res if set in the script or via game launch options
- if ($force_w -eq 0 -and $force_h -eq 0) {
- $lo = (gc "$env:CLOUD\config\localconfig.vdf") -join "`n"
- $lo = (($lo -split '\n\s{5}"' + $env:APPID + '"\n\s{5}{\n')[1] -split '\n\s{5}}\n')[0]
- $lo = (($lo -split '\n\s{6}"LaunchOptions"\s+"')[1] -split '"\n')[0]
- $lw = $lo -match '-w(idth)?\s+(\d+)'; if ($lw) { $_w = $matches[2] }
- $lh = $lo -match '-h(eight)?\s+(\d+)'; if ($lh) { $_h = $matches[2] }
- if ($_w -gt 0 -and $_h -gt 0) { $force_w = $_w; $force_h = $_h }
- }
- if ($force_w -gt 0 -and $force_h -gt 0) { $video.defaultres = $force_w; $video.defaultresheight = $force_h; $force = !0 }
- #:: prepare video mode options
- $coop = "-force_allow_coop_fullscreen -coop_fullscreen -width $auto_w -height $auto_h"
- $excl = "-force_allow_excl_fullscreen -fullscreen -width $force_w -height $force_h"
- $mode = @($coop,$excl)[$force]
- " change = $mode`n"
- #:: prepare quick steam options / offline options
- $quick = '-quicklogin -skipinitialbootstrap -skipstreamingdrivers -vrdisable -nofriendsui -oldtraymenu -cef-disable-gpu -silent'
- $launch_options = "$QUICK -applaunch $env:APPID -novid $mode +exec_async cloud"
- $offline_options = "-insecure -hushsteam -steamnetworkingsockets_use_steamclient -console -novid $mode +exec_async cloud"
- #:: update video settings txt file
- $VIDEO_TXT = "$env:CLOUD\$env:APPID\local\cfg\$env:VCVAR"
- (gc $VIDEO_TXT) |foreach { foreach ($k in $video.Keys) { if ($_ -like "*$k`"*") {
- $_ = $_ -replace "(`"$k`"\s+)(`"[^`"]+`")","`$1`"$($video.$k)`"" } }; $_ } | sc $VIDEO_TXT -force -ea 0
- #:: export configs in steam cloud folder back to game files
- robocopy "$env:CLOUD\570\local/" "$env:FILES/" *.* /E /J /NFL /NDL /NP /NJS /R:1 /W:0 /SJ /SL >''
- robocopy "$env:CLOUD\570\remote/" "$env:FILES/" *.* /E /J /NFL /NDL /NP /NJS /R:1 /W:0 /SJ /SL >''
- #:: export steam cloud folder settings to cloud.cfg in game cfg folder - then can exec cloud to restore missing settings
- sc "$env:FILES\cfg\cloud.cfg" "// steam cloud settings from $env:MCVAR & $env:UCVAR`r`n" -force -ea 0
- gc "$env:CLOUD\$env:APPID\local\cfg\$env:MCVAR" |foreach { $l = $_ -split '"'; if ($l.count -eq 5) {
- ac -Path "$env:FILES\cfg\cloud.cfg" -Value $($l[1].Split('$')[0] + ' "' + $l[3] + '"') } }
- gc "$env:CLOUD\$env:APPID\local\cfg\$env:UCVAR" |foreach { $l = $_ -split '"'; if ($l.count -eq 5) {
- ac -Path "$env:FILES\cfg\cloud.cfg" -Value $($l[1] + ' "' + $l[3] + '"') } }
- #:: export offline.cfg
- sc "$env:FILES\cfg\offline.cfg" $offline -force
- ac -Path "$env:FILES\cfg\cloud.cfg" -Value "`nclear; exec_async offline`n"
- #:: kill app
- 'dota2','cs2','steamwebhelper','steam' |foreach {kill -name $_ -force -ea 0}; sleep 3; del "$STEAM\.crash" -force -ea 0
- #:: start offline
- start "$env:PROGR" -args "$offline_options"
- #:: done
Add Comment
Please, Sign In to add comment