Tony Hawk's Pro Skater 2

From LANCommander
Revision as of 01:35, 1 August 2023 by DoctorDalek (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Westlake Interactive

Neversoft Entertainment

Publishers
Activision Aspyr Media
Release Date
Windows: September 20, 2000
Genres
Sport
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play THawk2.exe True
Setup THPS2Setup.exe False

Name Change Script

$NewName = $args[0]
$InstallDir = $PSScriptRoot

function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}

Write-ReplaceContentInFile -Regex '^NAME=(.+)' -Replacement "NAME=$NewName" -FilePath "$InstallDir\TH2_OPT.CFG"

Install Script

$InstallDir = $PSScriptRoot
Add-Type -AssemblyName System.Windows.Forms
$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"