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"
15#include "app/gui/core/style.h"
16#include "app/rom.h"
17
18namespace yaze {
19namespace editor {
20
21constexpr int kGfxFont = 0x70000; // 2bpp format
22constexpr int kCharactersWidth = 0x74ADF;
23constexpr int kNumMessages = 396;
24constexpr int kFontGfxMessageSize = 128;
25constexpr int kFontGfxMessageDepth = 8; // Fixed: Must be 8 for indexed palette mode
26constexpr int kFontGfx16Size = 172 * 4096;
27
28constexpr uint8_t kBlockTerminator = 0x80;
29constexpr uint8_t kMessageBankChangeId = 0x80;
30
31class MessageEditor : public Editor {
32 public:
33 explicit MessageEditor(Rom* rom = nullptr) : rom_(rom) {
35 }
36
37 explicit MessageEditor(Rom* rom, const EditorDependencies& deps)
39 dependencies_ = deps;
40 }
41
42 void Initialize() override;
43 absl::Status Load() override;
44 absl::Status Update() override;
45
46 void DrawMessageList();
47 void DrawCurrentMessage();
48 void DrawFontAtlas();
49 void DrawTextCommands();
52 void DrawDictionary();
53 void DrawMessagePreview();
54
55 absl::Status Save() override;
56 absl::Status SaveExpandedMessages();
57
58 absl::Status Cut() override;
59 absl::Status Copy() override;
60 absl::Status Paste() override;
61 absl::Status Undo() override;
62 absl::Status Redo() override;
63 absl::Status Find() override;
64 void Delete();
65 void SelectAll();
66
67 void set_rom(Rom* rom) { rom_ = rom; }
68 Rom* rom() const { return rom_; }
69
70 private:
71 bool case_sensitive_ = false;
72 bool match_whole_word_ = false;
73 std::string search_text_ = "";
74
75 std::array<uint8_t, 0x4000> raw_font_gfx_data_;
76 std::vector<std::string> parsed_messages_;
77 std::vector<MessageData> list_of_texts_;
78 std::vector<MessageData> expanded_messages_;
79
82
86
87 gui::Canvas font_gfx_canvas_{"##FontGfxCanvas", ImVec2(256, 256)};
89 ImVec2(172 * 2, 4096)};
93
94 // Card visibility states
95 bool show_message_list_ = false;
97 bool show_font_atlas_ = false;
98 bool show_dictionary_ = false;
99};
100
101} // namespace editor
102} // namespace yaze
103
104#endif // YAZE_APP_EDITOR_MESSAGE_EDITOR_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:74
Interface for editor classes.
Definition editor.h:122
EditorDependencies dependencies_
Definition editor.h:165
EditorType type_
Definition editor.h:164
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:66
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:59
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
Main namespace for the application.
Definition controller.cc:20
Unified dependency container for all editor types.
Definition editor.h:64