1#ifndef YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_H
2#define YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_H
4#include "absl/status/status.h"
26#include "imgui/imgui.h"
27#include "imgui/misc/cpp/imgui_stdlib.h"
28#include "imgui_memory_editor.h"
38 void Update(
bool &show_memory_editor) {
39 static MemoryEditor mem_edit;
40 static MemoryEditor comp_edit;
41 static bool show_compare_rom =
false;
42 static Rom comparison_rom;
43 ImGui::Begin(
"Hex Editor", &show_memory_editor);
44 if (ImGui::Button(
"Compare Rom")) {
47 show_compare_rom =
true;
50 static uint64_t convert_address = 0;
51 gui::InputHex(
"SNES to PC", (
int *)&convert_address, 6, 200.f);
56 BEGIN_TABLE(
"Memory Comparison", 2, ImGuiTableFlags_Resizable);
61 Text(
"%s",
rom()->filename().data());
62 mem_edit.DrawContents((
void *)&(*
rom()),
rom()->size());
65 if (show_compare_rom) {
66 comp_edit.SetComparisonData((
void *)&(*
rom()));
68 ImGui::BeginChild(
"Comparison ROM");
69 Text(
"%s", comparison_rom.
filename().data());
70 comp_edit.DrawContents((
void *)&(comparison_rom), comparison_rom.
size());
The Rom class is used to load, save, and modify Rom data.
absl::Status LoadFromFile(const std::string &filename, bool z3_load=true)
A class to hold a shared pointer to a Rom object.
static std::string ShowOpenFileDialog()
ShowOpenFileDialog opens a file dialog and returns the selected filepath.
#define BEGIN_TABLE(l, n, f)
#define PRINT_IF_ERROR(expression)
uint32_t SnesToPc(uint32_t addr) noexcept
bool InputHex(const char *label, uint64_t *data)
void Update(bool &show_memory_editor)