Text editor for modifying assembly code. More...
#include <assembly_editor.h>

Public Member Functions | |
| AssemblyEditor (Rom *rom=nullptr) | |
| void | ChangeActiveFile (const std::string_view &filename) |
| absl::Status | JumpToSymbolDefinition (const std::string &symbol) |
| absl::Status | JumpToReference (const std::string &reference) |
| std::string | active_file_path () const |
| TextEditor::Coordinates | active_cursor_position () const |
| void | Initialize () override |
| absl::Status | Load () override |
| void | InlineUpdate () |
| void | UpdateCodeView () |
| absl::Status | Cut () override |
| absl::Status | Copy () override |
| absl::Status | Paste () override |
| absl::Status | Undo () override |
| absl::Status | Redo () override |
| absl::Status | Find () override |
| absl::Status | Update () override |
| absl::Status | Save () override |
| void | OpenFolder (const std::string &folder_path) |
| absl::Status | ValidateCurrentFile () |
| absl::Status | ApplyPatchToRom () |
| void | UpdateErrorMarkers (const core::AsarPatchResult &result) |
| void | ClearErrorMarkers () |
| void | SetRom (Rom *rom) |
| Rom * | rom () const |
| bool | is_asar_initialized () const |
| const std::map< std::string, core::AsarSymbol > & | symbols () const |
| core::AsarWrapper * | asar_wrapper () |
Public Member Functions inherited from yaze::editor::Editor | |
| Editor ()=default | |
| virtual | ~Editor ()=default |
| virtual void | SetDependencies (const EditorDependencies &deps) |
| virtual void | SetGameData (zelda3::GameData *game_data) |
| virtual std::string | GetUndoDescription () const |
| virtual std::string | GetRedoDescription () const |
| const UndoManager & | undo_manager () const |
| virtual absl::Status | Clear () |
| EditorType | type () const |
| bool * | active () |
| void | set_active (bool active) |
| void | toggle_active () |
| virtual bool | IsRomLoaded () const |
| virtual std::string | GetRomStatus () const |
| Rom * | rom () const |
| zelda3::GameData * | game_data () const |
| EditorContext | context () const |
| bool | HasContext () const |
Private Member Functions | |
| TextEditor * | GetActiveEditor () |
| const TextEditor * | GetActiveEditor () const |
| bool | HasActiveFile () const |
| void | DrawCodeEditor () |
| void | DrawFileBrowser () |
| void | DrawSymbolsContent () |
| void | DrawBuildOutput () |
| void | DrawToolbarContent () |
| void | DrawFileMenu () |
| void | DrawEditMenu () |
| void | DrawAssembleMenu () |
| void | DrawCurrentFolder () |
| void | DrawFileTabView () |
| void | DrawToolset () |
| void | DrawSymbolPanel () |
| void | ClearSymbolJumpCache () |
Private Attributes | |
| bool | file_is_loaded_ = false |
| int | current_file_id_ = 0 |
| int | active_file_id_ = -1 |
| std::vector< std::string > | files_ |
| std::vector< TextEditor > | open_files_ |
| ImVector< int > | active_files_ |
| std::string | current_file_ |
| FolderItem | current_folder_ |
| TextEditor | text_editor_ |
| Rom * | rom_ |
| core::AsarWrapper | asar_ |
| bool | asar_initialized_ = false |
| bool | show_symbol_panel_ = false |
| std::map< std::string, core::AsarSymbol > | symbols_ |
| std::vector< std::string > | last_errors_ |
| std::vector< std::string > | last_warnings_ |
| std::string | symbol_jump_root_ |
| absl::flat_hash_map< std::string, AsmSymbolLocation > | symbol_jump_cache_ |
| absl::flat_hash_set< std::string > | symbol_jump_negative_cache_ |
Additional Inherited Members | |
Protected Member Functions inherited from yaze::editor::Editor | |
| std::string | MakePanelTitle (const std::string &base_title) const |
| std::string | MakePanelId (const std::string &base_id) const |
| template<typename T > | |
| absl::StatusOr< T > | SafeRomAccess (std::function< T()> accessor, const std::string &operation="") const |
Protected Attributes inherited from yaze::editor::Editor | |
| bool | active_ = false |
| EditorType | type_ |
| EditorDependencies | dependencies_ |
| UndoManager | undo_manager_ |
Text editor for modifying assembly code.
Definition at line 36 of file assembly_editor.h.
|
inlineexplicit |
Definition at line 38 of file assembly_editor.h.
References TextEditor::GetDarkPalette(), yaze::editor::kAssembly, TextEditor::SetPalette(), TextEditor::SetShowWhitespaces(), text_editor_, and yaze::editor::Editor::type_.

