Fix smoke gaps: recorder target + VK translation, player enum + null guard (#11)
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Recordingtest.Recorder;
|
||||
|
||||
public static class Program
|
||||
{
|
||||
[STAThread]
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
var parsed = ParseArgs(args);
|
||||
@@ -126,7 +127,8 @@ public static class Program
|
||||
|
||||
Console.WriteLine("[recorder] capturing... press Ctrl+C to stop.");
|
||||
int eventCount = 0;
|
||||
int unresolved = 0;
|
||||
int unresolvedPaths = 0; // resolver ran but returned null
|
||||
int noResolverAttempt = 0; // resolver skipped entirely (e.g. automation null, key event)
|
||||
var sw = Stopwatch.StartNew();
|
||||
var rawBuffer = new System.Collections.Generic.List<RawEvent>();
|
||||
|
||||
@@ -146,13 +148,24 @@ public static class Program
|
||||
var collapser = new DragCollapser();
|
||||
UiaResolution? Resolve(RawEvent ev)
|
||||
{
|
||||
if (automation is null) return null;
|
||||
// Key events have no meaningful coordinate — resolver cannot attempt
|
||||
// a point-based lookup. Count them separately from genuine misses.
|
||||
if (ev.Kind == "key_down" || ev.Kind == "key_up")
|
||||
{
|
||||
noResolverAttempt++;
|
||||
return null;
|
||||
}
|
||||
if (automation is null)
|
||||
{
|
||||
noResolverAttempt++;
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
var snap = ResolveAt(automation, ev.X, ev.Y);
|
||||
if (snap is null)
|
||||
{
|
||||
unresolved++;
|
||||
unresolvedPaths++;
|
||||
return null;
|
||||
}
|
||||
var path = ElementPathBuilder.Build(snap);
|
||||
@@ -160,7 +173,7 @@ public static class Program
|
||||
}
|
||||
catch
|
||||
{
|
||||
unresolved++;
|
||||
unresolvedPaths++;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -168,8 +181,19 @@ public static class Program
|
||||
{
|
||||
scenario.Steps.Add(step);
|
||||
}
|
||||
int nullTargetSteps = 0;
|
||||
foreach (var s in scenario.Steps)
|
||||
{
|
||||
if (s.Target is null && s.Kind != "wait" && s.Kind != "checkpoint")
|
||||
{
|
||||
nullTargetSteps++;
|
||||
}
|
||||
}
|
||||
ScenarioWriter.WriteToFile(scenario, args.OutputPath);
|
||||
Console.WriteLine($"[recorder] done. events={eventCount} elapsed={sw.Elapsed} unresolved_paths={unresolved}");
|
||||
Console.WriteLine(
|
||||
$"[recorder] done. events={eventCount} elapsed={sw.Elapsed} " +
|
||||
$"unresolved_paths={unresolvedPaths} no_resolver_attempt={noResolverAttempt} " +
|
||||
$"null_target_steps={nullTargetSteps}");
|
||||
|
||||
automation?.Dispose();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user