Last active
April 6, 2024 14:32
-
-
Save yipo/8e8bda27cf0d39600196f5bbfa955eb1 to your computer and use it in GitHub Desktop.
SimCity 3000 Unlimited: Unlock supported resolution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = 'Stop' | |
function Get-ExecutablePath { | |
$key = 'HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\Maxis\SimCity 3000 Unlimited' | |
try { | |
$dir = Get-ItemPropertyValue -Path $key -Name 'InstalledPath' | |
} | |
catch [Management.Automation.ItemNotFoundException] { | |
Write-Error -Message 'The game is not installed.' | |
} | |
Join-Path -Path $dir -ChildPath 'SC3U.exe' -Resolve | |
} | |
function Unlock-Resolution ([string]$File) { | |
$p = ( | |
'8b-4c-24-04-8b-44-24-08-53', | |
'c2-08-00-90-8b-44-24-08-53' | |
), ( | |
'8b-4c-24-04-8b-54-24-08-81-f9', | |
'c2-08-00-90-8b-54-24-08-81-f9' | |
) | |
$data = [BitConverter]::ToString((Get-Content -Path $File -Encoding Byte -Raw)) | |
$data = $data -replace $p[0] -replace $p[1] | |
Set-Content -Path $File -Encoding Byte -Value (Convert-HexStringToBytes -String $data) | |
} | |
function Convert-HexStringToBytes ([string]$String) { | |
return $String -split '-' | ForEach-Object -Process { | |
[Convert]::ToByte($_, 16) | |
} | |
} | |
Unlock-Resolution -File (Get-ExecutablePath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
About the hack trick, please check this page.