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

Allows the user to edit graphics sheets from the game or view prototype graphics. More...

#include <graphics_editor.h>

Inheritance diagram for yaze::editor::GraphicsEditor:

Public Member Functions

 GraphicsEditor (Rom *rom=nullptr)
 
void Initialize () override
 
absl::Status Load () override
 
absl::Status Save () override
 
absl::Status Update () override
 
absl::Status Cut () override
 
absl::Status Copy () override
 
absl::Status Paste () override
 
absl::Status Undo () override
 
absl::Status Redo () override
 
absl::Status Find () override
 
void set_rom (Rom *rom)
 
void SetGameData (zelda3::GameData *game_data) override
 
void NextSheet ()
 
void PrevSheet ()
 
Romrom () const
 
- Public Member Functions inherited from yaze::editor::Editor
 Editor ()=default
 
virtual ~Editor ()=default
 
void SetDependencies (const EditorDependencies &deps)
 
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

void HandleEditorShortcuts ()
 
void DrawPrototypeViewer ()
 
absl::Status DrawCgxImport ()
 
absl::Status DrawScrImport ()
 
absl::Status DrawFileImport ()
 
absl::Status DrawObjImport ()
 
absl::Status DrawTilemapImport ()
 
absl::Status DrawPaletteControls ()
 
absl::Status DrawClipboardImport ()
 
absl::Status DrawExperimentalFeatures ()
 
absl::Status DrawMemoryEditor ()
 
absl::Status DecompressImportData (int size)
 
absl::Status DecompressSuperDonkey ()
 

Private Attributes

GraphicsEditorState state_
 
std::unique_ptr< SheetBrowserPanelsheet_browser_panel_
 
std::unique_ptr< PixelEditorPanelpixel_editor_panel_
 
std::unique_ptr< PaletteControlsPanelpalette_controls_panel_
 
std::unique_ptr< LinkSpritePanellink_sprite_panel_
 
std::unique_ptr< PolyhedralEditorPanelpolyhedral_panel_
 
std::unique_ptr< GfxGroupEditorgfx_group_panel_
 
std::unique_ptr< PalettesetEditorPanelpaletteset_panel_
 
int current_palette_ = 0
 
uint64_t current_offset_ = 0
 
uint64_t current_palette_index_ = 0
 
int current_bpp_ = 0
 
int scr_mod_value_ = 0
 
uint64_t num_sheets_to_load_ = 1
 
uint64_t bin_size_ = 0
 
uint64_t clipboard_offset_ = 0
 
uint64_t clipboard_size_ = 0
 
bool refresh_graphics_ = false
 
bool open_memory_editor_ = false
 
bool gfx_loaded_ = false
 
bool is_open_ = false
 
bool super_donkey_ = false
 
bool col_file_ = false
 
bool cgx_loaded_ = false
 
bool scr_loaded_ = false
 
bool obj_loaded_ = false
 
bool tilemap_loaded_ = false
 
std::string file_path_
 
std::string col_file_path_
 
std::string col_file_name_
 
std::string cgx_file_path_
 
std::string cgx_file_name_
 
std::string scr_file_path_
 
std::string scr_file_name_
 
std::string obj_file_path_
 
std::string tilemap_file_path_
 
std::string tilemap_file_name_
 
Rom temp_rom_
 
Rom tilemap_rom_
 
std::vector< uint8_t > import_data_
 
std::vector< uint8_t > decoded_cgx_
 
std::vector< uint8_t > cgx_data_
 
std::vector< uint8_t > extra_cgx_data_
 
std::vector< SDL_Color > decoded_col_
 
std::vector< uint8_t > scr_data_
 
std::vector< uint8_t > decoded_scr_data_
 
gfx::Bitmap cgx_bitmap_
 
gfx::Bitmap scr_bitmap_
 
gfx::Bitmap bin_bitmap_
 
std::array< gfx::Bitmap, zelda3::kNumGfxSheetsgfx_sheets_
 
gfx::PaletteGroup col_file_palette_group_
 
gfx::SnesPalette z3_rom_palette_
 
