ppsspp_state_observer
Register named memory probes once, then sample their values repeatedly while the emulator runs to track changing state.
Instructions
PURPOSE: Named memory-probe registry plus running-state observation — register probes once, then sample them cheaply every loop.
USAGE: action + session_id for observe; register needs name + address (+size 1/2/4, description); observe takes comma-separated names and samples.
ROUTING: recurring sampled probes across loops -> here; one-shot paused snapshot -> ppsspp_frame_snapshot; single-address access watch -> ppsspp_breakpoint(action="trace"). BEHAVIOR: STATE-CHANGE. register/clear mutate the registry; observe is reliable while RUNNING. The registry is PER-SESSION (keyed by session_id), seeded from addresses.yaml state_probes; clear removes user-registered probes only, so the configured baseline survives. Delete semantics are IDEMPOTENT: clearing an unknown probe name succeeds (ok), unlike ppsspp_breakpoint mem_remove which rejects missing targets.
RETURNS: {registered|probes|observations, count, success_count, failure_count} — shape depends on the action.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Probe name. Required for action='register'; optional for action='observe' (comma-separated names; omit to observe all registered probes). Ignored for list / clear. | |
| size | No | Read width in bytes (1 = u8, 2 = u16, 4 = u32). Default 4. Used by action='register'. Ignored for all other actions (probe's stored size is used at observe time). | |
| names | No | Comma-separated probe names for action='observe'. If empty, all registered probes are observed. Ignored for all other actions. | |
| action | Yes | Observer operation. Valid values: - 'register': add a probe to the runtime registry (requires name + address; optional size default 4, optional description). - 'list': list all registered probes. - 'observe': read current value of named probe(s) (optional names — omit to observe all); optional samples (default 1) for multi-sample median. - 'clear': clear the runtime registry. | |
| address | No | Required for action='register'. Absolute runtime address to read, as a hex string (e.g. '0x08804000'). Not used by the other actions. The schema default of '0x0' exists for legacy callers -- do NOT rely on it when the action is 'register'. | 0x0 |
| samples | No | Number of samples to take per probe for action='observe' (default 1). If >1, samples are taken with a short yield between reads; the final value is the last read (caller can inspect stability by comparing samples externally). | |
| session_id | Yes | Active session ID. | |
| description | No | Optional human-readable note for action='register'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Raw PPSSPP echo (reserved) | |
| count | Yes | Probe count (register/list/clear) or observation count (observe) | |
| action | Yes | Observer action executed | |
| probes | Yes | All probes (action=list only) | |
| registered | Yes | Probe added (action=register only) | |
| observations | Yes | Per-probe readings (action=observe only) | |
| failure_count | Yes | Failed observations (action=observe only) | |
| success_count | Yes | Successful observations (action=observe only) |