Distinguish obstructed native picks from grabbed detours

This commit is contained in:
NINI
2026-10-10 12:05:59 +09:00
parent 2a59c4e8eb
commit 8bd6c426a8
3 changed files with 94 additions and 2 deletions
+18
View File
@@ -22,6 +22,24 @@ function Step([string]$Name,[string[]]$Arguments=@(),[int]$Delay=500) {
}
function Save([string]$Name) { Adb @('pull',$remote,(Join-Path $EvidenceDir "$Name.json")) | Out-Null; return Get-Content -LiteralPath (Join-Path $EvidenceDir "$Name.json") -Raw | ConvertFrom-Json }
function Same($First,$Second) { return ($First | ConvertTo-Json -Depth 12 -Compress) -eq ($Second | ConvertTo-Json -Depth 12 -Compress) }
function IsNativeOrbitMiss($Before,$After,[int]$Stage) {
$beforeBoards=@($Before.puzzleStates|Where-Object stageId -eq $Stage)
$afterBoards=@($After.puzzleStates|Where-Object stageId -eq $Stage)
if($beforeBoards.Count-ne1-or$afterBoards.Count-ne1){return $false}
$camera=$beforeBoards[0].camera;$observed=$afterBoards[0].camera
if(!(Same $camera.target $observed.target)-or!(Same $camera.distance $observed.distance)){return $false}
$unchanged=$After|ConvertTo-Json -Depth 20|ConvertFrom-Json
@($unchanged.puzzleStates|Where-Object stageId -eq $Stage)[0].camera=$camera
if(!(Same $Before $unchanged)){return $false}
$from=[Numerics.Quaternion]::new($camera.rotation.x,$camera.rotation.y,$camera.rotation.z,$camera.rotation.w)
$to=[Numerics.Quaternion]::new($observed.rotation.x,$observed.rotation.y,$observed.rotation.z,$observed.rotation.w)
if([Math]::Abs($from.LengthSquared()-1)-gt.00001-or[Math]::Abs($to.LengthSquared()-1)-gt.00001){return $false}
$relative=[Numerics.Quaternion]::Normalize([Numerics.Quaternion]::Inverse($from)*$to)
if($relative.W-lt0){$relative=[Numerics.Quaternion]::Negate($relative)}
$angle=2*[Math]::Acos([Math]::Clamp([double]$relative.W,-1.0,1.0))*180/[Math]::PI
# One actual UP120 gives local-right -30 degrees; scenery/ground may clamp it.
return $relative.X-lt-.000001-and[Math]::Abs($relative.Y)-lt.00001-and[Math]::Abs($relative.Z)-lt.00001-and$angle-le30.002
}
function NativePointer([int[]]$Contacts) {
$touchHelper=Join-Path $PSScriptRoot 'send-composition-touch.ps1'
& pwsh -NoProfile -CommandWithArgs '$ErrorActionPreference="Stop"; $touchHelper=$args[0]; $touchContacts=@($args[1..($args.Count-1)]|ForEach-Object {[int]$_}); & $touchHelper -Contacts $touchContacts; exit $LASTEXITCODE' $touchHelper @Contacts