FUA/patcher/windows/install_crack.ps1

90 lines
2.8 KiB
PowerShell

# Maya License Crack Installer - Windows PowerShell
# Run as Administrator
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Maya License Crack Installer (Windows)" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Set paths
$ProjectDir = Split-Path -Parent $MyInvocation.MyCommand.Path | Split-Path -Parent
$CoreDir = Join-Path $ProjectDir "core\windows"
$HookDll = Join-Path $CoreDir "libmaya_hook.dll"
# Find Maya installation
$MayaPath = $null
$MayaVersions = Get-ChildItem "C:\Program Files\Autodesk\" -Filter "Maya*" -Directory | Sort-Object Name -Descending
foreach ($Version in $MayaVersions) {
$TestPath = Join-Path $Version.FullName "bin\maya.exe"
if (Test-Path $TestPath) {
$MayaPath = $TestPath
Write-Host "Found Maya at: $MayaPath" -ForegroundColor Green
break
}
}
if (-not $MayaPath) {
Write-Host "ERROR: Maya not found!" -ForegroundColor Red
Read-Host "Press Enter to exit"
exit 1
}
Write-Host ""
# Check if hook DLL exists
if (-not (Test-Path $HookDll)) {
Write-Host "Building license hook..." -ForegroundColor Yellow
Set-Location $CoreDir
& make
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Failed to build hook" -ForegroundColor Red
Set-Location $ProjectDir
Read-Host "Press Enter to exit"
exit 1
}
Set-Location $ProjectDir
}
Write-Host "Hook DLL ready: $HookDll" -ForegroundColor Green
Write-Host ""
# Backup original maya.exe
$MayaBackup = "$MayaPath.original"
if (-not (Test-Path $MayaBackup)) {
Write-Host "Backing up original maya.exe..." -ForegroundColor Yellow
Copy-Item $MayaPath $MayaBackup
Write-Host "Backup created: $MayaBackup" -ForegroundColor Green
} else {
Write-Host "Backup already exists: $MayaBackup" -ForegroundColor Yellow
}
Write-Host ""
# Create launcher script
$LauncherPath = Join-Path (Join-Path $ProjectDir "patcher\windows") "maya_launcher.bat"
$LauncherContent = @"
@echo off
REM Maya Launcher with License Hook
set MAYA_HOOK=$HookDll
set ORIGINAL_MAYA=$MayaBackup
echo Starting Maya with license hook...
set MAYA_APP_LAUNCHER_DLL=%%MAYA_HOOK%%
start "Autodesk Maya" %%ORIGINAL_MAYA%% %%*%
"@
Set-Content -Path $LauncherPath -Value $LauncherContent
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Installation Complete!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "To launch Maya with the crack, run:" -ForegroundColor Yellow
Write-Host " $LauncherPath"
Write-Host ""
Write-Host "To uninstall, run:" -ForegroundColor Yellow
Write-Host " $ProjectDir\patcher\windows\uninstall_crack.ps1"
Write-Host ""
Read-Host "Press Enter to exit"