#include #include #include #include #include #include #include namespace hex::plugin::builtin { void drawHexVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span arguments) { static ui::HexEditor editor; static prv::MemoryProvider dataProvider; if (shouldReset) { auto pattern = arguments[0].toPattern(); std::vector data; try { data = pattern->getBytes(); } catch (const std::exception &) { dataProvider.resize(0); throw; } dataProvider.resize(data.size()); dataProvider.writeRaw(0x00, data.data(), data.size()); editor.setProvider(&dataProvider); } if (ImGui::BeginChild("##editor", scaled(ImVec2(600, 400)), false, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) { editor.draw(); ImGui::EndChild(); } } }