Files
dota2-assistant/install_gsi.ps1

93 lines
3.0 KiB
PowerShell

# Dota 2 Assistant - GSI Setup Script
# Run as Administrator if needed (or ensure write access to Dota 2 directory)
# Usage: .\install_gsi.ps1
param(
[string]$DotaPath = "C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta"
)
$ErrorActionPreference = "Stop"
Write-Host "=== Dota 2 Assistant - GSI Configuration Setup ===" -ForegroundColor Cyan
# Find Dota 2 installation
$gsiDir = Join-Path $DotaPath "game\dota\cfg\gamestate_integration"
if (-not (Test-Path (Join-Path $DotaPath "game\dota"))) {
# Try common Steam library paths
$possiblePaths = @(
"C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta",
"D:\Steam\steamapps\common\dota 2 beta",
"C:\Steam\steamapps\common\dota 2 beta"
)
foreach ($path in $possiblePaths) {
if (Test-Path (Join-Path $path "game\dota")) {
$DotaPath = $path
$gsiDir = Join-Path $DotaPath "game\dota\cfg\gamestate_integration"
break
}
}
}
if (-not (Test-Path (Join-Path $DotaPath "game\dota"))) {
Write-Host "ERROR: Could not find Dota 2 installation." -ForegroundColor Red
Write-Host "Please specify the path with: .\install_gsi.ps1 -DotaPath 'D:\Steam\steamapps\common\dota 2 beta'"
exit 1
}
Write-Host "Found Dota 2 at: $DotaPath" -ForegroundColor Green
# Create GSI directory
if (-not (Test-Path $gsiDir)) {
New-Item -ItemType Directory -Path $gsiDir -Force | Out-Null
Write-Host "Created directory: $gsiDir" -ForegroundColor Green
} else {
Write-Host "GSI directory already exists: $gsiDir"
}
# Copy config file
$srcCfg = Join-Path $PSScriptRoot "config\gamestate_integration_assistant.cfg"
$dstCfg = Join-Path $gsiDir "gamestate_integration_assistant.cfg"
if (Test-Path $srcCfg) {
Copy-Item $srcCfg $dstCfg -Force
Write-Host "Installed GSI config to: $dstCfg" -ForegroundColor Green
} else {
Write-Host "WARNING: Config file not found at $srcCfg" -ForegroundColor Yellow
Write-Host "Writing config directly..."
$cfgContent = @'
"dota2-assistant"
{
"uri" "http://127.0.0.1:3000"
"timeout" "5.0"
"buffer" "0.1"
"throttle" "0.5"
"heartbeat" "30.0"
"data"
{
"draft" "1"
"hero" "1"
"abilities" "1"
"items" "1"
"map" "1"
"player" "1"
"provider" "1"
}
}
'@
Set-Content -Path $dstCfg -Value $cfgContent -Encoding UTF8
Write-Host "Created GSI config at: $dstCfg" -ForegroundColor Green
}
Write-Host ""
Write-Host "=== IMPORTANT: Next Steps ===" -ForegroundColor Yellow
Write-Host "1. Add '-gamestateintegration' to Dota 2 launch options in Steam:"
Write-Host " Right-click Dota 2 -> Properties -> General -> Launch Options"
Write-Host ""
Write-Host "2. Set Dota 2 to 'Borderless Windowed' mode:"
Write-Host " Dota 2 Settings -> Video -> Display Mode -> Borderless Window"
Write-Host ""
Write-Host "3. Run dota2-assistant.exe BEFORE launching Dota 2"
Write-Host ""
Write-Host "Setup complete!" -ForegroundColor Green