ppsspp_query
Query PPSSPP debug state—game status, CPU registers, backtrace, threads, modules, and HLE functions—to inspect execution or manage function tracking during emulator debugging.
Instructions
PURPOSE: Aggregate game-state queries — game_state, registers (all or one), backtrace, threads, modules, and function-list management (funcs/func_scan/func_add/func_remove).
USAGE: action + session_id; 'register' needs name; func_scan/func_remove need address; top_n defaults to 100 (pass 0 for the full list — hle.func.list can reach 700+KB).
ROUTING: one-shot PC read -> query(action='register', name='pc') (safe=true pauses for consistency; safe=false for hot-path polling); pause+capture -> ppsspp_frame_snapshot; recurring named probes -> ppsspp_state_observer; game_state / backtrace / threads / modules / HLE func management also here. BEHAVIOR: READ-ONLY. Lookups only — func_add/func_remove mutate the debugger function list. Verified on a live game: threads / modules / funcs / func_scan respond while the CPU is RUNNING (no pause needed); running-state PC/isCurrent reads are LOW trust unless safe=true (which pauses briefly for a consistent, high-trust read).
RETURNS: {action, data, trust_level} — data shape depends on the action.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Required for action='register' (the register name to read) and for action='func_add'. Ignored by func_remove because PPSSPP's hle.func.remove protocol does not accept a name parameter. | |
| safe | No | action=register/registers only: pause the CPU for a consistent read (trust_level='high', same as the retired ppsspp_get_pc) — or read without pausing (trust_level='low', zero cost, racy while running; for hot-path polling). | |
| size | No | Function size in bytes, 'func_add' only. When omitted the server sends no size — on PPSSPP builds where the omit path underflows (v1.20.4-1845 and earlier) this produces an unusable zero-size function, so this tool defaults to sending 4. Pass an explicit size to override. | |
| top_n | No | Limit the number of entries returned for 'funcs' / 'func_scan' actions (default 100). 0 = no limit — hle.func.list can reach 700+KB, pass 0 only when the full list is genuinely needed. | |
| action | Yes | Query action. Valid values: - 'game_state': PPSSPP game status (paused / game title). - 'registers': all CPU registers (GPR + FPU + VFPU). - 'register': single register by name (MIPS ABI name like 'a0'/'v0'/'t9', or 'pc'/'hi'/'lo'). - 'backtrace': HLE call stack (thread optional). - 'threads': PSP thread list (safe: stepping → query → resume). - 'modules': list all loaded HLE modules. - 'funcs': list registered HLE function tracking entries. - 'func_scan': scan HLE functions in a 64KB range starting at address (requires address; CPU must be stepping). - 'func_add': add HLE function tracking (name? and/or address?). - 'func_remove': remove HLE function tracking (address required; PPSSPP protocol only accepts address, no name). | |
| thread | No | Thread ID (backtrace action only; None = current). | |
| address | No | Required for func_remove and func_scan. Function address 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 one of the above. | 0x0 |
| session_id | Yes | Active session ID. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Raw result payload. | |
| text | Yes | Unified text representation. Populated for action='registers' with grouped '── GPR ──' / '── FPU ──' / '── VFPU ──' headers and ' name = 0xVAL' lines, and for action='register' with a single 'name = 0xVAL' line (the requested register name echoed with its hex value). Empty for other actions (use the structured `data` field). | |
| action | Yes | 'game_state' / 'registers' / 'backtrace' / 'threads' / 'modules' / 'funcs' / 'func_scan' / 'func_add' / 'func_remove'. | |
| trust_level | Yes | Trust annotation (threads + pc only). Lowercase enum value: 'high' (stepping-verified) / 'medium' / 'low'. |