17#include "absl/status/status.h"
18#include "absl/strings/str_cat.h"
19#include "absl/strings/str_format.h"
20#include "absl/time/clock.h"
21#include "absl/time/time.h"
28#include "imgui/imgui.h"
52 "Captured room screenshot to %s";
56 "Copied report to clipboard and saved issue report to %s";
58 "Copied diagnostics and saved issue report to %s";
65 const int layer_value =
object.GetLayerValue();
67 if (layer_value == 0) {
68 return "Upper layer (BG1)";
70 return layer_value == 1 ?
"Lower layer (BG2)" :
"Invalid selector";
72 switch (layer_value) {
85 static const char* kGroupNames[] = {
86 "HC/Sewers",
"Eastern",
"Desert",
"Hera",
"A-Tower",
"PoD",
"Swamp",
87 "Skull",
"Thieves",
"Ice",
"Misery",
"Turtle",
"GT",
89 constexpr size_t kCount =
sizeof(kGroupNames) /
sizeof(kGroupNames[0]);
90 return blockset < kCount ? kGroupNames[blockset] :
"Custom";
94 return absl::FormatTime(
"%Y%m%d-%H%M%S", absl::Now(), absl::LocalTimeZone());
98 return absl::FormatTime(
"%Y-%m-%d %H:%M:%S %Z", absl::Now(),
99 absl::LocalTimeZone());
103 const auto blocks = room.
blocks();
104 if (blocks.size() < 8) {
105 return "BG sheets: unavailable";
107 return absl::StrFormat(
108 "BG sheets: [%02X %02X %02X %02X %02X %02X %02X %02X]",
109 static_cast<int>(blocks[0]),
static_cast<int>(blocks[1]),
110 static_cast<int>(blocks[2]),
static_cast<int>(blocks[3]),
111 static_cast<int>(blocks[4]),
static_cast<int>(blocks[5]),
112 static_cast<int>(blocks[6]),
static_cast<int>(blocks[7]));
118 return absl::StrFormat(
119 "storage=special-table selector=%d (%s) routine=%d both_bgs=%s",
121 semantics.draws_to_both_bgs ?
"yes" :
"no");
123 return absl::StrFormat(
124 "stream=%s draw_layer=%d effective_bg=%s routine=%d both_bgs=%s",
129 semantics.routine_id, semantics.draws_to_both_bgs ?
"yes" :
"no");
145 size_t max_count, std::string_view prefix) {
146 std::string out = absl::StrFormat(
"%s count=%zu", std::string(prefix).c_str(),
148 const size_t preview_count = std::min<size_t>(tiles.size(), max_count);
149 for (
size_t i = 0; i < preview_count; ++i) {
150 const auto& tile = tiles[i];
151 out += absl::StrFormat(
" [%zu]=0x%03X/p%d/pr%d/h%d/v%d", i, tile.id_,
152 static_cast<int>(tile.palette_), tile.over_ ? 1 : 0,
153 tile.horizontal_mirror_ ? 1 : 0,
154 tile.vertical_mirror_ ? 1 : 0);
156 if (tiles.size() > preview_count) {
157 out += absl::StrFormat(
" ... %zu more", tiles.size() - preview_count);
164 std::vector<zelda3::ObjectDrawer::TileTrace>
writes;
170 if (rom ==
nullptr || !rom->
is_loaded()) {
171 return {.
summary =
"\nDrawer trace: unavailable (ROM not loaded)"};
177 std::vector<zelda3::ObjectDrawer::TileTrace> trace;
179 const auto status = drawer.
DrawObject(obj, bg1, bg2, palette_group);
182 return {.summary = absl::StrFormat(
"\nDrawer trace: unavailable (%s)",
183 std::string(status.message()).c_str())};
187 return {.summary =
"\nDrawer trace: status=ok writes=0"};
190 int min_x = std::numeric_limits<int>::max();
191 int min_y = std::numeric_limits<int>::max();
192 int max_x = std::numeric_limits<int>::min();
193 int max_y = std::numeric_limits<int>::min();
194 std::array<int, 3> layer_counts = {0, 0, 0};
195 std::set<std::tuple<int, int, uint8_t>> unique_cells;
196 for (
const auto& write : trace) {
197 min_x = std::min<int>(min_x, write.x_tile);
198 min_y = std::min<int>(min_y, write.y_tile);
199 max_x = std::max<int>(max_x, write.x_tile);
200 max_y = std::max<int>(max_y, write.y_tile);
201 if (write.layer < layer_counts.size()) {
202 ++layer_counts[write.layer];
204 unique_cells.insert({write.x_tile, write.y_tile, write.layer});
207 std::string out = absl::StrFormat(
208 "\nDrawer trace: status=ok writes=%zu unique_cells=%zu "
209 "bounds_tiles=(%d,%d)..(%d,%d) layer_counts BG1=%d BG2=%d BG3=%d",
210 trace.size(), unique_cells.size(), min_x, min_y, max_x, max_y,
215 const size_t preview_count = std::min<size_t>(trace.size(), 12);
216 for (
size_t i = 0; i < preview_count; ++i) {
217 const auto& write = trace[i];
218 const int palette = (write.flags >> 3) & 0x7;
219 out += absl::StrFormat(
220 "\n write[%zu] %s tile=(%d,%d) id=0x%03X pal=%d pri=%d h=%d v=%d", i,
221 TraceLayerLabel(write.layer), write.x_tile, write.y_tile, write.tile_id,
222 palette, (write.flags & 0x4) ? 1 : 0, (write.flags & 0x1) ? 1 : 0,
223 (write.flags & 0x2) ? 1 : 0);
225 if (trace.size() > preview_count) {
226 out += absl::StrFormat(
"\n ... %zu more write(s)",
227 trace.size() - preview_count);
229 return {.summary = std::move(out), .writes = std::move(trace)};
239 uint8_t trace_flags) {
240 if ((palette_index & 0x0F) == 0) {
243 const uint8_t trace_palette =
static_cast<uint8_t
>((trace_flags >> 3) & 0x7);
244 return static_cast<uint8_t
>((palette_index >> 4) & 0x7) == trace_palette;
248 std::span<const zelda3::ObjectDrawer::TileTrace> trace,
250 constexpr std::array<std::pair<int, int>, 6> kPreferredOffsets = {
251 std::pair{4, 4}, std::pair{3, 3}, std::pair{0, 0},
252 std::pair{7, 7}, std::pair{0, 7}, std::pair{7, 0},
255 for (
size_t i = 0; i < trace.size(); ++i) {
256 const auto& write = trace[i];
257 const int tile_origin_x = write.x_tile * 8;
258 const int tile_origin_y = write.y_tile * 8;
259 const auto label = absl::StrFormat(
260 "object-trace[%zu] tile=(%d,%d) pal=%d", i, write.x_tile, write.y_tile,
261 static_cast<int>((write.flags >> 3) & 0x7));
263 for (
const auto& [dx, dy] : kPreferredOffsets) {
264 const int sample_x = tile_origin_x + dx;
265 const int sample_y = tile_origin_y + dy;
266 const auto comp = palette_debugger.
SamplePixelAt(sample_x, sample_y);
272 for (
int dy = 0; dy < 8; ++dy) {
273 for (
int dx = 0; dx < 8; ++dx) {
274 const int sample_x = tile_origin_x + dx;
275 const int sample_y = tile_origin_y + dy;
276 const auto comp = palette_debugger.
SamplePixelAt(sample_x, sample_y);
279 .
label = label, .x = sample_x, .y = sample_y};
285 if (!trace.empty()) {
286 const auto& write = trace.front();
288 .
label = absl::StrFormat(
"object-trace[0] tile=(%d,%d) pal=%d fallback",
289 write.x_tile, write.y_tile,
290 static_cast<int>((write.flags >> 3) & 0x7)),
291 .x = write.x_tile * 8 + 4,
292 .y = write.y_tile * 8 + 4};
299 std::span<const zelda3::ObjectDrawer::TileTrace> trace,
int selection_x_px,
300 int selection_y_px,
int selection_w_px,
int selection_h_px) {
302 return "trace: writes=0";
305 int min_x = std::numeric_limits<int>::max();
306 int min_y = std::numeric_limits<int>::max();
307 int max_x = std::numeric_limits<int>::min();
308 int max_y = std::numeric_limits<int>::min();
309 std::set<std::tuple<int, int, uint8_t>> unique_cells;
310 for (
const auto& write : trace) {
311 min_x = std::min<int>(min_x, write.x_tile);
312 min_y = std::min<int>(min_y, write.y_tile);
313 max_x = std::max<int>(max_x, write.x_tile);
314 max_y = std::max<int>(max_y, write.y_tile);
315 unique_cells.insert({write.x_tile, write.y_tile, write.layer});
318 const int trace_x_px = min_x * 8;
319 const int trace_y_px = min_y * 8;
320 const int trace_w_px = (max_x - min_x + 1) * 8;
321 const int trace_h_px = (max_y - min_y + 1) * 8;
322 return absl::StrFormat(
323 "trace: writes=%zu unique_cells=%zu bounds_px=(%d,%d,%d,%d) "
324 "delta_vs_selection_px=(%+d,%+d,%+d,%+d)",
325 trace.size(), unique_cells.size(), trace_x_px, trace_y_px, trace_w_px,
326 trace_h_px, trace_x_px - selection_x_px, trace_y_px - selection_y_px,
327 trace_w_px - selection_w_px, trace_h_px - selection_h_px);
331 std::string_view label) {
336 const auto [bounds_x, bounds_y, bounds_w, bounds_h] = door.
GetBounds();
337 const auto [editor_x, editor_y, editor_w, editor_h] = door.
GetEditorBounds();
338 const auto [encoded_b1, encoded_b2] = door.
EncodeBytes();
340 return absl::StrFormat(
342 "- type=%s (0x%02X)\n"
343 "- direction=%s (%d)\n"
345 "- tile_coords=(%d,%d) pixel_coords=(%d,%d)\n"
346 "- dims_tiles=(%d,%d) editor_dims_tiles=(%d,%d)\n"
347 "- bounds_px=(%d,%d,%d,%d) editor_bounds_px=(%d,%d,%d,%d)\n"
348 "- encoded=(0x%02X,0x%02X) original=(0x%02X,0x%02X)",
349 std::string(label).c_str(), index,
351 static_cast<int>(door.
type),
354 tile_y, pixel_x, pixel_y, dims.width_tiles, dims.height_tiles,
355 editor_dims.width_tiles, editor_dims.height_tiles, bounds_x, bounds_y,
356 bounds_w, bounds_h, editor_x, editor_y, editor_w, editor_h, encoded_b1,
365 return std::filesystem::path(rom.
filename()).filename().string();
367 const std::string title = rom.
title();
368 return title.empty() ?
"in-memory ROM" : title;
375 const std::string rom_path =
377 ? std::string(
"in-memory")
379 summary += absl::StrFormat(
384 summary +=
"ROM: unavailable";
388 summary += absl::StrFormat(
400 return absl::StrFormat(
"- [%s] palette=%d colors=%d %s",
405 return absl::StrFormat(
"- [%s] palette=%d %s", event.
location.c_str(),
409 return absl::StrFormat(
"- [%s] colors=%d %s", event.
location.c_str(),
412 return absl::StrFormat(
"- [%s] %s", event.
location.c_str(),
424 std::string entrance_context =
"Entrance:none";
426 const std::string entrance_id_text =
430 const std::string entrance_blockset_text =
431 entrance_blockset != 0xFF
432 ? absl::StrFormat(
"%02X",
static_cast<int>(entrance_blockset))
435 absl::StrFormat(
"Entrance:%s EB:%s", entrance_id_text.c_str(),
436 entrance_blockset_text.c_str());
439 std::string summary = absl::StrFormat(
440 "Room 0x%03X [%s] | B:%02X P:%02X->%02X L:%02X S:%02X | %s | Group:%s | "
441 "Floor:%d Effect:%d Tag1:%d Tag2:%d\n%s\n%s",
444 entrance_context, GetBlocksetGroupName(room.
blockset()), room.
floor1(),
447 BuildEffectiveBlockListSummary(room).c_str());
454 const auto link_diagnostics =
456 if (!link_diagnostics.links.empty() ||
457 !link_diagnostics.staircase_issues.empty()) {
458 summary +=
"\nConnectivity:";
459 for (
const auto& link : link_diagnostics.links) {
463 for (
const auto& issue : link_diagnostics.staircase_issues) {
474 std::string report =
"Dungeon Draw Issue Report\n";
476 report += absl::StrFormat(
477 "\nResolved palette group: 0x%02X\nInteraction mode: %s\nView: BG1=%s "
478 "BG2=%s Grid=%s Bounds=%s Sprites=%s Pots=%s Collision=%s Camera=%s",
490 if (!selected.empty()) {
491 report += absl::StrFormat(
"\nSelected objects: %zu", selected.size());
492 if (selected.size() == 1) {
494 const size_t index = selected.front();
495 if (index < objects.size()) {
496 const auto& obj = objects[index];
497 report += absl::StrFormat(
498 "\nObject: id=0x%03X name=%s pos=(%d,%d) size=0x%02X %s", obj.id_,
499 GetObjectName(obj.id_).c_str(), obj.x_, obj.y_, obj.size_,
500 BuildSelectedObjectSemanticsSummary(obj).c_str());
501 if (
auto tiles = obj.GetTiles(); tiles.ok()) {
503 report += FormatObjectTileSample(*tiles, 16,
"Object tiles:");
506 auto [bounds_x, bounds_y, bounds_w, bounds_h] =
508 bounds_w = std::max(bounds_w, 8);
509 bounds_h = std::max(bounds_h, 8);
510 const int origin_x = obj.x_ * 8;
511 const int origin_y = obj.y_ * 8;
512 const int center_x = bounds_x + std::max(0, (bounds_w / 2) - 1);
513 const int center_y = bounds_y + std::max(0, (bounds_h / 2) - 1);
514 report += absl::StrFormat(
515 "\nObject geometry: selection_bounds_px=(%d,%d,%d,%d) "
516 "object_origin_px=(%d,%d) center_px=(%d,%d)",
517 bounds_x, bounds_y, bounds_w, bounds_h, origin_x, origin_y,
519 const auto trace_report =
521 report += trace_report.summary;
524 auto append_sample = [&](std::string_view label,
int sample_x,
526 const auto comp = palette_debugger.SamplePixelAt(sample_x, sample_y);
527 palette_debugger.AddComparison(comp);
528 const std::string label_text(label);
529 report += absl::StrFormat(
530 "\nPalette sample %s (%d,%d): idx=%d expected=(%d,%d,%d) "
531 "actual=(%d,%d,%d) match=%s",
532 label_text.c_str(), sample_x, sample_y,
533 static_cast<int>(comp.palette_index),
534 static_cast<int>(comp.expected_r),
535 static_cast<int>(comp.expected_g),
536 static_cast<int>(comp.expected_b),
537 static_cast<int>(comp.actual_r),
static_cast<int>(comp.actual_g),
538 static_cast<int>(comp.actual_b), comp.matches ?
"yes" :
"no");
541 if (
auto trace_sample = ChooseObjectTracePaletteSample(
542 trace_report.writes, palette_debugger)) {
543 append_sample(trace_sample->label, trace_sample->x, trace_sample->y);
545 append_sample(
"selection-origin", bounds_x, bounds_y);
546 if (center_x != bounds_x || center_y != bounds_y) {
547 append_sample(
"selection-center", center_x, center_y);
551 report += absl::StrFormat(
552 "\nSelected object index %zu is stale; room currently has %zu "
553 "object(s). Reselect the object and report again if this issue "
555 index, objects.size());
562 switch (selected_entity.type) {
564 const auto& doors = room.
GetDoors();
565 if (selected_entity.index < doors.size()) {
566 const auto& door = doors[selected_entity.index];
567 report += BuildDoorIssueSummary(door, selected_entity.index,
574 if (selected_entity.index < sprites.size()) {
575 const auto& sprite = sprites[selected_entity.index];
576 report += absl::StrFormat(
577 "\nSelected entity: sprite id=0x%02X name=%s pos=(%d,%d) "
580 sprite.y(), sprite.layer());
586 if (selected_entity.index < items.size()) {
587 const auto& item = items[selected_entity.index];
589 absl::StrFormat(
"\nSelected entity: pot item=0x%02X pos=(%d,%d)",
590 item.item, item.GetPixelX(), item.GetPixelY());
600 if (!palette_events.empty()) {
602 absl::StrFormat(
"\nPalette debug events: %zu", palette_events.size());
603 const size_t preview_count = std::min<size_t>(palette_events.size(), 4);
604 const size_t start = palette_events.size() - preview_count;
605 for (
size_t i = start; i < palette_events.size(); ++i) {
606 const auto&
event = palette_events[i];
608 report += FormatPaletteDebugEventForReport(event);
617 std::string report =
"Dungeon Selection Issue Report\n";
620 absl::StrFormat(
"\nInteraction mode: %s\nResolved palette group: 0x%02X",
625 if (!selected_objects.empty()) {
627 absl::StrFormat(
"\nSelected objects: %zu", selected_objects.size());
629 const size_t preview_count = std::min<size_t>(selected_objects.size(), 4);
630 for (
size_t i = 0; i < preview_count; ++i) {
631 const size_t index = selected_objects[i];
632 if (index >= objects.size()) {
633 report += absl::StrFormat(
634 "\n- object[%zu] unavailable; room currently has %zu object(s) "
635 "(selection is stale)",
636 index, objects.size());
639 const auto& obj = objects[index];
640 report += absl::StrFormat(
641 "\n- object[%zu] id=0x%03X name=%s pos=(%d,%d) size=0x%02X %s", index,
642 obj.id_, GetObjectName(obj.id_).c_str(), obj.x_, obj.y_, obj.size_,
643 BuildSelectedObjectSemanticsSummary(obj).c_str());
644 auto [bounds_x, bounds_y, bounds_w, bounds_h] =
646 bounds_w = std::max(bounds_w, 8);
647 bounds_h = std::max(bounds_h, 8);
648 report += absl::StrFormat(
649 "\n geometry: selection_bounds_px=(%d,%d,%d,%d) "
650 "object_origin_px=(%d,%d)",
651 bounds_x, bounds_y, bounds_w, bounds_h, obj.x_ * 8, obj.y_ * 8);
652 if (
auto tiles = obj.GetTiles(); tiles.ok() && !tiles->empty()) {
654 report += FormatObjectTileSample(*tiles, 10,
"tiles:");
656 const auto trace_report =
659 report += BuildObjectTraceBoundsSummary(trace_report.writes, bounds_x,
660 bounds_y, bounds_w, bounds_h);
662 if (selected_objects.size() > preview_count) {
663 report += absl::StrFormat(
"\n- ... %zu more object(s)",
664 selected_objects.size() - preview_count);
671 switch (selected_entity.type) {
673 const auto& doors = room.
GetDoors();
674 if (selected_entity.index < doors.size()) {
675 const auto& door = doors[selected_entity.index];
676 report += BuildDoorIssueSummary(door, selected_entity.index,
684 if (selected_entity.index < sprites.size()) {
685 const auto& sprite = sprites[selected_entity.index];
686 report += absl::StrFormat(
687 "\nSelected sprite[%zu]:\n"
692 selected_entity.index, sprite.id(),
701 if (selected_entity.index < items.size()) {
702 const auto& item = items[selected_entity.index];
703 report += absl::StrFormat(
704 "\nSelected pot item[%zu]:\n"
706 "- pixel_pos=(%d,%d)",
707 selected_entity.index, item.item, item.GetPixelX(),
718 report +=
"\nNo active object or entity selection.";
727 if (!paths_or.ok()) {
758 ImGui::TextWrapped(tr(
"Log target: %s"),
763 ImGui::TextWrapped(tr(
"Screenshot dir: %s"),
767 ImGui::TextWrapped(tr(
"Screenshot: %s"),
771 ImGui::TextWrapped(tr(
"Issue log: %s"),
788 const std::string& title,
const std::string& summary,
789 const std::string& kind_label,
const std::string& diagnostics,
int room_id,
790 int default_category_index) {
796 std::clamp(default_category_index, 0,
807 if (initial_persist_status.ok()) {
809 absl::StrFormat(kIssueReportStatusStartedLog,
816 return initial_persist_status;
820 const std::string& summary,
821 const std::string& kind_label,
822 const std::string& diagnostics,
824 int default_category_index) {
826 room_id, default_category_index);
829 ImGuiWindowFlags_AlwaysAutoResize)) {
838 const char* category_preview =
840 if (ImGui::BeginCombo(tr(
"Category"), category_preview)) {
842 const bool selected =
849 ImGui::SetItemDefaultFocus();
855 ImGui::SetNextItemWidth(kIssueReportDialogWidth);
856 if (ImGui::InputTextWithHint(
"Summary", kIssueReportSummaryHint,
861 if (ImGui::InputTextMultiline(
864 ImVec2(kIssueReportDialogWidth, kIssueReportNotesHeight))) {
871 tr(
"Reports auto-save on open, screenshot capture, copy, or close."));
873 if (ImGui::CollapsingHeader(kIssueReportSectionDiagnostics,
874 ImGuiTreeNodeFlags_DefaultOpen)) {
875 ImGui::InputTextMultiline(
876 kIssueReportPopupIdDiagnostics,
879 ImVec2(kIssueReportDialogWidth, kIssueReportDiagnosticsHeight),
880 ImGuiInputTextFlags_ReadOnly);
885 ? kIssueReportCaptureButtonLabel
886 : kIssueReportRecaptureButtonLabel;
887 if (ImGui::Button(capture_label)) {
892 if (persist_status.ok()) {
894 absl::StrFormat(kIssueReportStatusSavedScreenshot,
911 absl::StrFormat(kIssueReportStatusSavedLog,
921 ImGui::SetClipboardText(report.c_str());
925 absl::StrFormat(kIssueReportStatusCopiedReport,
938 absl::StrFormat(kIssueReportStatusCopiedDiagnostics,
954 ImGui::CloseCurrentPopup();
971 report += absl::StrFormat(
977 report += absl::StrFormat(
"Screenshot: %s\n",
983 report +=
"\nDiagnostics:\n";
992 return absl::FailedPreconditionError(
993 "Room canvas region is not available for screenshot capture");
996 const std::string timestamp = BuildIssueTimestampSlug();
1000 if (!screenshot_path_or.ok()) {
1001 return screenshot_path_or.status();
1004 yaze::test::CaptureRegion region;
1010 auto artifact_or = yaze::test::CaptureHarnessScreenshotRegion(
1011 std::optional<yaze::test::CaptureRegion>(region),
1012 screenshot_path_or->string(),
1014 if (!artifact_or.ok()) {
1015 return artifact_or.status();
1020 return absl::OkStatus();
1022 return absl::UnimplementedError(
1023 "Screenshot capture is unavailable without YAZE_WITH_GRPC");
1040 if (!log_path_or.ok()) {
1041 return log_path_or.status();
1046 return absl::OkStatus();
1052 return absl::OkStatus();
1057 return absl::OkStatus();
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
bool issue_report_popup_status_is_error_
std::string issue_report_popup_screenshot_dir_
int issue_report_category_index_
bool has_canvas_capture_region_
void MarkIssueReportDirty()
bool show_camera_quadrant_overlay_
std::string issue_report_popup_status_message_
bool IsBG1Visible(int room_id) const
std::string issue_report_popup_id_
std::string issue_report_popup_kind_
void RefreshIssueReportOutputTargets()
std::string BuildIssueReportClipboardText() const
std::string issue_report_popup_screenshot_path_
int issue_report_popup_room_id_
void SetIssueReportPopupStatus(std::string message, bool is_error)
char issue_report_summary_[256]
bool show_custom_collision_overlay_
DungeonObjectInteraction object_interaction_
void OpenIssueReportPopup(const std::string &title, const std::string &summary, const std::string &kind_label, const std::string &diagnostics, int room_id, int default_category_index)
absl::Status AppendIssueReportToLog()
std::string BuildRoomMetadataSummary(const zelda3::Room &room, int room_id) const
void DrawIssueReportStatusMessage() const
const project::YazeProject * project_
void DrawIssueReportStorageSummary() const
absl::Status EnsureIssueReportPersisted()
int canvas_capture_height_
std::string issue_report_popup_diagnostics_
gfx::PaletteGroup current_palette_group_
std::string BuildDrawIssueReport(const zelda3::Room &room, int room_id) const
absl::Status PrepareIssueReportPopup(const std::string &title, const std::string &summary, const std::string &kind_label, const std::string &diagnostics, int room_id, int default_category_index)
bool issue_report_popup_persisted_
EntityVisibility entity_visibility_
bool IsBG2Visible(int room_id) const
absl::Status CaptureIssueReportScreenshot()
char issue_report_notes_[2048]
std::string issue_report_popup_last_log_path_
std::string issue_report_popup_log_target_path_
int canvas_capture_width_
std::string issue_report_popup_title_
std::string BuildSelectionIssueReport(const zelda3::Room &room, int room_id) const
SelectedEntity GetSelectedEntity() const
std::vector< size_t > GetSelectedObjectIndices() const
InteractionModeManager & mode_manager()
bool HasEntitySelection() const
const char * GetModeName() const
Get mode name for debugging/UI.
void ClosePersistentPopup(const std::string &popup_id)
void OpenPersistentPopup(const std::string &popup_id, std::function< void()> render_callback)
static DimensionService & Get()
std::tuple< int, int, int, int > GetSelectionBoundsPixels(const RoomObject &obj) const
Draws dungeon objects to background buffers using game patterns.
void ClearTraceCollector()
absl::Status DrawObject(const RoomObject &object, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const gfx::PaletteGroup &palette_group, const DungeonState *state=nullptr, gfx::BackgroundBuffer *layout_bg1=nullptr)
Draw a room object to background buffers.
void SetTraceCollector(std::vector< TileTrace > *collector, bool trace_only=false)
static PaletteDebugger & Get()
const std::vector< PaletteDebugEvent > & GetEvents() const
ColorComparison SamplePixelAt(int x, int y) const
uint8_t GetLayerValue() const
const std::vector< Door > & GetDoors() const
uint8_t spriteset() const
const std::vector< zelda3::Sprite > & GetSprites() const
const std::vector< RoomObject > & GetTileObjects() const
int ResolveDungeonPaletteId() const
uint8_t render_entrance_blockset() const
uint8_t layout_id() const
const std::vector< PotItem > & GetPotItems() const
#define ICON_MD_ADD_A_PHOTO
#define ICON_MD_ASSIGNMENT
#define ICON_MD_CONTENT_COPY
#define ICON_MD_PHOTO_CAMERA
std::string BuildEffectiveBlockListSummary(const zelda3::Room &room)
constexpr char kIssueReportSummaryHint[]
std::string BuildDoorIssueSummary(const zelda3::Room::Door &door, size_t index, std::string_view label)
bool PaletteIndexMatchesTracePalette(uint8_t palette_index, uint8_t trace_flags)
constexpr char kIssueReportStatusStartedLog[]
std::string BuildIssueTimestampSlug()
std::string BuildObjectTraceBoundsSummary(std::span< const zelda3::ObjectDrawer::TileTrace > trace, int selection_x_px, int selection_y_px, int selection_w_px, int selection_h_px)
constexpr char kIssueReportCaptureButtonLabel[]
std::optional< PaletteSamplePoint > ChooseObjectTracePaletteSample(std::span< const zelda3::ObjectDrawer::TileTrace > trace, const zelda3::PaletteDebugger &palette_debugger)
constexpr float kIssueReportDialogWidth
constexpr char kIssueReportStatusCopiedDiagnostics[]
constexpr char kIssueReportPopupIdDiagnostics[]
std::string BuildRomDisplayName(const Rom &rom)
std::string BuildSelectedObjectSemanticsSummary(const zelda3::RoomObject &obj)
std::string BuildIssueTimestampDisplay()
constexpr char kIssueReportStatusSavedLog[]
std::string FormatPaletteDebugEventForReport(const zelda3::PaletteDebugEvent &event)
constexpr char kIssueReportSectionPaths[]
constexpr char kIssueReportRecaptureButtonLabel[]
constexpr char kIssueReportStatusCopiedReport[]
std::string BuildReportSessionSummary(const Rom *rom, const project::YazeProject *project)
ObjectTraceReport BuildObjectTraceReport(Rom *rom, int room_id, const zelda3::RoomObject &obj, const gfx::PaletteGroup &palette_group)
constexpr char kIssueReportStatusSavedScreenshot[]
constexpr float kIssueReportDiagnosticsHeight
std::string FormatObjectTileSample(std::span< const gfx::TileInfo > tiles, size_t max_count, std::string_view prefix)
constexpr char kIssueReportSectionDiagnostics[]
const char * TraceLayerLabel(uint8_t layer)
const char * GetBlocksetGroupName(uint8_t blockset)
const char * GetStoredPlacementLabel(const zelda3::RoomObject &object)
constexpr float kIssueReportNotesHeight
Editors are the view controllers for the application.
std::string FormatDungeonConnectedLinkDescription(const DungeonConnectedRoomLink &link)
DungeonConnectedRoomLinkDiagnostics CollectDungeonConnectedRoomLinkDiagnostics(int room_id, const zelda3::Room &room, const std::function< bool(int, zelda3::DoorDirection)> &has_reciprocal_door)
const char * GetIssueCategoryLabel(int index)
constexpr std::array< const char *, 6 > kDungeonIssueCategoryLabels
absl::StatusOr< std::filesystem::path > AppendDungeonIssueLogEntry(const DungeonIssueLogEntry &entry)
absl::StatusOr< std::filesystem::path > BuildDungeonIssueScreenshotPath(int room_id, const std::string &category_label, const std::string ×tamp_slug)
absl::StatusOr< DungeonIssueReportPaths > ResolveDungeonIssueReportPaths()
std::string FormatDungeonStaircaseIssueDescription(const DungeonStaircaseIssue &issue)
void SeparatorText(const char *label)
std::string ComputeRomHash(const uint8_t *data, size_t size)
ObjectLayerSemantics GetObjectLayerSemantics(const RoomObject &object)
std::string GetRoomLabel(int id)
Convenience function to get a room label.
RoomObject::LayerType MapRoomObjectListIndexToDrawLayer(uint8_t list_index)
constexpr std::string_view GetDoorDirectionName(DoorDirection dir)
Get human-readable name for door direction.
bool UsesRoomObjectStream(const RoomObject &object)
std::string GetObjectName(int object_id)
constexpr std::string_view GetDoorTypeName(DoorType type)
Get human-readable name for door type.
const char * EffectiveBgLayerLabel(EffectiveBgLayer layer)
const char * ResolveSpriteName(uint16_t id)
#define RETURN_IF_ERROR(expr)
std::string observed_issue
std::string screenshot_path
std::string timestamp_display
std::string category_label
std::vector< zelda3::ObjectDrawer::TileTrace > writes
Represents a group of palettes.
Modern project structure with comprehensive settings consolidation.
bool project_opened() const
std::string GetDisplayName() const
Represents a door in a dungeon room.
std::tuple< int, int, int, int > GetEditorBounds() const
Get editor interaction bounds (x, y, width, height in pixels)
std::tuple< int, int, int, int > GetBounds() const
Get bounding rectangle (x, y, width, height in pixels)
uint8_t byte1
Original ROM byte 1 (position data)
DoorDimensions GetDimensions() const
Get door dimensions in tiles.
DoorType type
Door type (determines appearance/behavior)
std::pair< uint8_t, uint8_t > EncodeBytes() const
Encode door data for ROM storage.
DoorDirection direction
Which wall the door is on.
DoorDimensions GetEditorDimensions() const
Get editor interaction dimensions in tiles.
uint8_t position
Encoded position (5-bit, 0-31)
std::pair< int, int > GetPixelCoords() const
Get pixel coordinates for this door.
uint8_t byte2
Original ROM byte 2 (type + direction)
std::pair< int, int > GetTileCoords() const
Get tile coordinates for this door.