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