| void yaze::editor::AssemblyEditor::ChangeActiveFile | ( | const std::string_view & | filename | ) |
Definition at line 1249 of file assembly_editor.cc.
References active_file_id_, active_files_, current_file_, files_, yaze::gui::GetAssemblyLanguageDef(), TextEditor::GetDarkPalette(), yaze::util::GetFileName(), yaze::util::LoadFile(), and open_files_.
Referenced by DrawCurrentFolder(), DrawFileMenu(), DrawToolbarContent(), JumpToReference(), and JumpToSymbolDefinition().

| absl::Status yaze::editor::AssemblyEditor::JumpToSymbolDefinition | ( | const std::string & | symbol | ) |
Definition at line 609 of file assembly_editor.cc.
References ChangeActiveFile(), yaze::project::YazeProject::code_folder, current_folder_, yaze::editor::Editor::dependencies_, yaze::project::YazeProject::GetAbsolutePath(), GetActiveEditor(), HasActiveFile(), yaze::editor::FolderItem::name, OpenFolder(), yaze::editor::EditorDependencies::project, symbol_jump_cache_, symbol_jump_negative_cache_, and symbol_jump_root_.
Referenced by JumpToReference().
| absl::Status yaze::editor::AssemblyEditor::JumpToReference | ( | const std::string & | reference | ) |
Definition at line 683 of file assembly_editor.cc.
References ChangeActiveFile(), yaze::project::YazeProject::code_folder, current_folder_, yaze::editor::Editor::dependencies_, yaze::project::YazeProject::GetAbsolutePath(), GetActiveEditor(), HasActiveFile(), JumpToSymbolDefinition(), yaze::editor::FolderItem::name, OpenFolder(), and yaze::editor::EditorDependencies::project.
| std::string yaze::editor::AssemblyEditor::active_file_path | ( | ) | const |
Definition at line 769 of file assembly_editor.cc.
References active_file_id_, files_, and HasActiveFile().

| TextEditor::Coordinates yaze::editor::AssemblyEditor::active_cursor_position | ( | ) | const |
Definition at line 776 of file assembly_editor.cc.
References active_file_id_, HasActiveFile(), TextEditor::Coordinates::Invalid(), and open_files_.

|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 575 of file assembly_editor.cc.
References yaze::editor::Editor::dependencies_, DrawBuildOutput(), DrawCodeEditor(), DrawFileBrowser(), DrawSymbolsContent(), DrawToolbarContent(), yaze::gui::GetAssemblyLanguageDef(), yaze::editor::EditorDependencies::panel_manager, yaze::editor::PanelManager::RegisterEditorPanel(), TextEditor::SetLanguageDefinition(), and text_editor_.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 604 of file assembly_editor.cc.
| void yaze::editor::AssemblyEditor::InlineUpdate | ( | ) |
Definition at line 1099 of file assembly_editor.cc.
References TextEditor::CanUndo(), current_file_, GetActiveEditor(), TextEditor::GetCursorPosition(), TextEditor::GetLanguageDefinition(), TextEditor::GetTotalLines(), TextEditor::IsOverwrite(), TextEditor::LanguageDefinition::mName, and TextEditor::Render().
Referenced by yaze::editor::MusicAssemblyPanel::Draw().
| void yaze::editor::AssemblyEditor::UpdateCodeView | ( | ) |
Definition at line 1113 of file assembly_editor.cc.
References DrawFileBrowser(), and DrawToolbarContent().

|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 1289 of file assembly_editor.cc.
References TextEditor::Cut(), and GetActiveEditor().

|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 1294 of file assembly_editor.cc.
References TextEditor::Copy(), and GetActiveEditor().

|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 1299 of file assembly_editor.cc.
References GetActiveEditor(), and TextEditor::Paste().

|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 1304 of file assembly_editor.cc.
References GetActiveEditor(), and TextEditor::Undo().

|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 1309 of file assembly_editor.cc.
References GetActiveEditor(), and TextEditor::Redo().

|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 72 of file assembly_editor.h.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 1082 of file assembly_editor.cc.
References yaze::editor::Editor::active_, DrawCodeEditor(), and DrawSymbolPanel().

