yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
graphics_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_GRAPHICS_EDITOR_H
2#define YAZE_APP_EDITOR_GRAPHICS_EDITOR_H
3
4#include <array>
5#include <memory>
6#include <string>
7#include <vector>
8
9#include "absl/status/status.h"
10#include "app/editor/editor.h"
19#include "app/gfx/core/bitmap.h"
22#include "rom/rom.h"
23#include "zelda3/game_data.h"
24
25namespace yaze {
26namespace editor {
27
28// Super Donkey prototype graphics offsets (from leaked dev materials)
29const std::string kSuperDonkeyTiles[] = {
30 "97C05", "98219", "9871E", "98C00", "99084", "995AF", "99DE0", "9A27E",
31 "9A741", "9AC31", "9B07E", "9B55C", "9B963", "9BB99", "9C009", "9C4B4",
32 "9C92B", "9CDD6", "9D2C2", "9E037", "9E527", "9EA56", "9EF65", "9FCD1",
33 "A0193", "A059E", "A0B17", "A0FB6", "A14A5", "A1988", "A1E66", "A232B",
34 "A27F0", "A2B6E", "A302C", "A3453", "A38CA", "A42BB", "A470C", "A4BA9",
35 "A5089", "A5385", "A5742", "A5BCC", "A6017", "A6361", "A66F8"};
36
37const std::string kSuperDonkeySprites[] = {
38 "A8E5D", "A9435", "A9934", "A9D83", "AA2F1", "AA6D4", "AABE4", "AB127",
39 "AB65A", "ABBDD", "AC38D", "AC797", "ACCC8", "AD0AE", "AD245", "AD554",
40 "ADAAC", "ADECC", "AE453", "AE9D2", "AEF40", "AF3C9", "AF92E", "AFE9D",
41 "B03D2", "B09AC", "B0F0C", "B1430", "B1859", "B1E01", "B229A", "B2854",
42 "B2D27", "B31D7", "B3B58", "B40B5", "B45A5", "B4D64", "B5031", "B555F",
43 "B5F30", "B6858", "B70DD", "B7526", "B79EC", "B7C83", "B80F7", "B85CC",
44 "B8A3F", "B8F97", "B94F2", "B9A20", "B9E9A", "BA3A2", "BA8F6", "BACDC",
45 "BB1F9", "BB781", "BBCCA", "BC26D", "BC7D4", "BCBB0", "BD082", "BD5FC",
46 "BE115", "BE5C2", "BEB63", "BF0CB", "BF607", "BFA55", "BFD71", "C017D",
47 "C0567", "C0981", "C0BA7", "C116D", "C166A", "C1FE0", "C24CE", "C2B19"};
48
63class GraphicsEditor : public Editor {
64 public:
65 explicit GraphicsEditor(Rom* rom = nullptr) : rom_(rom) {
67 }
68
69 void Initialize() override;
70 absl::Status Load() override;
71 absl::Status Save() override;
72 absl::Status Update() override;
73 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
74 absl::Status Copy() override { return absl::UnimplementedError("Copy"); }
75 absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
76 absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
77 absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
78 absl::Status Find() override { return absl::UnimplementedError("Find"); }
79
80 // Set the ROM pointer
81 void set_rom(Rom* rom) { rom_ = rom; }
82
83 // Set the game data pointer
90
91 // Editor shortcuts
92 void NextSheet();
93 void PrevSheet();
94
95 // Get the ROM pointer
96 Rom* rom() const { return rom_; }
97
98 private:
99 // Editor-level shortcut handling
101
102 // --- Panel-Based Architecture ---
104 std::unique_ptr<SheetBrowserPanel> sheet_browser_panel_;
105 std::unique_ptr<PixelEditorPanel> pixel_editor_panel_;
106 std::unique_ptr<PaletteControlsPanel> palette_controls_panel_;
107 std::unique_ptr<LinkSpritePanel> link_sprite_panel_;
108 std::unique_ptr<PolyhedralEditorPanel> polyhedral_panel_;
109 std::unique_ptr<GfxGroupEditor> gfx_group_panel_;
110 std::unique_ptr<PalettesetEditorPanel> paletteset_panel_;
111
112 // --- Prototype Viewer (Super Donkey / Dev Format Imports) ---
113 void DrawPrototypeViewer();
114 absl::Status DrawCgxImport();
115 absl::Status DrawScrImport();
116 absl::Status DrawFileImport();
117 absl::Status DrawObjImport();
118 absl::Status DrawTilemapImport();
119 absl::Status DrawPaletteControls();
120 absl::Status DrawClipboardImport();
121 absl::Status DrawExperimentalFeatures();
122 absl::Status DrawMemoryEditor();
123 absl::Status DecompressImportData(int size);
124 absl::Status DecompressSuperDonkey();
125
126 // Prototype viewer state
128 uint64_t current_offset_ = 0;
133 uint64_t bin_size_ = 0;
134 uint64_t clipboard_offset_ = 0;
135 uint64_t clipboard_size_ = 0;
136 bool refresh_graphics_ = false;
138 bool gfx_loaded_ = false;
139 bool is_open_ = false;
140 bool super_donkey_ = false;
141 bool col_file_ = false;
142 bool cgx_loaded_ = false;
143 bool scr_loaded_ = false;
144 bool obj_loaded_ = false;
145 bool tilemap_loaded_ = false;
146
147 std::string file_path_;
148 std::string col_file_path_;
149 std::string col_file_name_;
150 std::string cgx_file_path_;
151 std::string cgx_file_name_;
152 std::string scr_file_path_;
153 std::string scr_file_name_;
154 std::string obj_file_path_;
157
160 std::vector<uint8_t> import_data_;
161 std::vector<uint8_t> decoded_cgx_;
162 std::vector<uint8_t> cgx_data_;
163 std::vector<uint8_t> extra_cgx_data_;
164 std::vector<SDL_Color> decoded_col_;
165 std::vector<uint8_t> scr_data_;
166 std::vector<uint8_t> decoded_scr_data_;
170 std::array<gfx::Bitmap, zelda3::kNumGfxSheets> gfx_sheets_;
177
178 // Status tracking
179 absl::Status status_;
180
181 // Core references
184};
185
186} // namespace editor
187} // namespace yaze
188
189#endif // YAZE_APP_EDITOR_GRAPHICS_EDITOR_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
Interface for editor classes.
Definition editor.h:179
zelda3::GameData * game_data() const
Definition editor.h:228
EditorType type_
Definition editor.h:236
Shared state between GraphicsEditor panel components.
Allows the user to edit graphics sheets from the game or view prototype graphics.
std::vector< uint8_t > scr_data_
absl::Status Save() override
GraphicsEditor(Rom *rom=nullptr)
gfx::PaletteGroup col_file_palette_group_
absl::Status Load() override
std::unique_ptr< GfxGroupEditor > gfx_group_panel_
std::unique_ptr< PaletteControlsPanel > palette_controls_panel_
std::vector< uint8_t > decoded_cgx_
absl::Status Copy() override
std::vector< uint8_t > cgx_data_
std::unique_ptr< PixelEditorPanel > pixel_editor_panel_
absl::Status Redo() override
std::unique_ptr< PolyhedralEditorPanel > polyhedral_panel_
std::unique_ptr< PalettesetEditorPanel > paletteset_panel_
absl::Status Cut() override
std::vector< uint8_t > import_data_
absl::Status Paste() override
std::vector< SDL_Color > decoded_col_
absl::Status Undo() override
absl::Status Update() override
absl::Status Find() override
std::vector< uint8_t > extra_cgx_data_
std::array< gfx::Bitmap, zelda3::kNumGfxSheets > gfx_sheets_
std::vector< uint8_t > decoded_scr_data_
void SetGameData(zelda3::GameData *game_data) override
std::unique_ptr< LinkSpritePanel > link_sprite_panel_
absl::Status DecompressImportData(int size)
std::unique_ptr< SheetBrowserPanel > sheet_browser_panel_
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:150
const std::string kSuperDonkeySprites[]
const std::string kSuperDonkeyTiles[]
Represents a group of palettes.