yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
editor_manager.cc
Go to the documentation of this file.
1#include "editor_manager.h"
2
3#include "absl/status/status.h"
4#include "absl/strings/match.h"
5#include "app/core/features.h"
7#include "app/core/project.h"
16#include "app/emu/emulator.h"
17#include "app/gui/icons.h"
18#include "app/gui/input.h"
19#include "app/gui/style.h"
20#include "app/rom.h"
21#include "editor/editor.h"
22#include "imgui/imgui.h"
23#include "imgui/misc/cpp/imgui_stdlib.h"
24#include "util/hex.h"
25#include "util/macro.h"
26
27namespace yaze {
28namespace editor {
29
30using namespace ImGui;
31using core::FileDialogWrapper;
32
33namespace {
34
35bool BeginCentered(const char *name) {
36 ImGuiIO const &io = GetIO();
37 ImVec2 pos(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f);
38 SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
39 ImGuiWindowFlags flags =
40 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration |
41 ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings;
42 return Begin(name, nullptr, flags);
43}
44
45bool IsEditorActive(Editor *editor, std::vector<Editor *> &active_editors) {
46 return std::find(active_editors.begin(), active_editors.end(), editor) !=
47 active_editors.end();
48}
49
50} // namespace
51
52void EditorManager::Initialize(std::string filename) {
53 if (!filename.empty()) {
54 PRINT_IF_ERROR(rom()->LoadFromFile(filename));
55 }
56 overworld_editor_.Initialize();
57}
58
59absl::Status EditorManager::Update() {
61
63 DrawPopups();
64
65 if (rom()->is_loaded() && !rom_assets_loaded_) {
66 auto &sheet_manager = GraphicsSheetManager::GetInstance();
67 ASSIGN_OR_RETURN(*sheet_manager.mutable_gfx_sheets(),
69 RETURN_IF_ERROR(overworld_editor_.LoadGraphics());
70 rom_assets_loaded_ = true;
71 }
72
73 if (!current_rom_) {
75 } else {
77 }
78 return absl::OkStatus();
79}
80
82 // Show popup pane to select an editor to add
83 static bool show_add_editor = false;
84 if (show_add_editor) OpenPopup("AddEditor");
85
86 if (BeginPopup("AddEditor", ImGuiWindowFlags_AlwaysAutoResize)) {
87 if (MenuItem("Overworld", nullptr, false,
88 !IsEditorActive(&overworld_editor_, active_editors_))) {
90 CloseCurrentPopup();
91 }
92 if (MenuItem("Dungeon", nullptr, false,
93 !IsEditorActive(&dungeon_editor_, active_editors_))) {
95 CloseCurrentPopup();
96 }
97 if (MenuItem("Graphics", nullptr, false,
98 !IsEditorActive(&graphics_editor_, active_editors_))) {
100 CloseCurrentPopup();
101 }
102 if (MenuItem("Music", nullptr, false,
103 !IsEditorActive(&music_editor_, active_editors_))) {
104 active_editors_.push_back(&music_editor_);
105 CloseCurrentPopup();
106 }
107 if (MenuItem("Palette", nullptr, false,
108 !IsEditorActive(&palette_editor_, active_editors_))) {
110 CloseCurrentPopup();
111 }
112 if (MenuItem("Screen", nullptr, false,
113 !IsEditorActive(&screen_editor_, active_editors_))) {
115 CloseCurrentPopup();
116 }
117 if (MenuItem("Sprite", nullptr, false,
118 !IsEditorActive(&sprite_editor_, active_editors_))) {
120 CloseCurrentPopup();
121 }
122 if (MenuItem("Code", nullptr, false,
123 !IsEditorActive(&assembly_editor_, active_editors_))) {
125 CloseCurrentPopup();
126 }
127 if (MenuItem("Message", nullptr, false,
128 !IsEditorActive(&message_editor_, active_editors_))) {
130 CloseCurrentPopup();
131 }
132 if (MenuItem("Settings", nullptr, false,
133 !IsEditorActive(&settings_editor_, active_editors_))) {
135 CloseCurrentPopup();
136 }
137 EndPopup();
138 }
139
140 if (!IsPopupOpen("AddEditor")) {
141 show_add_editor = false;
142 }
143
144 if (BeginTabBar("##TabBar", ImGuiTabBarFlags_Reorderable |
145 ImGuiTabBarFlags_AutoSelectNewTabs)) {
146 for (auto editor : active_editors_) {
147 bool open = true;
148 switch (editor->type()) {
150 if (overworld_editor_.jump_to_tab() == -1) {
151 if (BeginTabItem("Overworld", &open)) {
153 status_ = overworld_editor_.Update();
154 EndTabItem();
155 }
156 }
157 break;
159 if (BeginTabItem("Dungeon", &open)) {
161 status_ = dungeon_editor_.Update();
162 if (overworld_editor_.jump_to_tab() != -1) {
163 dungeon_editor_.add_room(overworld_editor_.jump_to_tab());
164 overworld_editor_.jump_to_tab_ = -1;
165 }
166 EndTabItem();
167 }
168 break;
170 if (BeginTabItem("Graphics", &open)) {
172 status_ = graphics_editor_.Update();
173 EndTabItem();
174 }
175 break;
177 if (BeginTabItem("Music", &open)) {
179
180 status_ = music_editor_.Update();
181 EndTabItem();
182 }
183 break;
185 if (BeginTabItem("Palette", &open)) {
187 status_ = palette_editor_.Update();
188 EndTabItem();
189 }
190 break;
192 if (BeginTabItem("Screen", &open)) {
194 status_ = screen_editor_.Update();
195 EndTabItem();
196 }
197 break;
199 if (BeginTabItem("Sprite", &open)) {
201 status_ = sprite_editor_.Update();
202 EndTabItem();
203 }
204 break;
206 if (BeginTabItem("Code", &open)) {
208 assembly_editor_.UpdateCodeView();
209 EndTabItem();
210 }
211 break;
213 if (BeginTabItem("Settings", &open)) {
215 status_ = settings_editor_.Update();
216 EndTabItem();
217 }
218 break;
220 if (BeginTabItem("Message", &open)) {
222 status_ = message_editor_.Update();
223 EndTabItem();
224 }
225 break;
226 default:
227 break;
228 }
229 if (!open) {
230 active_editors_.erase(
231 std::remove(active_editors_.begin(), active_editors_.end(), editor),
232 active_editors_.end());
233 }
234 }
235
236 if (TabItemButton(ICON_MD_ADD, ImGuiTabItemFlags_Trailing)) {
237 show_add_editor = true;
238 }
239
240 EndTabBar();
241 }
242}
243
245 bool ctrl_or_super = (GetIO().KeyCtrl || GetIO().KeySuper);
246
247 editor_context_.command_manager.ShowWhichKey();
248
249 // If CMD + R is pressed, reload the top result of recent files
250 if (IsKeyDown(ImGuiKey_R) && ctrl_or_super) {
251 static RecentFilesManager manager("recent_files.txt");
252 manager.Load();
253 if (!manager.GetRecentFiles().empty()) {
254 auto front = manager.GetRecentFiles().front();
255 OpenRomOrProject(front);
256 }
257 }
258
259 if (IsKeyDown(ImGuiKey_F1)) {
260 about_ = true;
261 }
262
263 // If CMD + Q is pressed, quit the application
264 if (IsKeyDown(ImGuiKey_Q) && ctrl_or_super) {
265 quit_ = true;
266 }
267
268 // If CMD + O is pressed, open a file dialog
269 if (IsKeyDown(ImGuiKey_O) && ctrl_or_super) {
270 LoadRom();
271 }
272
273 // If CMD + S is pressed, save the current ROM
274 if (IsKeyDown(ImGuiKey_S) && ctrl_or_super) {
275 SaveRom();
276 }
277
278 if (IsKeyDown(ImGuiKey_X) && ctrl_or_super) {
279 status_ = current_editor_->Cut();
280 }
281
282 if (IsKeyDown(ImGuiKey_C) && ctrl_or_super) {
283 status_ = current_editor_->Copy();
284 }
285
286 if (IsKeyDown(ImGuiKey_V) && ctrl_or_super) {
287 status_ = current_editor_->Paste();
288 }
289
290 if (IsKeyDown(ImGuiKey_Z) && ctrl_or_super) {
291 status_ = current_editor_->Undo();
292 }
293
294 if (IsKeyDown(ImGuiKey_Y) && ctrl_or_super) {
295 status_ = current_editor_->Redo();
296 }
297
298 if (IsKeyDown(ImGuiKey_F) && ctrl_or_super) {
299 status_ = current_editor_->Find();
300 }
301}
302
304 static absl::Status prev_status;
305 if (!status_.ok()) {
306 show_status_ = true;
307 prev_status = status_;
308 }
309
310 if (show_status_ && (BeginCentered("StatusWindow"))) {
311 Text("%s", ICON_MD_ERROR);
312 Text("%s", prev_status.ToString().c_str());
313 Spacing();
314 NextColumn();
315 Columns(1);
316 Separator();
317 NewLine();
318 SameLine(128);
319 if (Button("OK", gui::kDefaultModalSize) || IsKeyPressed(ImGuiKey_Space)) {
320 show_status_ = false;
321 status_ = absl::OkStatus();
322 }
323 SameLine();
324 if (Button(ICON_MD_CONTENT_COPY, ImVec2(50, 0))) {
325 SetClipboardText(prev_status.ToString().c_str());
326 }
327 End();
328 }
329
330 if (about_) OpenPopup("About");
331 if (BeginPopupModal("About", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
332 Text("Yet Another Zelda3 Editor - v%s", version_.c_str());
333 Text("Written by: scawful");
334 Spacing();
335 Text("Special Thanks: Zarby89, JaredBrian");
336 Separator();
337
338 if (Button("Close", gui::kDefaultModalSize)) {
339 about_ = false;
340 CloseCurrentPopup();
341 }
342 EndPopup();
343 }
344
345 if (rom_info_) OpenPopup("ROM Information");
346 if (BeginPopupModal("ROM Information", nullptr,
347 ImGuiWindowFlags_AlwaysAutoResize)) {
348 Text("Title: %s", rom()->title().c_str());
349 Text("ROM Size: %s", util::HexLongLong(rom()->size()).c_str());
350
351 if (Button("Close", gui::kDefaultModalSize) ||
352 IsKeyPressed(ImGuiKey_Escape)) {
353 rom_info_ = false;
354 CloseCurrentPopup();
355 }
356 EndPopup();
357 }
358}
359
361 TextWrapped("Welcome to the Yet Another Zelda3 Editor (yaze)!");
362 TextWrapped(
363 "This editor is designed to be a comprehensive tool for editing the "
364 "Legend of Zelda: A Link to the Past.");
365 TextWrapped(
366 "The editor is still in development, so please report any bugs or issues "
367 "you encounter.");
368
369 static bool managed_startup = false;
370
371 if (Button("Open ROM", ImVec2(200, 0))) {
372 LoadRom();
373 }
374 SameLine();
375 ImGui::Checkbox("Manage Startup", &managed_startup);
376 Separator();
377
378 settings_editor_.Update();
379}
380
382 static bool show_display_settings = false;
383
384 if (BeginMenuBar()) {
386
387 SameLine(GetWindowWidth() - GetStyle().ItemSpacing.x -
388 CalcTextSize(ICON_MD_DISPLAY_SETTINGS).x - 110);
389 PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
390 if (Button(ICON_MD_DISPLAY_SETTINGS)) {
391 show_display_settings = !show_display_settings;
392 }
393 PopStyleColor();
394 Text("yaze v%s", version_.c_str());
395 EndMenuBar();
396 }
397
398 if (show_display_settings) {
399 Begin("Display Settings", &show_display_settings, ImGuiWindowFlags_None);
401 End();
402 }
403}
404
406 static bool save_as_menu = false;
407 static bool new_project_menu = false;
408
409 if (BeginMenu("File")) {
410 if (MenuItem("Open", "Ctrl+O")) {
411 LoadRom();
412 }
413
414 if (BeginMenu("Open Recent")) {
415 static RecentFilesManager manager("recent_files.txt");
416 manager.Load();
417 if (manager.GetRecentFiles().empty()) {
418 MenuItem("No Recent Files", nullptr, false, false);
419 } else {
420 for (const auto &filePath : manager.GetRecentFiles()) {
421 if (MenuItem(filePath.c_str())) {
422 OpenRomOrProject(filePath);
423 }
424 }
425 }
426 EndMenu();
427 }
428
429 MENU_ITEM2("Save", "Ctrl+S") {
430 if (rom()->is_loaded()) {
431 SaveRom();
432 }
433 }
434 MENU_ITEM("Save As..") { save_as_menu = true; }
435
436 if (rom()->is_loaded()) {
437 MENU_ITEM("Close") {
438 status_ = rom()->Close();
439 rom_assets_loaded_ = false;
440 }
441 }
442
443 Separator();
444
445 if (BeginMenu("Project")) {
446 if (MenuItem("Create New Project")) {
447 // Create a new project
448 new_project_menu = true;
449 }
450 if (MenuItem("Open Project")) {
451 // Open an existing project
454 if (status_.ok()) {
456 }
457 }
458 if (MenuItem("Save Project")) {
459 // Save the current project
460 status_ = current_project_.Save();
461 }
462
463 EndMenu();
464 }
465
466 if (BeginMenu("Options")) {
467 MenuItem("Backup ROM", "", &backup_rom_);
468 MenuItem("Save New Auto", "", &save_new_auto_);
469 Separator();
470 static core::FlagsMenu flags_menu;
471 if (BeginMenu("System Flags")) {
472 flags_menu.DrawSystemFlags();
473 EndMenu();
474 }
475 if (BeginMenu("Overworld Flags")) {
476 flags_menu.DrawOverworldFlags();
477 EndMenu();
478 }
479 if (BeginMenu("Dungeon Flags")) {
480 flags_menu.DrawDungeonFlags();
481 EndMenu();
482 }
483 if (BeginMenu("Resource Flags")) {
484 flags_menu.DrawResourceFlags();
485 EndMenu();
486 }
487 EndMenu();
488 }
489
490 Separator();
491
492 if (MenuItem("Quit", "Ctrl+Q")) {
493 quit_ = true;
494 }
495
496 EndMenu();
497 }
498
499 if (save_as_menu) {
500 static std::string save_as_filename = "";
501 Begin("Save As..", &save_as_menu, ImGuiWindowFlags_AlwaysAutoResize);
502 InputText("Filename", &save_as_filename);
503 if (Button("Save", gui::kDefaultModalSize)) {
504 SaveRom();
505 save_as_menu = false;
506 }
507 SameLine();
508 if (Button("Cancel", gui::kDefaultModalSize)) {
509 save_as_menu = false;
510 }
511 End();
512 }
513
514 if (new_project_menu) {
515 Begin("New Project", &new_project_menu, ImGuiWindowFlags_AlwaysAutoResize);
516 static std::string save_as_filename = "";
517 InputText("Project Name", &save_as_filename);
518 if (Button("Destination Filepath", gui::kDefaultModalSize)) {
520 }
521 SameLine();
522 Text("%s", current_project_.filepath.c_str());
523 if (Button("ROM File", gui::kDefaultModalSize)) {
525 }
526 SameLine();
527 Text("%s", current_project_.rom_filename_.c_str());
528 if (Button("Labels File", gui::kDefaultModalSize)) {
529 current_project_.labels_filename_ =
531 }
532 SameLine();
533 Text("%s", current_project_.labels_filename_.c_str());
534 if (Button("Code Folder", gui::kDefaultModalSize)) {
536 }
537 SameLine();
538 Text("%s", current_project_.code_folder_.c_str());
539
540 Separator();
541 if (Button("Create", gui::kDefaultModalSize)) {
542 new_project_menu = false;
543 status_ = current_project_.Create(save_as_filename);
544 if (status_.ok()) {
545 status_ = current_project_.Save();
546 }
547 }
548 SameLine();
549 if (Button("Cancel", gui::kDefaultModalSize)) {
550 new_project_menu = false;
551 }
552 End();
553 }
554
555 if (BeginMenu("Edit")) {
556 MENU_ITEM2("Undo", "Ctrl+Z") { status_ = current_editor_->Undo(); }
557 MENU_ITEM2("Redo", "Ctrl+Y") { status_ = current_editor_->Redo(); }
558 Separator();
559 MENU_ITEM2("Cut", "Ctrl+X") { status_ = current_editor_->Cut(); }
560 MENU_ITEM2("Copy", "Ctrl+C") { status_ = current_editor_->Copy(); }
561 MENU_ITEM2("Paste", "Ctrl+V") { status_ = current_editor_->Paste(); }
562 Separator();
563 MENU_ITEM2("Find", "Ctrl+F") { status_ = current_editor_->Find(); }
564 EndMenu();
565 }
566
567 static bool show_imgui_metrics = false;
568 static bool show_memory_editor = false;
569 static bool show_asm_editor = false;
570 static bool show_imgui_demo = false;
571 static bool show_palette_editor = false;
572 static bool show_emulator = false;
573
574 if (show_imgui_demo) ShowDemoWindow();
575 if (show_imgui_metrics) ShowMetricsWindow(&show_imgui_metrics);
576 if (show_memory_editor) memory_editor_.Update(show_memory_editor);
577 if (show_asm_editor) assembly_editor_.Update(show_asm_editor);
578
579 if (show_emulator) {
580 Begin("Emulator", &show_emulator, ImGuiWindowFlags_MenuBar);
581 emulator_.Run();
582 End();
583 }
584
585 if (show_palette_editor) {
586 Begin("Palette Editor", &show_palette_editor);
587 status_ = palette_editor_.Update();
588 End();
589 }
590
591 if (BeginMenu("View")) {
592 MenuItem("Emulator", nullptr, &show_emulator);
593 Separator();
594 MenuItem("Memory Editor", nullptr, &show_memory_editor);
595 MenuItem("Assembly Editor", nullptr, &show_asm_editor);
596 MenuItem("Palette Editor", nullptr, &show_palette_editor);
597 Separator();
598 MENU_ITEM("ROM Information") rom_info_ = true;
599 Separator();
600 MenuItem("ImGui Demo", nullptr, &show_imgui_demo);
601 MenuItem("ImGui Metrics", nullptr, &show_imgui_metrics);
602 EndMenu();
603 }
604
605 static bool show_resource_label_manager = false;
606 if (current_project_.project_opened_) {
607 if (BeginMenu("Project")) {
608 Text("Name: %s", current_project_.name.c_str());
609 Text("ROM: %s", current_project_.rom_filename_.c_str());
610 Text("Labels: %s", current_project_.labels_filename_.c_str());
611 Text("Code: %s", current_project_.code_folder_.c_str());
612 Separator();
613 MenuItem("Resource Labels", nullptr, &show_resource_label_manager);
614 EndMenu();
615 }
616 }
617
618 static bool open_rom_help = false;
619 static bool open_supported_features = false;
620 static bool open_manage_project = false;
621 if (BeginMenu("Help")) {
622 if (MenuItem("How to open a ROM")) open_rom_help = true;
623 if (MenuItem("Supported Features")) open_supported_features = true;
624 if (MenuItem("How to manage a project")) open_manage_project = true;
625
626 if (MenuItem("About", "F1")) about_ = true;
627 EndMenu();
628 }
629
630 if (open_supported_features) OpenPopup("Supported Features");
631 if (BeginPopupModal("Supported Features", nullptr,
632 ImGuiWindowFlags_AlwaysAutoResize)) {
633 Text("Overworld");
634 BulletText("LW/DW/SW Tilemap Editing");
635 BulletText("LW/DW/SW Map Properties");
636 BulletText("Create/Delete/Update Entrances");
637 BulletText("Create/Delete/Update Exits");
638 BulletText("Create/Delete/Update Sprites");
639 BulletText("Create/Delete/Update Items");
640
641 Text("Dungeon");
642 BulletText("View Room Header Properties");
643 BulletText("View Entrance Properties");
644
645 Text("Graphics");
646 BulletText("View Decompressed Graphics Sheets");
647 BulletText("View/Update Graphics Groups");
648
649 Text("Palettes");
650 BulletText("View Palette Groups");
651
652 Text("Saveable");
653 BulletText("All Listed Overworld Features");
654 BulletText("Hex Editor Changes");
655
656 if (Button("Close", gui::kDefaultModalSize)) {
657 open_supported_features = false;
658 CloseCurrentPopup();
659 }
660 EndPopup();
661 }
662
663 if (open_rom_help) OpenPopup("Open a ROM");
664 if (BeginPopupModal("Open a ROM", nullptr,
665 ImGuiWindowFlags_AlwaysAutoResize)) {
666 Text("File -> Open");
667 Text("Select a ROM file to open");
668 Text("Supported ROMs (headered or unheadered):");
669 Text("The Legend of Zelda: A Link to the Past");
670 Text("US Version 1.0");
671 Text("JP Version 1.0");
672
673 if (Button("Close", gui::kDefaultModalSize)) {
674 open_rom_help = false;
675 CloseCurrentPopup();
676 }
677 EndPopup();
678 }
679
680 if (open_manage_project) OpenPopup("Manage Project");
681 if (BeginPopupModal("Manage Project", nullptr,
682 ImGuiWindowFlags_AlwaysAutoResize)) {
683 Text("Project Menu");
684 Text("Create a new project or open an existing one.");
685 Text("Save the project to save the current state of the project.");
686 TextWrapped(
687 "To save a project, you need to first open a ROM and initialize your "
688 "code path and labels file. Label resource manager can be found in "
689 "the View menu. Code path is set in the Code editor after opening a "
690 "folder.");
691
692 if (Button("Close", gui::kDefaultModalSize)) {
693 open_manage_project = false;
694 CloseCurrentPopup();
695 }
696 EndPopup();
697 }
698
699 if (show_resource_label_manager) {
700 rom()->resource_label()->DisplayLabels(&show_resource_label_manager);
701 if (current_project_.project_opened_ &&
702 !current_project_.labels_filename_.empty()) {
703 current_project_.labels_filename_ = rom()->resource_label()->filename_;
704 }
705 }
706}
707
709 if (roms_.empty()) return;
710
711 // Dropdown in the center of the menu bar with ROMs
712 if (BeginMenu("ROM")) {
713 for (size_t i = 0; i < roms_.size(); ++i) {
714 if (MenuItem(roms_[i]->title().c_str())) {
715 current_rom_ = roms_[i].get();
716 }
717 }
718 EndMenu();
719 }
720}
721
723 auto file_name = FileDialogWrapper::ShowOpenFileDialog();
724 auto load_rom = rom()->LoadFromFile(file_name);
725 if (load_rom.ok()) {
726 current_rom_ = rom();
727 static RecentFilesManager manager("recent_files.txt");
728 manager.Load();
729 manager.AddFile(file_name);
730 manager.Save();
731 }
732}
733
735 if (core::FeatureFlags::get().kSaveDungeonMaps) {
736 status_ = screen_editor_.SaveDungeonMaps();
738 }
739
740 status_ = overworld_editor_.Save();
742
743 if (core::FeatureFlags::get().kSaveGraphicsSheet)
745 *rom(), GraphicsSheetManager::GetInstance().gfx_sheets()));
746
747 status_ = rom()->SaveToFile(backup_rom_, save_new_auto_);
748}
749
750void EditorManager::OpenRomOrProject(const std::string &filename) {
751 if (absl::StrContains(filename, ".yaze")) {
752 status_ = current_project_.Open(filename);
753 if (status_.ok()) {
755 }
756 } else {
757 status_ = rom()->LoadFromFile(filename);
758 current_rom_ = rom();
759 }
760}
761
763 RETURN_IF_ERROR(rom()->LoadFromFile(current_project_.rom_filename_));
764 current_rom_ = rom();
765
766 if (!rom()->resource_label()->LoadLabels(current_project_.labels_filename_)) {
767 return absl::InternalError(
768 "Could not load labels file, update your project file.");
769 }
770
771 static RecentFilesManager manager("recent_files.txt");
772 manager.Load();
773 manager.AddFile(current_project_.filepath + "/" + current_project_.name +
774 ".yaze");
775 manager.Save();
776
777 assembly_editor_.OpenFolder(current_project_.code_folder_);
778
779 current_project_.project_opened_ = true;
780
781 return absl::OkStatus();
782}
783
784} // namespace editor
785} // namespace yaze
static GraphicsSheetManager & GetInstance()
Definition rom.h:271
const std::vector< std::string > & GetRecentFiles() const
Definition project.h:122
void AddFile(const std::string &file_path)
Definition project.h:88
auto rom()
Definition rom.h:383
static Flags & get()
Definition features.h:69
static std::string ShowOpenFileDialog()
ShowOpenFileDialog opens a file dialog and returns the selected filepath.
void OpenRomOrProject(const std::string &filename)
OverworldEditor overworld_editor_
std::vector< std::unique_ptr< Rom > > roms_
void Initialize(std::string filename="")
MemoryEditorWithDiffChecker memory_editor_
std::vector< Editor * > active_editors_
Interface for editor classes.
Definition editor.h:49
static std::string ShowOpenFileDialog()
ShowOpenFileDialog opens a file dialog and returns the selected filepath.
static std::string ShowOpenFolderDialog()
ShowOpenFolderDialog opens a file dialog and returns the selected folder path.
#define ICON_MD_ERROR
Definition icons.h:684
#define ICON_MD_DISPLAY_SETTINGS
Definition icons.h:585
#define ICON_MD_ADD
Definition icons.h:84
#define ICON_MD_CONTENT_COPY
Definition icons.h:463
#define MENU_ITEM(w)
Definition macro.h:9
#define PRINT_IF_ERROR(expression)
Definition macro.h:36
#define RETURN_IF_ERROR(expression)
Definition macro.h:62
#define MENU_ITEM2(w, v)
Definition macro.h:10
#define ASSIGN_OR_RETURN(type_variable_name, expression)
Definition macro.h:70
#define RETURN_VOID_IF_ERROR(expression)
Definition macro.h:53
bool IsEditorActive(Editor *editor, std::vector< Editor * > &active_editors)
Editors are the view controllers for the application.
void DrawDisplaySettings(ImGuiStyle *ref)
Definition style.cc:382
constexpr ImVec2 kDefaultModalSize
Definition input.h:21
std::string HexLongLong(uint64_t qword, HexStringParams params)
Definition hex.cc:72
Main namespace for the application.
Definition controller.cc:18
absl::StatusOr< std::array< gfx::Bitmap, kNumGfxSheets > > LoadAllGraphicsData(Rom &rom, bool defer_render)
This function iterates over all graphics sheets in the Rom and loads them into memory....
Definition rom.cc:78
absl::Status SaveAllGraphicsData(Rom &rom, std::array< gfx::Bitmap, kNumGfxSheets > &gfx_sheets)
Definition rom.cc:137