|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 1121 of file assembly_editor.cc.
References active_file_id_, files_, GetActiveEditor(), TextEditor::GetText(), and HasActiveFile().
Referenced by DrawFileMenu(), DrawToolbarContent(), and DrawToolset().

| void yaze::editor::AssemblyEditor::OpenFolder | ( | const std::string & | folder_path | ) |
Definition at line 798 of file assembly_editor.cc.
References ClearSymbolJumpCache(), current_folder_, and symbol_jump_root_.
Referenced by DrawCurrentFolder(), DrawFileBrowser(), JumpToReference(), and JumpToSymbolDefinition().

| absl::Status yaze::editor::AssemblyEditor::ValidateCurrentFile | ( | ) |
Definition at line 1318 of file assembly_editor.cc.
References active_file_id_, asar_, asar_initialized_, ClearErrorMarkers(), files_, GetActiveEditor(), HasActiveFile(), yaze::core::AsarWrapper::Initialize(), last_errors_, TextEditor::SetErrorMarkers(), and yaze::core::AsarWrapper::ValidateAssembly().
Referenced by DrawAssembleMenu(), DrawBuildOutput(), and DrawToolbarContent().
| absl::Status yaze::editor::AssemblyEditor::ApplyPatchToRom | ( | ) |
Definition at line 1372 of file assembly_editor.cc.
References active_file_id_, yaze::core::AsarWrapper::ApplyPatch(), asar_, asar_initialized_, ClearErrorMarkers(), files_, yaze::core::AsarWrapper::GetSymbolTable(), HasActiveFile(), yaze::core::AsarWrapper::Initialize(), yaze::Rom::is_loaded(), last_errors_, last_warnings_, yaze::Rom::LoadFromData(), rom_, symbols_, UpdateErrorMarkers(), and yaze::Rom::vector().
Referenced by DrawAssembleMenu(), DrawBuildOutput(), and DrawToolbarContent().
| void yaze::editor::AssemblyEditor::UpdateErrorMarkers | ( | const core::AsarPatchResult & | result | ) |
Definition at line 1423 of file assembly_editor.cc.
References yaze::core::AsarPatchResult::errors, GetActiveEditor(), HasActiveFile(), last_errors_, last_warnings_, TextEditor::SetErrorMarkers(), and yaze::core::AsarPatchResult::warnings.
Referenced by ApplyPatchToRom().

| void yaze::editor::AssemblyEditor::ClearErrorMarkers | ( | ) |
Definition at line 1459 of file assembly_editor.cc.
References GetActiveEditor(), HasActiveFile(), last_errors_, and TextEditor::SetErrorMarkers().
Referenced by ApplyPatchToRom(), and ValidateCurrentFile().

|
inline |
|
inline |
|
inline |
Definition at line 90 of file assembly_editor.h.
References asar_initialized_.
|
inline |
Definition at line 91 of file assembly_editor.h.
References symbols_.
|
inline |
Definition at line 94 of file assembly_editor.h.
References asar_.
|
private |
Definition at line 784 of file assembly_editor.cc.
References active_file_id_, HasActiveFile(), open_files_, and text_editor_.
Referenced by ClearErrorMarkers(), Copy(), Cut(), DrawCodeEditor(), DrawEditMenu(), InlineUpdate(), JumpToReference(), JumpToSymbolDefinition(), Paste(), Redo(), Save(), Undo(), UpdateErrorMarkers(), and ValidateCurrentFile().

|
private |
Definition at line 791 of file assembly_editor.cc.
References active_file_id_, HasActiveFile(), open_files_, and text_editor_.

|
inlineprivate |
Definition at line 99 of file assembly_editor.h.
References active_file_id_, and open_files_.
Referenced by active_cursor_position(), active_file_path(), ApplyPatchToRom(), ClearErrorMarkers(), DrawAssembleMenu(), DrawBuildOutput(), DrawToolbarContent(), GetActiveEditor(), GetActiveEditor(), JumpToReference(), JumpToSymbolDefinition(), Save(), UpdateErrorMarkers(), and ValidateCurrentFile().
|
private |
Definition at line 815 of file assembly_editor.cc.
References TextEditor::CanUndo(), current_file_, DrawAssembleMenu(), DrawEditMenu(), DrawFileMenu(), DrawFileTabView(), GetActiveEditor(), TextEditor::GetCursorPosition(), TextEditor::GetLanguageDefinition(), TextEditor::GetTotalLines(), TextEditor::IsOverwrite(), TextEditor::LanguageDefinition::mName, and TextEditor::Render().
Referenced by Initialize(), and Update().
|
private |
Definition at line 843 of file assembly_editor.cc.
References yaze::project::YazeProject::code_folder, current_folder_, yaze::editor::Editor::dependencies_, DrawCurrentFolder(), yaze::project::YazeProject::GetAbsolutePath(), ICON_MD_FOLDER_OPEN, yaze::editor::FolderItem::name, OpenFolder(), yaze::editor::EditorDependencies::project, and yaze::util::FileDialogWrapper::ShowOpenFolderDialog().
Referenced by Initialize(), and UpdateCodeView().

