blob: a625853068be034615139967e0d0380b3d9e421e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#ifndef GBC_CONTROL_H
#define GBC_CONTROL_H
#include "gb.h"
// Socket-based external control + debug channel.
//
// This is a superset of the legacy input FIFO: a Unix-domain stream socket that
// accepts the same button-command vocabulary (see render.h / README) *plus*
// emulator-introspection commands (memory read/write, CPU context, single-step,
// breakpoints, watchpoints, run/pause). Because it is a socket it can reply to
// each command and push asynchronous "event stop ..." lines when execution
// halts at a breakpoint / step boundary / watchpoint.
//
// The protocol is line based (one command per line, '\n' terminated). Replies
// begin with "ok" or "err"; asynchronous notifications begin with "event".
// Create and start listening on a Unix-domain socket at `path`. Safe to call
// once at startup. On failure prints to stderr and leaves the channel inactive.
void control_open(const char *path);
void control_close(void);
bool control_active(void);
// Accept new connections and dispatch any pending commands against `gb`.
// Returns false if a client requested the emulator to quit.
bool control_poll(GB *gb);
// True while the debugger is holding execution (no CPU advancement).
bool control_paused(void);
// Advance emulation by up to one video frame, honoring the debugger's
// pause / single-step / breakpoint / watchpoint state. When the control channel
// is inactive this simply runs a full frame like the plain emulator loop.
void control_run_frame(GB *gb);
#endif
|