feat(emulator): implement gRPC control server and emulator commands

- Added `AgentControlServer` to manage gRPC connections for emulator control.
- Introduced `EmulatorServiceImpl` with methods for starting, stopping, and controlling the emulator, including button presses and memory operations.
- Created new command handlers for pressing, releasing, and holding emulator buttons.
- Updated CMake configuration to include new source files and proto definitions for the emulator service.

Benefits:
- Enhanced control over the emulator through gRPC, allowing for remote interactions.
- Improved modularity and maintainability of the emulator's command handling.
- Streamlined integration of new features for emulator control and state inspection.
This commit is contained in:
scawful
2025-10-11 13:57:07 -04:00
parent 9ffb7803f5
commit aacc7795c3
10 changed files with 1054 additions and 181 deletions

View File

@@ -34,6 +34,87 @@
"required": ["type", "query"]
}
},
{
"name": "emulator-press-buttons",
"description": "Presses and immediately releases one or more buttons on the SNES controller.",
"parameters": {
"type": "object",
"properties": {
"buttons": {
"type": "string",
"description": "A comma-separated list of buttons to press (e.g., 'A,Right,Start')."
}
},
"required": ["buttons"]
}
},
{
"name": "emulator-hold-buttons",
"description": "Holds down one or more buttons for a specified duration.",
"parameters": {
"type": "object",
"properties": {
"buttons": {
"type": "string",
"description": "A comma-separated list of buttons to hold."
},
"duration": {
"type": "integer",
"description": "The duration in milliseconds to hold the buttons."
}
},
"required": ["buttons", "duration"]
}
},
{
"name": "emulator-get-state",
"description": "Retrieves the current state of the game from the emulator.",
"parameters": {
"type": "object",
"properties": {
"screenshot": {
"type": "boolean",
"description": "Whether to include a screenshot of the current frame."
}
}
}
},
{
"name": "emulator-read-memory",
"description": "Reads a block of memory from the SNES WRAM.",
"parameters": {
"type": "object",
"properties": {
"address": {
"type": "string",
"description": "The memory address to read from (e.g., '0x7E0010')."
},
"length": {
"type": "integer",
"description": "The number of bytes to read."
}
},
"required": ["address"]
}
},
{
"name": "emulator-write-memory",
"description": "Writes a block of data to the SNES WRAM.",
"parameters": {
"type": "object",
"properties": {
"address": {
"type": "string",
"description": "The memory address to write to."
},
"data": {
"type": "string",
"description": "The data to write, as a hex string (e.g., 'AABBCCDD')."
}
},
"required": ["address", "data"]
}
},
{
"name": "dungeon-list-sprites",
"description": "List all sprites in a specific dungeon or room",