Files
SirHumza--orbisRPC/orbisrpc/focus.h
T
SirHumza 43246c3ab3 god-tier: diag census, v1.1.0, arch docs, CI version gate
- daemon writes diag.json at boot (fw, kinfo-table hit, msgbuf /
  sandbox / shellcore reachability) for the firmware matrix
- focus_msgbuf_ok() reachability probe + host test
- version 1.1.0 (version.h + installer Makefile)
- ARCHITECTURE.md: binaries, detection cascade, gateway states,
  no-exit policy, on-disk state, installer, compat baseline
- CI consistency job: version.h vs Makefile parity gate
2026-09-27 15:31:08 +02:00

29 lines
1.5 KiB
C

/* focus.h - kernel message-buffer focus tracking (event-driven).
* The kernel logs "AppFocusChanged [...]" on every focus switch, which beats
* polling: multi-app ambiguity disappears and system screens (settings,
* browser) become visible instead of "no game". Verified approach: a
* third-party 18KB payload tracks focus exactly this way off kern.msgbuf.
* Everything here fails soft to "unknown" — snapshot probes stay fallback. */
#ifndef ORBISRPC_FOCUS_H
#define ORBISRPC_FOCUS_H
#include <stddef.h>
#define FOCUS_UNKNOWN 0 /* no information (keep previous state) */
#define FOCUS_GAME 1 /* game/app title id (CUSA, PPSA, ...) */
#define FOCUS_SYSTEM 2 /* system app (NPXS...) — settings, browser, etc. */
/* Parse the LAST AppFocusChanged event in a raw msgbuf window.
* Returns 0 and writes the focus target title id, -1 when no event found. */
int focus_parse_appfocus(const char *buf, size_t len,
char *out_tid, size_t cap);
/* 1 game, 2 system (NPXS), 0 unknown prefix. */
int focus_classify(const char *tid);
/* Probe kern.msgbuf candidates, parse last focus event, classify it.
* Returns FOCUS_* class, writes tid when parsed. Never crashes, never
* blocks: unreadable buffer just means FOCUS_UNKNOWN. */
int detect_system_screen(char *out_tid, size_t cap);
/* Reachability probe for the census: 1 if any candidate msgbuf path
* opens, 0 otherwise. No parsing, no logging, no sticky state. */
int focus_msgbuf_ok(void);
#endif