yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::AssemblyEditor Class Reference

Text editor for modifying assembly code. More...

#include <assembly_editor.h>

Inheritance diagram for yaze::editor::AssemblyEditor:

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)
 
Romrom () const
 
bool is_asar_initialized () const
 
const std::map< std::string, core::AsarSymbol > & symbols () const
 
core::AsarWrapperasar_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 UndoManagerundo_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
 
Romrom () const
 
zelda3::GameDatagame_data () const
 
EditorContext context () const
 
bool HasContext () const
 

Private Member Functions

TextEditorGetActiveEditor ()
 
const TextEditorGetActiveEditor () 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< TextEditoropen_files_
 
ImVector< int > active_files_
 
std::string current_file_
 
FolderItem current_folder_
 
TextEditor text_editor_
 
Romrom_
 
core::AsarWrapper asar_
 
bool asar_initialized_ = false
 
bool show_symbol_panel_ = false
 
std::map< std::string, core::AsarSymbolsymbols_
 
std::vector< std::string > last_errors_
 
std::vector< std::string > last_warnings_
 
std::string symbol_jump_root_
 
absl::flat_hash_map< std::string, AsmSymbolLocationsymbol_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_
 

Detailed Description

Text editor for modifying assembly code.

Definition at line 36 of file assembly_editor.h.

Constructor & Destructor Documentation

◆ AssemblyEditor()

yaze::editor::AssemblyEditor::AssemblyEditor ( Rom * rom = nullptr)
inlineexplicit

Member Function Documentation

◆ ChangeActiveFile()

void yaze::editor::AssemblyEditor::ChangeActiveFile ( const std::string_view & filename)

◆ JumpToSymbolDefinition()

◆ JumpToReference()

◆ active_file_path()

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().

Here is the call graph for this function:

◆ active_cursor_position()

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_.

Here is the call graph for this function:

◆ Initialize()

◆ Load()

absl::Status yaze::editor::AssemblyEditor::Load ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 604 of file assembly_editor.cc.

◆ InlineUpdate()

◆ UpdateCodeView()

void yaze::editor::AssemblyEditor::UpdateCodeView ( )

Definition at line 1113 of file assembly_editor.cc.

References DrawFileBrowser(), and DrawToolbarContent().

Here is the call graph for this function:

◆ Cut()

absl::Status yaze::editor::AssemblyEditor::Cut ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1289 of file assembly_editor.cc.

References TextEditor::Cut(), and GetActiveEditor().

Here is the call graph for this function:

◆ Copy()

absl::Status yaze::editor::AssemblyEditor::Copy ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1294 of file assembly_editor.cc.

References TextEditor::Copy(), and GetActiveEditor().

Here is the call graph for this function:

◆ Paste()

absl::Status yaze::editor::AssemblyEditor::Paste ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1299 of file assembly_editor.cc.

References GetActiveEditor(), and TextEditor::Paste().

Here is the call graph for this function:

◆ Undo()

absl::Status yaze::editor::AssemblyEditor::Undo ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1304 of file assembly_editor.cc.

References GetActiveEditor(), and TextEditor::Undo().

Here is the call graph for this function:

◆ Redo()

absl::Status yaze::editor::AssemblyEditor::Redo ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1309 of file assembly_editor.cc.

References GetActiveEditor(), and TextEditor::Redo().

Here is the call graph for this function:

◆ Find()

absl::Status yaze::editor::AssemblyEditor::Find ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 72 of file assembly_editor.h.

◆ Update()

absl::Status yaze::editor::AssemblyEditor::Update ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1082 of file assembly_editor.cc.

References yaze::editor::Editor::active_, DrawCodeEditor(), and DrawSymbolPanel().

Here is the call graph for this function:

◆ Save()

absl::Status yaze::editor::AssemblyEditor::Save ( )
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().

Here is the call graph for this function:

◆ OpenFolder()

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().

Here is the call graph for this function:

◆ ValidateCurrentFile()

◆ ApplyPatchToRom()

◆ UpdateErrorMarkers()

void yaze::editor::AssemblyEditor::UpdateErrorMarkers ( const core::AsarPatchResult & result)

◆ ClearErrorMarkers()

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().

Here is the call graph for this function:

◆ SetRom()

void yaze::editor::AssemblyEditor::SetRom ( Rom * rom)
inline

Definition at line 86 of file assembly_editor.h.

References rom(), and rom_.

Here is the call graph for this function:

◆ rom()

Rom * yaze::editor::AssemblyEditor::rom ( ) const
inline

Definition at line 87 of file assembly_editor.h.

References rom_.

Referenced by SetRom().

◆ is_asar_initialized()

bool yaze::editor::AssemblyEditor::is_asar_initialized ( ) const
inline

Definition at line 90 of file assembly_editor.h.

References asar_initialized_.

◆ symbols()

const std::map< std::string, core::AsarSymbol > & yaze::editor::AssemblyEditor::symbols ( ) const
inline

Definition at line 91 of file assembly_editor.h.

References symbols_.

◆ asar_wrapper()

core::AsarWrapper * yaze::editor::AssemblyEditor::asar_wrapper ( )
inline

Definition at line 94 of file assembly_editor.h.

