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 // Loads the comparison ROM and shows it. Returns false and leaves the view
56 // hidden when `path` is empty (a cancelled file dialog) or fails to load.
57 bool LoadComparisonRom(const std::string& path);
58 bool show_compare_rom() const { return show_compare_rom_; }
59
60 private:
61 void DrawToolbar();
63 void DrawBookmarksPopup();
64
68 bool show_compare_rom_ = false;
70
71 // Toolbar state
72 char jump_address_[16] = "0x000000";
73 uint32_t current_address_ = 0;
74
75 struct Bookmark {
76 uint32_t address;
77 std::string name;
78 std::string description;
79 };
80 std::vector<Bookmark> bookmarks_;
81};
82
83} // namespace editor
84} // namespace yaze
85
86#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:52
Interface for editor classes.
Definition editor.h:252
virtual void SetDependencies(const EditorDependencies &deps)
Definition editor.h:257
EditorType type_
Definition editor.h:381
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
bool LoadComparisonRom(const std::string &path)
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