Actions
Name |
Path |
Arguments |
Working Directory |
Primary |
Play |
MCM2.EXE |
|
|
True |
Install Script
This script requires admin access to function properly
$InstallDir = $PSScriptRoot
$PID = [GUID]::NewGuid()
$EmptyGuid = [GUID]::Empty
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" -Name "$InstallDir\MCM2.EXE" -Value "~ WINXPSP3" -Force
New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2"
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "AllowFreezeCamera" -Value 1 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "CDPath" -Value "$InstallDir" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "FIRSTRUN" -Value 1 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "HardDriveRootPath" -Value "$InstallDir" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "InstalledGroup" -Value 3 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "InstalledType" -Value "Full" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "IsAdmin" -Value 1 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "LangID" -Value 9 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "LastControllerId" -Value "$EmptyGuid" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "Launched" -Value 1 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "MRUProfile" -Value 1 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "PID" -Value "$PID" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "UseControllerId" -Value "$EmptyGuid" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "UseLastVideoCard" -Value 1 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "UseVideoCardIdx" -Value 2 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Motocross Madness 2" -Name "VersionType" -Value "RetailVersion" -Force
Name Change Script
$NewName = $args[0]
$InstallDir = $PSScriptRoot
$PID = [GUID]::NewGuid()
$EmptyGuid = [GUID]::Empty
function Get-AsciiBytes([string]$InputString, [int]$MaxLength)
{
if ($InputString.Length -gt $MaxLength)
{
$InputString = $InputString.Substring(0, $MaxLength)
}
$bytes = [System.Text.Encoding]::ASCII.GetBytes($InputString)
$array = @()
$count = 0
$extraPadding = $MaxLength - $bytes.Length
foreach ($byte in $bytes)
{
if ($count -lt $MaxLength)
{
$array += $byte
$count++
}
}
for ($i = $count; $i -lt $MaxLength; $i++)
{
$array += 0x00
}
return $array
}
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)
}
Copy-Item -Path "$InstallDir\ProfileTemplate" -Destination "$InstallDir\UI\PROFILE\$NewName" -Recurse
Rename-Item -Path "$InstallDir\UI\PROFILE\$NewName\ProfileTemplate.prf" -NewName "$NewName.prf"
$rawBytes = Get-AsciiBytes -InputString $newName -MaxLength 15
Patch-Binary -FilePath "$InstallDir\UI\PROFILE\$NewName\$NewName.prf" -Offset 0 -Data $rawBytes