summaryrefslogtreecommitdiff
path: root/anim/src/hexdump.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/hexdump.zig')
-rw-r--r--anim/src/hexdump.zig28
1 files changed, 26 insertions, 2 deletions
diff --git a/anim/src/hexdump.zig b/anim/src/hexdump.zig
index a35f091..9b39bf6 100644
--- a/anim/src/hexdump.zig
+++ b/anim/src/hexdump.zig
@@ -46,10 +46,15 @@ pub fn kindOf(things: []const objects.Object, moment: Recording.Moment, addr: u6
/// The rows of a region (`lo .. hi`, sixteen-aligned) a dump of `count`
/// rows shows: all of them, or a window round the first the step touched.
pub fn window(now: cursors.Now, lo: u64, hi: u64, count: usize) u64 {
+ return windowAt(now.rec, now.stops[1], now.stops[0], lo, hi, count);
+}
+
+/// The same for the step from moment `from` to `to`.
+pub fn windowAt(rec: *const Recording, from: u64, to: u64, lo: u64, hi: u64, count: usize) u64 {
const all = (hi - lo) / 16;
if (all <= count) return lo;
var touched: ?u64 = null;
- for ([_][]const Recording.Span{ now.rec.written(now.stops[1], now.stops[0]), now.rec.read(now.stops[1], now.stops[0]) }) |spans| for (spans) |span| {
+ for ([_][]const Recording.Span{ rec.written(from, to), rec.read(from, to) }) |spans| for (spans) |span| {
if (touched == null and span.addr >= lo and span.addr < hi) touched = span.addr & ~@as(u64, 15);
};
const at = touched orelse lo;
@@ -368,6 +373,20 @@ pub fn pointerArcs(arcs: *rows.Arcs, now: cursors.Now, field: u64, from: f32, sh
const time_arc = theme.time.arc;
+/// What the kernel fills strikes a byte every 2 f, as it lands: the
+/// kernel's fill is no write the recording has, so by its own times,
+/// cooling with the advance (`run` from `here`).
+fn givenStrike(now: cursors.Now, of: anytype, here: u64, run: *rows.Run) void {
+ const g = of.given orelse return;
+ const since = g.since orelse return;
+ if (here + run.len <= g.addr or here >= g.addr + g.bytes.len) return;
+ const first = @max(here, g.addr) - g.addr;
+ const struck = since - @as(f32, @floatFromInt(first)) * @import("syscalls.zig").Plan.byte;
+ if (struck >= 0) run.heat = .{ .level = 1, .solid = 1 - std.math.clamp((now.time - now.plan.advance) / theme.time.strike.cool, 0, 1), .in = std.math.clamp(struck / theme.time.strike.in, 0, 1) };
+ run.changed = .{ @intCast(@max(here, g.addr) - here), @intCast(@min(here + run.len, g.addr + g.bytes.len) - 1 - here) };
+ run.apart = 2;
+}
+
/// One arc from the row at `from` to the row of `shown` that holds
/// `target`; a stub toward the rule for one in the region past them, only
/// for the step's (`state.hot`).
@@ -391,6 +410,8 @@ fn aim(arcs: *rows.Arcs, now: cursors.Now, field: u64, target: u64, from: f32, s
// Past the rows: a stub, in the step that touches it, when it is the same region's.
if (!state.hot or rows.regionOf(moment, target) != rows.regionOf(moment, field) or rows.regionOf(moment, target) == .none) return;
arc.stub = true;
+ // Its step's alone (not a loupe's, always full): in as the step begins (12 f), out with the advance, never in a frame.
+ if (state.full < 1) arc.shows *= if (now.resting()) 0 else @min(std.math.clamp(now.time / theme.time.quick, 0, 1), 1 - std.math.clamp((now.time - now.plan.advance) / theme.time.read.out, 0, 1));
arc.to = if (target < shown[0].addr) rule[0] else rule[1];
arcs.add(arc);
}
@@ -606,7 +627,8 @@ fn fieldRow(u: ui.Ui, now: cursors.Now, y: f32, addr: u64, moment: Recording.Mom
if (of.given) |g| for (0..16) |i| {
const a = addr + i;
if (a < g.addr or a >= g.addr + g.bytes.len) continue;
- if (g.since) |since| if (since < @as(f32, @floatFromInt(a - g.addr)) * @import("syscalls.zig").Plan.byte) continue;
+ // Each byte as its strike lands (s+3), the fill coming in under it: never in a frame.
+ if (g.since) |since| if (since < @as(f32, @floatFromInt(a - g.addr)) * @import("syscalls.zig").Plan.byte + theme.time.strike.in / 2.0) continue;
given_values[i] = g.bytes[a - g.addr];
given_known[i] = true;
gives = true;
@@ -643,6 +665,7 @@ fn fieldRow(u: ui.Ui, now: cursors.Now, y: f32, addr: u64, moment: Recording.Mom
if (of.struck) |since| run.heat = now.writtenAt(here, run.len, since - @as(f32, @floatFromInt(field_k)) * cursors.write_apart);
// What the kernel fills lands a byte every 2 f.
if (@import("syscalls.zig").filledAt(now, here) != null) run.apart = 2;
+ givenStrike(now, of, here, &run);
var framed: f32 = 0;
if (fl.mark) |k| if (k < of.marks.len) {
framed = of.marks[k];
@@ -669,6 +692,7 @@ fn fieldRow(u: ui.Ui, now: cursors.Now, y: f32, addr: u64, moment: Recording.Mom
};
run.len = @intCast(end - at);
readings[n] = .{ .at = at, .len = run.len, .reads = .bytes };
+ givenStrike(now, of, here, &run);
}
runs[n] = run;
n += 1;