yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
api_handlers.cc
Go to the documentation of this file.
2
3#include <algorithm>
4#include <cctype>
5#include <filesystem>
6#include <fstream>
7#include <sstream>
8#include <system_error>
9
10#include "absl/status/status.h"
16#include "httplib.h"
17#include "nlohmann/json.hpp"
18#include "rom/rom.h"
19#include "util/log.h"
20
21namespace yaze {
22namespace cli {
23namespace api {
24
25using json = nlohmann::json;
26
27namespace {
28
29constexpr const char* kCorsAllowOrigin = "*";
30constexpr const char* kCorsAllowHeaders = "Content-Type, Authorization, Accept";
31constexpr const char* kCorsAllowMethods = "GET, POST, OPTIONS";
32constexpr const char* kCorsMaxAge = "86400";
33
34bool IsTruthyParam(const std::string& value, bool param_present) {
35 if (value.empty()) {
36 return param_present;
37 }
38 std::string normalized = value;
39 std::transform(
40 normalized.begin(), normalized.end(), normalized.begin(),
41 [](unsigned char c) { return static_cast<char>(std::tolower(c)); });
42 return normalized == "1" || normalized == "true" || normalized == "yes" ||
43 normalized == "on";
44}
45
46} // namespace
47
48void ApplyCorsHeaders(httplib::Response& res) {
49 res.set_header("Access-Control-Allow-Origin", kCorsAllowOrigin);
50 res.set_header("Access-Control-Allow-Headers", kCorsAllowHeaders);
51 res.set_header("Access-Control-Allow-Methods", kCorsAllowMethods);
52 res.set_header("Access-Control-Max-Age", kCorsMaxAge);
53}
54
55namespace {
56
57void HandleWindowAction(const std::function<bool()>& action,
58 const char* window_state, httplib::Response& res) {
60
61 if (action) {
62 if (action()) {
63 json response;
64 response["status"] = "ok";
65 response["window"] = window_state;
66 res.status = 200;
67 res.set_content(response.dump(), "application/json");
68 return;
69 }
70 res.status = 500;
71 json response;
72 response["status"] = "error";
73 response["message"] = "window action failed";
74 res.set_content(response.dump(), "application/json");
75 return;
76 }
77
78 res.status = 501;
79 json response;
80 response["status"] = "error";
81 response["message"] = "window control unavailable";
82 res.set_content(response.dump(), "application/json");
83}
84
85} // namespace
86
87void HandleHealth(const httplib::Request& req, httplib::Response& res,
88 const BonjourPublisher* bonjour) {
89 (void)req;
90 json j;
91 j["status"] = "ok";
92 j["version"] = "1.0";
93 j["service"] = "yaze-agent-api";
94
95 // Report LAN discovery mechanism availability.
96 if (bonjour && bonjour->IsAvailable()) {
97 j["discovery"] = "bonjour";
98 } else {
99 j["discovery"] = "none";
100 }
101
102 res.status = 200;
103 res.set_content(j.dump(), "application/json");
104 ApplyCorsHeaders(res);
105}
106
107void HandleListModels(const httplib::Request& req, httplib::Response& res) {
108 auto& registry = ModelRegistry::GetInstance();
109 const bool force_refresh =
110 IsTruthyParam(req.get_param_value("refresh"), req.has_param("refresh"));
111 auto models_or = registry.ListAllModels(force_refresh);
112
113 ApplyCorsHeaders(res);
114
115 if (!models_or.ok()) {
116 json j;
117 j["error"] = models_or.status().message();
118 res.status = 500;
119 res.set_content(j.dump(), "application/json");
120 return;
121 }
122
123 json j_models = json::array();
124 for (const auto& info : *models_or) {
125 json j_model;
126 j_model["name"] = info.name;
127 j_model["display_name"] = info.display_name;
128 j_model["provider"] = info.provider;
129 j_model["description"] = info.description;
130 j_model["family"] = info.family;
131 j_model["parameter_size"] = info.parameter_size;
132 j_model["quantization"] = info.quantization;
133 j_model["size_bytes"] = info.size_bytes;
134 j_model["is_local"] = info.is_local;
135 j_models.push_back(j_model);
136 }
137
138 json response;
139 response["models"] = j_models;
140 response["count"] = j_models.size();
141
142 res.status = 200;
143 res.set_content(response.dump(), "application/json");
144}
145
146void HandleGetSymbols(const httplib::Request& req, httplib::Response& res,
148 ApplyCorsHeaders(res);
149
150 std::string format_str = req.get_param_value("format");
151 if (format_str.empty())
152 format_str = "mesen";
153
156 if (format_str == "mesen") {
158 } else if (format_str == "asar") {
160 } else if (format_str == "wla") {
162 } else if (format_str == "bsnes") {
164 } else {
165 json j;
166 j["error"] = "Unsupported symbol format";
167 j["format"] = format_str;
168 j["supported"] = {"mesen", "asar", "wla", "bsnes"};
169 res.status = 400;
170 res.set_content(j.dump(), "application/json");
171 return;
172 }
173
174 if (!symbols) {
175 json j;
176 j["error"] = "Symbol provider not available";
177 res.status = 503;
178 res.set_content(j.dump(), "application/json");
179 return;
180 }
181
182 auto export_or = symbols->ExportSymbols(format);
183 if (export_or.ok()) {
184 const std::string accept = req.has_header("Accept")
185 ? req.get_header_value("Accept")
186 : std::string();
187 const bool wants_json =
188 accept.find("application/json") != std::string::npos;
189 if (wants_json) {
190 json j;
191 j["symbols"] = *export_or;
192 j["format"] = format_str;
193 res.status = 200;
194 res.set_content(j.dump(), "application/json");
195 } else {
196 res.status = 200;
197 res.set_content(*export_or, "text/plain");
198 }
199 } else {
200 json j;
201 j["error"] = export_or.status().message();
202 res.status = 500;
203 res.set_content(j.dump(), "application/json");
204 }
205}
206
207void HandleNavigate(const httplib::Request& req, httplib::Response& res) {
208 ApplyCorsHeaders(res);
209
210 try {
211 json body = json::parse(req.body);
212 uint32_t address = body.value("address", 0);
213 std::string source = body.value("source", "unknown");
214
215 (void)source; // Used in response
216 // Navigate request logged via JSON response
217
218 // TODO: Integrate with yaze's disassembly viewer to jump to address
219 // For now, just acknowledge the request
220 json response;
221 response["status"] = "ok";
222 response["address"] = address;
223 response["message"] = "Navigation request received";
224 res.status = 200;
225 res.set_content(response.dump(), "application/json");
226 } catch (const std::exception& e) {
227 json j;
228 j["error"] = e.what();
229 res.status = 400;
230 res.set_content(j.dump(), "application/json");
231 }
232}
233
234void HandleBreakpointHit(const httplib::Request& req, httplib::Response& res) {
235 ApplyCorsHeaders(res);
236
237 try {
238 json body = json::parse(req.body);
239 uint32_t address = body.value("address", 0);
240 std::string source = body.value("source", "unknown");
241
242 (void)source; // Used in response
243
244 // Log CPU state if provided (for debugging, stored in response)
245 json cpu_info;
246 if (body.contains("cpu_state")) {
247 cpu_info = body["cpu_state"];
248 }
249
250 // TODO: Integrate with RomDebugAgent for analysis
251 json response;
252 response["status"] = "ok";
253 response["address"] = address;
254 res.status = 200;
255 res.set_content(response.dump(), "application/json");
256 } catch (const std::exception& e) {
257 json j;
258 j["error"] = e.what();
259 res.status = 400;
260 res.set_content(j.dump(), "application/json");
261 }
262}
263
264void HandleStateUpdate(const httplib::Request& req, httplib::Response& res) {
265 ApplyCorsHeaders(res);
266
267 try {
268 json body = json::parse(req.body);
269
270 // State update received; store for panel use
271 (void)body; // Will be used when state storage is implemented
272
273 // TODO: Store state for use by MesenDebugPanel and RomDebugAgent
274 json response;
275 response["status"] = "ok";
276 res.status = 200;
277 res.set_content(response.dump(), "application/json");
278 } catch (const std::exception& e) {
279 json j;
280 j["error"] = e.what();
281 res.status = 400;
282 res.set_content(j.dump(), "application/json");
283 }
284}
285
286void HandleWindowShow(const httplib::Request& req, httplib::Response& res,
287 const std::function<bool()>& action) {
288 (void)req;
289 HandleWindowAction(action, "shown", res);
290}
291
292void HandleWindowHide(const httplib::Request& req, httplib::Response& res,
293 const std::function<bool()>& action) {
294 (void)req;
295 HandleWindowAction(action, "hidden", res);
296}
297
298void HandleCorsPreflight(const httplib::Request& req, httplib::Response& res) {
299 (void)req;
300 ApplyCorsHeaders(res);
301 res.status = 204;
302}
303
304// ---------------------------------------------------------------------------
305// Render endpoints
306// ---------------------------------------------------------------------------
307
308namespace {
309
310// Parse "room" query param — accepts decimal or 0x-prefixed hex.
311// Returns false and sets a 400 error response on failure.
312bool ParseRoomParam(const httplib::Request& req, httplib::Response& res,
313 int& room_id) {
314 if (!req.has_param("room")) {
315 json j;
316 j["error"] = "Missing required parameter: room";
317 res.status = 400;
318 res.set_content(j.dump(), "application/json");
319 return false;
320 }
321 const std::string s = req.get_param_value("room");
322 try {
323 room_id = std::stoi(s, nullptr, 0);
324 } catch (...) {
325 json j;
326 j["error"] = "Invalid room parameter";
327 j["value"] = s;
328 res.status = 400;
329 res.set_content(j.dump(), "application/json");
330 return false;
331 }
332 return true;
333}
334
335} // namespace
336
337void HandleRenderDungeon(const httplib::Request& req, httplib::Response& res,
338 yaze::app::service::RenderService* render_service) {
339 ApplyCorsHeaders(res);
340
341 if (!render_service) {
342 json j;
343 j["error"] = "Render service not available";
344 res.status = 503;
345 res.set_content(j.dump(), "application/json");
346 return;
347 }
348
349 int room_id = 0;
350 if (!ParseRoomParam(req, res, room_id))
351 return;
352
353 // Parse overlays — comma-separated: collision, sprites, objects, track,
354 // camera, grid, tiletype, all.
355 uint32_t overlay_flags = yaze::app::service::RenderOverlay::kNone;
356 if (req.has_param("overlays")) {
357 std::istringstream ss(req.get_param_value("overlays"));
358 std::string tok;
359 while (std::getline(ss, tok, ',')) {
360 tok.erase(0, tok.find_first_not_of(" \t"));
361 if (!tok.empty())
362 tok.erase(tok.find_last_not_of(" \t") + 1);
363 if (tok == "collision")
365 else if (tok == "sprites")
367 else if (tok == "objects")
369 else if (tok == "track")
371 else if (tok == "camera")
373 else if (tok == "grid")
375 else if (tok == "tiletype")
377 else if (tok == "all")
379 }
380 }
381
382 // Parse scale strictly; malformed requests must not silently render at 1x.
383 float scale = 1.0f;
384 if (req.has_param("scale")) {
385 const auto scale_or =
386 yaze::app::service::ParseRenderScale(req.get_param_value("scale"));
387 if (!scale_or.ok()) {
388 json j;
389 j["error"] = std::string(scale_or.status().message());
390 res.status = 400;
391 res.set_content(j.dump(), "application/json");
392 return;
393 }
394 scale = *scale_or;
395 }
396
398 render_req.room_id = room_id;
399 render_req.overlay_flags = overlay_flags;
400 render_req.scale = scale;
401
402 auto result_or = render_service->RenderDungeonRoom(render_req);
403 if (!result_or.ok()) {
404 const auto& s = result_or.status();
405 json j;
406 j["error"] = std::string(s.message());
407 if (s.code() == absl::StatusCode::kInvalidArgument)
408 res.status = 400;
409 else if (s.code() == absl::StatusCode::kFailedPrecondition)
410 res.status = 503;
411 else
412 res.status = 500;
413 res.set_content(j.dump(), "application/json");
414 return;
415 }
416
417 const auto& result = *result_or;
418 res.status = 200;
419 res.set_content(reinterpret_cast<const char*>(result.png_data.data()),
420 result.png_data.size(), "image/png");
421 res.set_header("X-Room-Id", std::to_string(room_id));
422 res.set_header("X-Room-Width", std::to_string(result.width));
423 res.set_header("X-Room-Height", std::to_string(result.height));
424}
425
427 const httplib::Request& req, httplib::Response& res,
428 yaze::app::service::RenderService* render_service) {
429 ApplyCorsHeaders(res);
430
431 if (!render_service) {
432 json j;
433 j["error"] = "Render service not available";
434 res.status = 503;
435 res.set_content(j.dump(), "application/json");
436 return;
437 }
438
439 int room_id = 0;
440 if (!ParseRoomParam(req, res, room_id))
441 return;
442
443 auto meta_or = render_service->GetDungeonRoomMetadata(room_id);
444 if (!meta_or.ok()) {
445 const auto& s = meta_or.status();
446 json j;
447 j["error"] = std::string(s.message());
448 res.status = (s.code() == absl::StatusCode::kInvalidArgument) ? 400 : 500;
449 res.set_content(j.dump(), "application/json");
450 return;
451 }
452
453 const auto& meta = *meta_or;
454 json j;
455 j["room_id"] = meta.room_id;
456 j["blockset"] = meta.blockset;
457 j["spriteset"] = meta.spriteset;
458 j["palette"] = meta.palette;
459 j["layout_id"] = meta.layout_id;
460 j["effect"] = meta.effect;
461 j["collision"] = meta.collision;
462 j["tag1"] = meta.tag1;
463 j["tag2"] = meta.tag2;
464 j["message_id"] = meta.message_id;
465 j["has_custom_collision"] = meta.has_custom_collision;
466 j["object_count"] = meta.object_count;
467 j["sprite_count"] = meta.sprite_count;
468 res.status = 200;
469 res.set_content(j.dump(), "application/json");
470}
471
472// ---------------------------------------------------------------------------
473// Command execution endpoints (Phase 3)
474// ---------------------------------------------------------------------------
475
476void HandleCommandExecute(const httplib::Request& req, httplib::Response& res,
477 yaze::Rom* rom) {
478 ApplyCorsHeaders(res);
479
480 try {
481 json body = json::parse(req.body);
482 std::string command_name = body.value("command", "");
483 if (command_name.empty()) {
484 json j;
485 j["error"] = "Missing 'command' field";
486 res.status = 400;
487 res.set_content(j.dump(), "application/json");
488 return;
489 }
490
491 std::vector<std::string> args;
492 if (body.contains("args") && body["args"].is_array()) {
493 for (const auto& arg : body["args"]) {
494 args.push_back(arg.get<std::string>());
495 }
496 }
497
498 auto& registry = CommandRegistry::Instance();
499 if (!registry.HasCommand(command_name)) {
500 json j;
501 j["error"] = "Unknown command: " + command_name;
502 res.status = 404;
503 res.set_content(j.dump(), "application/json");
504 return;
505 }
506
507 std::string captured_output;
508 auto status = registry.Execute(command_name, args, rom, &captured_output);
509
510 json response;
511 if (status.ok()) {
512 response["status"] = "ok";
513 response["command"] = command_name;
514 // Try to parse output as JSON, fall back to string
515 try {
516 response["result"] = json::parse(captured_output);
517 } catch (...) {
518 response["result"] = captured_output;
519 }
520 res.status = 200;
521 } else {
522 response["status"] = "error";
523 response["command"] = command_name;
524 response["error"] = std::string(status.message());
525 if (!captured_output.empty()) {
526 response["output"] = captured_output;
527 }
528 res.status = 500;
529 }
530 res.set_content(response.dump(), "application/json");
531 } catch (const std::exception& e) {
532 json j;
533 j["error"] = e.what();
534 res.status = 400;
535 res.set_content(j.dump(), "application/json");
536 }
537}
538
539void HandleCommandList(const httplib::Request& req, httplib::Response& res) {
540 (void)req;
541 ApplyCorsHeaders(res);
542
543 auto& registry = CommandRegistry::Instance();
544 json j_commands = json::array();
545
546 for (const auto& category : registry.GetCategories()) {
547 for (const auto& cmd_name : registry.GetCommandsInCategory(category)) {
548 const auto* meta = registry.GetMetadata(cmd_name);
549 if (!meta)
550 continue;
551
552 json j_cmd;
553 j_cmd["name"] = meta->name;
554 j_cmd["category"] = meta->category;
555 j_cmd["description"] = meta->description;
556 j_cmd["usage"] = meta->usage;
557 j_cmd["requires_rom"] = meta->requires_rom;
558 j_commands.push_back(j_cmd);
559 }
560 }
561
562 json response;
563 response["commands"] = j_commands;
564 response["count"] = j_commands.size();
565 res.status = 200;
566 res.set_content(response.dump(), "application/json");
567}
568
569// ---------------------------------------------------------------------------
570// Annotation CRUD endpoints (Phase 4)
571// ---------------------------------------------------------------------------
572
573namespace {
574
575std::string ResolveAnnotationsPath(const std::string& project_path) {
576 if (project_path.empty())
577 return "";
578 // Match the iOS AnnotationStore resolution logic
579 return project_path + "/Docs/Dev/Planning/annotations.json";
580}
581
582json LoadAnnotationsFile(const std::string& path) {
583 if (path.empty())
584 return json::object();
585 std::ifstream file(path);
586 if (!file.is_open())
587 return json::object();
588 try {
589 return json::parse(file);
590 } catch (...) {
591 return json::object();
592 }
593}
594
595bool SaveAnnotationsFile(const std::string& path, const json& data) {
596 if (path.empty())
597 return false;
598
599 const std::filesystem::path parent =
600 std::filesystem::path(path).parent_path();
601 if (!parent.empty()) {
602 std::error_code error;
603 std::filesystem::create_directories(parent, error);
604 if (error) {
605 return false;
606 }
607 }
608
609 std::ofstream file(path);
610 if (!file.is_open())
611 return false;
612 file << data.dump(2);
613 return file.good();
614}
615
616} // namespace
617
618void HandleAnnotationList(const httplib::Request& req, httplib::Response& res,
619 const std::string& project_path) {
620 ApplyCorsHeaders(res);
621
622 std::string path = ResolveAnnotationsPath(project_path);
623 if (path.empty()) {
624 json j;
625 j["error"] = "No project path configured";
626 res.status = 503;
627 res.set_content(j.dump(), "application/json");
628 return;
629 }
630
631 json file_data = LoadAnnotationsFile(path);
632 json annotations = file_data.value("annotations", json::array());
633
634 // Optional room filter
635 if (req.has_param("room")) {
636 int room_id = 0;
637 try {
638 room_id = std::stoi(req.get_param_value("room"), nullptr, 0);
639 } catch (...) {
640 json j;
641 j["error"] = "Invalid room parameter";
642 res.status = 400;
643 res.set_content(j.dump(), "application/json");
644 return;
645 }
646
647 json filtered = json::array();
648 for (const auto& ann : annotations) {
649 if (ann.value("room_id", -1) == room_id) {
650 filtered.push_back(ann);
651 }
652 }
653 annotations = filtered;
654 }
655
656 json response;
657 response["annotations"] = annotations;
658 res.status = 200;
659 res.set_content(response.dump(), "application/json");
660}
661
662void HandleAnnotationCreate(const httplib::Request& req, httplib::Response& res,
663 const std::string& project_path) {
664 ApplyCorsHeaders(res);
665
666 std::string path = ResolveAnnotationsPath(project_path);
667 if (path.empty()) {
668 json j;
669 j["error"] = "No project path configured";
670 res.status = 503;
671 res.set_content(j.dump(), "application/json");
672 return;
673 }
674
675 try {
676 json new_annotation = json::parse(req.body);
677 json file_data = LoadAnnotationsFile(path);
678
679 if (!file_data.contains("annotations")) {
680 file_data["annotations"] = json::array();
681 }
682 file_data["annotations"].push_back(new_annotation);
683
684 if (SaveAnnotationsFile(path, file_data)) {
685 json response;
686 response["status"] = "ok";
687 response["id"] = new_annotation.value("id", "");
688 res.status = 201;
689 res.set_content(response.dump(), "application/json");
690 } else {
691 json j;
692 j["error"] = "Failed to write annotations file";
693 res.status = 500;
694 res.set_content(j.dump(), "application/json");
695 }
696 } catch (const std::exception& e) {
697 json j;
698 j["error"] = e.what();
699 res.status = 400;
700 res.set_content(j.dump(), "application/json");
701 }
702}
703
704void HandleAnnotationUpdate(const httplib::Request& req, httplib::Response& res,
705 const std::string& project_path) {
706 ApplyCorsHeaders(res);
707
708 std::string path = ResolveAnnotationsPath(project_path);
709 if (path.empty()) {
710 json j;
711 j["error"] = "No project path configured";
712 res.status = 503;
713 res.set_content(j.dump(), "application/json");
714 return;
715 }
716
717 // Extract annotation ID from URL path
718 std::string annotation_id;
719 if (!req.matches.empty() && req.matches.size() > 1) {
720 annotation_id = req.matches[1].str();
721 }
722 if (annotation_id.empty()) {
723 json j;
724 j["error"] = "Missing annotation ID in URL";
725 res.status = 400;
726 res.set_content(j.dump(), "application/json");
727 return;
728 }
729
730 try {
731 json updated = json::parse(req.body);
732 json file_data = LoadAnnotationsFile(path);
733 json& annotations = file_data["annotations"];
734
735 bool found = false;
736 for (auto& ann : annotations) {
737 if (ann.value("id", "") == annotation_id) {
738 // Merge updated fields
739 for (auto it = updated.begin(); it != updated.end(); ++it) {
740 ann[it.key()] = it.value();
741 }
742 found = true;
743 break;
744 }
745 }
746
747 if (!found) {
748 json j;
749 j["error"] = "Annotation not found: " + annotation_id;
750 res.status = 404;
751 res.set_content(j.dump(), "application/json");
752 return;
753 }
754
755 if (SaveAnnotationsFile(path, file_data)) {
756 json response;
757 response["status"] = "ok";
758 response["id"] = annotation_id;
759 res.status = 200;
760 res.set_content(response.dump(), "application/json");
761 } else {
762 json j;
763 j["error"] = "Failed to write annotations file";
764 res.status = 500;
765 res.set_content(j.dump(), "application/json");
766 }
767 } catch (const std::exception& e) {
768 json j;
769 j["error"] = e.what();
770 res.status = 400;
771 res.set_content(j.dump(), "application/json");
772 }
773}
774
775void HandleAnnotationDelete(const httplib::Request& req, httplib::Response& res,
776 const std::string& project_path) {
777 ApplyCorsHeaders(res);
778 (void)req;
779
780 std::string path = ResolveAnnotationsPath(project_path);
781 if (path.empty()) {
782 json j;
783 j["error"] = "No project path configured";
784 res.status = 503;
785 res.set_content(j.dump(), "application/json");
786 return;
787 }
788
789 std::string annotation_id;
790 if (!req.matches.empty() && req.matches.size() > 1) {
791 annotation_id = req.matches[1].str();
792 }
793 if (annotation_id.empty()) {
794 json j;
795 j["error"] = "Missing annotation ID in URL";
796 res.status = 400;
797 res.set_content(j.dump(), "application/json");
798 return;
799 }
800
801 json file_data = LoadAnnotationsFile(path);
802 json& annotations = file_data["annotations"];
803
804 size_t original_size = annotations.size();
805 json filtered = json::array();
806 for (const auto& ann : annotations) {
807 if (ann.value("id", "") != annotation_id) {
808 filtered.push_back(ann);
809 }
810 }
811
812 if (filtered.size() == original_size) {
813 json j;
814 j["error"] = "Annotation not found: " + annotation_id;
815 res.status = 404;
816 res.set_content(j.dump(), "application/json");
817 return;
818 }
819
820 file_data["annotations"] = filtered;
821 if (SaveAnnotationsFile(path, file_data)) {
822 json response;
823 response["status"] = "ok";
824 response["id"] = annotation_id;
825 res.status = 200;
826 res.set_content(response.dump(), "application/json");
827 } else {
828 json j;
829 j["error"] = "Failed to write annotations file";
830 res.status = 500;
831 res.set_content(j.dump(), "application/json");
832 }
833}
834
835} // namespace api
836} // namespace cli
837} // namespace yaze
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:49
absl::StatusOr< RoomMetadata > GetDungeonRoomMetadata(int room_id)
absl::StatusOr< RenderResult > RenderDungeonRoom(const RenderRequest &req)
static CommandRegistry & Instance()
static ModelRegistry & GetInstance()
Provider for symbol (label) resolution in disassembly.
absl::StatusOr< std::string > ExportSymbols(SymbolFormat format) const
Export all symbols to a string in the specified format.
absl::StatusOr< float > ParseRenderScale(absl::string_view value)
bool IsTruthyParam(const std::string &value, bool param_present)
bool ParseRoomParam(const httplib::Request &req, httplib::Response &res, int &room_id)
void HandleWindowAction(const std::function< bool()> &action, const char *window_state, httplib::Response &res)
bool SaveAnnotationsFile(const std::string &path, const json &data)
std::string ResolveAnnotationsPath(const std::string &project_path)
void HandleStateUpdate(const httplib::Request &req, httplib::Response &res)
void ApplyCorsHeaders(httplib::Response &res)
void HandleCorsPreflight(const httplib::Request &req, httplib::Response &res)
void HandleBreakpointHit(const httplib::Request &req, httplib::Response &res)
void HandleListModels(const httplib::Request &req, httplib::Response &res)
void HandleGetSymbols(const httplib::Request &req, httplib::Response &res, yaze::emu::debug::SymbolProvider *symbols)
void HandleNavigate(const httplib::Request &req, httplib::Response &res)
void HandleWindowShow(const httplib::Request &req, httplib::Response &res, const std::function< bool()> &action)
void HandleAnnotationUpdate(const httplib::Request &req, httplib::Response &res, const std::string &project_path)
void HandleRenderDungeonMetadata(const httplib::Request &req, httplib::Response &res, yaze::app::service::RenderService *render_service)
void HandleRenderDungeon(const httplib::Request &req, httplib::Response &res, yaze::app::service::RenderService *render_service)
void HandleCommandExecute(const httplib::Request &req, httplib::Response &res, yaze::Rom *rom)
void HandleAnnotationDelete(const httplib::Request &req, httplib::Response &res, const std::string &project_path)
nlohmann::json json
void HandleAnnotationList(const httplib::Request &req, httplib::Response &res, const std::string &project_path)
void HandleAnnotationCreate(const httplib::Request &req, httplib::Response &res, const std::string &project_path)
void HandleCommandList(const httplib::Request &req, httplib::Response &res)
void HandleWindowHide(const httplib::Request &req, httplib::Response &res, const std::function< bool()> &action)
void HandleHealth(const httplib::Request &req, httplib::Response &res, const BonjourPublisher *bonjour)
SymbolFormat
Supported symbol file formats.