$Display = Get-PrimaryDisplay
$AspectRatio = [Math]::Round($Display.Bounds.Width / $Display.Bounds.Height, 6)
Write-ReplaceContentInFile -Pattern '^<ScreenXSize>(.+)</ScreenXSize>' -Substitution "<ScreenXSize>$($Display.Bounds.Width)</ScreenXSize>" -FilePath "$InstallDirectory\Engine.ini"
Write-ReplaceContentInFile -Pattern '^<ScreenYSize>(.+)</ScreenYSize>' -Substitution "<ScreenYSize>$($Display.Bounds.Height)</ScreenYSize>" -FilePath "$InstallDirectory\Engine.ini"
Write-ReplaceContentInFile -Pattern '^<AspectRatio>(.+)</AspectRatio>' -Substitution "<AspectRatio>$($AspectRatio)</AspectRatio>" -FilePath "$InstallDirectory\Engine.ini"
if ($NewPlayerAlias.Length -gt 13) {
$NewPlayerAlias = $NewPlayerAlias.Substring(0, 13);
}
$bytes = ConvertTo-StringBytes -Input $NewPlayerAlias -Utf16 1 -MaxLength 13 -MinLength 13
Edit-PatchBinary -FilePath "$InstallDirectory\Profiles\lastprofile.dat" -Offset 0x1C -Data $bytes
Copy-Item -Path "$InstallDirectory\ProfileTemplate\ABCDEFGHIJKLM.bindings" -Destination "$InstallDirectory\ProfileTemplate\$NewPlayerAlias.bindings" -Force
Copy-Item -Path "$InstallDirectory\ProfileTemplate\ABCDEFGHIJKLM.profile" -Destination "$InstallDirectory\ProfileTemplate\$NewPlayerAlias.profile" -Force