refactor(agent): reorganize emulator command handling for gRPC support

- Removed direct inclusion of `emulator_commands.h` in non-gRPC contexts to streamline dependencies.
- Updated CMake configuration to conditionally include emulator command sources only when gRPC is enabled, enhancing modularity.
- Ensured consistent handling of emulator commands across different components.

Benefits:
- Improved code organization and maintainability by clarifying the inclusion of gRPC-related features.
- Enhanced flexibility in managing command handlers based on compilation flags.
This commit is contained in:
scawful
2025-10-11 14:47:31 -04:00
parent ab73a09f47
commit cbbb480b08
4 changed files with 9 additions and 2 deletions

View File

@@ -14,7 +14,6 @@
#include "cli/handlers/game/dungeon_commands.h"
#include "cli/handlers/game/overworld_commands.h"
#include "cli/handlers/tools/gui_commands.h"
#include "cli/handlers/tools/emulator_commands.h"
ABSL_DECLARE_FLAG(bool, quiet);

View File

@@ -2,7 +2,9 @@
#include "cli/handlers/tools/resource_commands.h"
#include "cli/handlers/tools/gui_commands.h"
#ifdef YAZE_WITH_GRPC
#include "cli/handlers/tools/emulator_commands.h"
#endif
#include "cli/handlers/game/dungeon_commands.h"
#include "cli/handlers/game/overworld_commands.h"
#include "cli/handlers/game/message_commands.h"
@@ -95,6 +97,7 @@ std::vector<std::unique_ptr<resources::CommandHandler>> CreateAgentCommandHandle
handlers.push_back(std::make_unique<GuiScreenshotCommandHandler>());
// Emulator & debugger commands
#ifdef YAZE_WITH_GRPC
handlers.push_back(std::make_unique<EmulatorStepCommandHandler>());
handlers.push_back(std::make_unique<EmulatorRunCommandHandler>());
handlers.push_back(std::make_unique<EmulatorPauseCommandHandler>());
@@ -107,6 +110,7 @@ std::vector<std::unique_ptr<resources::CommandHandler>> CreateAgentCommandHandle
handlers.push_back(std::make_unique<EmulatorWriteMemoryCommandHandler>());
handlers.push_back(std::make_unique<EmulatorGetRegistersCommandHandler>());
handlers.push_back(std::make_unique<EmulatorGetMetricsCommandHandler>());
#endif
return handlers;
}