23 lines
1.7 KiB
Bash
Executable file
23 lines
1.7 KiB
Bash
Executable file
#!/bin/bash
|
|
# usage: battle-run.sh <tag> <affinity-mask-decimal|0=leave> <clickX> <clickY> [duration]
|
|
S=/tmp/claude-1000/-home-alex/ec8e34f8-af37-4ef2-a309-ed6a15293097/scratchpad
|
|
TAG=$1; AFF=$2; X=$3; Y=$4; DUR=${5:-120}
|
|
mkdir -p $S/runs/$TAG
|
|
if [ "$AFF" != "0" ]; then
|
|
ssh -o BatchMode=yes re@192.168.10.139 "\$p=Get-Process 'Sword of the Stars'; \$p.ProcessorAffinity=$AFF; (Get-Process 'Sword of the Stars').ProcessorAffinity" | tee $S/runs/$TAG/affinity.txt
|
|
fi
|
|
ssh -o BatchMode=yes re@192.168.10.139 "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\Users\re\sampler.ps1 -DurationSec $DUR -IntervalMs 20 -Out C:\Users\re\samp_$TAG.txt" > $S/runs/$TAG/sampler.log 2>&1 &
|
|
ssh spicy "/root/shots.sh $TAG $DUR" > /dev/null 2>&1 &
|
|
sleep 4
|
|
printf 'fg\nclick %s %s\nsleep 500\n' "$X" "$Y" > $S/runs/$TAG/cmd.txt
|
|
scp -q $S/runs/$TAG/cmd.txt re@192.168.10.139:C:/SOTS/ui/cmd.txt
|
|
ssh -o BatchMode=yes re@192.168.10.139 'schtasks /Run /TN SOTSUI | Out-Null'
|
|
date +%s.%N > $S/runs/$TAG/click_issued.txt
|
|
echo "click issued $(date +%H:%M:%S.%N)"
|
|
wait
|
|
scp -q re@192.168.10.139:samp_$TAG.txt $S/runs/$TAG/
|
|
scp -q "spicy:/tmp/shots/$TAG/times.txt" $S/runs/$TAG/
|
|
ssh spicy "cd /tmp/shots/$TAG && for f in *.ppm; do convert \$f -resize 256x192 \${f%.ppm}.png; done; tar cf /tmp/shots/$TAG.tar -C /tmp/shots/$TAG --wildcards '*.png' times.txt"
|
|
scp -q spicy:/tmp/shots/$TAG.tar $S/runs/$TAG/ && tar xf $S/runs/$TAG/$TAG.tar -C $S/runs/$TAG/
|
|
cd $S/runs/$TAG && prev=""; for f in $(ls [0-9]*.png | sort); do if [ -n "$prev" ]; then d=$(compare -metric RMSE $prev $f null: 2>&1 | sed 's/.*(\(.*\))/\1/'); echo "$f $d"; fi; prev=$f; done > framediff.txt
|
|
echo "run $TAG done; frames: $(ls $S/runs/$TAG/[0-9]*.png | wc -l)"
|