$Display = Get-PrimaryDisplay
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
New-Item -Path "$VirtualStore\WOW6432Node\Westwood\Nox"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Westwood\Nox" -Name "Name" -Value "Nox" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Westwood\Nox" -Name "InstallPath" -Value "$InstallDirectory\Nox.EXE" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Westwood\Nox" -Name "SKU" -Value 9472 -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Westwood\Nox" -Name "Version" -Value 65538 -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Westwood\Nox" -Name "Serial" -Value "664633-703436-227220-5728" -Force
Rename-Item -Path "$InstallDirectory\MOVIES\INTRO.VQA" -NewName "$InstallDirectory\MOVIES\INTRO.VQA.bak"
Rename-Item -Path "$InstallDirectory\MOVIES\NOXLOGO.VQA" -NewName "$InstallDirectory\MOVIES\NOXLOGO.VQA.bak"
Rename-Item -Path "$InstallDirectory\MOVIES\WWLOGO.VQA" -NewName "$InstallDirectory\MOVIES\WWLOGO.VQA.bak"
$X = $Display.Bounds.Width
$Y = $Display.Bounds.Height
$NoxX = 1024
$NoxY = 768
if (($X / $Y) -eq (16 / 9)) {
$NoxX = 1024
$NoxY = 576
} elseif (($X / $Y) -eq (16 / 10)) {
$NoxX = 1024
$NoxY = 640
}
Write-ReplaceContentInFile -Pattern '^VideoMode = (.+)' -Substitution "VideoMode = $NoxX $NoxY 16" -FilePath "$InstallDirectory\nox.cfg"
Write-ReplaceContentInFile -Pattern '^VideoMode = (.+)' -Substitution "VideoMode = $NoxX $NoxY 16" -FilePath "$InstallDirectory\default.cfg"
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
Remove-Item -Path "$VirtualStore\WOW6432Node\Westwood\Nox" -Recurse -Force