ppsspp_state_observer
Register memory probes and sample live values to monitor PSP emulator memory during execution.
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.
BEHAVIOR: STATE-CHANGE. register/clear mutate the registry; observe is reliable while RUNNING. The registry is PROCESS-wide (shared across sessions), seeded from addresses.yaml state_probes, and is NOT re-seeded after clear within the same process. Delete semantics are IDEMPOTENT: clearing an unknown probe name succeeds (ok), unlike ppsspp_breakpoint mem_remove which rejects missing targets (F-5 contract, 2026-09-08).
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 | Absolute runtime address to read, as a hex string (e.g. '0x08804000'). Required for action='register'; ignored for all other actions. | 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) |