gfx::SnesPalette col_file_palette_
 
gui::Canvas import_canvas_
 
gui::Canvas scr_canvas_
 
gui::Canvas super_donkey_canvas_
 
absl::Status status_
 
Romrom_
 
zelda3::GameDatagame_data_ = nullptr
 

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_
 

Detailed Description

Allows the user to edit graphics sheets from the game or view prototype graphics.

The GraphicsEditor class is responsible for providing functionality to edit graphics sheets from the game or view prototype graphics of Link to the Past from the CGX, SCR, and OBJ formats. It provides various methods to update different components of the graphics editor, such as the graphics edit tab, link graphics view, and prototype graphics viewer. It also includes import functions for different file formats, as well as other utility functions for drawing toolsets, palette controls, clipboard imports, experimental features, and memory editor.

Definition at line 63 of file graphics_editor.h.

Constructor & Destructor Documentation

◆ GraphicsEditor()

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

Definition at line 65 of file graphics_editor.h.

References yaze::editor::kGraphics, and yaze::editor::Editor::type_.

Member Function Documentation

◆ Initialize()

◆ Load()

◆ Save()

◆ Update()

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

Implements yaze::editor::Editor.

Definition at line 273 of file graphics_editor.cc.

References CLEAR_AND_RETURN_STATUS, HandleEditorShortcuts(), and status_.

Here is the call graph for this function:

◆ Cut()

absl::Status yaze::editor::GraphicsEditor::Cut ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 73 of file graphics_editor.h.

◆ Copy()

absl::Status yaze::editor::GraphicsEditor::Copy ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 74 of file graphics_editor.h.

◆ Paste()

absl::Status yaze::editor::GraphicsEditor::Paste ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 75 of file graphics_editor.h.

◆ Undo()

absl::Status yaze::editor::GraphicsEditor::Undo ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 76 of file graphics_editor.h.

◆ Redo()

absl::Status yaze::editor::GraphicsEditor::Redo ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 77 of file graphics_editor.h.

◆ Find()

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

Implements yaze::editor::Editor.

Definition at line 78 of file graphics_editor.h.

◆ set_rom()

void yaze::editor::GraphicsEditor::set_rom ( Rom * rom)
inline

Definition at line 81 of file graphics_editor.h.

References rom(), and rom_.

Here is the call graph for this function:

◆ SetGameData()

void yaze::editor::GraphicsEditor::SetGameData ( zelda3::GameData * game_data)
inlineoverridevirtual

Reimplemented from yaze::editor::Editor.

Definition at line 84 of file graphics_editor.h.

References yaze::editor::Editor::game_data(), game_data_, and palette_controls_panel_.

Here is the call graph for this function:

◆ NextSheet()

void yaze::editor::GraphicsEditor::NextSheet ( )

◆ PrevSheet()

void yaze::editor::GraphicsEditor::PrevSheet ( )

◆ rom()

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

Definition at line 96 of file graphics_editor.h.

References rom_.

Referenced by DecompressImportData(), DrawPaletteControls(), Load(), and set_rom().

◆ HandleEditorShortcuts()

◆ DrawPrototypeViewer()

◆ DrawCgxImport()

◆ DrawScrImport()

◆ DrawFileImport()

◆ DrawObjImport()

absl::Status yaze::editor::GraphicsEditor::DrawObjImport ( )
private

◆ DrawTilemapImport()

◆ DrawPaletteControls()

◆ DrawClipboardImport()

◆ DrawExperimentalFeatures()

absl::Status yaze::editor::GraphicsEditor::DrawExperimentalFeatures ( )
private

Definition at line 615 of file graphics_editor.cc.

References DecompressSuperDonkey(), file_path_, RETURN_IF_ERROR, and yaze::gui::TextWithSeparators().

Referenced by DrawPrototypeViewer().

Here is the call graph for this function:

◆ DrawMemoryEditor()

absl::Status yaze::editor::GraphicsEditor::DrawMemoryEditor ( )
private

Definition at line 631 of file graphics_editor.cc.

