Unreal Tournament 2004: Difference between revisions

From LANCommander
No edit summary
No edit summary
 
Line 28: Line 28:


# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^FullscreenViewportX=(.+)' -Substitution "FullscreenViewportX=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\System\ut2004.ini"
Write-ReplaceContentInFile -Pattern '^FullscreenViewportX=(.+)' -Substitution "FullscreenViewportX=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^FullscreenViewportY=(.+)' -Substitution "FullscreenViewportY=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\System\ut2004.ini"
Write-ReplaceContentInFile -Pattern '^FullscreenViewportY=(.+)' -Substitution "FullscreenViewportY=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\System\UT2004.ini"


# Might need to set FOV
# Might need to set FOV
Line 40: Line 40:
}
}


Write-ReplaceContentInFile -Pattern '^DesiredFOV=(.+)' -Substitution "DesiredFOV=$FOV" -FilePath "$InstallDirectory\System\ut2004.ini"
Write-ReplaceContentInFile -Pattern '^DesiredFOV=(.+)' -Substitution "DesiredFOV=$FOV" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^DefaultFOV=(.+)' -Substitution "DefaultFOV=$FOV" -FilePath "$InstallDirectory\System\ut2004.ini"
Write-ReplaceContentInFile -Pattern '^DefaultFOV=(.+)' -Substitution "DefaultFOV=$FOV" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^FOVAngle=(.+)' -Substitution "DefaultFOV=$FOV.0" -FilePath "$InstallDirectory\System\ut2004.ini"
Write-ReplaceContentInFile -Pattern '^FOVAngle=(.+)' -Substitution "DefaultFOV=$FOV.0" -FilePath "$InstallDirectory\System\UT2004.ini"


# Turns off Gamespy Stats & Replaces utmaster servers
# Turns off Gamespy Stats & Replaces utmaster servers
Write-ReplaceContentInFile -Pattern "UplinkToGamespy=True" -Substitution "UplinkToGamespy=False" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^UplinkToGamespy=(.+)' -Substitution "UplinkToGamespy=False" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern "ut2004master1.epicgames.com" -Substitution "utmaster.openspy.net" -FilePath "$InstallDirectory\System\UT2004.INI"
Write-ReplaceContentInFile -Pattern '^MasterServerList=(Address="ut2004master1.epicgames.com",Port=28902' -Substitution 'MasterServerList=(Address="utmaster.openspy.net",Port=28902' -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern "ut2004master2.epicgames.com" -Substitution "ut2004master.333networks.com" -FilePath "$InstallDirectory\System\UT2004.INI"
Write-ReplaceContentInFile -Pattern '^MasterServerList=(Address="ut2004master2.epicgames.com",Port=28902' -Substitution 'MasterServerList=(Address="ut2004master.333networks.com",Port=28902' -FilePath "$InstallDirectory\System\UT2004.ini"


$VirtualStore = "Registry::\HKEY_LOCAL_MACHINE\SOFTWARE"
$VirtualStore = "registry::\HKEY_LOCAL_MACHINE\SOFTWARE"


# Creates or updates a key in the registry
# Creates or updates a key in the registry
Line 66: Line 66:
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "YEAR" -Value "2004" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "YEAR" -Value "2004" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "Folder" -Value "$InstallDirectory" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "Folder" -Value "$InstallDirectory" -Force
Start-Sleep 10
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 14:05, 5 September 2024

Developers
Epic Games
Publishers
Atari, Inc.Epic GamesMacSoft Games
Release Date
Windows: March 16, 2004
Genres
Shooter
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\System/UT2004.exe True

Install Script

# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^FullscreenViewportX=(.+)' -Substitution "FullscreenViewportX=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^FullscreenViewportY=(.+)' -Substitution "FullscreenViewportY=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\System\UT2004.ini"

# Might need to set FOV
$FOV = 90

if (($Display.Bounds.Width / $Display.Bounds.Height) -eq (16 / 9)) {
    $FOV = 106
} elseif (($Display.Bounds.Width / $Display.Bounds.Height) -eq (16 / 10)) {
    $FOV = 100
}

Write-ReplaceContentInFile -Pattern '^DesiredFOV=(.+)' -Substitution "DesiredFOV=$FOV" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^DefaultFOV=(.+)' -Substitution "DefaultFOV=$FOV" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^FOVAngle=(.+)' -Substitution "DefaultFOV=$FOV.0" -FilePath "$InstallDirectory\System\UT2004.ini"

# Turns off Gamespy Stats & Replaces utmaster servers
Write-ReplaceContentInFile -Pattern '^UplinkToGamespy=(.+)' -Substitution "UplinkToGamespy=False" -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^MasterServerList=(Address="ut2004master1.epicgames.com",Port=28902' -Substitution 'MasterServerList=(Address="utmaster.openspy.net",Port=28902' -FilePath "$InstallDirectory\System\UT2004.ini"
Write-ReplaceContentInFile -Pattern '^MasterServerList=(Address="ut2004master2.epicgames.com",Port=28902' -Substitution 'MasterServerList=(Address="ut2004master.333networks.com",Port=28902' -FilePath "$InstallDirectory\System\UT2004.ini"

$VirtualStore = "registry::\HKEY_LOCAL_MACHINE\SOFTWARE"

# Creates or updates a key in the registry
# Non-destructively creates path in registry
New-Item -Path "$VirtualStore\WOW6432Node\Unreal Technology"
New-Item -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps"

New-Item -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "Version" -Value "1" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "CDKey" -Value "3QHVC-DHA9K-A84RE-KYRT4" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "ADMIN_RIGHTS" -Value "You need to run this program as an administrator, not as a guest or limited user account." -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "NO_DISC" -Value "No disc in drive.  Please insert the disc labeled 'Unreal Tournament 2004 Play Disc' to continue." -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "NO_DRIVE" -Value "No CD-ROM or DVD-ROM drive detected." -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "TITLEBAR" -Value "Unreal Tournament 2004" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "WRONG_DISC" -Value "Wrong disc in drive.  Please insert the disc labeled 'Unreal Tournament 2004 Play Disc' to continue." -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "YEAR" -Value "2004" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Name "Folder" -Value "$InstallDirectory" -Force

Start-Sleep 10

Uninstall Script

$VirtualStore = "Registry::\HKEY_LOCAL_MACHINE\SOFTWARE"

Remove-Item -Path "$VirtualStore\WOW6432Node\Unreal Technology\Installed Apps\UT2004" -Force -Recurse

Key Change Script

$VirtualStore = "Registry::\HKEY_LOCAL_MACHINE\SOFTWARE"

New-ItemProperty -Path "$VirtualStore\Wow6432Node\Unreal Technology\Installed Apps\UT2004" -Name "CDKey" -Value "$AllocatedKey" -Force

Name Change Script

Write-ReplaceContentInFile -Pattern 'Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\System\User.ini"