Age of Mythology: Difference between revisions

From LANCommander
(Created new page for Age of Mythology)
 
No edit summary
 
Line 5: Line 5:
{{Game.InfoBox.Developer|Ensemble Studios}}
{{Game.InfoBox.Developer|Ensemble Studios}}
|Publishers =
|Publishers =
{{Game.InfoBox.Developer|MacSoft Games}}{{Game.InfoBox.Developer|Microsoft Game Studios}}
{{Game.InfoBox.Publisher|MacSoft Games}}{{Game.InfoBox.Publisher|Microsoft Game Studios}}
|Release Date =
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|October 30, 2002}}
{{Game.InfoBox.ReleaseDate|Windows|October 30, 2002}}
Line 24: Line 24:
|Contents =
|Contents =
<syntaxhighlight lang="powershell" line>
<syntaxhighlight lang="powershell" line>
$DocumentsPath = [Environment]::GetFolderPath("MyDocuments")
$Documents = [Environment]::GetFolderPath("MyDocuments")
Copy-Item -Path "$InstallDirectory\Age of Mythology" -Destination "$DocumentsPath\My Games\Age of Mythology" -Recurse
Copy-Item -Path "$InstallDirectory\ProfileTemplate" -Destination "$Documents\My Games\Age of Mythology" -Recurse


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


# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^xres=(.+)' -Substitution "xres=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\startup\user.cfg"
Write-ReplaceContentInFile -Pattern '^xres=(.+)' -Substitution "xres=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\startup\user.cfg"
Write-ReplaceContentInFile -Pattern '^yres=(.+)' -Substitution "yres=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\startup\user.cfg"
Write-ReplaceContentInFile -Pattern '^yres=(.+)' -Substitution "yres=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\startup\user.cfg"
Write-ReplaceContentInFile -Pattern '^xres (.+)' -Substitution "xres $($Display.Bounds.Width)" -FilePath "$Documents\My Games\Age of Mythology\startup\persistent.cfg"
Write-ReplaceContentInFile -Pattern '^yres (.+)' -Substitution "yres $($Display.Bounds.Height)" -FilePath "$Documents\My Games\Age of Mythology\startup\persistent.cfg"
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack" -Force
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack\1.0" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack\1.0" -Name "FIRSTRUN" -Value 1 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack\1.0" -Name "SystemInitialization" -Value "1" -Force
</syntaxhighlight>
</syntaxhighlight>
}}
}}
Line 45: Line 50:


Remove-Item -Path "$DocumentsPath\My Games\Age of Mythology" -Force -Recurse
Remove-Item -Path "$DocumentsPath\My Games\Age of Mythology" -Force -Recurse
Remove-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack" -Force -Recurse
</syntaxhighlight>
</syntaxhighlight>
}}
}}
Line 58: Line 64:
$Guid = [Guid]::NewGuid().ToString().ToUpper()
$Guid = [Guid]::NewGuid().ToString().ToUpper()


$DocumentsPath = [Environment]::GetFolderPath("MyDocuments")
$Documents = [Environment]::GetFolderPath("MyDocuments")


Copy-Item -Path "$InstallDirectory\Age of Mythology\Users\Default.prf" -Destination "$DocumentsPath\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Copy-Item -Path "$InstallDirectory\ProfileTemplate\Users\Default.prf" -Destination "$Documents\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"


