Tony Hawk's Pro Skater 2: Difference between revisions

From LANCommander
(Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Westlake Interactive}} {{Game.InfoBox.Developer|Neversoft Entertainment}} |Publishers = {{Game.InfoBox.Publisher|Activision}} {{Game.InfoBox.Publisher|Aspyr Media}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|September 20, 2000}} |Genres = {{Game.InfoBox.Genre|Sport}} | PCGamingWiki = Tony_Hawk%27s_Pro_Skater_2 }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Pl...")
 
No edit summary
 
Line 3: Line 3:
|Cover = cover.jpg
|Cover = cover.jpg
|Developers =
|Developers =
{{Game.InfoBox.Developer|Westlake Interactive}}
{{Game.InfoBox.Developer|Westlake Interactive}}{{Game.InfoBox.Developer|Neversoft Entertainment}}
{{Game.InfoBox.Developer|Neversoft Entertainment}}
|Publishers =
|Publishers =
{{Game.InfoBox.Publisher|Activision}}
{{Game.InfoBox.Publisher|Activision}}{{Game.InfoBox.Publisher|Aspyr Media}}
{{Game.InfoBox.Publisher|Aspyr Media}}
|Release Date =
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|September 20, 2000}}
{{Game.InfoBox.ReleaseDate|Windows|September 20, 2000}}
|Genres =
|Genres =
{{Game.InfoBox.Genre|Sport}}
{{Game.InfoBox.Genre|Sport}}
| PCGamingWiki = Tony_Hawk%27s_Pro_Skater_2
|PCGamingWiki = Tony_Hawk%27s_Pro_Skater_2}}
}}


{{Game.ActionBox
{{Game.ActionBox
|Actions =  
|Actions =  
{{Game.ActionBox.Row|Name = Play|Path = THawk2.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\THawk2.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Setup|Path = THPS2Setup.exe|Arguments = |WorkingDirectory = |Primary = False}}
{{Game.ActionBox.Row|Name = Setup|Path = {InstallDir}\THPS2Setup.exe|Arguments = |WorkingDirectory = |Primary = False}}
}}
}}


{{Game.Scripts.NameChange
 
|Name = Name Change Script
{{Game.Scripts.Install
|Name = Install Script
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
$InstallDir = $PSScriptRoot
# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay


function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
# Bounds accessible via $Resolution.Height, $Resolution.Width
{
$Resolution = Convert-AspectRatio -Width $Display.Bounds.Width -Height $Display.Bounds.Height -AspectRatio (4 / 3)
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}


Write-ReplaceContentInFile -Regex '^NAME=(.+)' -Replacement "NAME=$NewName" -FilePath "$InstallDir\TH2_OPT.CFG"
Write-ReplaceContentInFile -Pattern '^DATAPATH=(.+)' -Substitution "DATAPATH=$InstallDirectory" -FilePath "$InstallDirectory\TH2_OPT.CFG"
Write-ReplaceContentInFile -Pattern '^MUSPATH=(.+)' -Substitution "MUSPATH=$InstallDirectory\Music" -FilePath "$InstallDirectory\TH2_OPT.CFG"
Write-ReplaceContentInFile -Pattern '^MOVPATH=(.+)' -Substitution "MOVPATH=$InstallDirectory\Movies" -FilePath "$InstallDirectory\TH2_OPT.CFG"
 
Write-ReplaceContentInFile -Pattern 'h:(\d+), v:(\d+)' -Substitution "h:$($Resolution.Width), v:$($Resolution.Height)" -FilePath "$InstallDirectory\dgVoodoo.conf"
</syntaxhighlight>
</syntaxhighlight>
}}
}}
 
           
{{Game.Scripts.Install
{{Game.Scripts.NameChange
|Name = Install Script
|Name = Name Change Script
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$InstallDir = $PSScriptRoot
<syntaxhighlight lang="powershell" line>
Add-Type -AssemblyName System.Windows.Forms
Write-ReplaceContentInFile -Pattern '^NAME=(.+)' -Substitution "NAME=$NewPlayerAlias" -FilePath "$InstallDirectory\TH2_OPT.CFG"
$Display = [System.Windows.Forms.Screen]::AllScreens | Where-Object Primary | Select Bounds
 
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}
 
function Get-43Resolution([int]$Width, [int]$Height) {
    $ratio = 4 / 3
 
    if (($Width -gt $Height) -or ($Width -eq $Height)) {
        return @{ Width = [math]::Round($ratio * $Height); Height = $Height }
    }
 
    if ($Width -lt $Height) {
        return @{ Width = $Width; Height = [math]::Round($Width / $ratio) }
    }
}
 
# Accessible via $Resolution.Height, $Resolution.Width
$Resolution = Get-43Resolution -Width $Display.Width -Height $Display.Height
 
Write-ReplaceContentInFile -Regex '^DATAPATH=(.+)' -Replacement "DATAPATH=$InstallDir" -FilePath "$InstallDir\TH2_OPT.CFG"
Write-ReplaceContentInFile -Regex '^MUSPATH=(.+)' -Replacement "MUSPATH=$InstallDir\Music" -FilePath "$InstallDir\TH2_OPT.CFG"
Write-ReplaceContentInFile -Regex '^MOVPATH=(.+)' -Replacement "MOVPATH=$InstallDir\Movies" -FilePath "$InstallDir\TH2_OPT.CFG"
 
Write-ReplaceContentInFile -Regex 'h:(\d+), v:(\d+)' -Replacement "h:$($Resolution.Width), v:$($Resolution.Height)" -FilePath "$InstallDir\dgVoodoo.conf"
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 21:58, 8 January 2024

Developers
Westlake InteractiveNeversoft Entertainment
Publishers
ActivisionAspyr Media
Release Date
Windows: September 20, 2000
Genres
Sport
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\THawk2.exe True
Setup {InstallDir}\THPS2Setup.exe False

Install Script

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

# Bounds accessible via $Resolution.Height, $Resolution.Width
$Resolution = Convert-AspectRatio -Width $Display.Bounds.Width -Height $Display.Bounds.Height -AspectRatio (4 / 3)

Write-ReplaceContentInFile -Pattern '^DATAPATH=(.+)' -Substitution "DATAPATH=$InstallDirectory" -FilePath "$InstallDirectory\TH2_OPT.CFG"
Write-ReplaceContentInFile -Pattern '^MUSPATH=(.+)' -Substitution "MUSPATH=$InstallDirectory\Music" -FilePath "$InstallDirectory\TH2_OPT.CFG"
Write-ReplaceContentInFile -Pattern '^MOVPATH=(.+)' -Substitution "MOVPATH=$InstallDirectory\Movies" -FilePath "$InstallDirectory\TH2_OPT.CFG"

Write-ReplaceContentInFile -Pattern 'h:(\d+), v:(\d+)' -Substitution "h:$($Resolution.Width), v:$($Resolution.Height)" -FilePath "$InstallDirectory\dgVoodoo.conf"

Name Change Script

Write-ReplaceContentInFile -Pattern '^NAME=(.+)' -Substitution "NAME=$NewPlayerAlias" -FilePath "$InstallDirectory\TH2_OPT.CFG"