yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
memory_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_H
2#define YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_H
3
4#include "absl/container/flat_hash_map.h"
5#include "app/editor/editor.h"
8#include "imgui/imgui.h"
9#include "rom/rom.h"
10#include "rom/snes.h"
11#include "util/file_util.h"
12#include "util/macro.h"
13
14namespace yaze {
15namespace editor {
16
17using ImGui::SameLine;
18using ImGui::Text;
19
20class MemoryEditor : public Editor {
21 public:
22 explicit MemoryEditor(Rom* rom = nullptr) : rom_(rom) {
24 }
25
26 void SetDependencies(const EditorDependencies& deps) override {
28 rom_ = deps.rom;
29 }
30
31 void Initialize() override {}
32 absl::Status Load() override { return absl::OkStatus(); }
33 absl::Status Save() override { return absl::OkStatus(); }
34 absl::Status Update() override;
35
36 absl::Status Undo() override { return absl::OkStatus(); }
37 absl::Status Redo() override { return absl::OkStatus(); }
38 absl::Status Cut() override { return absl::OkStatus(); }
39 absl::Status Copy() override { return absl::OkStatus(); }
40 absl::Status Paste() override { return absl::OkStatus(); }
41 absl::Status Find() override { return absl::OkStatus(); }
42 // Edit-menu actions are no-ops for this editor.
43 bool CanUndo() const override { return false; }
44 bool CanRedo() const override { return false; }
45 bool CanCut() const override { return false; }
46 bool CanCopy() const override { return false; }
47 bool CanPaste() const override { return false; }
48
49 // Set the ROM pointer
50 void SetRom(Rom* rom) { rom_ = rom; }
51
52 // Get the ROM pointer
53 Rom* rom() const { return rom_; }
54
55 private:
56 void DrawToolbar();
58 void DrawSearchPopup();
59 void DrawBookmarksPopup();
60
64 bool show_compare_rom_ = false;
66
67 // Toolbar state
68 char jump_address_[16] = "0x000000";
69 char search_pattern_[256] = "";
70 uint32_t current_address_ = 0;
71
72 struct Bookmark {
73 uint32_t address;
74 std::string name;
75 std::string description;
76 };
77 std::vector<Bookmark> bookmarks_;
78};
79
80} // namespace editor
81} // namespace yaze
82
83#endif // YAZE_APP_EDITOR_CODE_MEMORY_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:49
Interface for editor classes.
Definition editor.h:249
virtual void SetDependencies(const EditorDependencies &deps)
Definition editor.h:254
EditorType type_
Definition editor.h:369
absl::Status Copy() override
absl::Status Load() override
absl::Status Save() override
std::vector< Bookmark > bookmarks_
gui::MemoryEditorWidget memory_widget_
bool CanCut() const override
bool CanPaste() const override
bool CanCopy() const override
absl::Status Cut() override
absl::Status Update() override
absl::Status Redo() override
bool CanRedo() const override
void SetDependencies(const EditorDependencies &deps) override
absl::Status Find() override
gui::MemoryEditorWidget comparison_widget_
absl::Status Paste() override
absl::Status Undo() override
bool CanUndo() const override
MemoryEditor(Rom *rom=nullptr)
Unified dependency container for all editor types.
Definition editor.h:170