# 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 '<profilename>(.*)</profilename>' -Substitution "<profilename>$NewPlayerAlias</profilename>" -FilePath "$DocumentsPath\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profilename>(.*)</profilename>' -Substitution "<profilename>$NewPlayerAlias</profilename>" -FilePath "$Documents\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profilelanname>(.*)</profilelanname>' -Substitution "<profilelanname>$NewPlayerAlias</profilelanname>" -FilePath "$DocumentsPath\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profilelanname>(.*)</profilelanname>' -Substitution "<profilelanname>$NewPlayerAlias</profilelanname>" -FilePath "$Documents\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profileguid>(.*)</profileguid>' -Substitution "<profileguid>{$Guid}</profileguid>" -FilePath "$DocumentsPath\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profileguid>(.*)</profileguid>' -Substitution "<profileguid>{$Guid}</profileguid>" -FilePath "$Documents\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '^playerProfileName "(.+)"' -Substitution "playerProfileName ""$NewPlayerAlias""" -FilePath "$DocumentsPath\My Games\Age of Mythology\startup\persistent.cfg"
Write-ReplaceContentInFile -Pattern '^playerProfileName "(.+)"' -Substitution "playerProfileName ""$NewPlayerAlias""" -FilePath "$Documents\My Games\Age of Mythology\startup\persistent.cfg"
Write-ReplaceContentInFile -Pattern '^playerGUID "(.+)"' -Substitution "playerGUID ""{$Guid}""" -FilePath "$DocumentsPath\My Games\Age of Mythology\startup\persistent.cfg"
Write-ReplaceContentInFile -Pattern '^playerGUID "(.+)"' -Substitution "playerGUID ""{$Guid}""" -FilePath "$Documents\My Games\Age of Mythology\startup\persistent.cfg"


$NewPlayerAlias | Out-File -FilePath "$DocumentsPath\My Games\Age of Mythology\Users\LastProfile.txt"
$NewPlayerAlias | Out-File -FilePath "$Documents\My Games\Age of Mythology\Users\LastProfile.txt"
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 00:37, 22 February 2024

Developers
Ensemble Studios
Publishers
MacSoft GamesMicrosoft Game Studios
Release Date
Windows: October 30, 2002
Genres
Real Time Strategy (RTS)Strategy
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\aomx.exe True

Install Script

$Documents = [Environment]::GetFolderPath("MyDocuments")
Copy-Item -Path "$InstallDirectory\ProfileTemplate" -Destination "$Documents\My Games\Age of Mythology" -Recurse

$Display = Get-PrimaryDisplay

Write-ReplaceContentInFile -Pattern '^xres=(.+)' -Substitution "xres=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\startup\user.cfg"
Write-ReplaceContentInFile -Pattern '^yres=(.+)' -Substitution "yres=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\startup\user.cfg"
Write-ReplaceContentInFile -Pattern '^xres (.+)' -Substitution "xres $($Display.Bounds.Width)" -FilePath "$Documents\My Games\Age of Mythology\startup\persistent.cfg"
Write-ReplaceContentInFile -Pattern '^yres (.+)' -Substitution "yres $($Display.Bounds.Height)" -FilePath "$Documents\My Games\Age of Mythology\startup\persistent.cfg"

New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack" -Force
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack\1.0" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack\1.0" -Name "FIRSTRUN" -Value 1 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack\1.0" -Name "SystemInitialization" -Value "1" -Force

Uninstall Script

$DocumentsPath = [Environment]::GetFolderPath("MyDocuments")

Remove-Item -Path "$DocumentsPath\My Games\Age of Mythology" -Force -Recurse
Remove-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Mythology Expansion Pack" -Force -Recurse

Name Change Script

# Sanitize name as it will be used in a file name
$NewPlayerAlias = $NewPlayerAlias.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
$Guid = [Guid]::NewGuid().ToString().ToUpper()

$Documents = [Environment]::GetFolderPath("MyDocuments")

Copy-Item -Path "$InstallDirectory\ProfileTemplate\Users\Default.prf" -Destination "$Documents\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '<profilename>(.*)</profilename>' -Substitution "<profilename>$NewPlayerAlias</profilename>" -FilePath "$Documents\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profilelanname>(.*)</profilelanname>' -Substitution "<profilelanname>$NewPlayerAlias</profilelanname>" -FilePath "$Documents\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profileguid>(.*)</profileguid>' -Substitution "<profileguid>{$Guid}</profileguid>" -FilePath "$Documents\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '^playerProfileName "(.+)"' -Substitution "playerProfileName ""$NewPlayerAlias""" -FilePath "$Documents\My Games\Age of Mythology\startup\persistent.cfg"
Write-ReplaceContentInFile -Pattern '^playerGUID "(.+)"' -Substitution "playerGUID ""{$Guid}""" -FilePath "$Documents\My Games\Age of Mythology\startup\persistent.cfg"

$NewPlayerAlias | Out-File -FilePath "$Documents\My Games\Age of Mythology\Users\LastProfile.txt"