$NewName = $args[0]
$InstallDir = $PSScriptRoot
Add-Type -AssemblyName System.Windows.Forms
$Display = [System.Windows.Forms.Screen]::AllScreens | Where-Object Primary | Select Bounds
$X = $Display.Width
$Y = $Display.Height
$AspectRatio = $X / $Y
$Fov = 90 # 16:10 by default
if ($AspectRatio -eq $(16 / 9)) {
$Fov = 97
}
$Config = @"
seta r_customwidth $X
seta r_customheight $Y
seta cg_fov 97
seta r_mode -1
seta s_kHz "44"
"@
Set-Content "$InstallDir\GameData\base\autoexec.cfg" $Config
$NewName = $args[0]
$InstallDir = $PSScriptRoot
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
$content = (Get-Content $FilePath) -replace $Regex, $Replacement
[IO.File]::WriteAllLines($FilePath, $content)
}
Write-ReplaceContentInFile -Regex '^seta name (.+)' -Replacement "seta name ""$NewName""" -FilePath "$InstallDir\GameData\base\jampconfig.cfg"