yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::app::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::app::editor::GraphicsEditor:
Collaboration diagram for yaze::app::editor::GraphicsEditor:

Public Member Functions

 GraphicsEditor ()
 
absl::Status Update () override
 
absl::Status Undo () override
 
absl::Status Redo () override
 
absl::Status Cut () override
 
absl::Status Copy () override
 
absl::Status Paste () override
 
absl::Status Find () override
 
- Public Member Functions inherited from yaze::app::SharedRom
 SharedRom ()=default
 
virtual ~SharedRom ()=default
 
std::shared_ptr< Romshared_rom ()
 
auto rom ()
 
- Public Member Functions inherited from yaze::app::editor::Editor
 Editor ()=default
 
virtual ~Editor ()=default
 
EditorType type () const
 

Private Types

enum class  GfxEditMode { kSelect , kPencil , kFill }
 

Private Member Functions

absl::Status UpdateGfxEdit ()
 
absl::Status UpdateGfxSheetList ()
 
absl::Status UpdateGfxTabView ()
 
absl::Status UpdatePaletteColumn ()
 
void DrawGfxEditToolset ()
 
absl::Status UpdateLinkGfxView ()
 
absl::Status UpdateScadView ()
 
absl::Status DrawCgxImport ()
 
absl::Status DrawScrImport ()
 
absl::Status DrawFileImport ()
 
absl::Status DrawObjImport ()
 
absl::Status DrawTilemapImport ()
 
absl::Status DrawToolset ()
 
absl::Status DrawPaletteControls ()
 
absl::Status DrawClipboardImport ()
 
absl::Status DrawExperimentalFeatures ()
 
absl::Status DrawMemoryEditor ()
 
absl::Status DecompressImportData (int size)
 
absl::Status DecompressSuperDonkey ()
 

Private Attributes

ImVec4 current_color_
 
uint16_t current_sheet_ = 0
 
uint8_t tile_size_ = 0x01
 
std::set< uint16_t > open_sheets_
 
std::set< uint16_t > child_window_sheets_
 
std::stack< uint16_t > release_queue_
 
uint64_t edit_palette_group_name_index_ = 0
 
uint64_t edit_palette_group_index_ = 0
 
uint64_t edit_palette_index_ = 0
 
uint64_t edit_palette_sub_index_ = 0
 
float sheet_scale_ = 2.0f
 
float current_scale_ = 4.0f
 
int current_palette_ = 0
 
uint64_t current_offset_ = 0
 
uint64_t current_size_ = 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
 
char file_path_ [256] = ""
 
char col_file_path_ [256] = ""
 
char col_file_name_ [256] = ""
 
char cgx_file_path_ [256] = ""
 
char cgx_file_name_ [256] = ""
 
char scr_file_path_ [256] = ""
 
char scr_file_name_ [256] = ""
 
char obj_file_path_ [256] = ""
 
char tilemap_file_path_ [256] = ""
 
char tilemap_file_name_ [256] = ""
 
gui::GfxSheetAssetBrowser asset_browser_
 
GfxEditMode gfx_edit_mode_ = GfxEditMode::kSelect
 
Rom temp_rom_
 
Rom tilemap_rom_
 
zelda3::overworld::Overworld overworld_
 
MemoryEditor cgx_memory_editor_
 
MemoryEditor col_memory_editor_
 
PaletteEditor palette_editor_
 
std::vector< uint8_t > import_data_
 
std::vector< uint8_t > graphics_buffer_
 
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_
 
gfx::Bitmap link_full_sheet_
 
std::array< gfx::Bitmap, kNumGfxSheetsgfx_sheets_
 
gfx::PaletteGroup col_file_palette_group_
 
gfx::SnesPalette z3_rom_palette_
 
gfx::SnesPalette col_file_palette_
 
gfx::SnesPalette link_palette_
 
gui::Canvas import_canvas_
 
gui::Canvas scr_canvas_
 
gui::Canvas super_donkey_canvas_
 
gui::Canvas graphics_bin_canvas_
 
gui::Canvas current_sheet_canvas_
 
gui::Canvas link_canvas_
 
absl::Status status_
 

Additional Inherited Members

- Static Public Attributes inherited from yaze::app::SharedRom
static std::shared_ptr< Romshared_rom_ = nullptr
 
- Protected Attributes inherited from yaze::app::editor::Editor
EditorType type_
 
EditorContext context_
 

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 58 of file graphics_editor.h.

Member Enumeration Documentation

◆ GfxEditMode

Enumerator
kSelect 
kPencil 
kFill 

Definition at line 72 of file graphics_editor.h.

Constructor & Destructor Documentation

◆ GraphicsEditor()

yaze::app::editor::GraphicsEditor::GraphicsEditor ( )
inline

Member Function Documentation

◆ Update()

