28 LOG_INFO(
"App",
"Initializing Application instance...");
40 LOG_INFO(
"App",
"Found pending ROM load: %s", start_path.c_str());
41 }
else if (!start_path.empty()) {
42 LOG_INFO(
"App",
"Using configured startup ROM: %s", start_path.c_str());
44 LOG_INFO(
"App",
"No pending ROM, starting empty.");
47 LOG_INFO(
"App",
"WASM build - ROM loading handled via wasm_bootstrap queue.");
55 LOG_ERROR(
"App",
"Failed to initialize controller: %s", std::string(status.message()).c_str());
57 LOG_INFO(
"App",
"Controller initialized successfully. Active: %s",
controller_->IsActive() ?
"Yes" :
"No");
64 if (!start_path.empty() &&
controller_->editor_manager()) {
71 auto rom_getter = [
this]() ->
Rom* {
74 auto rom_loader = [
this](
const std::string& path) ->
bool {
76 auto status =
controller_->editor_manager()->OpenRomOrProject(path);
79 agent_control_server_ = std::make_unique<yaze::agent::AgentControlServer>(
80 &
controller_->editor_manager()->emulator(), rom_getter, rom_loader);
81 agent_control_server_->Start();
82 LOG_INFO(
"App",
"AgentControlServer started on port 50053");
87 LOG_INFO(
"App",
"Initializing gRPC automation services...");
88 canvas_automation_service_ = std::make_unique<CanvasAutomationServiceImpl>();
89 grpc_server_ = std::make_unique<YazeGRPCServer>();
91 auto th_rom_getter = [
this]() {
return controller_->GetCurrentRom(); };
92 auto th_rom_loader = [
this](
const std::string& path) ->
bool {
94 auto status =
controller_->editor_manager()->OpenRomOrProject(path);
99 auto emulator_service =
100 std::make_unique<yaze::net::EmulatorServiceImpl>(
102 th_rom_getter, th_rom_loader);
104 grpc_server_->AddService(std::move(emulator_service));
105 if (!add_status.ok()) {
106 LOG_ERROR(
"App",
"Failed to attach emulator service: %s",
107 std::string(add_status.message()).c_str());
110 LOG_WARN(
"App",
"EditorManager not ready; emulator gRPC disabled");
114 auto status = grpc_server_->Initialize(
120 canvas_automation_service_.get()
124 status = grpc_server_->StartAsync();
126 LOG_ERROR(
"App",
"Failed to start gRPC server: %s", std::string(status.message()).c_str());
131 LOG_ERROR(
"App",
"Failed to initialize gRPC server: %s", std::string(status.message()).c_str());
135 if (canvas_automation_service_) {
136 controller_->SetCanvasAutomationService(canvas_automation_service_.get());
144 yaze::app::wasm::SetRomLoadHandler([](std::string path) {