References yaze::gui::MemoryEditorWidget::DrawWindow(), is_open_, yaze::Rom::mutable_data(), yaze::Rom::size(), and temp_rom_.

Referenced by DrawPrototypeViewer().

Here is the call graph for this function:

◆ DecompressImportData()

◆ DecompressSuperDonkey()

Member Data Documentation

◆ state_

GraphicsEditorState yaze::editor::GraphicsEditor::state_
private

Definition at line 103 of file graphics_editor.h.

Referenced by HandleEditorShortcuts(), Initialize(), NextSheet(), PrevSheet(), and Save().

◆ sheet_browser_panel_

std::unique_ptr<SheetBrowserPanel> yaze::editor::GraphicsEditor::sheet_browser_panel_
private

Definition at line 104 of file graphics_editor.h.

Referenced by Initialize().

◆ pixel_editor_panel_

std::unique_ptr<PixelEditorPanel> yaze::editor::GraphicsEditor::pixel_editor_panel_
private

Definition at line 105 of file graphics_editor.h.

Referenced by Initialize().

◆ palette_controls_panel_

std::unique_ptr<PaletteControlsPanel> yaze::editor::GraphicsEditor::palette_controls_panel_
private

Definition at line 106 of file graphics_editor.h.

Referenced by Initialize(), and SetGameData().

◆ link_sprite_panel_

std::unique_ptr<LinkSpritePanel> yaze::editor::GraphicsEditor::link_sprite_panel_
private

Definition at line 107 of file graphics_editor.h.

Referenced by Initialize().

◆ polyhedral_panel_

std::unique_ptr<PolyhedralEditorPanel> yaze::editor::GraphicsEditor::polyhedral_panel_
private

Definition at line 108 of file graphics_editor.h.

Referenced by Initialize(), and Load().

◆ gfx_group_panel_

std::unique_ptr<GfxGroupEditor> yaze::editor::GraphicsEditor::gfx_group_panel_
private

Definition at line 109 of file graphics_editor.h.

Referenced by Initialize().

◆ paletteset_panel_

std::unique_ptr<PalettesetEditorPanel> yaze::editor::GraphicsEditor::paletteset_panel_
private

Definition at line 110 of file graphics_editor.h.

Referenced by Initialize().

◆ current_palette_

int yaze::editor::GraphicsEditor::current_palette_ = 0
private

◆ current_offset_

uint64_t yaze::editor::GraphicsEditor::current_offset_ = 0
private

Definition at line 128 of file graphics_editor.h.

Referenced by DecompressImportData(), and DrawFileImport().

◆ current_palette_index_

uint64_t yaze::editor::GraphicsEditor::current_palette_index_ = 0
private

Definition at line 129 of file graphics_editor.h.

Referenced by DecompressSuperDonkey(), and DrawPaletteControls().

◆ current_bpp_

int yaze::editor::GraphicsEditor::current_bpp_ = 0
private

Definition at line 130 of file graphics_editor.h.

Referenced by DrawCgxImport(), and DrawScrImport().

◆ scr_mod_value_

int yaze::editor::GraphicsEditor::scr_mod_value_ = 0
private

Definition at line 131 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ num_sheets_to_load_

uint64_t yaze::editor::GraphicsEditor::num_sheets_to_load_ = 1
private

◆ bin_size_

uint64_t yaze::editor::GraphicsEditor::bin_size_ = 0
private

Definition at line 133 of file graphics_editor.h.

Referenced by DrawFileImport().

◆ clipboard_offset_

uint64_t yaze::editor::GraphicsEditor::clipboard_offset_ = 0
private

Definition at line 134 of file graphics_editor.h.

Referenced by DrawClipboardImport().

◆ clipboard_size_

uint64_t yaze::editor::GraphicsEditor::clipboard_size_ = 0
private

Definition at line 135 of file graphics_editor.h.

Referenced by DrawClipboardImport().

◆ refresh_graphics_

bool yaze::editor::GraphicsEditor::refresh_graphics_ = false
private

Definition at line 136 of file graphics_editor.h.