◆ Undo()

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

Implements yaze::app::editor::Editor.

Definition at line 64 of file graphics_editor.h.

◆ Redo()

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

Implements yaze::app::editor::Editor.

Definition at line 65 of file graphics_editor.h.

◆ Cut()

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

Implements yaze::app::editor::Editor.

Definition at line 66 of file graphics_editor.h.

◆ Copy()

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

Implements yaze::app::editor::Editor.

Definition at line 67 of file graphics_editor.h.

◆ Paste()

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

Implements yaze::app::editor::Editor.

Definition at line 68 of file graphics_editor.h.

◆ Find()

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

Implements yaze::app::editor::Editor.

Definition at line 69 of file graphics_editor.h.

◆ UpdateGfxEdit()

absl::Status yaze::app::editor::GraphicsEditor::UpdateGfxEdit ( )
private

◆ UpdateGfxSheetList()

absl::Status yaze::app::editor::GraphicsEditor::UpdateGfxSheetList ( )
private

◆ UpdateGfxTabView()

◆ UpdatePaletteColumn()

◆ DrawGfxEditToolset()

◆ UpdateLinkGfxView()

◆ UpdateScadView()

◆ DrawCgxImport()

◆ DrawScrImport()

◆ DrawFileImport()

absl::Status yaze::app::editor::GraphicsEditor::DrawFileImport ( )
private

◆ DrawObjImport()

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

◆ DrawTilemapImport()

absl::Status yaze::app::editor::GraphicsEditor::DrawTilemapImport ( )
private

◆ DrawToolset()

absl::Status yaze::app::editor::GraphicsEditor::DrawToolset ( )
private

Definition at line 487 of file graphics_editor.cc.

References ICON_MD_MEMORY, open_memory_editor_, and TEXT_COLUMN.

Referenced by UpdateScadView().

◆ DrawPaletteControls()

◆ DrawClipboardImport()

absl::Status yaze::app::editor::GraphicsEditor::DrawClipboardImport ( )
private

◆ DrawExperimentalFeatures()

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

Definition at line 740 of file graphics_editor.cc.

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

Referenced by UpdateScadView().

Here is the call graph for this function:

◆ DrawMemoryEditor()

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

Definition at line 757 of file graphics_editor.cc.

References yaze::app::Rom::data(), is_open_, yaze::app::Rom::size(), and temp_rom_.

Referenced by UpdateScadView().

Here is the call graph for this function:

◆ DecompressImportData()

◆ DecompressSuperDonkey()

Member Data Documentation

◆ current_color_

ImVec4 yaze::app::editor::GraphicsEditor::current_color_
private

Definition at line 109 of file graphics_editor.h.

Referenced by DrawGfxEditToolset(), and UpdateGfxTabView().

◆ current_sheet_

uint16_t yaze::app::editor::GraphicsEditor::current_sheet_ = 0
private

◆ tile_size_

uint8_t yaze::app::editor::GraphicsEditor::tile_size_ = 0x01
private

Definition at line 111 of file graphics_editor.h.

Referenced by DrawGfxEditToolset(), and UpdateGfxTabView().

◆ open_sheets_

std::set<uint16_t> yaze::app::editor::GraphicsEditor::open_sheets_
private

Definition at line 112 of file graphics_editor.h.

Referenced by UpdateGfxSheetList(), UpdateGfxTabView(), and UpdatePaletteColumn().

◆ child_window_sheets_

std::set<uint16_t> yaze::app::editor::GraphicsEditor::child_window_sheets_
private

Definition at line 113 of file graphics_editor.h.

Referenced by UpdateGfxTabView().

◆ release_queue_

std::stack<uint16_t> yaze::app::editor::GraphicsEditor::release_queue_
private

Definition at line 114 of file graphics_editor.h.

Referenced by UpdateGfxTabView().

◆ edit_palette_group_name_index_

uint64_t yaze::app::editor::GraphicsEditor::edit_palette_group_name_index_ = 0
private

Definition at line 115 of file graphics_editor.h.

Referenced by UpdatePaletteColumn().

◆ edit_palette_group_index_

uint64_t yaze::app::editor::GraphicsEditor::edit_palette_group_index_ = 0
private

Definition at line 116 of file graphics_editor.h.

◆ edit_palette_index_

uint64_t yaze::app::editor::GraphicsEditor::edit_palette_index_ = 0
private

Definition at line 117 of file graphics_editor.h.

Referenced by UpdatePaletteColumn().

◆ edit_palette_sub_index_

uint64_t yaze::app::editor::GraphicsEditor::edit_palette_sub_index_ = 0
private

Definition at line 118 of file graphics_editor.h.

Referenced by UpdatePaletteColumn().

◆ sheet_scale_

float yaze::app::editor::GraphicsEditor::sheet_scale_ = 2.0f
private

