yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
message_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_MESSAGE_EDITOR_H
2#define YAZE_APP_EDITOR_MESSAGE_EDITOR_H
3
4#include <array>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "app/editor/editor.h"
13#include "app/gfx/core/bitmap.h"
16#include "app/gui/core/style.h"
17#include "rom/rom.h"
18
19namespace yaze {
20namespace editor {
21
22constexpr int kGfxFont = 0x70000; // 2bpp format
23constexpr int kCharactersWidth = 0x74ADF;
24constexpr int kNumMessages = 396;
25constexpr int kFontGfxMessageSize = 128;
26constexpr int kFontGfxMessageDepth =
27 8; // Fixed: Must be 8 for indexed palette mode
28constexpr int kFontGfx16Size = 172 * 4096;
29
30constexpr uint8_t kBlockTerminator = 0x80;
31constexpr uint8_t kMessageBankChangeId = 0x80;
32
33class MessageEditor : public Editor {
34 public:
35 explicit MessageEditor(Rom* rom = nullptr) : rom_(rom) {
37 }
38
39 explicit MessageEditor(Rom* rom, const EditorDependencies& deps)
41 dependencies_ = deps;
42 }
43
44 void Initialize() override;
45 absl::Status Load() override;
46 absl::Status Update() override;
47
48 void DrawMessageList();
49 void DrawCurrentMessage();
50 void DrawFontAtlas();
51 void DrawTextCommands();
54 void DrawDictionary();
55 void DrawMessagePreview();
56
57 absl::Status Save() override;
58 absl::Status SaveExpandedMessages();
59
60 absl::Status Cut() override;
61 absl::Status Copy() override;
62 absl::Status Paste() override;
63 absl::Status Undo() override;
64 absl::Status Redo() override;
65 absl::Status Find() override;
66 void Delete();
67 void SelectAll();
68
69 void set_rom(Rom* rom) { rom_ = rom; }
70 Rom* rom() const { return rom_; }
71
72 private:
73 bool case_sensitive_ = false;
74 bool match_whole_word_ = false;
75 std::string search_text_ = "";
76
77 std::array<uint8_t, 0x4000> raw_font_gfx_data_;
78 std::vector<std::string> parsed_messages_;
79 std::vector<MessageData> list_of_texts_;
80 std::vector<MessageData> expanded_messages_;
81
84
88
89 gui::Canvas font_gfx_canvas_{"##FontGfxCanvas", ImVec2(256, 256)};
91 ImVec2(172 * 2, 4096)};
96
97 // Panel visibility states
98 bool show_message_list_ = false;
100 bool show_font_atlas_ = false;
101 bool show_dictionary_ = false;
102};
103
104} // namespace editor
105} // namespace yaze
106
107#endif // YAZE_APP_EDITOR_MESSAGE_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
EditorDependencies dependencies_
Definition editor.h:237
EditorType type_
Definition editor.h:236
std::vector< std::string > parsed_messages_
absl::Status Copy() override
std::vector< MessageData > expanded_messages_
absl::Status Find() override
absl::Status Update() override
absl::Status Paste() override
absl::Status Undo() override
absl::Status Load() override
std::array< uint8_t, 0x4000 > raw_font_gfx_data_
MessageEditor(Rom *rom=nullptr)
absl::Status Cut() override
MessageEditor(Rom *rom, const EditorDependencies &deps)
std::vector< MessageData > list_of_texts_
gfx::SnesPalette font_preview_colors_
absl::Status Redo() override
absl::Status Save() override
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
constexpr int kCharactersWidth
constexpr int kFontGfx16Size
constexpr uint8_t kBlockTerminator
constexpr int kGfxFont
constexpr int kFontGfxMessageSize
constexpr int kFontGfxMessageDepth
constexpr uint8_t kMessageBankChangeId
constexpr int kNumMessages
Unified dependency container for all editor types.
Definition editor.h:111