Add floor_watch: hardware watchpoints on the floor the scan finds log which game code reads and writes it, at 60 fps and again at 120 fps or more.

floor_watch.c takes up to twelve of the floor scan's survivors (the platform's rigid body controller unit first, then one per object at the pivot's height), watches them four at a time through the debug registers on every thread (platform.h plat_watch_set, Windows only), counts each access's call chain in a lock-free table and logs the chains with the executable's symbol names after each pass. prof_syms gains a callback form for that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 07:08:09 -05:00
parent c84724da2c
commit cae09a2bcd
11 changed files with 492 additions and 8 deletions

13
runtime/floor_watch.h Normal file
View File

@@ -0,0 +1,13 @@
#pragma once
#include <stdint.h>
// NX2NAVI_FLOOR_WATCH (floor_watch.c): which code reads and writes the floor under Link, from hardware watchpoints on
// the addresses frame_rate.c's floor scan found. Diagnosis, 1.1.1, Windows; off by default.
int floor_watch_wanted(void); // the setting, read once: 1 on
// The scan's survivors once it has them (frame_rate.c floor_scan): n addresses of float triplets, their values at
// that present, whether each lies in the platform's rigid body controller unit, and Link's position. 1 when the watch
// runs from now on.
int floor_watch_found(const uint64_t *addr, const float *val, const int *unit, int n, const float link[3]);
// Each present from then on (frame_rate.c frame_step_present), with the game's frames per update. 0 once the watch is
// done.
int floor_watch_present(const float link[3], int link_ok, float frames);