diff options
Diffstat (limited to 'anim/src/cursor.zig')
| -rw-r--r-- | anim/src/cursor.zig | 363 |
1 files changed, 340 insertions, 23 deletions
diff --git a/anim/src/cursor.zig b/anim/src/cursor.zig index 16ccd77..5cb625a 100644 --- a/anim/src/cursor.zig +++ b/anim/src/cursor.zig @@ -63,6 +63,17 @@ pub const Levels = struct { /// sets it, `Context.Options.syscalls`): what the step changed in the /// registers strikes once the call is back. crossings: bool = false, + /// The disassembly's annotation (design/README.md, `insn`), read when + /// the context is made: `tied` names the word an instruction touches, + /// the stack counts from the frame's base with two `free` words over + /// rsp, and a walked step goes cause to effect (the `touch`, the word, + /// rsp's or rbp's pin, then the window); `whole` is pwndbg's chain, + /// offsets from rsp, and the cascade as it was. + annotation: enum { tied, whole } = .tied, + /// A value's way between memory and a register (`carry`, "4. Ties"), + /// read at each step (a beat may turn it on): none, an arrow, or the + /// arrow carrying the value's digits on a chip. + carry: enum { off, arrow, value } = .off, }; /// How a step is drawn. Walk: everything, as a sentence. Run: the mark and @@ -88,6 +99,46 @@ pub const Plan = struct { /// (a step that went on from it without its rest: a crossing from its /// call row): what it struck goes on cooling, never cut in a frame. cooling: f32 = 0, + /// A walk under `tied` (design/motion.md, "A word touched", "The + /// stack's own instructions"), seconds from its first frame, negative + /// where the step has none: the touch sets off; what the step read is + /// framed; the carry sets off (`carry_value`: its digits ride it); rsp's + /// pin and rbp's set off; the stack's window follows; the projection + /// sets off (else from memory's strike). + touch: f32 = -1, + read: f32 = -1, + carry: f32 = -1, + carry_value: bool = false, + pins: [2]f32 = .{ -1, -1 }, + follow: f32 = -1, + project: f32 = -1, + + /// How many values a plan is on the timeline (`pack`). + const values = 18; + + fn pack(p: Plan) [values]f32 { + return .{ @floatFromInt(@intFromEnum(p.gait)), p.at[0], p.at[1], p.at[2], p.advance, p.travel, p.total, @floatFromInt(@intFromBool(p.wave)), @floatFromInt(@intFromBool(p.fires)), p.cooling, p.touch, p.read, p.carry, @floatFromInt(@intFromBool(p.carry_value)), p.pins[0], p.pins[1], p.follow, p.project }; + } + + fn unpack(v: [values]f32) Plan { + return .{ + .gait = @enumFromInt(@as(u2, @intFromFloat(std.math.clamp(@round(v[0]), 0, 2)))), + .at = .{ v[1], v[2], v[3] }, + .advance = v[4], + .travel = v[5], + .total = v[6], + .wave = v[7] >= 0.5, + .fires = v[8] >= 0.5, + .cooling = v[9], + .touch = v[10], + .read = v[11], + .carry = v[12], + .carry_value = v[13] >= 0.5, + .pins = .{ v[14], v[15] }, + .follow = v[16], + .project = v[17], + }; + } /// Once the pattern is known: the levels a stagger apart from the /// first frame, the mark after them, in `seconds`. @@ -110,6 +161,116 @@ pub const quiet: u32 = blk: { break :blk mask; }; +/// rsp's and rbp's places in `Regs.names`. +pub const sp_index: u5 = blk: { + for (zt.Regs.names, 0..) |name, i| if (std.mem.eql(u8, name, "rsp")) break :blk i; + unreachable; +}; +pub const bp_index: u5 = blk: { + for (zt.Regs.names, 0..) |name, i| if (std.mem.eql(u8, name, "rbp")) break :blk i; + unreachable; +}; + +/// The word of the stack a step's instruction reads or writes: what its +/// `touch` goes to (design/README.md, "4. Ties"). The instruction's moment, +/// the word's address and width, and whether it writes there. +pub const Touched = struct { at: u64, addr: u64, len: u64, write: bool }; + +/// The step's touched word: a write first (the effect), else the first +/// read; the recorder's `touch` where it has one, else what a `push` or a +/// `call` writes at the new rsp, a `pop` or a `ret` reads at the old, a +/// `leave` at the old rbp (a recording made before the tracer's touches of +/// implicit operands, the gallery's, carries none for those). +pub fn stackTouch(rec: *const Recording, from: u64, to: u64) ?Touched { + var read: ?Touched = null; + var buf: [256]u8 = undefined; + var i = from; + // shortcut: a step of more than 64 instructions looks at its first 64. + while (i < to and i < from + 64 and i < rec.end()) : (i += 1) { + const m = rec.moment(i); + for (rec.insn_touches[i]) |maybe| if (maybe) |tt| { + if ((zt.telescope.region(m, tt.addr) catch .none) != .stack) continue; + const one: Touched = .{ .at = i, .addr = tt.addr, .len = tt.len, .write = tt.how & 2 != 0 }; + if (one.write) return one; + if (read == null) read = one; + }; + const was = rec.registers[i]; + const is = rec.registers[i + 1]; + const here = rec.instruction(i, was.rip, &buf) orelse continue; + const mn = here.text[0 .. std.mem.indexOfScalar(u8, here.text, ' ') orelse here.text.len]; + const eql = std.mem.eql; + // Only where the moment after is the instruction's own (a recording by instruction). + const next = is.rip == was.rip + here.len or (rec.insn_branches[i] != null and rec.insn_branches[i].?.to == is.rip); + if (!next) continue; + if ((eql(u8, mn, "push") or eql(u8, mn, "call")) and is.rsp +% 8 == was.rsp) return .{ .at = i, .addr = is.rsp, .len = 8, .write = true }; + if (read != null) continue; + if ((eql(u8, mn, "pop") or eql(u8, mn, "ret")) and is.rsp == was.rsp +% 8) read = .{ .at = i, .addr = was.rsp, .len = 8, .write = false }; + if (eql(u8, mn, "leave")) read = .{ .at = i, .addr = was.rbp, .len = 8, .write = false }; + } + return read; +} + +/// A value's way for `carry`: a load (into the register, `load`) or a store +/// (from it), by the touched instruction's operands: `mov` a register and +/// the word, a `push` or a `pop` of a register. Null for anything else (a +/// call's return address, an access with no register at its other end). +pub const Carry = struct { load: bool, reg: []const u8 }; + +pub fn carried(rec: *const Recording, touch: Touched) ?Carry { + var buf: [256]u8 = undefined; + const here = rec.instruction(touch.at, rec.register(touch.at, "rip"), &buf) orelse return null; + const text = here.text; + const space = std.mem.indexOfScalar(u8, text, ' ') orelse return null; + const mn = text[0..space]; + const ops = std.mem.trim(u8, text[space..], " "); + const comma = std.mem.indexOfScalar(u8, ops, ','); + const first = std.mem.trim(u8, ops[0 .. comma orelse ops.len], " "); + const second = if (comma) |cm| std.mem.trim(u8, ops[cm + 1 ..], " ") else ""; + const eql = std.mem.eql; + if (eql(u8, mn, "push")) return if (register64(first)) |r| .{ .load = false, .reg = r } else null; + if (eql(u8, mn, "pop")) return if (register64(first)) |r| .{ .load = true, .reg = r } else null; + if (!std.mem.startsWith(u8, mn, "mov")) return null; + if (touch.write) return if (register64(second)) |r| .{ .load = false, .reg = r } else null; + return if (register64(first)) |r| .{ .load = true, .reg = r } else null; +} + +/// A general register's 64-bit name, from any of its widths; null for anything else. +pub fn register64(name: []const u8) ?[]const u8 { + const table = [_][4][]const u8{ + .{ "rax", "eax", "ax", "al" }, .{ "rbx", "ebx", "bx", "bl" }, .{ "rcx", "ecx", "cx", "cl" }, .{ "rdx", "edx", "dx", "dl" }, + .{ "rsi", "esi", "si", "sil" }, .{ "rdi", "edi", "di", "dil" }, .{ "rbp", "ebp", "bp", "bpl" }, .{ "rsp", "esp", "sp", "spl" }, + }; + for (table) |row| for (row) |n| if (std.mem.eql(u8, n, name)) return row[0]; + for ([_][]const u8{ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" }) |r| { + if (std.mem.startsWith(u8, name, r) and (name.len == r.len or (name.len == r.len + 1 and std.mem.indexOfScalar(u8, "dwb", name[r.len]) != null))) return r; + } + return null; +} + +/// How many words register `name` (rsp, rbp) moved over the step from `from` to `to`. +pub fn wordsApart(rec: *const Recording, from: u64, to: u64, name: []const u8) f32 { + const a = rec.register(from, name); + const b = rec.register(to, name); + return @floatFromInt(@abs(@as(i64, @bitCast(b -% a))) / 8); +} + +/// Whether the step is a `pop rbp` (or ends in one alone): rbp's pin flies before rsp's falls. +fn popsRbp(rec: *const Recording, from: u64, to: u64) bool { + if (to != from + 1) return false; + var buf: [256]u8 = undefined; + const here = rec.instruction(from, rec.register(from, "rip"), &buf) orelse return false; + return std.mem.startsWith(u8, here.text, "pop"); +} + +/// How long rsp's or rbp's pin takes over `rows` rows (`time.tied`): 24 f +/// to the next, 6 f a further one, 48 f at most; at a run 8 f and 2 f a +/// row, 16 f at most. +pub fn pinTime(rows: f32, run: bool) f32 { + const k = time.tied; + if (run) return @min(time.run_ease + 2.0 / 60.0 * @max(rows - 1, 0), k.run_pin_most); + return @min(k.stack_pin + k.stack_pin_row * @max(rows - 1, 0), k.stack_pin_most); +} + pub const Cursor = struct { rec: *Recording, /// Where it is (or is arriving), where it came from, and before that. @@ -119,8 +280,8 @@ pub const Cursor = struct { gaits: [history]anim.Value, /// 0 to 1 through the step it is taking; 1 at rest. phase: anim.Value, - /// The step's `Plan`, a value a field. - plan: [10]anim.Value, + /// The step's `Plan`, a value a field (`Plan.pack`). + plan: [Plan.values]anim.Value, /// The moment the current mark was on, and the one it is on (or going to). marks: [2]anim.Value, /// 1 while steps are hurried (the head counts them), and while what @@ -154,7 +315,7 @@ pub const Cursor = struct { .stops = undefined, .gaits = undefined, .phase = s.value(1), - .plan = .{ s.value(0), s.value(plan.at[0]), s.value(plan.at[1]), s.value(plan.at[2]), s.value(plan.advance), s.value(plan.travel), s.value(plan.total), s.value(0), s.value(1), s.value(0) }, + .plan = undefined, .marks = .{ s.value(here), s.value(here) }, .hurried = s.value(0), .veil = s.value(0), @@ -164,6 +325,7 @@ pub const Cursor = struct { .first = start, .last = start, }; + for (&c.plan, Plan.pack(plan)) |*value, is| value.* = s.value(is); // shortcut: an f32 holds whole moments up to 16 million; a longer recording needs two values a stop. for (&c.stops) |*stop| stop.* = s.value(here); for (&c.gaits) |*gait| gait.* = s.value(0); @@ -183,7 +345,7 @@ pub const Cursor = struct { stops: [history]anim.Value, gaits: [history]anim.Value, phase: anim.Value, - plan: [10]anim.Value, + plan: [Plan.values]anim.Value, marks: [2]anim.Value, hurried: anim.Value, veil: anim.Value, @@ -261,24 +423,25 @@ pub const Cursor = struct { const Step = struct { stops: [history]f32, gaits: [history]f32, - plan: [10]f32, + plan: [Plan.values]f32, marks: [2]f32, count: f32, seconds: f32, fn run(st: @This(), sf: *anim.Frame, v: Cursor) void { - var set: [2 * history + 14]anim.Animation = undefined; + const n_plan = Plan.values; + var set: [2 * history + n_plan + 4]anim.Animation = undefined; for (v.stops, st.stops, 0..) |value, is, i| set[i] = value.to(is); - for (v.gaits, st.gaits, 0..) |value, is, i| set[history + 14 + i] = value.to(is); + for (v.gaits, st.gaits, 0..) |value, is, i| set[history + n_plan + 4 + i] = value.to(is); for (v.plan, st.plan, history..) |value, is, n| set[n] = value.to(is); - set[history + 10] = v.marks[0].to(st.marks[0]); - set[history + 11] = v.marks[1].to(st.marks[1]); - set[history + 12] = v.phase.to(0); - set[history + 13] = v.count.to(st.count); + set[history + n_plan] = v.marks[0].to(st.marks[0]); + set[history + n_plan + 1] = v.marks[1].to(st.marks[1]); + set[history + n_plan + 2] = v.phase.to(0); + set[history + n_plan + 3] = v.count.to(st.count); sf.play(set, .{ .seconds = 0 }); sf.play(.{v.phase.to(1)}, .{ .seconds = st.seconds, .ease = anim.ease.linear }); } }; - var st: Step = .{ .stops = undefined, .gaits = undefined, .plan = .{ @floatFromInt(@intFromEnum(plan.gait)), plan.at[0], plan.at[1], plan.at[2], plan.advance, plan.travel, plan.total, @floatFromInt(@intFromBool(plan.wave)), @floatFromInt(@intFromBool(plan.fires)), plan.cooling }, .marks = undefined, .count = settled(s, c.count) + 1, .seconds = seconds }; + var st: Step = .{ .stops = undefined, .gaits = undefined, .plan = Plan.pack(plan), .marks = undefined, .count = settled(s, c.count) + 1, .seconds = seconds }; st.stops[0] = @floatFromInt(to); for (1..history) |i| st.stops[i] = settled(s, c.stops[i - 1]); st.gaits[0] = @floatFromInt(@intFromEnum(plan.gait)); @@ -333,6 +496,7 @@ pub const Cursor = struct { } fn timetable(c: Cursor, from: u64, to: u64, wave: bool) Plan { + if (c.levels.annotation == .tied and !wave) return c.tiedTable(from, to); const rec = c.rec; const regs: f32 = @floatFromInt(@popCount(rec.registersChanged(from, to) & ~quiet)); // Memory gives up its slot when nothing it touched is drawn. @@ -392,6 +556,126 @@ pub const Cursor = struct { return plan; } + /// `timetable` under `tied` (design/motion.md, "A word touched", "A call + /// pushed", "A return", "The stack's own instructions"): cause before + /// effect, nothing downstream marked before what causes it has shown. + /// Fire; what the step read, its touch first (a stack word), then its + /// frame; the registers it filled (not rsp or rbp), armed after their + /// cause, a load's carry between; what it wrote, its touch (or a store's + /// carry) first, then armed and struck; a return's idea; rsp's pin and + /// rbp's, each struck as it lands (a `pop`'s rbp first); a call's or the + /// data's idea; the window follows; the hold, the advance, the rest. + fn tiedTable(c: Cursor, from: u64, to: u64) Plan { + const rec = c.rec; + const k = time.tied; + const f = 1.0 / 60.0; + const changed = rec.registersChanged(from, to) & ~quiet; + const regs: f32 = @floatFromInt(@popCount(changed & ~(@as(u32, 1) << sp_index | @as(u32, 1) << bp_index))); + var wrote_n: usize = 0; + var strikes_n: usize = 0; + for (rec.written(from, to)) |span| { + wrote_n += @intFromBool(rec.drawn(span, from, to)); + strikes_n += @intFromBool(takesPlace(rec, span, from, to)); + } + var read_n: usize = 0; + for (rec.read(from, to)) |span| read_n += @intFromBool(rec.drawn(span, from, to)); + const wrote: f32 = @floatFromInt(if (wrote_n > 0) @max(strikes_n, 1) else 0); + const touch = stackTouch(rec, from, to); + const deeper = rec.depths[to] > rec.depths[from]; + const back = rec.depths[to] < rec.depths[from]; + const idea = switch (c.levels.idea) { + .none => false, + .calls => deeper or back, + .data => wrote_n > 0 or read_n > 0, + }; + const carry: ?Carry = if (c.levels.carry != .off) if (touch) |tt| carried(rec, tt) else null else null; + var plan: Plan = .{ .travel = c.travel(from, to, false), .carry_value = c.levels.carry == .value }; + // When the last cause has shown, and how many things there are to read. + var t: f32 = time.fire; + var values: f32 = 0; + const reads = c.levels.memory and (read_n > 0 or (touch != null and !touch.?.write)); + if (reads) { + if (touch) |tt| if (!tt.write) { + plan.touch = t + 6 * f; + }; + plan.read = if (plan.touch >= 0) plan.touch + k.touch else t + 6 * f; + t = plan.read + time.read.in; + values += 1; + } + // (A load carried fills its register even where the value is the one it held: the arrow lands, nothing is struck.) + const loads = if (carry) |cc| cc.load else false; + if (c.levels.cpu and (regs > 0 or loads)) { + if (carry) |cc| if (cc.load) { + plan.carry = t; + t += k.carry; + }; + plan.at[0] = @max(time.cascade, t + time.strike.arm); + t = plan.at[0] + @min(@max(regs - 1, 0), 3) * write_apart; + values += 1; + } + const writes = c.levels.memory and (wrote > 0 or (touch != null and touch.?.write)); + if (writes) { + const store = if (carry) |cc| !cc.load else false; + if (store) { + // The register framed as read (6 f), then the carry: no touch, the row having named the word. + plan.carry = t + 12 * f; + plan.at[1] = plan.carry + k.carry + time.strike.arm; + } else if (touch != null and touch.?.write) { + plan.touch = t + 6 * f; + plan.at[1] = plan.touch + k.touch + time.strike.arm; + } else plan.at[1] = @max(time.cascade, (if (regs > 0) plan.at[0] else if (reads) plan.read else 0) + time.cascade); + t = plan.at[1] + @min(@max(wrote - 1, 0), 3) * write_apart; + values += 1; + } else plan.at[1] = if (reads) plan.read else t; + // The idea (design/motion.md, "A return"): a return's node answers before rsp falls. + var follow_through: f32 = 0; + if (idea and back) { + plan.at[2] = t + time.cascade; + t = plan.at[2]; + follow_through = time.snap; + values += 1; + } + // rsp's pin and rbp's, one after the other: a `pop`'s rbp first (it takes the word rsp leaves). + const rows = [2]f32{ wordsApart(rec, from, to, "rsp"), wordsApart(rec, from, to, "rbp") }; + if (rows[0] > 0 or rows[1] > 0) { + const order: [2]usize = if (popsRbp(rec, from, to)) .{ 1, 0 } else .{ 0, 1 }; + var start = t + 6 * f; + var first_land: ?f32 = null; + for (order) |r| if (rows[r] > 0) { + plan.pins[r] = start; + t = start + pinTime(rows[r], false); + first_land = first_land orelse t; + start = t + 6 * f; + }; + // Nothing else in the CPU's slot: it is rsp's (or rbp's) landing. + if (!(c.levels.cpu and regs > 0)) plan.at[0] = first_land.?; + values += 1; + } + if (idea and !back) { + // A drawing made of the bytes, or a call's node from the frame its return address made: projected once they have shown. + const projected = writes or reads; + plan.project = if (plan.pins[0] >= 0 or plan.pins[1] >= 0) t + 6 * f else plan.at[1]; + if (projected) { + plan.at[2] = @max(t, plan.project + time.project.bracket + @as(f32, if (c.levels.idea == .data) time.project.draw else time.project.far) + @as(f32, if (wrote > 0 and c.levels.idea == .data) time.strike.arm else 0)); + } else plan.at[2] = t + time.cascade; + t = plan.at[2]; + follow_through = switch (c.levels.idea) { + .none => 0, + .calls => time.snap, + .data => c.levels.follow, + }; + values += 1; + } + // The window follows, once rsp's pin has landed. + if (rows[0] > 0) { + plan.follow = t + 6 * f; + t = plan.follow + k.follow; + } + plan.advance = if (values > 0) t + follow_through + @min(time.read_value + time.read_more * (values - 1), time.read_most) else time.fire; + plan.total = plan.advance + plan.travel + time.rest; + return plan; + } + /// How long the mark takes to the next line: a slide by how far, or a /// jump (out, then in) into or out of a call, further than a few rows, /// or at the end of a continue (`wave`). @@ -501,16 +785,7 @@ pub const Cursor = struct { .rec = rec, .stops = undefined, .time = std.math.inf(f32), - .plan = .{ - .gait = @enumFromInt(@as(u2, @intFromFloat(std.math.clamp(@round(placed.value(c.plan[0])), 0, 2)))), - .at = .{ placed.value(c.plan[1]), placed.value(c.plan[2]), placed.value(c.plan[3]) }, - .advance = placed.value(c.plan[4]), - .travel = placed.value(c.plan[5]), - .total = placed.value(c.plan[6]), - .wave = placed.value(c.plan[7]) >= 0.5, - .fires = placed.value(c.plan[8]) >= 0.5, - .cooling = placed.value(c.plan[9]), - }, + .plan = undefined, .marks = .{ whole(rec, placed.value(c.marks[0])), whole(rec, placed.value(c.marks[1])) }, .hurried = placed.value(c.hurried), .veil = placed.value(c.veil), @@ -520,8 +795,12 @@ pub const Cursor = struct { .place = 0, .fired = c.levels.fire, .crossings = c.levels.crossings, + .annotation = c.levels.annotation, .way = .{ c.first, c.last }, }; + var plan: [Plan.values]f32 = undefined; + for (&plan, c.plan) |*is, v| is.* = placed.value(v); + n.plan = Plan.unpack(plan); for (&n.stops, c.stops) |*stop_at, v| stop_at.* = whole(rec, placed.value(v)); for (&n.gaits, c.gaits) |*gait, v| gait.* = @enumFromInt(@as(u2, @intFromFloat(std.math.clamp(@round(placed.value(v)), 0, 2)))); const phase = placed.value(c.phase); @@ -586,6 +865,8 @@ pub const Now = struct { fired: @FieldType(Levels, "fire") = .source, /// Steps that make a syscall cross into the kernel (`Levels.crossings`). crossings: bool = false, + /// The disassembly's annotation, and what goes with it (`Levels.annotation`). + annotation: @FieldType(Levels, "annotation") = .tied, /// The scene's way through the recording: its first moment and its last. way: [2]u64 = .{ 0, 0 }, @@ -927,12 +1208,48 @@ pub const Now = struct { /// gold, and out as the mark leaves, gone before the next line fires. pub fn reading(n: Now, level: Level, delay: f32) f32 { return switch (n.plan.gait) { - .walk => n.held(n.plan.at[@intFromEnum(level)] + delay), + // Under `tied` what a step read is framed in its own slot, before what it fills (`Plan.read`). + .walk => n.held((if (level == .memory and n.plan.read >= 0) n.plan.read else n.plan.at[@intFromEnum(level)]) + delay), .run => if (n.resting()) 0 else @min(std.math.clamp(n.since(level, 0) / time.stagger, 0, 1), std.math.clamp((n.plan.total - n.time) / time.snap, 0, 1)), .sprint => 0, }; } + /// Under `tied`, rsp's (`k` 0) or rbp's (1) pin: how far (0 to 1, on + /// `glide`) it has travelled from where the step found it, at a walk + /// from `Plan.pins`, at a run over its 8 f and 2 f a row from the step's + /// start; 1 at rest. Null where the step does not move it so (the old + /// timing: a plan with no pins, a sprint, `whole`). + pub fn pinGone(n: Now, k: usize) ?f32 { + if (n.annotation != .tied) return null; + if (n.resting()) return 1; + const rows = wordsApart(n.rec, n.stops[1], n.stops[0], if (k == 0) "rsp" else "rbp"); + if (rows == 0) return null; + return switch (n.plan.gait) { + .walk => if (n.plan.pins[k] < 0) null else glide(std.math.clamp((n.time - n.plan.pins[k]) / pinTime(rows, false), 0, 1)), + .run => standard(std.math.clamp(n.time / pinTime(rows, true), 0, 1)), + .sprint => null, + }; + } + + /// Seconds into a walked step when rsp's (`k` 0) or rbp's (1) pin lands: its strike. + pub fn pinLands(n: Now, k: usize) ?f32 { + if (n.annotation != .tied or n.plan.gait != .walk or n.plan.pins[k] < 0) return null; + return n.plan.pins[k] + pinTime(wordsApart(n.rec, n.stops[1], n.stops[0], if (k == 0) "rsp" else "rbp"), false); + } + + /// When the stack's labels that the step changes (an offset whose base + /// moved, the tag's note) crossfade from, under `tied`: as the window + /// follows, else as the last pin lands, else with memory's strike. + pub fn restacked(n: Now) f32 { + if (n.plan.follow >= 0) return n.plan.follow; + var last: ?f32 = null; + for (0..2) |k| if (n.pinLands(k)) |l| { + last = @max(last orelse l, l); + }; + return last orelse n.plan.at[1]; + } + /// The same for a frame that comes in `from` seconds into a walked step. pub fn held(n: Now, from: f32) f32 { const r = time.read; |
