Crusader_Decomp/tools/pyghidra_crusader/bootstrap_env.ps1
MaddoScientisto ad6ebd0b86 Add PyGhidra Crusader Toolkit and patch scripts
- Introduced README.md for the PyGhidra Crusader Toolkit, detailing setup and usage instructions.
- Added bootstrap_env.ps1 script to create and refresh the Python virtual environment with necessary packages.
- Implemented _tmp_patch_hidden_cheat_menu.py and _tmp_patch_hidden_cheat_menu_deferred.py scripts for patching specific memory addresses in Ghidra.
2026-03-25 08:15:21 +01:00

39 lines
No EOL
1.3 KiB
PowerShell

param(
[string]$PythonExe = "C:\Users\Maddo\.pyenv\pyenv-win\versions\3.11.6\python.exe",
[string]$GhidraInstallDir = "I:\Apps\ghidra_12.0.4_PUBLIC",
[string]$VenvPath = (Join-Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ".venv-pyghidra311")
)
$ErrorActionPreference = "Stop"
$resolvedPython = (Resolve-Path $PythonExe).Path
$resolvedGhidra = (Resolve-Path $GhidraInstallDir).Path
$pyghidraDist = Join-Path $resolvedGhidra "Ghidra\Features\PyGhidra\pypkg\dist"
$ghidraStubsDist = Join-Path $resolvedGhidra "docs\ghidra_stubs"
if (-not (Test-Path $pyghidraDist)) {
throw "Missing PyGhidra wheel directory: $pyghidraDist"
}
if (-not (Test-Path $ghidraStubsDist)) {
throw "Missing Ghidra stubs wheel directory: $ghidraStubsDist"
}
& $resolvedPython -m venv $VenvPath
$venvPython = Join-Path $VenvPath "Scripts\python.exe"
if (-not (Test-Path $venvPython)) {
throw "Virtual environment python not found at $venvPython"
}
& $venvPython -m pip install --upgrade --force-reinstall --no-index --find-links $pyghidraDist --find-links $ghidraStubsDist pyghidra==3.0.2 ghidra-stubs==12.0.4
$versionScript = @'
from importlib.metadata import version
print(f"pyghidra={version('pyghidra')}")
print(f"ghidra-stubs={version('ghidra-stubs')}")
'@
& $venvPython -c $versionScript