|
private |
Definition at line 871 of file assembly_editor.cc.
References ICON_MD_SEARCH, and symbols_.
Referenced by Initialize().
|
private |
Definition at line 908 of file assembly_editor.cc.
References ApplyPatchToRom(), yaze::editor::Editor::dependencies_, HasActiveFile(), ICON_MD_BUILD, ICON_MD_CHECK_CIRCLE, ICON_MD_ERROR, ICON_MD_WARNING, yaze::Rom::is_loaded(), yaze::editor::kSuccess, last_errors_, last_warnings_, rom_, yaze::editor::ToastManager::Show(), yaze::editor::EditorDependencies::toast_manager, and ValidateCurrentFile().
Referenced by Initialize().
|
private |
Definition at line 968 of file assembly_editor.cc.
References ApplyPatchToRom(), ChangeActiveFile(), current_folder_, HasActiveFile(), ICON_MD_BUILD, ICON_MD_CHECK_CIRCLE, ICON_MD_FILE_OPEN, ICON_MD_FOLDER_OPEN, ICON_MD_SAVE, yaze::Rom::is_loaded(), rom_, Save(), yaze::util::FileDialogWrapper::ShowOpenFileDialog(), yaze::util::FileDialogWrapper::ShowOpenFolderDialog(), and ValidateCurrentFile().
Referenced by Initialize(), and UpdateCodeView().
|
private |
Definition at line 1208 of file assembly_editor.cc.
References ChangeActiveFile(), ICON_MD_FILE_OPEN, ICON_MD_SAVE, Save(), and yaze::util::FileDialogWrapper::ShowOpenFileDialog().
Referenced by DrawCodeEditor().

|
private |
Definition at line 1223 of file assembly_editor.cc.
References TextEditor::Copy(), TextEditor::Cut(), GetActiveEditor(), ICON_MD_CONTENT_COPY, ICON_MD_CONTENT_CUT, ICON_MD_CONTENT_PASTE, ICON_MD_REDO, ICON_MD_SEARCH, ICON_MD_UNDO, TextEditor::Paste(), TextEditor::Redo(), and TextEditor::Undo().
Referenced by DrawCodeEditor().
|
private |
Definition at line 1470 of file assembly_editor.cc.
References ApplyPatchToRom(), asar_, yaze::core::VersionManager::CreateSnapshot(), yaze::editor::Editor::dependencies_, yaze::project::YazeProject::GetAbsolutePath(), yaze::core::AsarWrapper::GetSymbolTable(), HasActiveFile(), ICON_MD_BUILD, ICON_MD_CAMERA_ALT, ICON_MD_CHECK_CIRCLE, ICON_MD_FILE_UPLOAD, ICON_MD_LIST, yaze::Rom::is_loaded(), yaze::editor::kError, yaze::editor::kSuccess, yaze::editor::kWarning, last_errors_, last_warnings_, yaze::core::AsarWrapper::LoadSymbolsFromFile(), yaze::editor::EditorDependencies::project, rom_, yaze::editor::ToastManager::Show(), show_symbol_panel_, symbols_, yaze::project::YazeProject::symbols_filename, yaze::editor::EditorDependencies::toast_manager, ValidateCurrentFile(), and yaze::editor::EditorDependencies::version_manager.
Referenced by DrawCodeEditor().
|
private |
Definition at line 1152 of file assembly_editor.cc.
References ChangeActiveFile(), yaze::project::YazeProject::code_folder, current_folder_, yaze::editor::Editor::dependencies_, yaze::editor::FolderItem::files, yaze::project::YazeProject::GetAbsolutePath(), yaze::editor::FolderItem::name, OpenFolder(), yaze::editor::EditorDependencies::project, and yaze::editor::FolderItem::subfolders.
Referenced by DrawFileBrowser().

