1
0
mirror of synced 2024-11-30 18:34:29 +01:00

ux: Fix a bunch of weird behaviour in the data information view

This commit is contained in:
WerWolv 2021-05-25 23:47:38 +02:00
parent 4de8990b5c
commit 6219743c82
3 changed files with 7 additions and 4 deletions

2
.gitignore vendored
View File

@ -2,8 +2,8 @@
.idea/
cmake-build-debug/
cmake-build-release/
cmake-build-relwithdebinfo/
build-linux/
build/

View File

@ -161,6 +161,8 @@ struct MemoryEditor
GotoAddr = addr_min;
DataPreviewAddr = addr_min;
DataPreviewAddrEnd = addr_max;
DataPreviewAddrOld = addr_min;
DataPreviewAddrEndOld = addr_max;
}
struct Sizes
@ -722,8 +724,6 @@ struct MemoryEditor
ImGui::BeginChild("##scrolling");
ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (GotoAddr / Cols) * ImGui::GetTextLineHeight());
ImGui::EndChild();
DataEditingAddr = DataPreviewAddr = HighlightMin;
DataPreviewAddrEnd = HighlightMax;
}
GotoAddr = (size_t)-1;
}

View File

@ -73,6 +73,7 @@ namespace hex {
std::vector<u8> buffer(this->m_blockSize, 0x00);
std::memset(this->m_valueCounts.data(), 0x00, this->m_valueCounts.size() * sizeof(u32));
this->m_blockEntropy.clear();
this->m_valueCounts.fill(0);
for (u64 i = 0; i < provider->getSize(); i += this->m_blockSize) {
std::array<ImU64, 256> blockValueCounts = { 0 };
@ -216,7 +217,9 @@ namespace hex {
ImPlot::PlotLine("##entropy_line", this->m_blockEntropy.data(), this->m_blockEntropy.size());
if (ImPlot::DragLineX("Position", &this->m_entropyHandlePosition, false)) {
EventManager::post<RequestSelectionChange>( Region{ u64(this->m_entropyHandlePosition * this->m_blockSize) + provider->getBaseAddress(), 1 });
u64 address = u64(this->m_entropyHandlePosition * this->m_blockSize) + provider->getBaseAddress();
address = std::min(address, provider->getBaseAddress() + provider->getSize() - 1);
EventManager::post<RequestSelectionChange>( Region{ address, 1 });
}
ImPlot::EndPlot();