318 UpdateWelcomeAccentPalette();
330 ImVec2 mouse_pos = ImGui::GetMousePos();
332 bool action_taken =
false;
335 ImGuiViewport* viewport = ImGui::GetMainViewport();
336 ImVec2 viewport_size = viewport->WorkSize;
341 if (dockspace_width < 200.0f) {
342 dockspace_x = viewport->WorkPos.x;
343 dockspace_width = viewport_size.x;
345 float dockspace_center_x = dockspace_x + dockspace_width / 2.0f;
346 float dockspace_center_y = viewport->WorkPos.y + viewport_size.y / 2.0f;
347 ImVec2 center(dockspace_center_x, dockspace_center_y);
352 const float font_scale = ImGui::GetFontSize() / 16.0f;
353 float width = std::clamp(dockspace_width * 0.85f, 480.0f * font_scale,
354 1400.0f * font_scale);
355 float height = std::clamp(viewport_size.y * 0.85f, 360.0f * font_scale,
356 1050.0f * font_scale);
358 ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
359 ImGui::SetNextWindowSize(ImVec2(width, height), ImGuiCond_Always);
362 ImGuiWindowFlags window_flags =
363 ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
364 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBringToFrontOnFocus |
365 ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings;
370 if (ImGui::Begin(
"##WelcomeScreen", p_open, window_flags)) {
374 if (p_open !=
nullptr &&
375 ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) &&
376 ImGui::IsKeyPressed(ImGuiKey_Escape,
false)) {
380 ImDrawList* bg_draw_list = ImGui::GetWindowDrawList();
381 ImVec2 window_pos = ImGui::GetWindowPos();
382 ImVec2 window_size = ImGui::GetWindowSize();
385 struct TriforceConfig {
389 float repel_distance;
392 TriforceConfig triforce_configs[] = {
393 {0.08f, 0.12f, 36.0f, 0.025f, 50.0f},
394 {0.92f, 0.15f, 34.0f, 0.022f, 50.0f},
395 {0.06f, 0.88f, 32.0f, 0.020f, 45.0f},
396 {0.94f, 0.85f, 34.0f, 0.023f, 50.0f},
397 {0.50f, 0.08f, 38.0f, 0.028f, 55.0f},
398 {0.50f, 0.92f, 32.0f, 0.020f, 45.0f},
404 float x = window_pos.x + window_size.x * triforce_configs[i].x_pct;
405 float y = window_pos.y + window_size.y * triforce_configs[i].y_pct;
418 for (
int i = 0; triforces_visible && i <
kNumTriforces; ++i) {
420 float base_x = window_pos.x + window_size.x * triforce_configs[i].x_pct;
421 float base_y = window_pos.y + window_size.y * triforce_configs[i].y_pct;
425 float time_offset = i * 1.2f;
426 float float_speed_x =
428 float float_speed_y =
430 float float_amount_x = (20.0f + (i % 2) * 10.0f) *
432 float float_amount_y =
436 float float_x = std::sin(
animation_time_ * float_speed_x + time_offset) *
445 float dist = std::sqrt(dx * dx + dy * dy);
453 target_pos.x += float_x;
454 target_pos.y += float_y;
459 float dir_x = dx / dist;
460 float dir_y = dy / dist;
463 float normalized_dist = dist / repel_radius;
464 float repel_strength = (1.0f - normalized_dist * normalized_dist) *
465 triforce_configs[i].repel_distance;
467 target_pos.x += dir_x * repel_strength;
468 target_pos.y += dir_y * repel_strength;
481 float adjusted_alpha =
483 if (adjusted_alpha < (1.0f / 255.0f)) {
486 float adjusted_size =
489 adjusted_size, adjusted_alpha, 0.0f);
509 float angle = (rand() % 360) * (
M_PI / 180.0f);
510 float speed = 20.0f + (rand() % 40);
512 ImVec2(std::cos(angle) * speed, std::sin(angle) * speed);
526 float dt = ImGui::GetIO().DeltaTime;
547 ImU32 particle_color = ImGui::GetColorU32(
548 ImVec4(kTriforceGold.x, kTriforceGold.y, kTriforceGold.z, alpha));
549 bg_draw_list->AddCircleFilled(
particles_[i].position,
561 ImDrawList* draw_list = ImGui::GetWindowDrawList();
562 ImVec2 separator_start = ImGui::GetCursorScreenPos();
563 ImVec2 separator_end(separator_start.x + ImGui::GetContentRegionAvail().x,
564 separator_start.y + 1);
565 ImVec4 gold_faded = kTriforceGold;
566 gold_faded.w = 0.18f;
567 ImVec4 blue_faded = kMasterSwordBlue;
568 blue_faded.w = 0.18f;
569 draw_list->AddRectFilledMultiColor(
570 separator_start, separator_end, ImGui::GetColorU32(gold_faded),
571 ImGui::GetColorU32(blue_faded), ImGui::GetColorU32(blue_faded),
572 ImGui::GetColorU32(gold_faded));
574 ImGui::Dummy(ImVec2(0, 14));
576 ImGui::BeginChild(
"WelcomeContent", ImVec2(0, -40),
false);
577 const float content_width = ImGui::GetContentRegionAvail().x;
578 const float content_height = ImGui::GetContentRegionAvail().y;
579 const bool narrow_layout = content_width < 900.0f;
580 const float layout_scale = ImGui::GetFontSize() / 16.0f;
583 const float quick_actions_h = std::clamp(
584 content_height * 0.35f, 160.0f * layout_scale, 300.0f * layout_scale);
585 const float release_h = std::clamp(
586 content_height * 0.32f, 160.0f * layout_scale, 320.0f * layout_scale);
588 ImGui::BeginChild(
"QuickActionsNarrow", ImVec2(0, quick_actions_h),
true,
589 ImGuiWindowFlags_NoScrollbar);
596 ImGui::BeginChild(
"ReleaseHistoryNarrow", ImVec2(0, release_h),
true);
602 ImGui::BeginChild(
"RecentPanelNarrow", ImVec2(0, 0),
true);
607 std::clamp(ImGui::GetContentRegionAvail().x * 0.38f,
608 320.0f * layout_scale, 520.0f * layout_scale);
609 ImGui::BeginChild(
"LeftPanel", ImVec2(left_width, 0),
true,
610 ImGuiWindowFlags_NoScrollbar);
611 const float left_height = ImGui::GetContentRegionAvail().y;
612 const float quick_actions_h = std::clamp(
613 left_height * 0.35f, 180.0f * layout_scale, 300.0f * layout_scale);
615 ImGui::BeginChild(
"QuickActionsWide", ImVec2(0, quick_actions_h),
false,
616 ImGuiWindowFlags_NoScrollbar);
622 ImVec2 sep_start = ImGui::GetCursorScreenPos();
625 ImVec2(sep_start.x + ImGui::GetContentRegionAvail().x, sep_start.y),
626 ImGui::GetColorU32(ImVec4(kMasterSwordBlue.x, kMasterSwordBlue.y,
627 kMasterSwordBlue.z, 0.2f)),
629 ImGui::Dummy(ImVec2(0, 5));
631 ImGui::BeginChild(
"ReleaseHistoryWide", ImVec2(0, 0),
true);
638 ImGui::BeginChild(
"RightPanel", ImVec2(0, 0),
true);
646 ImVec2 footer_start = ImGui::GetCursorScreenPos();
647 ImVec2 footer_end(footer_start.x + ImGui::GetContentRegionAvail().x,
649 ImVec4 red_faded = kHeartRed;
651 ImVec4 green_faded = kHyruleGreen;
652 green_faded.w = 0.3f;
653 draw_list->AddRectFilledMultiColor(
654 footer_start, footer_end, ImGui::GetColorU32(red_faded),
655 ImGui::GetColorU32(green_faded), ImGui::GetColorU32(green_faded),
656 ImGui::GetColorU32(red_faded));
658 ImGui::Dummy(ImVec2(0, 5));
685 ImDrawList* draw_list = ImGui::GetWindowDrawList();
690 float header_alpha = header_progress;
691 float header_offset_y = (1.0f - header_progress) * 20.0f;
693 if (header_progress < 0.001f) {
694 ImGui::Dummy(ImVec2(0, 80));
698 ImFont* header_font =
nullptr;
699 const auto& font_list = ImGui::GetIO().Fonts->Fonts;
700 if (font_list.Size > 2) {
701 header_font = font_list[2];
702 }
else if (font_list.Size > 0) {
703 header_font = font_list[0];
706 ImGui::PushFont(header_font);
711 const float window_width = ImGui::GetWindowSize().x;
712 const float title_width = ImGui::CalcTextSize(title).x;
713 const float xPos = (window_width - title_width) * 0.5f;
716 ImVec2 cursor_pos = ImGui::GetCursorPos();
717 ImGui::SetCursorPos(ImVec2(xPos, cursor_pos.y - header_offset_y));
718 ImVec2 text_pos = ImGui::GetCursorScreenPos();
721 float glow_size = 30.0f;
722 ImU32 glow_color = ImGui::GetColorU32(ImVec4(
723 kTriforceGold.x, kTriforceGold.y, kTriforceGold.z, 0.15f * header_alpha));
724 draw_list->AddCircleFilled(
725 ImVec2(text_pos.x + title_width / 2, text_pos.y + 15), glow_size,
729 ImVec4 title_color = kTriforceGold;
730 title_color.w *= header_alpha;
731 ImGui::TextColored(title_color,
"%s", title);
739 float subtitle_alpha = subtitle_progress;
743 const char* subtitle =
"Yet Another Zelda3 Editor";
744 const float subtitle_width = ImGui::CalcTextSize(subtitle).x;
745 ImGui::SetCursorPosX((window_width - subtitle_width) * 0.5f);
748 ImVec4(text_secondary.x, text_secondary.y, text_secondary.z,
749 text_secondary.w * subtitle_alpha),
752 const std::string version_line =
754 const float version_width = ImGui::CalcTextSize(version_line.c_str()).x;
755 ImGui::SetCursorPosX((window_width - version_width) * 0.5f);
756 ImGui::TextColored(ImVec4(text_disabled.x, text_disabled.y, text_disabled.z,
757 text_disabled.w * subtitle_alpha),
758 "%s", version_line.c_str());
762 float tri_alpha = 0.12f * header_alpha;
763 ImVec2 left_tri_pos(xPos - 80, text_pos.y + 20);
764 ImVec2 right_tri_pos(xPos + title_width + 50, text_pos.y + 20);
765 DrawTriforceBackground(draw_list, left_tri_pos, 20, tri_alpha, 0.0f);
766 DrawTriforceBackground(draw_list, right_tri_pos, 20, tri_alpha, 0.0f);
836 float actions_alpha = actions_progress;
837 float actions_offset_x =
838 (1.0f - actions_progress) * -30.0f;
840 if (actions_progress < 0.001f) {
847 float indent = std::max(0.0f, -actions_offset_x);
849 ImGui::Indent(indent);
852 ImGui::TextColored(kSpiritOrange,
ICON_MD_BOLT " Quick Actions");
857 "Open a ROM or project when you are ready to hack a cartridge — or "
859 "into Prototype Research or the assembly editor first without any "
863 size_t rom_count = 0;
864 size_t project_count = 0;
865 size_t unavailable_count = 0;
866 for (
const auto& recent : entries) {
867 if (recent.unavailable) {
871 if (recent.item_type ==
"ROM") {
873 }
else if (recent.item_type ==
"Project") {
880 "%zu recent entries • %zu ROMs • %zu projects%s", entries.size(),
881 rom_count, project_count,
882 unavailable_count > 0 ?
" • some entries need re-open permission" :
"");
886 const float scale = ImGui::GetFontSize() / 16.0f;
887 const float button_height = std::max(38.0f, 40.0f * scale);
888 const float action_width = ImGui::GetContentRegionAvail().x;
889 float button_width = action_width;
892 auto draw_action_button = [&](
const char* icon,
const char* text,
893 const ImVec4& color,
bool enabled,
894 std::function<void()> callback) {
897 ImVec4(color.x * 0.6f, color.y * 0.6f, color.z * 0.6f, 0.8f)},
898 {ImGuiCol_ButtonHovered, ImVec4(color.x, color.y, color.z, 1.0f)},
899 {ImGuiCol_ButtonActive,
900 ImVec4(color.x * 1.2f, color.y * 1.2f, color.z * 1.2f, 1.0f)},
904 ImGui::BeginDisabled();
906 bool clicked = ImGui::Button(absl::StrFormat(
"%s %s", icon, text).c_str(),
907 ImVec2(button_width, button_height));
910 ImGui::EndDisabled();
912 if (clicked && enabled && callback) {
924 if (ImGui::IsItemHovered()) {
926 " Open .sfc/.smc ROMs and .yaze/.yazeproj project files");
933 kMasterSwordBlue,
true,
937 if (ImGui::IsItemHovered()) {
940 " Opens the Graphics editor with the prototype import lab — CGX, "
942 "COL, BIN, and clipboard tools work without loading a ROM.");
948 if (draw_action_button(
ICON_MD_CODE,
"Assembly Editor (no ROM)",
953 if (ImGui::IsItemHovered()) {
956 " Opens the Assembly editor — open a folder or files and work on asm "
957 "without loading a ROM. ROM-backed disassembly stays disabled until "
965 if (!recent.unavailable) {
966 last_recent = &recent;
971 const std::string resume_label = absl::StrFormat(
972 "Resume Last (%s)", last_recent->
item_type.empty()
975 const std::string resume_path = last_recent->
filepath;
977 kMasterSwordBlue,
true, [
this, resume_path]() {
978 if (open_project_callback_) {
979 open_project_callback_(resume_path);
984 if (ImGui::IsItemHovered()) {
985 ImGui::SetTooltip(
"%s\n%s", last_recent->
name.c_str(),
993 new_project_callback_)) {
996 if (ImGui::IsItemHovered()) {
999 " Create a new project for metadata, labels, and workflow settings");
1003 gui::StyleColorGuard text_guard(ImGuiCol_Text, text_secondary);
1006 "Release highlights and migration notes are now in the panel below.");
1010 if (indent > 0.0f) {
1011 ImGui::Unindent(indent);
1015void WelcomeScreen::DrawRecentProjects() {
1018 entry_time_, 4, kEntryAnimDuration, kEntryStaggerDelay);
1020 if (recent_progress < 0.001f) {
1027 int project_count = 0;
1028 for (
const auto& item : recent_projects_model_.entries()) {
1029 if (item.item_type ==
"ROM") {
1031 }
else if (item.item_type ==
"Project") {
1036 ImGui::TextColored(kMasterSwordBlue,
1039 const float header_spacing = ImGui::GetStyle().ItemSpacing.x;
1040 const float manage_width = ImGui::CalcTextSize(
" Manage").x +
1042 ImGui::GetStyle().FramePadding.x * 2.0f;
1043 const float clear_width = ImGui::CalcTextSize(
" Clear").x +
1045 ImGui::GetStyle().FramePadding.x * 2.0f;
1046 const float total_width = manage_width + clear_width + header_spacing;
1049 const float start_x = ImGui::GetCursorPosX();
1050 const float right_edge = start_x + ImGui::GetContentRegionAvail().x;
1051 const float button_start = std::max(start_x, right_edge - total_width);
1052 ImGui::SetCursorPosX(button_start);
1054 bool can_manage = open_project_management_callback_ !=
nullptr;
1056 ImGui::BeginDisabled();
1058 if (ImGui::SmallButton(
1060 if (open_project_management_callback_) {
1061 open_project_management_callback_();
1065 ImGui::EndDisabled();
1067 ImGui::SameLine(0.0f, header_spacing);
1068 if (ImGui::SmallButton(
1070 recent_projects_model_.ClearAll();
1071 RefreshRecentProjects();
1077 ImGui::Text(
"%d ROMs • %d projects", rom_count, project_count);
1080 DrawUndoRemovalBanner();
1084 if (recent_projects_model_.entries().empty()) {
1089 ImVec2 cursor = ImGui::GetCursorPos();
1090 ImGui::SetCursorPosX(cursor.x + ImGui::GetContentRegionAvail().x * 0.3f);
1092 ImVec4(kTriforceGold.x, kTriforceGold.y, kTriforceGold.z, 0.8f),
1094 ImGui::SetCursorPosX(cursor.x);
1096 ImGui::TextWrapped(
"No recent files yet.\nOpen a ROM or project to begin.");
1100 const float scale = ImGui::GetFontSize() / 16.0f;
1101 const float min_width = kRecentCardBaseWidth * scale;
1102 const float max_width =
1103 kRecentCardBaseWidth * kRecentCardWidthMaxFactor * scale;
1104 const float min_height = kRecentCardBaseHeight * scale;
1105 const float max_height =
1106 kRecentCardBaseHeight * kRecentCardHeightMaxFactor * scale;
1107 const float spacing = ImGui::GetStyle().ItemSpacing.x;
1108 const float aspect_ratio = min_height / std::max(min_width, 1.0f);
1110 GridLayout layout = ComputeGridLayout(
1111 ImGui::GetContentRegionAvail().x, min_width, max_width, min_height,
1112 max_height, min_width, aspect_ratio, spacing);
1114 const auto& entries = recent_projects_model_.entries();
1116 for (
size_t i = 0; i < entries.size(); ++i) {
1118 ImGui::SetCursorPosX(layout.row_start_x);
1121 DrawProjectPanel(entries[i],
static_cast<int>(i),
1122 ImVec2(layout.item_width, layout.item_height));
1125 if (column < layout.columns) {
1126 ImGui::SameLine(0.0f, layout.spacing);
1137 DrawRecentAnnotationPopup();
1140void WelcomeScreen::DrawRecentAnnotationPopup() {
1141 if (pending_annotation_kind_ == RecentAnnotationKind::None)
1147 const char* kPopupId =
"##RecentAnnotationPopup";
1148 if (!ImGui::IsPopupOpen(kPopupId)) {
1149 ImGui::OpenPopup(kPopupId);
1152 ImGui::SetNextWindowSize(ImVec2(420, 0), ImGuiCond_Appearing);
1153 if (ImGui::BeginPopupModal(kPopupId,
nullptr,
1154 ImGuiWindowFlags_AlwaysAutoResize |
1155 ImGuiWindowFlags_NoSavedSettings)) {
1156 const bool renaming =
1157 pending_annotation_kind_ == RecentAnnotationKind::Rename;
1158 ImGui::TextUnformatted(renaming ?
ICON_MD_EDIT " Rename"
1163 ImGui::TextWrapped(
"%s", pending_annotation_path_.c_str());
1167 bool committed =
false;
1169 ImGui::SetNextItemWidth(-1);
1170 if (ImGui::InputText(
"##rename_input", rename_buffer_,
1171 sizeof(rename_buffer_),
1172 ImGuiInputTextFlags_EnterReturnsTrue)) {
1178 "Leave blank to restore the filename. Affects only how this entry "
1179 "is displayed on the welcome screen.");
1182 ImGui::SetNextItemWidth(-1);
1183 ImGui::InputTextMultiline(
"##notes_input", notes_buffer_,
1184 sizeof(notes_buffer_), ImVec2(-1, 120));
1188 "Short free-form note shown on hover. Useful for tagging "
1189 "works-in-progress (\"WIP: palette swap\").");
1196 recent_projects_model_.SetDisplayName(pending_annotation_path_,
1197 std::string(rename_buffer_));
1199 recent_projects_model_.SetNotes(pending_annotation_path_,
1200 std::string(notes_buffer_));
1202 pending_annotation_kind_ = RecentAnnotationKind::None;
1203 pending_annotation_path_.clear();
1204 ImGui::CloseCurrentPopup();
1208 ImGui::IsKeyPressed(ImGuiKey_Escape,
false)) {
1209 pending_annotation_kind_ = RecentAnnotationKind::None;
1210 pending_annotation_path_.clear();
1211 ImGui::CloseCurrentPopup();
1217void WelcomeScreen::DrawUndoRemovalBanner() {
1218 if (!recent_projects_model_.HasUndoableRemoval())
1221 const auto pending = recent_projects_model_.PeekLastRemoval();
1222 if (pending.path.empty())
1230 ImVec4 bg = warning_bg;
1233 const ImVec2 avail = ImGui::GetContentRegionAvail();
1234 const float row_height = ImGui::GetFrameHeight() + 6.0f;
1235 const ImVec2 cursor = ImGui::GetCursorScreenPos();
1236 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1237 draw_list->AddRectFilled(cursor,
1238 ImVec2(cursor.x + avail.x, cursor.y + row_height),
1239 ImGui::GetColorU32(bg), 4.0f);
1241 ImGui::Dummy(ImVec2(0, 3.0f));
1242 ImGui::SameLine(8.0f);
1245 ImGui::Text(
"Removed \"%s\"", pending.display_name.c_str());
1249 const float undo_width = ImGui::CalcTextSize(
ICON_MD_UNDO " Undo").x +
1250 ImGui::GetStyle().FramePadding.x * 2.0f;
1251 const float dismiss_width = ImGui::CalcTextSize(
ICON_MD_CLOSE).x +
1252 ImGui::GetStyle().FramePadding.x * 2.0f;
1253 const float spacing = ImGui::GetStyle().ItemSpacing.x;
1254 const float button_row = undo_width + dismiss_width + spacing;
1255 const float right_edge =
1256 ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x;
1257 ImGui::SetCursorPosX(
1258 std::max(ImGui::GetCursorPosX(), right_edge - button_row - 4.0f));
1261 recent_projects_model_.UndoLastRemoval();
1262 RefreshRecentProjects(
true);
1264 ImGui::SameLine(0.0f, spacing);
1266 recent_projects_model_.DismissLastRemoval();
1268 ImGui::Dummy(ImVec2(0, 2.0f));
1272 const ImVec2& card_size) {
1275 ImGui::PushID(index);
1276 ImGui::BeginGroup();
1284 ImVec2 resolved_card_size = card_size;
1285 ImVec2 cursor_pos = ImGui::GetCursorScreenPos();
1288 float hover_scale = card_hover_scale_[index];
1289 if (hover_scale != 1.0f) {
1290 ImVec2 center(cursor_pos.x + resolved_card_size.x / 2,
1291 cursor_pos.y + resolved_card_size.y / 2);
1292 cursor_pos.x = center.x - (resolved_card_size.x * hover_scale) / 2;
1293 cursor_pos.y = center.y - (resolved_card_size.y * hover_scale) / 2;
1294 resolved_card_size.x *= hover_scale;
1295 resolved_card_size.y *= hover_scale;
1298 ImVec4 accent = kTriforceGold;
1301 }
else if (project.
item_type ==
"ROM") {
1302 accent = kHyruleGreen;
1303 }
else if (project.
item_type ==
"Project") {
1304 accent = kMasterSwordBlue;
1307 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1308 ImVec4 color_top = ImLerp(surface_variant, surface, 0.7f);
1309 ImVec4 color_bottom = ImLerp(surface_variant, surface, 0.3f);
1310 ImU32 color_top_u32 = ImGui::GetColorU32(color_top);
1311 ImU32 color_bottom_u32 = ImGui::GetColorU32(color_bottom);
1312 draw_list->AddRectFilledMultiColor(
1314 ImVec2(cursor_pos.x + resolved_card_size.x,
1315 cursor_pos.y + resolved_card_size.y),
1316 color_top_u32, color_top_u32, color_bottom_u32, color_bottom_u32);
1318 ImU32 border_color =
1319 ImGui::GetColorU32(ImVec4(accent.x, accent.y, accent.z, 0.6f));
1321 draw_list->AddRect(cursor_pos,
1322 ImVec2(cursor_pos.x + resolved_card_size.x,
1323 cursor_pos.y + resolved_card_size.y),
1324 border_color, 6.0f, 0, 2.0f);
1327 ImGui::SetCursorScreenPos(cursor_pos);
1328 ImGui::InvisibleButton(
"ProjectPanel", resolved_card_size);
1329 bool is_hovered = ImGui::IsItemHovered();
1330 bool is_clicked = ImGui::IsItemClicked();
1333 is_hovered ? index : (hovered_card_ == index ? -1 : hovered_card_);
1335 if (ImGui::BeginPopupContextItem(
"ProjectPanelMenu")) {
1340 const std::string new_path =
1342 if (!new_path.empty() && new_path != project.
filepath) {
1343 recent_projects_model_.RelinkRecent(project.
filepath, new_path);
1346 if (ImGui::IsItemHovered()) {
1348 "Point at the new location for this file. Pin/rename/notes are "
1353 if (open_project_callback_) {
1354 open_project_callback_(project.
filepath);
1361 recent_projects_model_.SetPinned(project.
filepath, !project.
pinned);
1364 pending_annotation_kind_ = RecentAnnotationKind::Rename;
1365 pending_annotation_path_ = project.
filepath;
1368 std::snprintf(rename_buffer_,
sizeof(rename_buffer_),
"%s",
1370 ? project.
name.c_str()
1374 pending_annotation_kind_ = RecentAnnotationKind::EditNotes;
1375 pending_annotation_path_ = project.
filepath;
1376 std::snprintf(notes_buffer_,
sizeof(notes_buffer_),
"%s",
1377 project.
notes.c_str());
1381 ImGui::SetClipboardText(project.
filepath.c_str());
1385 " Remove from Recents")) {
1386 recent_projects_model_.RemoveRecent(project.
filepath);
1393 ImGui::GetColorU32(ImVec4(accent.x, accent.y, accent.z, 0.16f));
1394 draw_list->AddRectFilled(cursor_pos,
1395 ImVec2(cursor_pos.x + resolved_card_size.x,
1396 cursor_pos.y + resolved_card_size.y),
1400 const float layout_scale = resolved_card_size.y / kRecentCardBaseHeight;
1401 const float padding = 10.0f * layout_scale;
1402 const float icon_radius = 14.0f * layout_scale;
1403 const float icon_spacing = 10.0f * layout_scale;
1404 const float line_spacing = 2.0f * layout_scale;
1406 const ImVec2 icon_center(cursor_pos.x + padding + icon_radius,
1407 cursor_pos.y + padding + icon_radius);
1408 draw_list->AddCircleFilled(icon_center, icon_radius,
1409 ImGui::GetColorU32(accent), 24);
1413 const ImVec2 icon_size = ImGui::CalcTextSize(item_icon);
1414 ImGui::SetCursorScreenPos(ImVec2(icon_center.x - icon_size.x * 0.5f,
1415 icon_center.y - icon_size.y * 0.5f));
1418 const std::string badge_text =
1420 const ImVec2 badge_text_size = ImGui::CalcTextSize(badge_text.c_str());
1421 const float badge_pad_x = 6.0f * layout_scale;
1422 const float badge_pad_y = 2.0f * layout_scale;
1423 const ImVec2 badge_min(cursor_pos.x + resolved_card_size.x - padding -
1424 badge_text_size.x - (badge_pad_x * 2.0f),
1425 cursor_pos.y + padding);
1426 const ImVec2 badge_max(
1427 badge_min.x + badge_text_size.x + (badge_pad_x * 2.0f),
1428 badge_min.y + badge_text_size.y + (badge_pad_y * 2.0f));
1429 draw_list->AddRectFilled(
1430 badge_min, badge_max,
1431 ImGui::GetColorU32(ImVec4(accent.x, accent.y, accent.z, 0.24f)), 4.0f);
1433 badge_min, badge_max,
1434 ImGui::GetColorU32(ImVec4(accent.x, accent.y, accent.z, 0.50f)), 4.0f);
1436 ImVec2(badge_min.x + badge_pad_x, badge_min.y + badge_pad_y),
1437 ImGui::GetColorU32(text_primary), badge_text.c_str());
1439 const float content_x = icon_center.x + icon_radius + icon_spacing;
1440 const float content_right = badge_min.x - (6.0f * layout_scale);
1441 const float text_max_w = std::max(80.0f, content_right - content_x);
1443 float text_y = cursor_pos.y + padding;
1444 const std::string display_name = EllipsizeText(project.
name, text_max_w);
1445 ImGui::SetCursorScreenPos(ImVec2(content_x, text_y));
1448 text_y += ImGui::GetTextLineHeight() + line_spacing;
1449 ImGui::SetCursorScreenPos(ImVec2(content_x, text_y));
1451 EllipsizeText(project.
rom_title, text_max_w).c_str());
1456 text_y += ImGui::GetTextLineHeight() + line_spacing;
1457 ImGui::SetCursorScreenPos(ImVec2(content_x, text_y));
1459 EllipsizeText(summary, text_max_w).c_str());
1461 text_y += ImGui::GetTextLineHeight() + line_spacing;
1462 const std::string opened_line =
1465 : absl::StrFormat(
"Last opened: %s", project.
last_modified.c_str());
1466 ImGui::SetCursorScreenPos(ImVec2(content_x, text_y));
1468 EllipsizeText(opened_line, text_max_w).c_str());
1471 ImGui::BeginTooltip();
1472 ImGui::TextColored(kMasterSwordBlue,
ICON_MD_INFO " Recent Item");
1474 ImGui::Text(
"Type: %s", badge_text.c_str());
1475 ImGui::Text(
"Name: %s", project.
name.c_str());
1476 ImGui::Text(
"Details: %s", project.
rom_title.c_str());
1480 ImGui::Text(
"Last opened: %s", project.
last_modified.c_str());
1481 ImGui::Text(
"Path: %s", project.
filepath.c_str());
1484 ImGui::EndTooltip();
1488 if (is_clicked && open_project_callback_) {
1489 open_project_callback_(project.
filepath);
1496void WelcomeScreen::DrawTemplatesSection() {
1499 entry_time_, 3, kEntryAnimDuration, kEntryStaggerDelay);
1501 if (templates_progress < 0.001f) {
1508 float content_width = ImGui::GetContentRegionAvail().x;
1509 ImGui::TextColored(kGanonPurple,
ICON_MD_LAYERS " Project Templates");
1510 ImGui::SameLine(content_width - 25);
1511 if (ImGui::SmallButton(show_triforce_settings_ ?
ICON_MD_CLOSE
1513 show_triforce_settings_ = !show_triforce_settings_;
1515 if (ImGui::IsItemHovered()) {
1522 if (show_triforce_settings_) {
1525 "VisualSettingsCompact", ImVec2(0, 115),
1526 {.bg = ImVec4(0.18f, 0.15f, 0.22f, 0.4f)},
true,
1527 ImGuiWindowFlags_NoScrollbar);
1534 bool changed_commit =
false;
1537 ImGui::SetNextItemWidth(-1);
1538 ImGui::SliderFloat(
"##visibility", &triforce_alpha_multiplier_, 0.0f,
1540 if (ImGui::IsItemDeactivatedAfterEdit())
1541 changed_commit =
true;
1544 ImGui::SetNextItemWidth(-1);
1545 ImGui::SliderFloat(
"##speed", &triforce_speed_multiplier_, 0.05f, 1.0f,
1547 if (ImGui::IsItemDeactivatedAfterEdit())
1548 changed_commit =
true;
1551 &triforce_mouse_repel_enabled_)) {
1552 changed_commit =
true;
1556 &particles_enabled_)) {
1557 changed_commit =
true;
1561 triforce_alpha_multiplier_ = 1.0f;
1562 triforce_speed_multiplier_ = 0.3f;
1563 triforce_size_multiplier_ = 1.0f;
1564 triforce_mouse_repel_enabled_ =
true;
1565 particles_enabled_ =
true;
1566 particle_spawn_rate_ = 2.0f;
1567 changed_commit =
true;
1570 if (changed_commit) {
1571 PersistAnimationSettings();
1582 const char* use_when;
1583 const char* what_changes;
1585 const char* template_id;
1586 const char** details;
1591 const char* vanilla_details[] = {
1592 "Edits vanilla data tables (rooms, sprites, maps)",
1593 "No custom ASM required — works with any vanilla ROM",
1594 "Overworld layout stays identical to the original"};
1595 const char* zso3_details[] = {
1596 "Unlocks wider / taller overworld areas",
1597 "Adds custom entrances, exits, items, and properties",
1598 "Extends palettes, GFX groups, and dungeon maps"};
1599 const char* zso2_details[] = {
1600 "Older overworld expansion with parent-area system",
1601 "Lighter footprint than v3 — good for ports of legacy hacks",
1602 "Palette + BG color overrides only"};
1603 const char* rando_details[] = {
1604 "Skips the features that break randomizer patches",
1605 "Leaves ASM hook points alone",
"Keeps the save layout minimal"};
1607 Template templates[] = {
1609 "You want to edit rooms, sprites, or graphics without custom code.",
1610 "Adds project metadata and labels on top of your vanilla ROM. The ROM "
1611 "itself is only changed when you save edits you make in the editors.",
1612 1,
"Vanilla ROM Hack", vanilla_details,
1613 static_cast<int>(
sizeof(vanilla_details) /
sizeof(vanilla_details[0])),
1616 "You want to resize overworld areas and add custom map features.",
1617 "Applies the ZSO3 patch: expands the overworld table, extends palette "
1618 "and GFX group storage, and enables custom entrances/exits.",
1619 2,
"ZSCustomOverworld v3", zso3_details,
1620 static_cast<int>(
sizeof(zso3_details) /
sizeof(zso3_details[0])),
1623 "You're porting an older hack that already uses ZSO v2.",
1624 "Applies the legacy ZSO2 patch. Smaller set of customizations than v3; "
1625 "pick this only if you need compatibility with an existing ZSO2 hack.",
1626 2,
"ZSCustomOverworld v2", zso2_details,
1627 static_cast<int>(
sizeof(zso2_details) /
sizeof(zso2_details[0])),
1630 "You're building a ROM that has to work with ALTTPR or similar.",
1631 "Keeps your changes inside the surface that randomizers patch over, so "
1632 "seeds keep working. Skips ASM hooks and overworld remapping.",
1633 3,
"Randomizer Compatible", rando_details,
1634 static_cast<int>(
sizeof(rando_details) /
sizeof(rando_details[0])),
1638 const int template_count =
1639 static_cast<int>(
sizeof(templates) /
sizeof(templates[0]));
1640 if (selected_template_ < 0 || selected_template_ >= template_count) {
1641 selected_template_ = 0;
1645 const float template_width = ImGui::GetContentRegionAvail().x;
1646 const float scale = ImGui::GetFontSize() / 16.0f;
1647 const bool stack_templates = template_width < 520.0f;
1649 auto draw_template_list = [&]() {
1650 for (
int i = 0; i < template_count; ++i) {
1651 bool is_selected = (selected_template_ == i);
1653 std::optional<gui::StyleColorGuard> header_guard;
1655 header_guard.emplace(std::initializer_list<gui::StyleColorGuard::Entry>{
1657 ImVec4(templates[i].color.x * 0.6f, templates[i].color.y * 0.6f,
1658 templates[i].color.z * 0.6f, 0.6f)}});
1664 if (ImGui::Selectable(
1665 absl::StrFormat(
"%s %s", templates[i].icon, templates[i].name)
1668 selected_template_ = i;
1673 if (ImGui::IsItemHovered()) {
1675 templates[i].name, templates[i].use_when);
1680 auto draw_template_details = [&]() {
1681 const Template& active = templates[selected_template_];
1682 ImGui::TextColored(active.color,
"%s %s", active.icon, active.name);
1688 ImVec4(text_secondary.x, text_secondary.y, text_secondary.z, 0.35f);
1689 for (
int i = 1; i <= 3; ++i) {
1691 ImGui::TextColored(i <= active.skill_level ? active.color : dim,
1694 if (ImGui::IsItemHovered()) {
1695 const char* skill_labels[] = {
"Beginner friendly",
1696 "Some familiarity helps",
1697 "Advanced — know the pipeline"};
1698 ImGui::SetTooltip(
"%s", skill_labels[active.skill_level - 1]);
1709 ImGui::TextWrapped(
ICON_MD_EDIT " What this changes: %s",
1710 active.what_changes);
1714 for (
int i = 0; i < active.detail_count; ++i) {
1717 ImGui::TextColored(text_secondary,
"%s", active.details[i]);
1721 if (stack_templates) {
1722 const float row_height = ImGui::GetTextLineHeightWithSpacing() + 4.0f;
1723 const float list_height = std::clamp(row_height * (template_count + 1),
1724 120.0f * scale, 200.0f * scale);
1725 ImGui::BeginChild(
"TemplateList", ImVec2(0, list_height),
false,
1726 ImGuiWindowFlags_NoScrollbar);
1727 draw_template_list();
1730 ImGui::BeginChild(
"TemplateDetails", ImVec2(0, 0),
false,
1731 ImGuiWindowFlags_NoScrollbar);
1732 draw_template_details();
1734 }
else if (ImGui::BeginTable(
"TemplateGrid", 2,
1735 ImGuiTableFlags_SizingStretchProp)) {
1736 ImGui::TableSetupColumn(
"TemplateList", ImGuiTableColumnFlags_WidthStretch,
1738 ImGui::TableSetupColumn(
"TemplateDetails",
1739 ImGuiTableColumnFlags_WidthStretch, 0.58f);
1741 ImGui::TableNextColumn();
1742 ImGui::BeginChild(
"TemplateList", ImVec2(0, 0),
false,
1743 ImGuiWindowFlags_NoScrollbar);
1744 draw_template_list();
1747 ImGui::TableNextColumn();
1748 ImGui::BeginChild(
"TemplateDetails", ImVec2(0, 0),
false,
1749 ImGuiWindowFlags_NoScrollbar);
1750 draw_template_details();
1761 {ImGuiCol_Button, ImVec4(kSpiritOrange.x * 0.6f, kSpiritOrange.y * 0.6f,
1762 kSpiritOrange.z * 0.6f, 0.8f)},
1763 {ImGuiCol_ButtonHovered, kSpiritOrange},
1764 {ImGuiCol_ButtonActive,
1765 ImVec4(kSpiritOrange.x * 1.2f, kSpiritOrange.y * 1.2f,
1766 kSpiritOrange.z * 1.2f, 1.0f)},
1773 if (new_project_with_template_callback_) {
1774 new_project_with_template_callback_(
1775 templates[selected_template_].template_id);
1776 }
else if (new_project_callback_) {
1778 new_project_callback_();
1783 if (ImGui::IsItemHovered()) {
1785 "%s Create new project with '%s' template\nThis will "
1786 "open a ROM and apply the template settings.",
1831void WelcomeScreen::DrawWhatsNew() {
1834 entry_time_, 5, kEntryAnimDuration, kEntryStaggerDelay);
1836 if (whatsnew_progress < 0.001f) {
1849 DrawThemeQuickSwitcher(
"WelcomeThemeQuickSwitch", ImVec2(-1, 0));
1852 struct ReleaseHighlight {
1857 struct ReleaseEntry {
1859 const char* version;
1863 const ReleaseHighlight* highlights;
1864 int highlight_count;
1867 const ReleaseHighlight highlights_071[] = {
1869 "Welcome screen overhaul: guided New Project wizard + template picker"},
1871 "Recent projects: async ROM scan, pin/rename/notes, 8s undo toast"},
1873 "Welcome actions now surfaced through the command palette"},
1875 "Dungeon editor parity: BG1/BG2 layout routing + pit mask fix"},
1877 "Dungeon ROM-backed object parity tests and render snapshots"},
1879 "Simplified workbench inspector/navigation + action-oriented selection"},
1881 "Lazy session editors + deferred asset loads trim startup footprint"},
1883 "Editor source map: registry/, shell/, system/*/, hack/oracle/ — easier "
1884 "navigation for contributors"},
1886 const ReleaseHighlight highlights_070[] = {
1887 {
ICON_MD_TABLET,
"iOS Remote Control with Bonjour LAN auto-discovery"},
1889 "Remote Room Viewer: browse all 296 dungeon rooms on iPad"},
1891 "Remote Command Runner: z3ed CLI from iPad with autocomplete"},
1892 {
ICON_MD_API,
"Desktop HTTP API: command execute/list + annotation CRUD"},
1894 "Sprite + Screen editor undo/redo and message replace-all"},
1895 {
ICON_MD_ARCHIVE,
"Desktop BPS patch export/import with CRC validation"},
1896 {
ICON_MD_TUNE,
"Themed tab bar and widget adoption across key editors"},
1898 const ReleaseHighlight highlights_062[] = {
1901 {
ICON_MD_TUNE,
"Dungeon placement feedback and editor UX polish"},
1903 const ReleaseHighlight highlights_061[] = {
1905 {
ICON_MD_ARCHIVE,
"Cross-platform .yazeproj verify/pack/unpack flows"},
1906 {
ICON_MD_TUNE,
"Dungeon placement feedback and workbench UX upgrades"},
1909 const ReleaseHighlight highlights_060[] = {
1913 {
ICON_MD_UNDO,
"Unified cross-editor Undo/Redo system"},
1915 const ReleaseHighlight highlights_056[] = {
1916 {
ICON_MD_TRAM,
"Minecart overlays and collision tile validation"},
1917 {
ICON_MD_RULE,
"Track audit tooling with filler/missing-start checks"},
1918 {
ICON_MD_TUNE,
"Object preview stability and layer-aware hover"},
1920 const ReleaseHighlight highlights_055[] = {
1923 {
ICON_MD_BUILD,
"Build cleanup with shared yaze_core_lib target"},
1925 const ReleaseHighlight highlights_054[] = {
1927 {
ICON_MD_SYNC,
"Model registry + API refresh stability"},
1930 const ReleaseHighlight highlights_053[] = {
1935 const ReleaseHighlight highlights_052[] = {
1939 const ReleaseHighlight highlights_051[] = {
1944 const ReleaseHighlight highlights_050[] = {
1950 const ReleaseEntry releases[] = {
1952 "Welcome screen overhaul + dungeon editor parity",
"Apr 2026",
1953 kHyruleGreen, highlights_071,
1954 static_cast<int>(
sizeof(highlights_071) /
sizeof(highlights_071[0]))},
1956 "Feature Completion + iOS Remote Control",
"Mar 2026", kMasterSwordBlue,
1958 static_cast<int>(
sizeof(highlights_070) /
sizeof(highlights_070[0]))},
1960 "Bundle reliability + Oracle workflow hardening",
"Feb 2026",
1961 kSpiritOrange, highlights_062,
1962 static_cast<int>(
sizeof(highlights_062) /
sizeof(highlights_062[0]))},
1964 "Feb 24, 2026", kMasterSwordBlue, highlights_061,
1965 static_cast<int>(
sizeof(highlights_061) /
sizeof(highlights_061[0]))},
1967 "Feb 13, 2026", kTriforceGold, highlights_060,
1968 static_cast<int>(
sizeof(highlights_060) /
sizeof(highlights_060[0]))},
1969 {
ICON_MD_TRAM,
"0.5.6",
"Minecart workflow + editor stability",
1970 "Feb 5, 2026", kSpiritOrange, highlights_056,
1971 static_cast<int>(
sizeof(highlights_056) /
sizeof(highlights_056[0]))},
1973 "Jan 28, 2026", kShadowPurple, highlights_055,
1974 static_cast<int>(
sizeof(highlights_055) /
sizeof(highlights_055[0]))},
1976 "Jan 25, 2026", kMasterSwordBlue, highlights_054,
1977 static_cast<int>(
sizeof(highlights_054) /
sizeof(highlights_054[0]))},
1978 {
ICON_MD_BUILD,
"0.5.3",
"Build + WASM improvements",
"Jan 20, 2026",
1979 kMasterSwordBlue, highlights_053,
1980 static_cast<int>(
sizeof(highlights_053) /
sizeof(highlights_053[0]))},
1981 {
ICON_MD_TUNE,
"0.5.2",
"Runtime guards",
"Jan 20, 2026", kSpiritOrange,
1983 static_cast<int>(
sizeof(highlights_052) /
sizeof(highlights_052[0]))},
1985 kTriforceGold, highlights_051,
1986 static_cast<int>(
sizeof(highlights_051) /
sizeof(highlights_051[0]))},
1988 kHyruleGreen, highlights_050,
1989 static_cast<int>(
sizeof(highlights_050) /
sizeof(highlights_050[0]))},
1993 for (
int i = 0; i < static_cast<int>(
sizeof(releases) /
sizeof(releases[0]));
1995 const auto& release = releases[i];
1996 ImGui::PushID(release.version);
2000 ImGui::TextColored(release.color,
"%s v%s", release.icon, release.version);
2002 ImGui::TextColored(text_secondary,
"%s", release.date);
2003 ImGui::TextColored(text_secondary,
"%s", release.title);
2004 for (
int j = 0; j < release.highlight_count; ++j) {
2007 ImGui::TextColored(release.color,
"%s", release.highlights[j].icon);
2009 ImGui::TextColored(text_secondary,
"%s", release.highlights[j].text);
2019 ImVec4(kMasterSwordBlue.x * 0.6f, kMasterSwordBlue.y * 0.6f,
2020 kMasterSwordBlue.z * 0.6f, 0.8f)},
2021 {ImGuiCol_ButtonHovered, kMasterSwordBlue},