# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "CD Path" -Value "." -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Display" -Value "dgVoodoo DirectX Wrapper" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Display Height" -Value $Display.Bounds.Width -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Display Width" -Value $Display.Bounds.Height -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "FullScreen" -Value 1 -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Install Path" -Value $InstallDirectory -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Source Dir" -Value $InstallDirectory -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Source Path" -Value $InstallDirectory -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "InstallType" -Value 9 -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Display Height" -Value $Display.Bounds.Height -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Display Width" -Value $Display.Bounds.Width -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Display" -Value "dgVoodoo DirectX Wrapper" -Force
Write-ReplaceContentInFile -Pattern '^Resolution(.+)' -Substitution "Resolution = desktop" -FilePath "$InstallDirectory\dgVoodoo.conf"
Remove-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer" -Recurse
# Trim a string down to a specified amount of characters
if ($NewPlayerAlias.Length -gt 16) {
$NewPlayerAlias = $NewPlayerAlias.Substring(0, 16);
}
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0"
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "FullScreen" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Fix Flicker" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "DevMode" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "UseFett" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Last Game" -Value "$NewPlayerAlias's Game" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\LucasArts Entertainment Company LLC\Star Wars: Episode I Racer\v1.0" -Name "Last Player" -Value "$NewPlayerAlias" -Force