diff options
Diffstat (limited to 'src/control.h')
| -rw-r--r-- | src/control.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/control.h b/src/control.h new file mode 100644 index 0000000..a625853 --- /dev/null +++ b/src/control.h @@ -0,0 +1,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 |