Referenced by DrawPaletteControls().

◆ open_memory_editor_

bool yaze::editor::GraphicsEditor::open_memory_editor_ = false
private

Definition at line 137 of file graphics_editor.h.

Referenced by DrawClipboardImport(), and DrawPrototypeViewer().

◆ gfx_loaded_

bool yaze::editor::GraphicsEditor::gfx_loaded_ = false
private

Definition at line 138 of file graphics_editor.h.

Referenced by DecompressImportData(), and DrawPrototypeViewer().

◆ is_open_

bool yaze::editor::GraphicsEditor::is_open_ = false
private

◆ super_donkey_

bool yaze::editor::GraphicsEditor::super_donkey_ = false
private

Definition at line 140 of file graphics_editor.h.

Referenced by DecompressSuperDonkey(), and DrawPrototypeViewer().

◆ col_file_

bool yaze::editor::GraphicsEditor::col_file_ = false
private

◆ cgx_loaded_

bool yaze::editor::GraphicsEditor::cgx_loaded_ = false
private

Definition at line 142 of file graphics_editor.h.

Referenced by DrawCgxImport(), and DrawPrototypeViewer().

◆ scr_loaded_

bool yaze::editor::GraphicsEditor::scr_loaded_ = false
private

Definition at line 143 of file graphics_editor.h.

Referenced by DrawPrototypeViewer(), and DrawScrImport().

◆ obj_loaded_

bool yaze::editor::GraphicsEditor::obj_loaded_ = false
private

Definition at line 144 of file graphics_editor.h.

Referenced by DrawObjImport().

◆ tilemap_loaded_

bool yaze::editor::GraphicsEditor::tilemap_loaded_ = false
private

Definition at line 145 of file graphics_editor.h.

Referenced by DrawTilemapImport().

◆ file_path_

std::string yaze::editor::GraphicsEditor::file_path_
private

Definition at line 147 of file graphics_editor.h.

Referenced by DrawExperimentalFeatures(), and DrawFileImport().

◆ col_file_path_

std::string yaze::editor::GraphicsEditor::col_file_path_
private

Definition at line 148 of file graphics_editor.h.

Referenced by DrawPaletteControls().

◆ col_file_name_

std::string yaze::editor::GraphicsEditor::col_file_name_
private

Definition at line 149 of file graphics_editor.h.

Referenced by DrawPaletteControls().

◆ cgx_file_path_

std::string yaze::editor::GraphicsEditor::cgx_file_path_
private

Definition at line 150 of file graphics_editor.h.

Referenced by DrawCgxImport().

◆ cgx_file_name_

std::string yaze::editor::GraphicsEditor::cgx_file_name_
private

Definition at line 151 of file graphics_editor.h.

Referenced by DrawCgxImport().

◆ scr_file_path_

std::string yaze::editor::GraphicsEditor::scr_file_path_
private

Definition at line 152 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ scr_file_name_

std::string yaze::editor::GraphicsEditor::scr_file_name_
private

Definition at line 153 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ obj_file_path_

std::string yaze::editor::GraphicsEditor::obj_file_path_
private

Definition at line 154 of file graphics_editor.h.

Referenced by DrawObjImport().

◆ tilemap_file_path_

std::string yaze::editor::GraphicsEditor::tilemap_file_path_
private

Definition at line 155 of file graphics_editor.h.

Referenced by DrawTilemapImport().

◆ tilemap_file_name_

std::string yaze::editor::GraphicsEditor::tilemap_file_name_
private

Definition at line 156 of file graphics_editor.h.

◆ temp_rom_

Rom yaze::editor::GraphicsEditor::temp_rom_
private

◆ tilemap_rom_

Rom yaze::editor::GraphicsEditor::tilemap_rom_
private

Definition at line 159 of file graphics_editor.h.

Referenced by DrawTilemapImport().

◆ import_data_

std::vector<uint8_t> yaze::editor::GraphicsEditor::import_data_
private

Definition at line 160 of file graphics_editor.h.

Referenced by DecompressImportData().

◆ decoded_cgx_

