$Display = Get-PrimaryDisplay
Write-ReplaceContentInFile -Pattern '^seta r_customwidth "(.+)"' -Substitution "seta r_customwidth ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\main\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customheight "(.+)"' -Substitution "seta r_customheight ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\main\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_mode "(.+)"' -Substitution "seta r_mode ""-1""" -FilePath "$InstallDirectory\main\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customwidth "(.+)"' -Substitution "seta r_customwidth ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\mainta\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customheight "(.+)"' -Substitution "seta r_customheight ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\mainta\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_mode "(.+)"' -Substitution "seta r_mode ""-1""" -FilePath "$InstallDirectory\mainta\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customwidth "(.+)"' -Substitution "seta r_customwidth ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\maintt\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customheight "(.+)"' -Substitution "seta r_customheight ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\maintt\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_mode "(.+)"' -Substitution "seta r_mode ""-1""" -FilePath "$InstallDirectory\maintt\configs\unnamedsoldier.cfg"
# Determine the correct FOV
$FOV = 0xA0
if (($Display.Bounds.Width / $Display.Bounds.Height) -eq (16 / 9)) {
$FOV = 0xBE
} elseif (($Display.Bounds.Width / $Display.Bounds.Height) -eq (16 / 10)) {
$FOV = 0xB4
} elseif (($Display.Bounds.Width / $Display.Bounds.Height) -eq (21 / 9)) {
$FOV = 0xF0
} elseif (($Display.Bounds.Width / $Display.Bounds.Height) -eq (32 / 9)) {
$FOV = 0xF0
}
# Patch gamex86.dll to use correct FOV
Edit-PatchBinary -FilePath "$InstallDirectory\main\gamex86.dll" -Offset 0xA10A6 -Data ([byte[]]@( $FOV ))
Edit-PatchBinary -FilePath "$InstallDirectory\mainta\gamex86.dll" -Offset 0xE7836 -Data ([byte[]]@( $FOV ))
Edit-PatchBinary -FilePath "$InstallDirectory\maintt\gamex86.dll" -Offset 0xEEB06 -Data ([byte[]]@( $FOV ))
Write-ReplaceContentInFile -Pattern 'seta name (.+)' -Substitution "seta name ""$NewPlayerAlias""" -FilePath "$InstallDirectory\main\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern 'seta name (.+)' -Substitution "seta name ""$NewPlayerAlias""" -FilePath "$InstallDirectory\mainta\configs\unnamedsoldier.cfg"
Write-ReplaceContentInFile -Pattern 'seta name (.+)' -Substitution "seta name ""$NewPlayerAlias""" -FilePath "$InstallDirectory\maintt\configs\unnamedsoldier.cfg"