Definition at line 119 of file graphics_editor.h.

Referenced by UpdateGfxSheetList().

◆ current_scale_

float yaze::app::editor::GraphicsEditor::current_scale_ = 4.0f
private

Definition at line 120 of file graphics_editor.h.

Referenced by DrawGfxEditToolset(), and UpdateGfxTabView().

◆ current_palette_

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

◆ current_offset_

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

Definition at line 124 of file graphics_editor.h.

Referenced by DecompressImportData(), and DrawFileImport().

◆ current_size_

uint64_t yaze::app::editor::GraphicsEditor::current_size_ = 0
private

Definition at line 125 of file graphics_editor.h.

◆ current_palette_index_

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

Definition at line 126 of file graphics_editor.h.

Referenced by DecompressSuperDonkey(), and DrawPaletteControls().

◆ current_bpp_

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

Definition at line 127 of file graphics_editor.h.

Referenced by DrawCgxImport(), and DrawScrImport().

◆ scr_mod_value_

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

Definition at line 128 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ num_sheets_to_load_

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

Definition at line 130 of file graphics_editor.h.

Referenced by DecompressSuperDonkey(), and DrawClipboardImport().

◆ bin_size_

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

Definition at line 131 of file graphics_editor.h.

Referenced by DrawFileImport().

◆ clipboard_offset_

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

Definition at line 132 of file graphics_editor.h.

Referenced by DrawClipboardImport().

◆ clipboard_size_

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

Definition at line 133 of file graphics_editor.h.

Referenced by DrawClipboardImport().

◆ refresh_graphics_

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

Definition at line 135 of file graphics_editor.h.

Referenced by DrawPaletteControls(), and UpdatePaletteColumn().

◆ open_memory_editor_

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

Definition at line 136 of file graphics_editor.h.

Referenced by DrawClipboardImport(), DrawToolset(), and UpdateScadView().

◆ gfx_loaded_

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

Definition at line 137 of file graphics_editor.h.

Referenced by DecompressImportData(), and UpdateScadView().

◆ is_open_

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

◆ super_donkey_

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

Definition at line 139 of file graphics_editor.h.

Referenced by DecompressSuperDonkey(), and UpdateScadView().

◆ col_file_

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

◆ cgx_loaded_

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

Definition at line 141 of file graphics_editor.h.

Referenced by DrawCgxImport(), and UpdateScadView().

◆ scr_loaded_

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

Definition at line 142 of file graphics_editor.h.

Referenced by DrawScrImport(), and UpdateScadView().

◆ obj_loaded_

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

Definition at line 143 of file graphics_editor.h.

◆ tilemap_loaded_

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

Definition at line 144 of file graphics_editor.h.

Referenced by DrawTilemapImport().

◆ file_path_

char yaze::app::editor::GraphicsEditor::file_path_[256] = ""
private

Definition at line 146 of file graphics_editor.h.

Referenced by DrawExperimentalFeatures(), DrawFileImport(), and DrawObjImport().

◆ col_file_path_

char yaze::app::editor::GraphicsEditor::col_file_path_[256] = ""
private

Definition at line 147 of file graphics_editor.h.

Referenced by DrawPaletteControls().

◆ col_file_name_

char yaze::app::editor::GraphicsEditor::col_file_name_[256] = ""
private

Definition at line 148 of file graphics_editor.h.

Referenced by DrawPaletteControls().

◆ cgx_file_path_

char yaze::app::editor::GraphicsEditor::cgx_file_path_[256] = ""
private

Definition at line 149 of file graphics_editor.h.

Referenced by DrawCgxImport().

◆ cgx_file_name_

char yaze::app::editor::GraphicsEditor::cgx_file_name_[256] = ""
private

Definition at line 150 of file graphics_editor.h.

Referenced by DrawCgxImport().

◆ scr_file_path_

char yaze::app::editor::GraphicsEditor::scr_file_path_[256] = ""
private

Definition at line 151 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ scr_file_name_

char yaze::app::editor::GraphicsEditor::scr_file_name_[256] = ""
private

Definition at line 152 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ obj_file_path_

char yaze::app::editor::GraphicsEditor::obj_file_path_[256] = ""
private

Definition at line 153 of file graphics_editor.h.

Referenced by DrawObjImport().

◆ tilemap_file_path_

char yaze::app::editor::GraphicsEditor::tilemap_file_path_[256] = ""
private

Definition at line 154 of file graphics_editor.h.

Referenced by DrawTilemapImport().

◆ tilemap_file_name_

char yaze::app::editor::GraphicsEditor::tilemap_file_name_[256] = ""
private

Definition at line 155 of file graphics_editor.h.

◆ asset_browser_

gui::GfxSheetAssetBrowser yaze::app::editor::GraphicsEditor::asset_browser_
private