|
private |
Definition at line 1024 of file assembly_editor.cc.
References active_file_id_, active_files_, yaze::gui::BeginThemedTabBar(), current_file_, yaze::gui::EndThemedTabBar(), files_, yaze::util::GetFileName(), and open_files_.
Referenced by DrawCodeEditor().

|
private |
Definition at line 1138 of file assembly_editor.cc.
References yaze::gui::Toolset::AddAction(), yaze::gui::Toolset::Begin(), current_folder_, yaze::gui::Toolset::End(), ICON_MD_FOLDER_OPEN, ICON_MD_SAVE, Save(), and yaze::util::FileDialogWrapper::ShowOpenFolderDialog().
|
private |
Definition at line 1586 of file assembly_editor.cc.
References show_symbol_panel_, and symbols_.
Referenced by Update().
|
private |
Definition at line 806 of file assembly_editor.cc.
References symbol_jump_cache_, and symbol_jump_negative_cache_.
Referenced by OpenFolder().
|
private |
Definition at line 124 of file assembly_editor.h.
|
private |
Definition at line 125 of file assembly_editor.h.
|
private |
Definition at line 126 of file assembly_editor.h.
Referenced by active_cursor_position(), active_file_path(), ApplyPatchToRom(), ChangeActiveFile(), DrawFileTabView(), GetActiveEditor(), GetActiveEditor(), HasActiveFile(), Save(), and ValidateCurrentFile().
|
private |
Definition at line 128 of file assembly_editor.h.
Referenced by active_file_path(), ApplyPatchToRom(), ChangeActiveFile(), DrawFileTabView(), Save(), and ValidateCurrentFile().
|
private |
Definition at line 129 of file assembly_editor.h.
Referenced by active_cursor_position(), ChangeActiveFile(), DrawFileTabView(), GetActiveEditor(), GetActiveEditor(), and HasActiveFile().
|
private |
Definition at line 130 of file assembly_editor.h.
Referenced by ChangeActiveFile(), and DrawFileTabView().
|
private |
Definition at line 132 of file assembly_editor.h.
Referenced by ChangeActiveFile(), DrawCodeEditor(), DrawFileTabView(), and InlineUpdate().
|
private |
Definition at line 133 of file assembly_editor.h.
Referenced by DrawCurrentFolder(), DrawFileBrowser(), DrawToolbarContent(), DrawToolset(), JumpToReference(), JumpToSymbolDefinition(), and OpenFolder().
|
private |
Definition at line 134 of file assembly_editor.h.
Referenced by AssemblyEditor(), GetActiveEditor(), GetActiveEditor(), and Initialize().
|
private |
Definition at line 136 of file assembly_editor.h.
Referenced by ApplyPatchToRom(), DrawAssembleMenu(), DrawBuildOutput(), DrawToolbarContent(), rom(), and SetRom().
|
private |
Definition at line 139 of file assembly_editor.h.
Referenced by ApplyPatchToRom(), asar_wrapper(), DrawAssembleMenu(), and ValidateCurrentFile().
|
private |
Definition at line 140 of file assembly_editor.h.
Referenced by ApplyPatchToRom(), is_asar_initialized(), and ValidateCurrentFile().
|
private |
Definition at line 141 of file assembly_editor.h.
Referenced by DrawAssembleMenu(), and DrawSymbolPanel().
|
private |
Definition at line 142 of file assembly_editor.h.
Referenced by ApplyPatchToRom(), DrawAssembleMenu(), DrawSymbolPanel(), DrawSymbolsContent(), and symbols().
|
private |
Definition at line 143 of file assembly_editor.h.
Referenced by ApplyPatchToRom(), ClearErrorMarkers(), DrawAssembleMenu(), DrawBuildOutput(), UpdateErrorMarkers(), and ValidateCurrentFile().
|
private |
Definition at line 144 of file assembly_editor.h.
Referenced by ApplyPatchToRom(), DrawAssembleMenu(), DrawBuildOutput(), and UpdateErrorMarkers().
|
private |
Definition at line 148 of file assembly_editor.h.
Referenced by JumpToSymbolDefinition(), and OpenFolder().
|
private |
Definition at line 149 of file assembly_editor.h.
Referenced by ClearSymbolJumpCache(), and JumpToSymbolDefinition().
|
private |
Definition at line 150 of file assembly_editor.h.
Referenced by ClearSymbolJumpCache(), and JumpToSymbolDefinition().