Added arrays

This commit is contained in:
WerWolv
2020-11-12 23:57:43 +01:00
parent f0fe3a85d2
commit 83bb358427
6 changed files with 50 additions and 19 deletions

View File

@@ -34,19 +34,24 @@ namespace hex {
if (ImGui::Begin("Pattern Data", &this->m_windowOpen)) {
ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav);
for (auto& [offset, size, color, name] : this->m_highlights) {
std::vector<u8> buffer(size + 1, 0x00);
if (this->m_dataProvider != nullptr && this->m_dataProvider->isReadable()) {
this->m_dataProvider->read(offset, buffer.data(), size);
for (auto&[offset, size, color, name] : this->m_highlights) {
std::vector<u8> buffer(size + 1, 0x00);
if (size <= 8) {
u64 data = 0;
std::memcpy(&data, buffer.data(), size);
this->m_dataProvider->read(offset, buffer.data(), size);
ImGui::LabelText(name.c_str(), "[0x%08lx:0x%08lx] %lu (0x%08lx) \"%s\"", offset, offset + size, data, data, makeDisplayable(buffer.data(), buffer.size()).c_str());
if (size <= 8) {
u64 data = 0;
std::memcpy(&data, buffer.data(), size);
ImGui::LabelText(name.c_str(), "[0x%08lx:0x%08lx] %lu (0x%08lx) \"%s\"", offset,
offset + size, data, data,
makeDisplayable(buffer.data(), buffer.size()).c_str());
} else
ImGui::LabelText(name.c_str(), "[0x%08lx:0x%08lx] [ ARRAY ] \"%s\"", offset, offset + size,
makeDisplayable(buffer.data(), buffer.size()).c_str());
}
else
ImGui::LabelText(name.c_str(), "[0x%08lx:0x%08lx] [ ARRAY ] \"%s\"", offset, offset + size, makeDisplayable(buffer.data(), buffer.size()).c_str());
}
ImGui::EndChild();