3#include "absl/strings/str_format.h"
9#include "imgui/misc/cpp/imgui_stdlib.h"
17 : editor_manager_(editor_manager), status_(absl::OkStatus()) {}
135 for (
auto& [name, params] :
popups_) {
136 if (params.is_visible) {
137 OpenPopup(name.c_str());
140 ImGuiWindowFlags popup_flags = params.allow_resize ?
141 ImGuiWindowFlags_None : ImGuiWindowFlags_AlwaysAutoResize;
143 if (BeginPopupModal(name.c_str(),
nullptr, popup_flags)) {
144 params.draw_function();
156 std::string name_str(name);
157 auto it =
popups_.find(name_str);
159 it->second.is_visible =
true;
162 printf(
"[PopupManager] Warning: Popup '%s' not registered. Available popups: ", name);
163 for (
const auto& [key, _] :
popups_) {
164 printf(
"'%s' ", key.c_str());
175 std::string name_str(name);
176 auto it =
popups_.find(name_str);
178 it->second.is_visible =
false;
188 std::string name_str(name);
189 auto it =
popups_.find(name_str);
191 return it->second.is_visible;
205 ImGuiIO
const& io = GetIO();
206 ImVec2 pos(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f);
207 SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
208 ImGuiWindowFlags flags =
209 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration |
210 ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings;
211 return Begin(name,
nullptr, flags);
238 Text(
"Written by: scawful");
240 Text(
"Special Thanks: Zarby89, JaredBrian");
250 if (!current_rom)
return;
252 Text(
"Title: %s", current_rom->title().c_str());
256 Hide(
"ROM Information");
261 using namespace ImGui;
266 static std::string save_as_filename =
"";
271 InputText(
"Filename", &save_as_filename);
277 if (!file_path.empty()) {
278 save_as_filename = file_path;
283 if (Button(absl::StrFormat(
"%s Save",
ICON_MD_SAVE).c_str(),
285 if (!save_as_filename.empty()) {
287 std::string final_filename = save_as_filename;
288 if (final_filename.find(
".sfc") == std::string::npos &&
289 final_filename.find(
".smc") == std::string::npos) {
290 final_filename +=
".sfc";
295 save_as_filename =
"";
304 save_as_filename =
"";
310 using namespace ImGui;
312 static std::string project_name =
"";
313 static std::string project_filepath =
"";
314 static std::string rom_filename =
"";
315 static std::string labels_filename =
"";
316 static std::string code_folder =
"";
318 InputText(
"Project Name", &project_name);
320 if (Button(absl::StrFormat(
"%s Destination Folder",
ICON_MD_FOLDER).c_str(),
325 Text(
"%s", project_filepath.empty() ?
"(Not set)" : project_filepath.c_str());
332 Text(
"%s", rom_filename.empty() ?
"(Not set)" : rom_filename.c_str());
334 if (Button(absl::StrFormat(
"%s Labels File",
ICON_MD_LABEL).c_str(),
339 Text(
"%s", labels_filename.empty() ?
"(Not set)" : labels_filename.c_str());
341 if (Button(absl::StrFormat(
"%s Code Folder",
ICON_MD_CODE).c_str(),
346 Text(
"%s", code_folder.empty() ?
"(Not set)" : code_folder.c_str());
350 if (Button(absl::StrFormat(
"%s Choose Project File Location",
ICON_MD_SAVE).c_str(),
353 if (!project_file_path.empty()) {
354 if (project_file_path.find(
".yaze") == std::string::npos) {
355 project_file_path +=
".yaze";
357 project_filepath = project_file_path;
361 if (Button(absl::StrFormat(
"%s Create Project",
ICON_MD_ADD).c_str(),
363 if (!project_filepath.empty() && !project_name.empty()) {
368 project_filepath =
"";
370 labels_filename =
"";
381 project_filepath =
"";
383 labels_filename =
"";
390 if (CollapsingHeader(absl::StrFormat(
"%s Overworld Editor",
ICON_MD_LAYERS).c_str(), ImGuiTreeNodeFlags_DefaultOpen)) {
391 BulletText(
"LW/DW/SW Tilemap Editing");
392 BulletText(
"LW/DW/SW Map Properties");
393 BulletText(
"Create/Delete/Update Entrances");
394 BulletText(
"Create/Delete/Update Exits");
395 BulletText(
"Create/Delete/Update Sprites");
396 BulletText(
"Create/Delete/Update Items");
397 BulletText(
"Multi-session map editing support");
400 if (CollapsingHeader(absl::StrFormat(
"%s Dungeon Editor",
ICON_MD_CASTLE).c_str())) {
401 BulletText(
"View Room Header Properties");
402 BulletText(
"View Entrance Properties");
403 BulletText(
"Enhanced room navigation");
406 if (CollapsingHeader(absl::StrFormat(
"%s Graphics & Themes",
ICON_MD_PALETTE).c_str())) {
407 BulletText(
"View Decompressed Graphics Sheets");
408 BulletText(
"View/Update Graphics Groups");
409 BulletText(
"5+ Built-in themes (Classic, Cyberpunk, Sunset, Forest, Midnight)");
410 BulletText(
"Custom theme creation and editing");
411 BulletText(
"Theme import/export functionality");
412 BulletText(
"Animated background grid effects");
416 BulletText(
"View Palette Groups");
417 BulletText(
"Enhanced palette editing tools");
418 BulletText(
"Color conversion utilities");
421 if (CollapsingHeader(absl::StrFormat(
"%s Project Management",
ICON_MD_FOLDER).c_str())) {
422 BulletText(
"Multi-session workspace support");
423 BulletText(
"Enhanced project creation and management");
424 BulletText(
"ZScream project format compatibility");
425 BulletText(
"Workspace settings and feature flags");
428 if (CollapsingHeader(absl::StrFormat(
"%s Development Tools",
ICON_MD_BUILD).c_str())) {
429 BulletText(
"Asar 65816 assembler integration");
430 BulletText(
"Enhanced CLI tools with TUI interface");
431 BulletText(
"Memory editor with advanced features");
432 BulletText(
"Hex editor with search and navigation");
433 BulletText(
"Assembly validation and symbol extraction");
436 if (CollapsingHeader(absl::StrFormat(
"%s Save Capabilities",
ICON_MD_SAVE).c_str())) {
437 BulletText(
"All Overworld editing features");
438 BulletText(
"Hex Editor changes");
439 BulletText(
"Theme configurations");
440 BulletText(
"Project settings and workspace layouts");
441 BulletText(
"Custom assembly patches");
445 Hide(
"Supported Features");
450 Text(
"File -> Open");
451 Text(
"Select a ROM file to open");
452 Text(
"Supported ROMs (headered or unheadered):");
453 Text(
"The Legend of Zelda: A Link to the Past");
454 Text(
"US Version 1.0");
455 Text(
"JP Version 1.0");
463 Text(
"Project Menu");
464 Text(
"Create a new project or open an existing one.");
465 Text(
"Save the project to save the current state of the project.");
467 "To save a project, you need to first open a ROM and initialize your "
468 "code path and labels file. Label resource manager can be found in "
469 "the View menu. Code path is set in the Code editor after opening a "
473 Hide(
"Manage Project");
478 TextWrapped(
"Welcome to YAZE v0.3!");
479 TextWrapped(
"This software allows you to modify 'The Legend of Zelda: A Link to the Past' (US or JP) ROMs.");
481 TextWrapped(
"General Tips:");
482 BulletText(
"Experiment flags determine whether certain features are enabled");
483 BulletText(
"Backup files are enabled by default for safety");
484 BulletText(
"Use File > Options to configure settings");
487 Hide(
"Getting Started");
492 TextWrapped(
"Asar 65816 Assembly Integration");
493 TextWrapped(
"YAZE v0.3 includes full Asar assembler support for ROM patching.");
495 TextWrapped(
"Features:");
496 BulletText(
"Cross-platform ROM patching with assembly code");
497 BulletText(
"Symbol extraction with addresses and opcodes");
498 BulletText(
"Assembly validation with error reporting");
499 BulletText(
"Memory-safe operations with automatic ROM size management");
502 Hide(
"Asar Integration");
507 TextWrapped(
"Build Instructions");
508 TextWrapped(
"YAZE uses modern CMake for cross-platform builds.");
510 TextWrapped(
"Quick Start:");
511 BulletText(
"cmake -B build");
512 BulletText(
"cmake --build build --target yaze");
514 TextWrapped(
"Development:");
515 BulletText(
"cmake --preset dev");
516 BulletText(
"cmake --build --preset dev");
519 Hide(
"Build Instructions");
524 TextWrapped(
"Command Line Interface (z3ed)");
525 TextWrapped(
"Enhanced CLI tool with Asar integration.");
527 TextWrapped(
"Commands:");
528 BulletText(
"z3ed asar patch.asm --rom=file.sfc");
529 BulletText(
"z3ed extract symbols.asm");
530 BulletText(
"z3ed validate assembly.asm");
531 BulletText(
"z3ed patch file.bps --rom=file.sfc");
539 TextWrapped(
"Troubleshooting");
540 TextWrapped(
"Common issues and solutions:");
542 BulletText(
"ROM won't load: Check file format (SFC/SMC supported)");
543 BulletText(
"Graphics issues: Try disabling experimental features");
544 BulletText(
"Performance: Enable hardware acceleration in display settings");
545 BulletText(
"Crashes: Check ROM file integrity and available memory");
548 Hide(
"Troubleshooting");
553 TextWrapped(
"Contributing to YAZE");
554 TextWrapped(
"YAZE is open source and welcomes contributions!");
556 TextWrapped(
"How to contribute:");
557 BulletText(
"Fork the repository on GitHub");
558 BulletText(
"Create feature branches for new work");
559 BulletText(
"Follow C++ coding standards");
560 BulletText(
"Include tests for new features");
561 BulletText(
"Submit pull requests for review");
564 Hide(
"Contributing");
569 TextWrapped(
"What's New in YAZE v0.3");
572 if (CollapsingHeader(absl::StrFormat(
"%s User Interface & Theming",
ICON_MD_PALETTE).c_str(), ImGuiTreeNodeFlags_DefaultOpen)) {
573 BulletText(
"Complete theme management system with 5+ built-in themes");
574 BulletText(
"Custom theme editor with save-to-file functionality");
575 BulletText(
"Animated background grid with breathing effects (optional)");
576 BulletText(
"Enhanced welcome screen with themed elements");
577 BulletText(
"Multi-session workspace support with docking");
578 BulletText(
"Improved editor organization and navigation");
581 if (CollapsingHeader(absl::StrFormat(
"%s Development & Build System",
ICON_MD_BUILD).c_str(), ImGuiTreeNodeFlags_DefaultOpen)) {
582 BulletText(
"Asar 65816 assembler integration for ROM patching");
583 BulletText(
"Enhanced CLI tools with TUI (Terminal User Interface)");
584 BulletText(
"Modernized CMake build system with presets");
585 BulletText(
"Cross-platform CI/CD pipeline (Windows, macOS, Linux)");
586 BulletText(
"Comprehensive testing framework with 46+ core tests");
587 BulletText(
"Professional packaging for all platforms (DMG, MSI, DEB)");
590 if (CollapsingHeader(absl::StrFormat(
"%s Core Improvements",
ICON_MD_SETTINGS).c_str())) {
591 BulletText(
"Enhanced project management with YazeProject structure");
592 BulletText(
"Improved ROM loading and validation");
593 BulletText(
"Better error handling and status reporting");
594 BulletText(
"Memory safety improvements with sanitizers");
595 BulletText(
"Enhanced file dialog integration");
596 BulletText(
"Improved logging and debugging capabilities");
599 if (CollapsingHeader(absl::StrFormat(
"%s Editor Features",
ICON_MD_EDIT).c_str())) {
600 BulletText(
"Enhanced overworld editing capabilities");
601 BulletText(
"Improved graphics sheet viewing and editing");
602 BulletText(
"Better palette management and editing");
603 BulletText(
"Enhanced memory and hex editing tools");
604 BulletText(
"Improved sprite and item management");
605 BulletText(
"Better entrance and exit editing");
609 if (Button(absl::StrFormat(
"%s View Theme Editor",
ICON_MD_PALETTE).c_str(), ImVec2(-1, 30))) {
611 Hide(
"Whats New v03");
616 Hide(
"Whats New v03");
621 TextWrapped(
"Workspace Management");
622 TextWrapped(
"YAZE supports multiple ROM sessions and flexible workspace layouts.");
625 TextWrapped(
"Session Management:");
626 BulletText(
"Ctrl+Shift+N: Create new session");
627 BulletText(
"Ctrl+Shift+W: Close current session");
628 BulletText(
"Ctrl+Tab: Quick session switcher");
629 BulletText(
"Each session maintains its own ROM and editor state");
632 TextWrapped(
"Layout Management:");
633 BulletText(
"Drag window tabs to dock/undock");
634 BulletText(
"Ctrl+Shift+S: Save current layout");
635 BulletText(
"Ctrl+Shift+O: Load saved layout");
636 BulletText(
"F11: Maximize current window");
639 TextWrapped(
"Preset Layouts:");
640 BulletText(
"Developer: Code, memory, testing tools");
641 BulletText(
"Designer: Graphics, palettes, sprites");
642 BulletText(
"Modder: All gameplay editing tools");
645 Hide(
"Workspace Help");
650 TextColored(ImVec4(1.0f, 0.5f, 0.0f, 1.0f),
"%s Warning",
ICON_MD_WARNING);
651 TextWrapped(
"You have reached the recommended session limit.");
652 TextWrapped(
"Having too many sessions open may impact performance.");
654 TextWrapped(
"Consider closing unused sessions or saving your work.");
657 Hide(
"Session Limit Warning");
661 Hide(
"Session Limit Warning");
667 TextColored(ImVec4(1.0f, 0.5f, 0.0f, 1.0f),
"%s Confirm Reset",
ICON_MD_WARNING);
668 TextWrapped(
"This will reset your current workspace layout to default.");
669 TextWrapped(
"Any custom window arrangements will be lost.");
671 TextWrapped(
"Do you want to continue?");
674 Hide(
"Layout Reset Confirm");
679 Hide(
"Layout Reset Confirm");
685 SetNextWindowSize(ImVec2(900, 700), ImGuiCond_FirstUseEver);
686 SetNextWindowSizeConstraints(ImVec2(600, 400), ImVec2(FLT_MAX, FLT_MAX));
689 TextWrapped(
"Customize your YAZE experience - accessible anytime!");
694 float available_height = GetContentRegionAvail().y - 60;
695 if (BeginChild(
"DisplaySettingsContent", ImVec2(0, available_height),
true, ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
704 ImGuiIO &io = GetIO();
706 Text(
"Global Font Scale");
707 static float font_global_scale = io.FontGlobalScale;
708 if (SliderFloat(
"##global_scale", &font_global_scale, 0.5f, 1.8f,
"%.2f")) {
712 io.FontGlobalScale = font_global_scale;
720 Hide(
"Display Settings");
725 using namespace ImGui;
728 Text(
"Feature Flags Configuration");
731 BeginChild(
"##FlagsContent", ImVec2(0, -30),
true);
736 if (BeginTabBar(
"FlagCategories")) {
737 if (BeginTabItem(
"Overworld")) {
741 if (BeginTabItem(
"Dungeon")) {
745 if (BeginTabItem(
"Resources")) {
749 if (BeginTabItem(
"System")) {
765 using namespace ImGui;
767 Text(
"Data Integrity Check Results");
770 BeginChild(
"##IntegrityContent", ImVec2(0, -30),
true);
774 Text(
"ROM Data Integrity:");
776 TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f),
"✓ ROM header valid");
777 TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f),
"✓ Checksum valid");
778 TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f),
"✓ Graphics data intact");
779 TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f),
"✓ Map data intact");
782 Text(
"No issues detected.");
The EditorManager controls the main editor window and manages the various editor classes.
absl::Status SaveRomAs(const std::string &filename)
absl::Status CreateNewProject(const std::string &template_name="Basic ROM Hack")
void SetFontGlobalScale(float scale)
auto GetCurrentRom() const -> Rom *
static std::string ShowSaveFileDialog(const std::string &default_name="", const std::string &default_extension="")
ShowSaveFileDialog opens a save file dialog and returns the selected filepath. Uses global feature fl...
static std::string ShowOpenFileDialog()
ShowOpenFileDialog opens a file dialog and returns the selected filepath. Uses global feature flag to...
static std::string ShowOpenFolderDialog()
ShowOpenFolderDialog opens a file dialog and returns the selected folder path. Uses global feature fl...
#define ICON_MD_FOLDER_OPEN
#define ICON_MD_VIDEOGAME_ASSET
#define ICON_MD_DISPLAY_SETTINGS
#define ICON_MD_CONTENT_COPY
#define ICON_MD_COLOR_LENS
void DrawDisplaySettingsForPopup(ImGuiStyle *ref)
constexpr ImVec2 kDefaultModalSize
void TextWithSeparators(const absl::string_view &text)
std::string HexLongLong(uint64_t qword, HexStringParams params)
Main namespace for the application.