XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
param([Parameter(Mandatory)][int]$GameProcessId,[Parameter(Mandatory)][string]$Harness,[Parameter(Mandatory)][string]$Prefix,[switch]$DockingOnly)
$ErrorActionPreference='Stop'
if($Prefix -notmatch '^[a-z0-9-]+$'){throw 'Use a simple evidence label.'}
$taskScPath="artifacts/system-navigation-0418/$Prefix-sc.json"
$taskDockPath="artifacts/system-navigation-0418/$Prefix-docking.json"
if((Test-Path -LiteralPath $taskScPath) -or (Test-Path -LiteralPath $taskDockPath)){throw 'Use new evidence paths.'}
$taskDeadline=(Get-Date).AddMinutes(8)
$taskSc=[bool]$DockingOnly
$taskDock=$false
while((Get-Date) -lt $taskDeadline -and (Get-Process -Id $GameProcessId -ErrorAction SilentlyContinue)){
    try{
        $taskText=& dotnet $Harness describe-local $GameProcessId 2>$null
        if($LASTEXITCODE -eq 0){
            $taskFrame=$taskText|ConvertFrom-Json
            if(-not $taskSc -and $taskFrame.inSupercruise){
                & python research/navigation_read_components.py --pid $GameProcessId --profile artifacts/navigation-research/native-profile-d.json --output $taskScPath --damage
                $taskSc=($LASTEXITCODE -eq 0)
            }
            if($taskSc -and -not $taskDock -and -not $taskFrame.inSupercruise -and $taskFrame.docking.nativeDutyActive -and -not $taskFrame.docking.nativeLaunchActive){
                & python research/navigation_read_components.py --pid $GameProcessId --profile artifacts/navigation-research/native-profile-d.json --output $taskDockPath --damage
                $taskDock=($LASTEXITCODE -eq 0)
            }
            if($taskSc -and $taskDock){break}
        }
    }catch{Write-Output ('Read-only capture waiting: '+$_.Exception.Message)}
    Start-Sleep -Milliseconds 600
}
[pscustomobject]@{pid=$GameProcessId;supercruiseCaptured=(Test-Path -LiteralPath $taskScPath);dockingCaptured=$taskDock;gameInputsSent=0}|ConvertTo-Json -Compress