References asar_.

◆ GetActiveEditor() [1/2]

TextEditor * yaze::editor::AssemblyEditor::GetActiveEditor ( )
private

◆ GetActiveEditor() [2/2]

const TextEditor * yaze::editor::AssemblyEditor::GetActiveEditor ( ) const
private

Definition at line 791 of file assembly_editor.cc.

References active_file_id_, HasActiveFile(), open_files_, and text_editor_.

Here is the call graph for this function:

◆ HasActiveFile()

◆ DrawCodeEditor()

◆ DrawFileBrowser()

◆ DrawSymbolsContent()

void yaze::editor::AssemblyEditor::DrawSymbolsContent ( )
private

Definition at line 871 of file assembly_editor.cc.

References ICON_MD_SEARCH, and symbols_.

Referenced by Initialize().

◆ DrawBuildOutput()

◆ DrawToolbarContent()

◆ DrawFileMenu()

void yaze::editor::AssemblyEditor::DrawFileMenu ( )
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().

Here is the call graph for this function:

◆ DrawEditMenu()

◆ DrawAssembleMenu()

◆ DrawCurrentFolder()

◆ DrawFileTabView()

void yaze::editor::AssemblyEditor::DrawFileTabView ( )
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().

Here is the call graph for this function:

◆ DrawToolset()

◆ DrawSymbolPanel()

void yaze::editor::AssemblyEditor::DrawSymbolPanel ( )
private

Definition at line 1586 of file assembly_editor.cc.

References show_symbol_panel_, and symbols_.

Referenced by Update().

◆ ClearSymbolJumpCache()

void yaze::editor::AssemblyEditor::ClearSymbolJumpCache ( )
private

Definition at line 806 of file assembly_editor.cc.

References symbol_jump_cache_, and symbol_jump_negative_cache_.

Referenced by OpenFolder().

Member Data Documentation

◆ file_is_loaded_

bool yaze::editor::AssemblyEditor::file_is_loaded_ = false
private

Definition at line 124 of file assembly_editor.h.

◆ current_file_id_

int yaze::editor::AssemblyEditor::current_file_id_ = 0
private

Definition at line 125 of file assembly_editor.h.

◆ active_file_id_

int yaze::editor::AssemblyEditor::active_file_id_ = -1
private

◆ files_

std::vector<std::string> yaze::editor::AssemblyEditor::files_
private

◆ open_files_

std::vector<TextEditor> yaze::editor::AssemblyEditor::open_files_
private

◆ active_files_

ImVector<int> yaze::editor::AssemblyEditor::active_files_
private

Definition at line 130 of file assembly_editor.h.

Referenced by ChangeActiveFile(), and DrawFileTabView().

◆ current_file_

std::string yaze::editor::AssemblyEditor::current_file_
private

Definition at line 132 of file assembly_editor.h.

Referenced by ChangeActiveFile(), DrawCodeEditor(), DrawFileTabView(), and InlineUpdate().

◆ current_folder_

FolderItem yaze::editor::AssemblyEditor::current_folder_
private

◆ text_editor_

TextEditor yaze::editor::AssemblyEditor::text_editor_
private

Definition at line 134 of file assembly_editor.h.

Referenced by AssemblyEditor(), GetActiveEditor(), GetActiveEditor(), and Initialize().

◆ rom_

Rom* yaze::editor::AssemblyEditor::rom_
private

◆ asar_

core::AsarWrapper yaze::editor::AssemblyEditor::asar_
private

◆ asar_initialized_

bool yaze::editor::AssemblyEditor::asar_initialized_ = false
private

Definition at line 140 of file assembly_editor.h.

Referenced by ApplyPatchToRom(), is_asar_initialized(), and ValidateCurrentFile().

◆ show_symbol_panel_

bool yaze::editor::AssemblyEditor::show_symbol_panel_ = false
private

Definition at line 141 of file assembly_editor.h.

Referenced by DrawAssembleMenu(), and DrawSymbolPanel().

◆ symbols_

std::map<std::string, core::AsarSymbol> yaze::editor::AssemblyEditor::symbols_
private

◆ last_errors_

std::vector<std::string> yaze::editor::AssemblyEditor::last_errors_
private

◆ last_warnings_

std::vector<std::string> yaze::editor::AssemblyEditor::last_warnings_
private

◆ symbol_jump_root_

std::string yaze::editor::AssemblyEditor::symbol_jump_root_
private

Definition at line 148 of file assembly_editor.h.

Referenced by JumpToSymbolDefinition(), and OpenFolder().

◆ symbol_jump_cache_

absl::flat_hash_map<std::string, AsmSymbolLocation> yaze::editor::AssemblyEditor::symbol_jump_cache_
private

Definition at line 149 of file assembly_editor.h.

Referenced by ClearSymbolJumpCache(), and JumpToSymbolDefinition().

◆ symbol_jump_negative_cache_

absl::flat_hash_set<std::string> yaze::editor::AssemblyEditor::symbol_jump_negative_cache_
private

Definition at line 150 of file assembly_editor.h.

Referenced by ClearSymbolJumpCache(), and JumpToSymbolDefinition().


The documentation for this class was generated from the following files: