Plane Crazy: Difference between revisions

From LANCommander
No edit summary
No edit summary
Line 3: Line 3:
|Cover = cover.jpg
|Cover = cover.jpg
|Developers =
|Developers =
{{Game.InfoBox.Developer|Contoso Software}}
{{Game.InfoBox.Developer|Inner Workings}}
{{Game.InfoBox.Developer|MacroSift Inc}}
|Publishers =
|Publishers =
{{Game.InfoBox.Publisher|Haxtivision}}
{{Game.InfoBox.Publisher|SegaSoft}}
|Engine =
{{Game.InfoBox.Engine|ID Tech 1}}
|Release Date =
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|November 11, 2011}}
{{Game.InfoBox.ReleaseDate|Windows|September 30, 1998}}
|Genres =
|Genres =
{{Game.InfoBox.Genre|First Person Shooter}}
{{Game.InfoBox.Genre|Racing}}
| PCGamingWiki = Tony_Hawk%27s_Pro_Skater_3
| PCGamingWiki = Plane_Crazy
}}
}}


== Install Script ==
{{Game.Scripts.Install
|Name = Install Script
|Description =
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
$InstallDir = $PSScriptRoot
$InstallDrive = Split-Path -Path $InstallDir -Qualifier


== Uninstall Script ==
$User = New-Object System.Security.Principal.NTAccount($env:UserName)
$SID = $User.Translate([System.Security.Principal.SecurityIdentifier]).value


== Name Change Script ==
$BasePath = "registry::\HKEY_USERS\$SID\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Inner Workings"
# Non-destructively creates path in registry
New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\<Path>"


== Key Change Script ==
# The OS might force your game to read/write to the user's virtual store. This will write a key to the correct SID's virtual store.
New-Item -Path $BasePath
New-Item -Path "$BasePath\Plane Crazy"
New-Item -Path "$BasePath\Plane Crazy\1.0"
 
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "bRetail" -Value 1 -Force
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "Installed" -Value 1 -Force
# The following lines are required for the CD check. sNotBovine will default to the drive letter, e.g. "C:"
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "sNotBovine" -Value $InstallDrive -Force
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "sPathDataMax" -Value "$InstallDir\data\datamax" -Force
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "sPathDataMin" -Value "$InstallDir\data\datamin" -Force
</syntaxhighlight>
}}
 
{{Game.Scripts.NameChange
|Name = Name Change Script
|Description =
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
$NewName = $args[0]
 
function Patch-Binary([byte[]]$Data, [int]$Offset, [string]$FilePath)
{
    $bytes = [System.IO.File]::ReadAllBytes($FilePath)
 
    for ($i = 0; $i -lt $Data.Length; $i++)
    {
        $bytes[$Offset + $i] = $Data[$i]
    }
 
    [System.IO.File]::WriteAllBytes($FilePath, $bytes)
}
 
# Plane Crazy stores player/plane strings in a binary .pln file in the data\DataMin\Planes directory
# The following script should change the player name in plane1.pln. THe length of the name seems to
# be arbitrary, so make sure MaxLength matches the length of the template plane1.pln file you will
# have to place at the root of the game's directory before packaging.
$bytes = Get-AsciiBytes -InputString $NewName -MaxLength 32
 
Copy-Item -Path "$InstallDir\Template.pln" -Destination "$InstallDir\data\DataMin\Planes\plane1.pln" -Force
 
# Writes byte[] to a file at an offset
Patch-Binary -FilePath "$InstallDir\data\DataMin\Planes\plane1.pln" -Offset 0x00 -Data $bytes
</syntaxhighlight>
}}

Revision as of 01:20, 1 August 2023

Developers
Inner Workings
Publishers
SegaSoft
Release Date
Windows: September 30, 1998
Genres
Racing
View at PCGamingWiki

Install Script

$InstallDir = $PSScriptRoot
$InstallDrive = Split-Path -Path $InstallDir -Qualifier

$User = New-Object System.Security.Principal.NTAccount($env:UserName)
$SID = $User.Translate([System.Security.Principal.SecurityIdentifier]).value

$BasePath = "registry::\HKEY_USERS\$SID\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Inner Workings"
# Non-destructively creates path in registry
New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\<Path>"

# The OS might force your game to read/write to the user's virtual store. This will write a key to the correct SID's virtual store.
New-Item -Path $BasePath
New-Item -Path "$BasePath\Plane Crazy"
New-Item -Path "$BasePath\Plane Crazy\1.0"

New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "bRetail" -Value 1 -Force
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "Installed" -Value 1 -Force
# The following lines are required for the CD check. sNotBovine will default to the drive letter, e.g. "C:"
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "sNotBovine" -Value $InstallDrive -Force
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "sPathDataMax" -Value "$InstallDir\data\datamax" -Force
New-ItemProperty -Path "$BasePath\Plane Crazy\1.0" -Name "sPathDataMin" -Value "$InstallDir\data\datamin" -Force

Name Change Script

$NewName = $args[0]

function Patch-Binary([byte[]]$Data, [int]$Offset, [string]$FilePath)
{
    $bytes = [System.IO.File]::ReadAllBytes($FilePath)

    for ($i = 0; $i -lt $Data.Length; $i++)
    {
        $bytes[$Offset + $i] = $Data[$i]
    }

    [System.IO.File]::WriteAllBytes($FilePath, $bytes)
}

# Plane Crazy stores player/plane strings in a binary .pln file in the data\DataMin\Planes directory
# The following script should change the player name in plane1.pln. THe length of the name seems to
# be arbitrary, so make sure MaxLength matches the length of the template plane1.pln file you will
# have to place at the root of the game's directory before packaging.
$bytes = Get-AsciiBytes -InputString $NewName -MaxLength 32

Copy-Item -Path "$InstallDir\Template.pln" -Destination "$InstallDir\data\DataMin\Planes\plane1.pln" -Force

# Writes byte[] to a file at an offset
Patch-Binary -FilePath "$InstallDir\data\DataMin\Planes\plane1.pln" -Offset 0x00 -Data $bytes