std::vector<uint8_t> yaze::editor::GraphicsEditor::decoded_cgx_
private

Definition at line 161 of file graphics_editor.h.

Referenced by DrawCgxImport(), and DrawScrImport().

◆ cgx_data_

std::vector<uint8_t> yaze::editor::GraphicsEditor::cgx_data_
private

Definition at line 162 of file graphics_editor.h.

Referenced by DrawCgxImport().

◆ extra_cgx_data_

std::vector<uint8_t> yaze::editor::GraphicsEditor::extra_cgx_data_
private

Definition at line 163 of file graphics_editor.h.

Referenced by DrawCgxImport().

◆ decoded_col_

std::vector<SDL_Color> yaze::editor::GraphicsEditor::decoded_col_
private

Definition at line 164 of file graphics_editor.h.

Referenced by DrawCgxImport(), DrawPaletteControls(), and DrawScrImport().

◆ scr_data_

std::vector<uint8_t> yaze::editor::GraphicsEditor::scr_data_
private

Definition at line 165 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ decoded_scr_data_

std::vector<uint8_t> yaze::editor::GraphicsEditor::decoded_scr_data_
private

Definition at line 166 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ cgx_bitmap_

gfx::Bitmap yaze::editor::GraphicsEditor::cgx_bitmap_
private

Definition at line 167 of file graphics_editor.h.

Referenced by DrawCgxImport(), and DrawPrototypeViewer().

◆ scr_bitmap_

gfx::Bitmap yaze::editor::GraphicsEditor::scr_bitmap_
private

Definition at line 168 of file graphics_editor.h.

Referenced by DrawPrototypeViewer(), and DrawScrImport().

◆ bin_bitmap_

gfx::Bitmap yaze::editor::GraphicsEditor::bin_bitmap_
private

Definition at line 169 of file graphics_editor.h.

Referenced by DecompressImportData(), and DrawPrototypeViewer().

◆ gfx_sheets_

std::array<gfx::Bitmap, zelda3::kNumGfxSheets> yaze::editor::GraphicsEditor::gfx_sheets_
private

Definition at line 170 of file graphics_editor.h.

Referenced by DecompressSuperDonkey(), and DrawPrototypeViewer().

◆ col_file_palette_group_

gfx::PaletteGroup yaze::editor::GraphicsEditor::col_file_palette_group_
private

Definition at line 171 of file graphics_editor.h.

Referenced by DecompressSuperDonkey(), and DrawPaletteControls().

◆ z3_rom_palette_

gfx::SnesPalette yaze::editor::GraphicsEditor::z3_rom_palette_
private

Definition at line 172 of file graphics_editor.h.

Referenced by DecompressImportData(), and DecompressSuperDonkey().

◆ col_file_palette_

gfx::SnesPalette yaze::editor::GraphicsEditor::col_file_palette_
private

Definition at line 173 of file graphics_editor.h.

Referenced by DecompressImportData(), and DrawPaletteControls().

◆ import_canvas_

gui::Canvas yaze::editor::GraphicsEditor::import_canvas_
private

Definition at line 174 of file graphics_editor.h.

Referenced by DrawPrototypeViewer().

◆ scr_canvas_

gui::Canvas yaze::editor::GraphicsEditor::scr_canvas_
private

Definition at line 175 of file graphics_editor.h.

Referenced by DrawPrototypeViewer().

◆ super_donkey_canvas_

gui::Canvas yaze::editor::GraphicsEditor::super_donkey_canvas_
private

Definition at line 176 of file graphics_editor.h.

◆ status_

absl::Status yaze::editor::GraphicsEditor::status_
private

◆ rom_

Rom* yaze::editor::GraphicsEditor::rom_
private

Definition at line 182 of file graphics_editor.h.

Referenced by Initialize(), Load(), rom(), Save(), and set_rom().

◆ game_data_

zelda3::GameData* yaze::editor::GraphicsEditor::game_data_ = nullptr
private

Definition at line 183 of file graphics_editor.h.

Referenced by Initialize(), and SetGameData().


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