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, 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 == "all")
377 }
378 }
379
380 // Parse scale strictly; malformed requests must not silently render at 1x.
381 float scale = 1.0f;
382 if (req.has_param("scale")) {
383 const auto scale_or =
384 yaze::app::service::ParseRenderScale(req.get_param_value("scale"));
385 if (!scale_or.ok()) {
386 json j;
387 j["error"] = std::string(scale_or.status().message());
388 res.status = 400;
389 res.set_content(j.dump(), "application/json");
390 return;
391 }
392 scale = *scale_or;
393 }
394
396 render_req.room_id = room_id;
397 render_req.overlay_flags = overlay_flags;
398 render_req.scale = scale;
399
400 auto result_or = render_service->RenderDungeonRoom(render_req);
401 if (!result_or.ok()) {
402 const auto& s = result_or.status();
403 json j;
404 j["error"] = std::string(s.message());
405 if (s.code() == absl::StatusCode::kInvalidArgument)
406 res.status = 400;
407 else if (s.code() == absl::StatusCode::kFailedPrecondition)
408 res.status = 503;
409 else
410 res.status = 500;
411 res.set_content(j.dump(), "application/json");
412 return;
413 }
414
415 const auto& result = *result_or;
416 res.status = 200;
417 res.set_content(reinterpret_cast<const char*>(result.png_data.data()),
418 result.png_data.size(), "image/png");
419 res.set_header("X-Room-Id", std::to_string(room_id));
420 res.set_header("X-Room-Width", std::to_string(result.width));
421 res.set_header("X-Room-Height", std::to_string(result.height));
422}
423
425 const httplib::Request& req, httplib::Response& res,
426 yaze::app::service::RenderService* render_service) {
427 ApplyCorsHeaders(res);
428
429 if (!render_service) {
430 json j;
431 j["error"] = "Render service not available";
432 res.status = 503;
433 res.set_content(j.dump(), "application/json");
434 return;
435 }
436
437 int room_id = 0;
438 if (!ParseRoomParam(req, res, room_id))
439 return;
440
441 auto meta_or = render_service->GetDungeonRoomMetadata(room_id);
442 if (!meta_or.ok()) {
443 const auto& s = meta_or.status();
444 json j;
445 j["error"] = std::string(s.message());
446 res.status = (s.code() == absl::StatusCode::kInvalidArgument) ? 400 : 500;
447 res.set_content(j.dump(), "application/json");
448 return;
449 }
450
451 const auto& meta = *meta_or;
452 json j;
453 j["room_id"] = meta.room_id;
454 j["blockset"] = meta.blockset;
455 j["spriteset"] = meta.spriteset;
456 j["palette"] = meta.palette;
457 j["layout_id"] = meta.layout_id;
458 j["effect"] = meta.effect;
459 j["collision"] = meta.collision;
460 j["tag1"] = meta.tag1;
461 j["tag2"] = meta.tag2;
462 j["message_id"] = meta.message_id;
463 j["has_custom_collision"] = meta.has_custom_collision;
464 j["object_count"] = meta.object_count;
465 j["sprite_count"] = meta.sprite_count;
466 res.status = 200;
467 res.set_content(j.dump(), "application/json");
468}
469
470// ---------------------------------------------------------------------------
471// Command execution endpoints (Phase 3)
472// ---------------------------------------------------------------------------
473
474void HandleCommandExecute(const httplib::Request& req, httplib::Response& res,
475 yaze::Rom* rom) {
476 ApplyCorsHeaders(res);
477
478 try {
479 json body = json::parse(req.body);
480 std::string command_name = body.value("command", "");
481 if (command_name.empty()) {
482 json j;
483 j["error"] = "Missing 'command' field";
484 res.status = 400;
485 res.set_content(j.dump(), "application/json");
486 return;
487 }
488
489 std::vector<std::string> args;
490 if (body.contains("args") && body["args"].is_array()) {
491 for (const auto& arg : body["args"]) {
492 args.push_back(arg.get<std::string>());
493 }
494 }
495
496 auto& registry = CommandRegistry::Instance();
497 if (!registry.HasCommand(command_name)) {
498 json j;
499 j["error"] = "Unknown command: " + command_name;
500 res.status = 404;
501 res.set_content(j.dump(), "application/json");
502 return;
503 }
504
505 std::string captured_output;
506 auto status = registry.Execute(command_name, args, rom, &captured_output);
507
508 json response;
509 if (status.ok()) {
510 response["status"] = "ok";
511 response["command"] = command_name;
512 // Try to parse output as JSON, fall back to string
513 try {
514 response["result"] = json::parse(captured_output);
515 } catch (...) {
516 response["result"] = captured_output;
517 }
518 res.status = 200;
519 } else {
520 response["status"] = "error";
521 response["command"] = command_name;
522 response["error"] = std::string(status.message());
523 if (!captured_output.empty()) {
524 response["output"] = captured_output;
525 }
526 res.status = 500;
527 }
528 res.set_content(response.dump(), "application/json");
529 } catch (const std::exception& e) {
530 json j;
531 j["error"] = e.what();
532 res.status = 400;
533 res.set_content(j.dump(), "application/json");
534 }
535}
536
537void HandleCommandList(const httplib::Request& req, httplib::Response& res) {
538 (void)req;
539 ApplyCorsHeaders(res);
540
541 auto& registry = CommandRegistry::Instance();
542 json j_commands = json::array();
543
544 for (const auto& category : registry.GetCategories()) {
545 for (const auto& cmd_name : registry.GetCommandsInCategory(category)) {
546 const auto* meta = registry.GetMetadata(cmd_name);
547 if (!meta)
548 continue;
549
550 json j_cmd;
551 j_cmd["name"] = meta->name;
552 j_cmd["category"] = meta->category;
553 j_cmd["description"] = meta->description;
554 j_cmd["usage"] = meta->usage;
555 j_cmd["requires_rom"] = meta->requires_rom;
556 j_commands.push_back(j_cmd);
557 }
558 }
559
560 json response;
561 response["commands"] = j_commands;
562 response["count"] = j_commands.size();
563 res.status = 200;
564 res.set_content(response.dump(), "application/json");
565}
566
567// ---------------------------------------------------------------------------
568// Annotation CRUD endpoints (Phase 4)
569// ---------------------------------------------------------------------------
570
571namespace {
572
573std::string ResolveAnnotationsPath(const std::string& project_path) {
574 if (project_path.empty())
575 return "";
576 // Match the iOS AnnotationStore resolution logic
577 return project_path + "/Docs/Dev/Planning/annotations.json";
578}
579
580json LoadAnnotationsFile(const std::string& path) {
581 if (path.empty())
582 return json::object();
583 std::ifstream file(path);
584 if (!file.is_open())
585 return json::object();
586 try {
587 return json::parse(file);
588 } catch (...) {
589 return json::object();
590 }
591}
592
593bool SaveAnnotationsFile(const std::string& path, const json& data) {
594 if (path.empty())
595 return false;
596
597 const std::filesystem::path parent =
598 std::filesystem::path(path).parent_path();
599 if (!parent.empty()) {
600 std::error_code error;
601 std::filesystem::create_directories(parent, error);
602 if (error) {
603 return false;
604 }
605 }
606
607 std::ofstream file(path);
608 if (!file.is_open())
609 return false;
610 file << data.dump(2);
611 return file.good();
612}
613
614} // namespace
615
616void HandleAnnotationList(const httplib::Request& req, httplib::Response& res,
617 const std::string& project_path) {
618 ApplyCorsHeaders(res);
619
620 std::string path = ResolveAnnotationsPath(project_path);
621 if (path.empty()) {
622 json j;
623 j["error"] = "No project path configured";
624 res.status = 503;
625 res.set_content(j.dump(), "application/json");
626 return;
627 }
628
629 json file_data = LoadAnnotationsFile(path);
630 json annotations = file_data.value("annotations", json::array());
631
632 // Optional room filter
633 if (req.has_param("room")) {
634 int room_id = 0;
635 try {
636 room_id = std::stoi(req.get_param_value("room"), nullptr, 0);
637 } catch (...) {
638 json j;
639 j["error"] = "Invalid room parameter";
640 res.status = 400;
641 res.set_content(j.dump(), "application/json");
642 return;
643 }
644
645 json filtered = json::array();
646 for (const auto& ann : annotations) {
647 if (ann.value("room_id", -1) == room_id) {
648 filtered.push_back(ann);
649 }
650 }
651 annotations = filtered;
652 }
653
654 json response;
655 response["annotations"] = annotations;
656 res.status = 200;
657 res.set_content(response.dump(), "application/json");
658}
659
660void HandleAnnotationCreate(const httplib::Request& req, httplib::Response& res,
661 const std::string& project_path) {
662 ApplyCorsHeaders(res);
663
664 std::string path = ResolveAnnotationsPath(project_path);
665 if (path.empty()) {
666 json j;
667 j["error"] = "No project path configured";
668 res.status = 503;
669 res.set_content(j.dump(), "application/json");
670 return;
671 }
672
673 try {
674 json new_annotation = json::parse(req.body);
675 json file_data = LoadAnnotationsFile(path);
676
677 if (!file_data.contains("annotations")) {
678 file_data["annotations"] = json::array();
679 }
680 file_data["annotations"].push_back(new_annotation);
681
682 if (SaveAnnotationsFile(path, file_data)) {
683 json response;
684 response["status"] = "ok";
685 response["id"] = new_annotation.value("id", "");
686 res.status = 201;
687 res.set_content(response.dump(), "application/json");
688 } else {
689 json j;
690 j["error"] = "Failed to write annotations file";
691 res.status = 500;
692 res.set_content(j.dump(), "application/json");
693 }
694 } catch (const std::exception& e) {
695 json j;
696 j["error"] = e.what();
697 res.status = 400;
698 res.set_content(j.dump(), "application/json");
699 }
700}
701
702void HandleAnnotationUpdate(const httplib::Request& req, httplib::Response& res,
703 const std::string& project_path) {
704 ApplyCorsHeaders(res);
705
706 std::string path = ResolveAnnotationsPath(project_path);
707 if (path.empty()) {
708 json j;
709 j["error"] = "No project path configured";
710 res.status = 503;
711 res.set_content(j.dump(), "application/json");
712 return;
713 }
714
715 // Extract annotation ID from URL path
716 std::string annotation_id;
717 if (!req.matches.empty() && req.matches.size() > 1) {
718 annotation_id = req.matches[1].str();
719 }
720 if (annotation_id.empty()) {
721 json j;
722 j["error"] = "Missing annotation ID in URL";
723 res.status = 400;
724 res.set_content(j.dump(), "application/json");
725 return;
726 }
727
728 try {
729 json updated = json::parse(req.body);
730 json file_data = LoadAnnotationsFile(path);
731 json& annotations = file_data["annotations"];
732
733 bool found = false;
734 for (auto& ann : annotations) {
735 if (ann.value("id", "") == annotation_id) {
736 // Merge updated fields
737 for (auto it = updated.begin(); it != updated.end(); ++it) {
738 ann[it.key()] = it.value();
739 }
740 found = true;
741 break;
742 }
743 }
744
745 if (!found) {
746 json j;
747 j["error"] = "Annotation not found: " + annotation_id;
748 res.status = 404;
749 res.set_content(j.dump(), "application/json");
750 return;
751 }
752
753 if (SaveAnnotationsFile(path, file_data)) {
754 json response;
755 response["status"] = "ok";
756 response["id"] = annotation_id;
757 res.status = 200;
758 res.set_content(response.dump(), "application/json");
759 } else {
760 json j;
761 j["error"] = "Failed to write annotations file";
762 res.status = 500;
763 res.set_content(j.dump(), "application/json");
764 }
765 } catch (const std::exception& e) {
766 json j;
767 j["error"] = e.what();
768 res.status = 400;
769 res.set_content(j.dump(), "application/json");
770 }
771}
772
773void HandleAnnotationDelete(const httplib::Request& req, httplib::Response& res,
774 const std::string& project_path) {
775 ApplyCorsHeaders(res);
776 (void)req;
777
778 std::string path = ResolveAnnotationsPath(project_path);
779 if (path.empty()) {
780 json j;
781 j["error"] = "No project path configured";
782 res.status = 503;
783 res.set_content(j.dump(), "application/json");
784 return;
785 }
786
787 std::string annotation_id;
788 if (!req.matches.empty() && req.matches.size() > 1) {
789 annotation_id = req.matches[1].str();
790 }
791 if (annotation_id.empty()) {
792 json j;
793 j["error"] = "Missing annotation ID in URL";
794 res.status = 400;
795 res.set_content(j.dump(), "application/json");
796 return;
797 }
798
799 json file_data = LoadAnnotationsFile(path);
800 json& annotations = file_data["annotations"];
801
802 size_t original_size = annotations.size();
803 json filtered = json::array();
804 for (const auto& ann : annotations) {
805 if (ann.value("id", "") != annotation_id) {
806 filtered.push_back(ann);
807 }
808 }
809
810 if (filtered.size() == original_size) {
811 json j;
812 j["error"] = "Annotation not found: " + annotation_id;
813 res.status = 404;
814 res.set_content(j.dump(), "application/json");
815 return;
816 }
817
818 file_data["annotations"] = filtered;
819 if (SaveAnnotationsFile(path, file_data)) {
820 json response;
821 response["status"] = "ok";
822 response["id"] = annotation_id;
823 res.status = 200;
824 res.set_content(response.dump(), "application/json");
825 } else {
826 json j;
827 j["error"] = "Failed to write annotations file";
828 res.status = 500;
829 res.set_content(j.dump(), "application/json");
830 }
831}
832
833} // namespace api
834} // namespace cli
835} // 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:28
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.