Definition at line 157 of file graphics_editor.h.

Referenced by Update().

◆ gfx_edit_mode_

GfxEditMode yaze::app::editor::GraphicsEditor::gfx_edit_mode_ = GfxEditMode::kSelect
private

Definition at line 159 of file graphics_editor.h.

Referenced by DrawGfxEditToolset().

◆ temp_rom_

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

◆ tilemap_rom_

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

Definition at line 162 of file graphics_editor.h.

Referenced by DrawTilemapImport().

◆ overworld_

zelda3::overworld::Overworld yaze::app::editor::GraphicsEditor::overworld_
private

Definition at line 163 of file graphics_editor.h.

◆ cgx_memory_editor_

MemoryEditor yaze::app::editor::GraphicsEditor::cgx_memory_editor_
private

Definition at line 164 of file graphics_editor.h.

◆ col_memory_editor_

MemoryEditor yaze::app::editor::GraphicsEditor::col_memory_editor_
private

Definition at line 165 of file graphics_editor.h.

◆ palette_editor_

PaletteEditor yaze::app::editor::GraphicsEditor::palette_editor_
private

Definition at line 166 of file graphics_editor.h.

◆ import_data_

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

Definition at line 167 of file graphics_editor.h.

Referenced by DecompressImportData().

◆ graphics_buffer_

std::vector<uint8_t> yaze::app::editor::GraphicsEditor::graphics_buffer_
private

Definition at line 168 of file graphics_editor.h.

◆ decoded_cgx_

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

Definition at line 169 of file graphics_editor.h.

Referenced by DrawCgxImport(), and DrawScrImport().

◆ cgx_data_

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

Definition at line 170 of file graphics_editor.h.

Referenced by DrawCgxImport().

◆ extra_cgx_data_

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

Definition at line 171 of file graphics_editor.h.

Referenced by DrawCgxImport().

◆ decoded_col_

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

Definition at line 172 of file graphics_editor.h.

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

◆ scr_data_

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

Definition at line 173 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ decoded_scr_data_

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

Definition at line 174 of file graphics_editor.h.

Referenced by DrawScrImport().

◆ cgx_bitmap_

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

Definition at line 175 of file graphics_editor.h.

Referenced by DrawCgxImport(), and UpdateScadView().

◆ scr_bitmap_

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

Definition at line 176 of file graphics_editor.h.

Referenced by DrawScrImport(), and UpdateScadView().

◆ bin_bitmap_

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

Definition at line 177 of file graphics_editor.h.

Referenced by DecompressImportData(), and UpdateScadView().

◆ link_full_sheet_

gfx::Bitmap yaze::app::editor::GraphicsEditor::link_full_sheet_
private

Definition at line 178 of file graphics_editor.h.

◆ gfx_sheets_

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

Definition at line 179 of file graphics_editor.h.

Referenced by DecompressSuperDonkey().

◆ col_file_palette_group_

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

Definition at line 181 of file graphics_editor.h.

Referenced by DecompressSuperDonkey(), and DrawPaletteControls().

◆ z3_rom_palette_

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

Definition at line 182 of file graphics_editor.h.

Referenced by DecompressImportData(), and DecompressSuperDonkey().

◆ col_file_palette_

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

Definition at line 183 of file graphics_editor.h.

Referenced by DecompressImportData(), and DrawPaletteControls().

◆ link_palette_

gfx::SnesPalette yaze::app::editor::GraphicsEditor::link_palette_
private

Definition at line 184 of file graphics_editor.h.

◆ import_canvas_

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

Definition at line 185 of file graphics_editor.h.

Referenced by UpdateScadView().

◆ scr_canvas_

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

Definition at line 186 of file graphics_editor.h.

Referenced by UpdateScadView().

◆ super_donkey_canvas_

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

Definition at line 187 of file graphics_editor.h.

◆ graphics_bin_canvas_

gui::Canvas yaze::app::editor::GraphicsEditor::graphics_bin_canvas_
private

Definition at line 188 of file graphics_editor.h.

Referenced by UpdateGfxSheetList().

◆ current_sheet_canvas_

gui::Canvas yaze::app::editor::GraphicsEditor::current_sheet_canvas_
private
Initial value:
{"CurrentSheetCanvas", ImVec2(0x80, 0x20),

Definition at line 189 of file graphics_editor.h.

Referenced by UpdateGfxTabView().

◆ link_canvas_

gui::Canvas yaze::app::editor::GraphicsEditor::link_canvas_
private
Initial value:
{
"LinkCanvas",
constexpr int kTilesheetWidth
Definition snes_tile.h:16
constexpr int kTilesheetHeight
Definition snes_tile.h:17

Definition at line 191 of file graphics_editor.h.

Referenced by UpdateLinkGfxView().

◆ status_


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