Match native rounded-pixel grab rays and retry missing startup PID
This commit is contained in:
@@ -9,10 +9,11 @@ $checks=[Collections.Generic.List[object]]::new(); $commands=[Collections.Generi
|
||||
$result=[ordered]@{milestone='Final';sourceCommit=(& git rev-parse HEAD);sourceDirty=[bool](& git status --porcelain);serial=$Serial;apkSha256=(Get-FileHash -LiteralPath $ApkPath -Algorithm SHA256).Hash;status='failed'}
|
||||
$result.rendererProjection=@{fieldOfView=62;fixedWorldPivot=@(0,.65,0);rawCamera='Saved Board.camera JSON remains canonical';viewport='Landscape wm size max/min; remaining UI and physical touch helper assume sole 2400x1080 AVD'}
|
||||
$networkBefore=$null; $musicBefore=$null
|
||||
function Adb([string[]]$Arguments) {
|
||||
function Adb([string[]]$Arguments,[switch]$AllowMissingPid) {
|
||||
$started=[DateTime]::UtcNow.ToString('o'); $output=& $adb -s $Serial @Arguments 2>&1; $code=$LASTEXITCODE
|
||||
$commands.Add(@{startedUtc=$started;finishedUtc=[DateTime]::UtcNow.ToString('o');command=('adb -s '+$Serial+' '+($Arguments -join ' '));exitCode=$code;output=($output -join "`n")})
|
||||
if ($code -ne 0) { throw "ADB exit $code : $($Arguments -join ' ')" }; return ($output -join "`n").Trim()
|
||||
$missingPid=$AllowMissingPid -and $code-eq1 -and $Arguments.Count-eq3 -and $Arguments[0]-eq'shell' -and $Arguments[1]-eq'pidof' -and $Arguments[2]-eq$package -and [string]::IsNullOrWhiteSpace(($output -join "`n"))
|
||||
if ($code -ne 0 -and !$missingPid) { throw "ADB exit $code : $($Arguments -join ' ')" }; return ($output -join "`n").Trim()
|
||||
}
|
||||
function Check([string]$Id,[bool]$Passed,[string]$Actual) {
|
||||
$checks.Add(@{id=$Id;passed=$Passed;actual=$Actual}); if (!$Passed) { throw "Content check failed: $Id ($Actual)" }
|
||||
@@ -111,18 +112,26 @@ function BallClear($Board,[string]$Id) {
|
||||
$camera=$Board.camera
|
||||
$rotation=[Numerics.Quaternion]::new($camera.rotation.x,$camera.rotation.y,$camera.rotation.z,$camera.rotation.w)
|
||||
$origin=[Numerics.Vector3]::new($camera.target.x,($camera.target.y+.65),$camera.target.z)+[Numerics.Vector3]::Transform([Numerics.Vector3]::new(0,0,-$camera.distance),$rotation)
|
||||
$size=Adb @('shell','wm','size'); if ($size -notmatch '(\d+)x(\d+)') { throw "Unknown device resolution: $size" }
|
||||
$width=[Math]::Max([int]$Matches[1],[int]$Matches[2]); $height=[Math]::Min([int]$Matches[1],[int]$Matches[2])
|
||||
$scale=[Math]::Tan(31*[Math]::PI/180)/($height/2)
|
||||
# Match the rounded native DOWN pixel, including its actual target entry distance.
|
||||
$direction=[Numerics.Vector3]::Normalize([Numerics.Vector3]::Transform([Numerics.Vector3]::new(($point[0]-$width/2)*$scale,($height/2-$point[1])*$scale,1),$rotation))
|
||||
$target=@($Board.balls|Where-Object id -eq $Id)[0].position
|
||||
$direction=[Numerics.Vector3]::new($target.x,$target.y,$target.z)-$origin
|
||||
$targetHit=$direction.Length()-.5
|
||||
$direction=[Numerics.Vector3]::Normalize($direction)
|
||||
$delta=[Numerics.Vector3]::new($target.x,$target.y,$target.z)-$origin
|
||||
$along=[Numerics.Vector3]::Dot($direction,$delta)
|
||||
$perpendicularSquared=($delta-$direction*$along).LengthSquared()
|
||||
if($perpendicularSquared-gt.25){return $false}
|
||||
$targetHit=$along-[Math]::Sqrt([Math]::Max(0.0,.25-$perpendicularSquared))
|
||||
if($targetHit-lt0){return $false}
|
||||
foreach($ball in $Board.balls){
|
||||
if($ball.id-eq$Id){continue}
|
||||
$delta=[Numerics.Vector3]::new($ball.position.x,$ball.position.y,$ball.position.z)-$origin
|
||||
$along=[Numerics.Vector3]::Dot($direction,$delta)
|
||||
$perpendicularSquared=$delta.LengthSquared()-$along*$along
|
||||
$perpendicularSquared=($delta-$direction*$along).LengthSquared()
|
||||
if($perpendicularSquared-le.25){
|
||||
$near=$along-[Math]::Sqrt([Math]::Max(0,.25-$perpendicularSquared))
|
||||
if($near-ge0-and$near-lt$targetHit){return $false}
|
||||
$near=$along-[Math]::Sqrt([Math]::Max(0.0,.25-$perpendicularSquared))
|
||||
if($near-ge0-and$near-le$targetHit){return $false}
|
||||
}
|
||||
}
|
||||
return $true
|
||||
@@ -160,7 +169,7 @@ function StartHome([string]$Name) {
|
||||
$ready=$false; $pauseRequested=$false
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
for($attempt=0;$attempt-lt30;$attempt++) {
|
||||
$pidText=Adb @('shell','pidof',$package)
|
||||
$pidText=Adb @('shell','pidof',$package) -AllowMissingPid
|
||||
$saveText=Adb @('shell',('if test -s '+$remote+'; then cat '+$remote+'; fi'))
|
||||
$validSave=$false
|
||||
try { $state=$saveText|ConvertFrom-Json -ErrorAction Stop; $validSave=$state.schemaVersion-eq1 -and $null-ne$state.completedStageIds -and $null-ne$state.puzzleStates } catch { }
|
||||
@@ -195,6 +204,7 @@ function StartHome([string]$Name) {
|
||||
$pauseRequested=$true
|
||||
}
|
||||
if($pidText-match'^\d+'-and$validSave-and$ui){$ready=$true;$saveText|Set-Content (Join-Path $EvidenceDir "$Name-ready-save.json") -Encoding utf8;break}
|
||||
if($pidText-notmatch'^\d+'){Adb @('shell','am','start','-W','-n',$activity)|Out-Null}
|
||||
}
|
||||
$observations.ToArray()|ConvertTo-Json -Depth 6|Set-Content (Join-Path $EvidenceDir "$Name-readiness.json") -Encoding utf8
|
||||
Check "$Name-home-ready" $ready 'Actual app PID, landscape home colors/button/title and app save JSON; bounded30 observations, black/Unity splash excluded, PNG retained for direct review'
|
||||
|
||||
Reference in New Issue
Block a user