From 4b7bbfaf1c6f96f416c8eef05530eb6729803852 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 10 May 2025 09:43:45 -0400 Subject: [PATCH] Add MemoryEditorPopup function --- src/app/gui/input.cc | 14 ++++++++++++++ src/app/gui/input.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/app/gui/input.cc b/src/app/gui/input.cc index 1891add3..a2825420 100644 --- a/src/app/gui/input.cc +++ b/src/app/gui/input.cc @@ -8,6 +8,7 @@ #include "app/gfx/snes_tile.h" #include "imgui/imgui.h" #include "imgui/imgui_internal.h" +#include "imgui_memory_editor.h" template struct overloaded : Ts... { @@ -442,5 +443,18 @@ void RenderLayout(const Layout& layout) { } } +void MemoryEditorPopup(const std::string& label, std::span memory) { + static bool open = false; + static MemoryEditor editor; + if (ImGui::Button("View Data")) { + open = true; + } + if (open) { + ImGui::Begin(label.c_str(), &open); + editor.DrawContents(memory.data(), memory.size()); + ImGui::End(); + } +} + } // namespace gui } // namespace yaze diff --git a/src/app/gui/input.h b/src/app/gui/input.h index 70760beb..8e94c4f8 100644 --- a/src/app/gui/input.h +++ b/src/app/gui/input.h @@ -107,6 +107,8 @@ struct Layout { void RenderLayout(const Layout &layout); +void MemoryEditorPopup(const std::string &label, std::span memory); + } // namespace gui } // namespace yaze