feat: log the game's high-score report as a gameplay event
When the game builds its high-score table report for Stern's agent (/api/v1/game/high_score_events - the endpoint the Insider gate already sits on), the logger writes an HSTD line with all four players' scores. This is the report the game sends when a game has changed the table, so the line marks a high-score event with no new per-game RE. The entries themselves (initials, position) live deeper in the report body and stay uncaptured for now - that needs locating the report builder or the in-memory table. Tests: the endpoint trigger and the HSTD line lift into the host harness (the endpoint pointer is a 32-bit register, so the harness maps its string below 4 GiB and the tests run on the Linux leg like the port-gate ones). Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -8671,6 +8671,21 @@ static void gl_switch_log(unsigned id, unsigned level, int hit, int playing)
|
||||
if (fd >= 0) { write(fd, line, len); close(fd); }
|
||||
}
|
||||
|
||||
/* GAMELOG: the game's own high-score report (HSTD_REPORT — the /api/v1/game/high_score_events
|
||||
* the agent gate sees being built): the players' scores as the game reports its table. */
|
||||
static void gl_hstd_report(void)
|
||||
{
|
||||
char tbuf[40], buf[128], one[32];
|
||||
unsigned p, n = 0;
|
||||
gl_rfc3339(tbuf, sizeof tbuf);
|
||||
buf[0] = 0;
|
||||
for (p = 1; p <= 4; p++) {
|
||||
pm_commas(one, sizeof one, pm_score(p));
|
||||
n += (unsigned)pm_snprintf(buf + n, sizeof buf - n, "%sP%u=%s", n ? " " : "", p, one);
|
||||
}
|
||||
pm_log("[GAMELOG] %s HSTD high-score report - %s", tbuf, buf);
|
||||
}
|
||||
|
||||
static void on_switch_edge(unsigned *r)
|
||||
{
|
||||
static volatile int said;
|
||||
@@ -8998,6 +9013,8 @@ static void on_agent_header(unsigned *r)
|
||||
const char *s = (const char *)(unsigned long)r[1];
|
||||
if (s && s[0] == '/') str_copy(insider_endpoint, sizeof insider_endpoint, s, INSIDER_ENDPOINT_MAX - 1);
|
||||
else insider_endpoint[0] = 0;
|
||||
if (insider_blocked(insider_endpoint) == 2) /* the high-score table report */
|
||||
gl_hstd_report();
|
||||
}
|
||||
|
||||
static int on_agent_begin(unsigned *r)
|
||||
|
||||
Reference in New Issue
Block a user