1
0
mirror of synced 2024-09-24 11:38:26 +02:00

ui: Improve the look and feel of the information view

This commit is contained in:
WerWolv 2023-03-17 17:07:39 +01:00
parent 1f8645fd43
commit 466dacaab4
14 changed files with 99 additions and 60 deletions

View File

@ -8,12 +8,13 @@
#include <vector>
#include <variant>
#include <map>
#include <filesystem>
#include <hex/helpers/concepts.hpp>
#include <hex/api/task.hpp>
#include <hex/api/keybinding.hpp>
#include <wolv/io/fs.hpp>
using ImGuiID = unsigned int;
struct ImVec2;

View File

@ -436,11 +436,35 @@ namespace hex {
}
// Return the highest entropy value among all of the blocks
double getHighestBlockEntropy() {
double highestBlockEntropy = 0.0f;
double getHighestEntropyBlockValue() {
double result = 0.0f;
if (!this->m_yBlockEntropy.empty())
highestBlockEntropy = *std::max_element(this->m_yBlockEntropy.begin(), this->m_yBlockEntropy.end());
return highestBlockEntropy;
result = *std::max_element(this->m_yBlockEntropy.begin(), this->m_yBlockEntropy.end());
return result;
}
// Return the highest entropy value among all of the blocks
u64 getHighestEntropyBlockAddress() {
u64 address = 0x00;
if (!this->m_yBlockEntropy.empty())
address = (std::max_element(this->m_yBlockEntropy.begin(), this->m_yBlockEntropy.end()) - this->m_yBlockEntropy.begin()) * this->m_blockSize;
return address;
}
// Return the highest entropy value among all of the blocks
double getLowestEntropyBlockValue() {
double result = 0.0f;
if (!this->m_yBlockEntropy.empty())
result = *std::min_element(this->m_yBlockEntropy.begin(), this->m_yBlockEntropy.end());
return result;
}
// Return the highest entropy value among all of the blocks
u64 getLowestEntropyBlockAddress() {
u64 address = 0x00;
if (!this->m_yBlockEntropy.empty())
address = (std::min_element(this->m_yBlockEntropy.begin(), this->m_yBlockEntropy.end()) - this->m_yBlockEntropy.begin()) * this->m_blockSize;
return address;
}
// Return the number of blocks that have been processed
@ -828,8 +852,8 @@ namespace hex {
this->m_blockCount = 0;
// Loop over each byte of the file (or a part of it)
for (u64 i = 0; i < bytes.size(); ++i) {
this->m_blockValueCounts[bytes[i]]++;
for (u8 byte : bytes) {
this->m_blockValueCounts[byte]++;
this->m_byteCount++;
if (((this->m_byteCount % this->m_blockSize) == 0) || this->m_byteCount == (this->m_endAddress - this->m_startAddress)) [[unlikely]] {

View File

@ -21,10 +21,15 @@ namespace hex::plugin::builtin {
void drawContent() override;
private:
bool m_dataValid = false;
u32 m_blockSize = 0;
double m_averageEntropy = -1.0;
bool m_dataValid = false;
u32 m_blockSize = 0;
double m_averageEntropy = -1.0;
double m_highestBlockEntropy = -1.0;
u64 m_highestBlockEntropyAddress = 0x00;
double m_lowestBlockEntropy = -1.0;
u64 m_lowestBlockEntropyAddress = 0x00;
double m_plainTextCharacterPercentage = -1.0;
TaskHolder m_analyzerTask;
@ -44,8 +49,8 @@ namespace hex::plugin::builtin {
// User controlled input (referenced by ImgGui)
int m_inputChunkSize = 0;
int m_inputStartAddress = 0;
int m_inputEndAddress = 0;
u64 m_inputStartAddress = 0;
u64 m_inputEndAddress = 0;
};
}

View File

@ -590,7 +590,6 @@
"hex.builtin.view.disassembler.ppc.spe",
"hex.builtin.view.disassembler.region",
"hex.builtin.view.disassembler.riscv.compressed",
"hex.builtin.view.disassembler.settings.header",
"hex.builtin.view.disassembler.settings.mode",
"hex.builtin.view.disassembler.sparc.v9",
"hex.builtin.view.find.binary_pattern",

View File

@ -52,6 +52,7 @@
"hex.builtin.common.range.selection": "Auswahl",
"hex.builtin.common.region": "Region",
"hex.builtin.common.set": "Setzen",
"hex.builtin.common.settings": "Einstellungen",
"hex.builtin.common.size": "Länge",
"hex.builtin.common.type": "Typ",
"hex.builtin.common.type.f32": "float",
@ -590,7 +591,6 @@
"hex.builtin.view.disassembler.ppc.spe": "Signal Processing Engine",
"hex.builtin.view.disassembler.region": "Code Region",
"hex.builtin.view.disassembler.riscv.compressed": "Komprimiert",
"hex.builtin.view.disassembler.settings.header": "Einstellungen",
"hex.builtin.view.disassembler.settings.mode": "Modus",
"hex.builtin.view.disassembler.sparc.v9": "Sparc V9",
"hex.builtin.view.find.binary_pattern": "Binärpattern",
@ -701,8 +701,9 @@
"hex.builtin.view.information.distribution": "Byte Verteilung",
"hex.builtin.view.information.encrypted": "Diese Daten sind vermutlich verschlüsselt oder komprimiert!",
"hex.builtin.view.information.entropy": "Entropie",
"hex.builtin.view.information.file_entropy": "Dateientropie",
"hex.builtin.view.information.file_entropy": "Gesammtentropie",
"hex.builtin.view.information.highest_entropy": "Höchste Blockentropie",
"hex.builtin.view.information.Lowest_entropy": "Tiefste Blockentropie",
"hex.builtin.view.information.info_analysis": "Informationsanalyse",
"hex.builtin.view.information.layered_distribution": "Schichtverteilung",
"hex.builtin.view.information.magic": "Magic Informationen",
@ -711,6 +712,7 @@
"hex.builtin.view.information.name": "Dateninformationen",
"hex.builtin.view.information.plain_text": "Diese Daten sind vermutlich einfacher Text.",
"hex.builtin.view.information.plain_text_percentage": "Klartext Prozentanteil",
"hex.builtin.view.information.provider_information": "Provider Informationen",
"hex.builtin.view.information.region": "Analysierte Region",
"hex.builtin.view.patches.name": "Patches",
"hex.builtin.view.patches.offset": "Offset",

View File

@ -56,6 +56,7 @@
"hex.builtin.common.region": "Region",
"hex.builtin.common.reset": "Reset",
"hex.builtin.common.set": "Set",
"hex.builtin.common.settings": "Settings",
"hex.builtin.common.size": "Size",
"hex.builtin.common.type": "Type",
"hex.builtin.common.type.f32": "float",
@ -626,7 +627,6 @@
"hex.builtin.view.disassembler.ppc.spe": "Signal Processing Engine",
"hex.builtin.view.disassembler.region": "Code region",
"hex.builtin.view.disassembler.riscv.compressed": "Compressed",
"hex.builtin.view.disassembler.settings.header": "Settings",
"hex.builtin.view.disassembler.settings.mode": "Mode",
"hex.builtin.view.disassembler.sparc.v9": "Sparc V9",
"hex.builtin.view.find.binary_pattern": "Binary Pattern",
@ -738,8 +738,9 @@
"hex.builtin.view.information.distribution": "Byte distribution",
"hex.builtin.view.information.encrypted": "This data is most likely encrypted or compressed!",
"hex.builtin.view.information.entropy": "Entropy",
"hex.builtin.view.information.file_entropy": "File entropy",
"hex.builtin.view.information.highest_entropy": "Highest entropy block",
"hex.builtin.view.information.file_entropy": "Overall entropy",
"hex.builtin.view.information.highest_entropy": "Highest block entropy",
"hex.builtin.view.information.lowest_entropy": "Lowest block entropy",
"hex.builtin.view.information.info_analysis": "Information analysis",
"hex.builtin.view.information.layered_distribution": "Layered distribution",
"hex.builtin.view.information.magic": "Magic information",
@ -749,6 +750,7 @@
"hex.builtin.view.information.region": "Analyzed region",
"hex.builtin.view.information.plain_text": "This data is most likely plain text.",
"hex.builtin.view.information.plain_text_percentage": "Plain text percentage",
"hex.builtin.view.information.provider_information": "Provider Information",
"hex.builtin.view.patches.name": "Patches",
"hex.builtin.view.patches.offset": "Offset",
"hex.builtin.view.patches.orig": "Original value",

View File

@ -52,6 +52,7 @@
"hex.builtin.common.range.selection": "",
"hex.builtin.common.region": "Regione",
"hex.builtin.common.set": "Imposta",
"hex.builtin.common.settings": "Impostazioni",
"hex.builtin.common.size": "Dimensione",
"hex.builtin.common.type": "",
"hex.builtin.common.type.f32": "float",
@ -590,7 +591,6 @@
"hex.builtin.view.disassembler.ppc.spe": "Signal Processing Engine",
"hex.builtin.view.disassembler.region": "Regione del Codice",
"hex.builtin.view.disassembler.riscv.compressed": "Compresso",
"hex.builtin.view.disassembler.settings.header": "Impostazioni",
"hex.builtin.view.disassembler.settings.mode": "",
"hex.builtin.view.disassembler.sparc.v9": "Sparc V9",
"hex.builtin.view.find.binary_pattern": "",
@ -699,8 +699,8 @@
"hex.builtin.view.information.distribution": "Distribuzione dei Byte",
"hex.builtin.view.information.encrypted": "Questi dati sono probabilmente codificati o compressi!",
"hex.builtin.view.information.entropy": "Entropia",
"hex.builtin.view.information.file_entropy": "Entropia dei File",
"hex.builtin.view.information.highest_entropy": "Highest entropy block",
"hex.builtin.view.information.file_entropy": "",
"hex.builtin.view.information.highest_entropy": "Highest block entropy",
"hex.builtin.view.information.info_analysis": "Informazioni dell'analisi",
"hex.builtin.view.information.layered_distribution": "",
"hex.builtin.view.information.magic": "Informazione Magica",
@ -709,6 +709,7 @@
"hex.builtin.view.information.name": "Informazione sui Dati",
"hex.builtin.view.information.plain_text": "",
"hex.builtin.view.information.plain_text_percentage": "",
"hex.builtin.view.information.provider_information": "",
"hex.builtin.view.information.region": "Regione Analizzata",
"hex.builtin.view.patches.name": "Patches",
"hex.builtin.view.patches.offset": "Offset",

View File

@ -52,6 +52,7 @@
"hex.builtin.common.range.selection": "選択範囲",
"hex.builtin.common.region": "領域",
"hex.builtin.common.set": "セット",
"hex.builtin.common.settings": "設定",
"hex.builtin.common.size": "サイズ",
"hex.builtin.common.type": "",
"hex.builtin.common.type.f32": "float",
@ -590,7 +591,6 @@
"hex.builtin.view.disassembler.ppc.spe": "信号処理エンジン",
"hex.builtin.view.disassembler.region": "コード領域",
"hex.builtin.view.disassembler.riscv.compressed": "圧縮済み",
"hex.builtin.view.disassembler.settings.header": "設定",
"hex.builtin.view.disassembler.settings.mode": "モード",
"hex.builtin.view.disassembler.sparc.v9": "Sparc V9",
"hex.builtin.view.find.binary_pattern": "16進数",
@ -699,7 +699,7 @@
"hex.builtin.view.information.distribution": "バイト分布",
"hex.builtin.view.information.encrypted": "暗号化や圧縮を経たデータと推測されます。",
"hex.builtin.view.information.entropy": "エントロピー",
"hex.builtin.view.information.file_entropy": "ファイルのエントロピー",
"hex.builtin.view.information.file_entropy": "",
"hex.builtin.view.information.highest_entropy": "最大エントロピーブロック",
"hex.builtin.view.information.info_analysis": "情報の分析",
"hex.builtin.view.information.layered_distribution": "",
@ -709,6 +709,7 @@
"hex.builtin.view.information.name": "データ解析",
"hex.builtin.view.information.plain_text": "",
"hex.builtin.view.information.plain_text_percentage": "",
"hex.builtin.view.information.provider_information": "",
"hex.builtin.view.information.region": "解析する領域",
"hex.builtin.view.patches.name": "パッチ",
"hex.builtin.view.patches.offset": "オフセット",

View File

@ -52,6 +52,7 @@
"hex.builtin.common.range.selection": "선택",
"hex.builtin.common.region": "지역",
"hex.builtin.common.set": "설정",
"hex.builtin.common.settings": "설정",
"hex.builtin.common.size": "크기",
"hex.builtin.common.type": "타입",
"hex.builtin.common.type.f32": "float",
@ -590,7 +591,6 @@
"hex.builtin.view.disassembler.ppc.spe": "Signal Processing Engine",
"hex.builtin.view.disassembler.region": "코드 영역",
"hex.builtin.view.disassembler.riscv.compressed": "Compressed",
"hex.builtin.view.disassembler.settings.header": "설정",
"hex.builtin.view.disassembler.settings.mode": "모드",
"hex.builtin.view.disassembler.sparc.v9": "Sparc V9",
"hex.builtin.view.find.binary_pattern": "바이너리 패턴",
@ -699,7 +699,7 @@
"hex.builtin.view.information.distribution": "바이트 분포",
"hex.builtin.view.information.encrypted": "이 데이터는 아마 암호화 혹은 압축되었을 가능성이 높습니다!",
"hex.builtin.view.information.entropy": "엔트로피",
"hex.builtin.view.information.file_entropy": "파일 엔트로피",
"hex.builtin.view.information.file_entropy": "",
"hex.builtin.view.information.highest_entropy": "최대 엔트로피 블록",
"hex.builtin.view.information.info_analysis": "정보 분석",
"hex.builtin.view.information.layered_distribution": "",
@ -709,6 +709,7 @@
"hex.builtin.view.information.name": "데이터 정보",
"hex.builtin.view.information.plain_text": "",
"hex.builtin.view.information.plain_text_percentage": "",
"hex.builtin.view.information.provider_information": "",
"hex.builtin.view.information.region": "분석한 영역",
"hex.builtin.view.patches.name": "패치",
"hex.builtin.view.patches.offset": "오프셋",

View File

@ -52,6 +52,7 @@
"hex.builtin.common.range.selection": "",
"hex.builtin.common.region": "Region",
"hex.builtin.common.set": "Colocar",
"hex.builtin.common.settings": "Configurações",
"hex.builtin.common.size": "Tamanho",
"hex.builtin.common.type": "",
"hex.builtin.common.type.f32": "float",
@ -590,7 +591,6 @@
"hex.builtin.view.disassembler.ppc.spe": "Signal Processing Engine",
"hex.builtin.view.disassembler.region": "Região do código",
"hex.builtin.view.disassembler.riscv.compressed": "Compressed",
"hex.builtin.view.disassembler.settings.header": "Configurações",
"hex.builtin.view.disassembler.settings.mode": "Modo",
"hex.builtin.view.disassembler.sparc.v9": "Sparc V9",
"hex.builtin.view.find.binary_pattern": "",
@ -699,8 +699,8 @@
"hex.builtin.view.information.distribution": "Byte distribution",
"hex.builtin.view.information.encrypted": "Esses dados provavelmente estão criptografados ou compactados!",
"hex.builtin.view.information.entropy": "Entropy",
"hex.builtin.view.information.file_entropy": "File entropy",
"hex.builtin.view.information.highest_entropy": "Highest entropy block",
"hex.builtin.view.information.file_entropy": "",
"hex.builtin.view.information.highest_entropy": "Highest block entropy",
"hex.builtin.view.information.info_analysis": "Análise de Informações",
"hex.builtin.view.information.layered_distribution": "",
"hex.builtin.view.information.magic": "Informação Mágica",
@ -709,6 +709,7 @@
"hex.builtin.view.information.name": "Data Information",
"hex.builtin.view.information.plain_text": "",
"hex.builtin.view.information.plain_text_percentage": "",
"hex.builtin.view.information.provider_information": "",
"hex.builtin.view.information.region": "Região analizada",
"hex.builtin.view.patches.name": "Patches",
"hex.builtin.view.patches.offset": "Desvio",

View File

@ -52,6 +52,7 @@
"hex.builtin.common.range.selection": "选区",
"hex.builtin.common.region": "区域",
"hex.builtin.common.set": "设置",
"hex.builtin.common.settings": "设置",
"hex.builtin.common.size": "大小",
"hex.builtin.common.type": "类型",
"hex.builtin.common.type.f32": "float",
@ -590,7 +591,6 @@
"hex.builtin.view.disassembler.ppc.spe": "PowerPC 单核引擎SPE",
"hex.builtin.view.disassembler.region": "代码范围",
"hex.builtin.view.disassembler.riscv.compressed": "压缩的 RISC-V",
"hex.builtin.view.disassembler.settings.header": "设置",
"hex.builtin.view.disassembler.settings.mode": "模式",
"hex.builtin.view.disassembler.sparc.v9": "Sparc V9",
"hex.builtin.view.find.binary_pattern": "二进制模式",
@ -701,7 +701,7 @@
"hex.builtin.view.information.distribution": "字节分布",
"hex.builtin.view.information.encrypted": "此数据似乎经过了加密或压缩!",
"hex.builtin.view.information.entropy": "熵",
"hex.builtin.view.information.file_entropy": "文件熵",
"hex.builtin.view.information.file_entropy": "",
"hex.builtin.view.information.highest_entropy": "最高熵",
"hex.builtin.view.information.info_analysis": "信息分析",
"hex.builtin.view.information.layered_distribution": "",
@ -711,6 +711,7 @@
"hex.builtin.view.information.name": "数据信息",
"hex.builtin.view.information.plain_text": "",
"hex.builtin.view.information.plain_text_percentage": "",
"hex.builtin.view.information.provider_information": "",
"hex.builtin.view.information.region": "已分析区域",
"hex.builtin.view.patches.name": "补丁",
"hex.builtin.view.patches.offset": "偏移",

View File

@ -52,6 +52,7 @@
"hex.builtin.common.range.selection": "所選",
"hex.builtin.common.region": "區域",
"hex.builtin.common.set": "設置",
"hex.builtin.common.set": "設定",
"hex.builtin.common.size": "大小",
"hex.builtin.common.type": "類型",
"hex.builtin.common.type.f32": "float",
@ -590,7 +591,6 @@
"hex.builtin.view.disassembler.ppc.spe": "訊號處理引擎",
"hex.builtin.view.disassembler.region": "程式碼區域",
"hex.builtin.view.disassembler.riscv.compressed": "Compressed",
"hex.builtin.view.disassembler.settings.header": "設定",
"hex.builtin.view.disassembler.settings.mode": "模式",
"hex.builtin.view.disassembler.sparc.v9": "Sparc V9",
"hex.builtin.view.find.binary_pattern": "Binary Pattern",
@ -699,8 +699,8 @@
"hex.builtin.view.information.distribution": "位元組分佈",
"hex.builtin.view.information.encrypted": "此資料很有可能經過加密或壓縮!",
"hex.builtin.view.information.entropy": "熵",
"hex.builtin.view.information.file_entropy": "檔案熵",
"hex.builtin.view.information.highest_entropy": "Highest entropy block",
"hex.builtin.view.information.file_entropy": "",
"hex.builtin.view.information.highest_entropy": "Highest block entropy",
"hex.builtin.view.information.info_analysis": "資訊分析",
"hex.builtin.view.information.layered_distribution": "",
"hex.builtin.view.information.magic": "Magic information",
@ -709,6 +709,7 @@
"hex.builtin.view.information.name": "資料資訊",
"hex.builtin.view.information.plain_text": "",
"hex.builtin.view.information.plain_text_percentage": "",
"hex.builtin.view.information.provider_information": "",
"hex.builtin.view.information.region": "Analyzed region",
"hex.builtin.view.patches.name": "Patches",
"hex.builtin.view.patches.offset": "位移",

View File

@ -113,9 +113,7 @@ namespace hex::plugin::builtin {
ImHexApi::HexEditor::setSelection(0, 0);
}
ImGui::NewLine();
ImGui::TextUnformatted("hex.builtin.view.disassembler.settings.header"_lang);
ImGui::Separator();
ImGui::Header("hex.builtin.common.settings"_lang);
if (ImGui::Combo("hex.builtin.view.disassembler.arch"_lang, reinterpret_cast<int *>(&this->m_architecture), Disassembler::ArchitectureNames, Disassembler::getArchitectureSupportedCount()))
this->m_mode = cs_mode(0);

View File

@ -11,7 +11,6 @@
#include <cstring>
#include <cmath>
#include <filesystem>
#include <numeric>
#include <span>
#include <implot.h>
@ -67,14 +66,13 @@ namespace hex::plugin::builtin {
this->m_analyzerTask = TaskManager::createTask("hex.builtin.view.information.analyzing", 0, [this](auto &task) {
auto provider = ImHexApi::Provider::get();
if ((this->m_inputChunkSize <= 0)
|| (this->m_inputStartAddress < 0)
if ((this->m_inputChunkSize <= 0)
|| (this->m_inputStartAddress >= this->m_inputEndAddress)
|| ((size_t) this->m_inputEndAddress > provider->getSize())) {
|| ((size_t) this->m_inputEndAddress > provider->getActualSize())) {
// Invalid parameters, set default one
this->m_inputChunkSize = 256;
this->m_inputStartAddress = 0;
this->m_inputEndAddress = provider->getSize();
this->m_inputEndAddress = provider->getActualSize();
}
task.setMaxValue(this->m_inputEndAddress - this->m_inputStartAddress);
@ -129,7 +127,10 @@ namespace hex::plugin::builtin {
}
this->m_averageEntropy = this->m_chunkBasedEntropy.calculateEntropy(this->m_byteDistribution.get(), this->m_inputEndAddress - this->m_inputStartAddress);
this->m_highestBlockEntropy = this->m_chunkBasedEntropy.getHighestBlockEntropy();
this->m_highestBlockEntropy = this->m_chunkBasedEntropy.getHighestEntropyBlockValue();
this->m_highestBlockEntropyAddress = this->m_chunkBasedEntropy.getHighestEntropyBlockAddress();
this->m_lowestBlockEntropy = this->m_chunkBasedEntropy.getLowestEntropyBlockValue();
this->m_lowestBlockEntropyAddress = this->m_chunkBasedEntropy.getLowestEntropyBlockAddress();
this->m_plainTextCharacterPercentage = this->m_byteTypesDistribution.getPlainTextCharacterPercentage();
}
@ -145,16 +146,17 @@ namespace hex::plugin::builtin {
if (ImHexApi::Provider::isValid() && provider->isReadable()) {
ImGui::BeginDisabled(this->m_analyzerTask.isRunning());
{
ImGui::Header("hex.builtin.view.disassembler.settings.header"_lang);
ImGui::Header("hex.builtin.common.settings"_lang, true);
const u64 min = 0;
const u64 max = provider->getActualSize();
ImGui::SliderScalar("hex.builtin.common.begin"_lang, ImGuiDataType_U64, &this->m_inputStartAddress, &min, &max, "0x%02llX", ImGuiSliderFlags_AlwaysClamp);
ImGui::SliderScalar("hex.builtin.common.end"_lang, ImGuiDataType_U64, &this->m_inputEndAddress, &min, &max, "0x%02llX", ImGuiSliderFlags_AlwaysClamp);
ImGui::NewLine();
ImGui::InputInt("hex.builtin.view.information.block_size"_lang, &this->m_inputChunkSize, ImGuiInputTextFlags_CharsDecimal);
// Clamp the values since the user can Ctrl+Click to transform the slider into a input
ImGui::SliderInt("hex.builtin.common.begin"_lang, &this->m_inputStartAddress, 0, provider->getSize(), "%d", ImGuiSliderFlags_AlwaysClamp);
// Clamp the values since the user can Ctrl+Click to transform the slider into a input
ImGui::SliderInt("hex.builtin.common.end"_lang, &this->m_inputEndAddress, 0, provider->getSize(), "%d", ImGuiSliderFlags_AlwaysClamp);
if (ImGui::Button("hex.builtin.view.information.analyze"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0)))
this->analyze();
}
@ -168,8 +170,8 @@ namespace hex::plugin::builtin {
if (!this->m_analyzerTask.isRunning() && this->m_dataValid) {
// Analyzed region
ImGui::Header("hex.builtin.view.information.region"_lang, true);
// Provider information
ImGui::Header("hex.builtin.view.information.provider_information"_lang, true);
if (ImGui::BeginTable("information", 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoKeepColumnsVisible)) {
ImGui::TableSetupColumn("type");
@ -192,8 +194,6 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
ImGui::NewLine();
// Magic information
if (!(this->m_dataDescription.empty() && this->m_dataMimeType.empty())) {
ImGui::Header("hex.builtin.view.information.magic"_lang);
@ -275,19 +275,23 @@ namespace hex::plugin::builtin {
ImGui::TextFormatted("{}", "hex.builtin.view.information.file_entropy"_lang);
ImGui::TableNextColumn();
if (this->m_averageEntropy < 0) ImGui::TextUnformatted("???");
else ImGui::TextFormatted("{:.8f}", this->m_averageEntropy);
else ImGui::TextFormatted("{:.5f}", this->m_averageEntropy);
ImGui::TableNextColumn();
ImGui::TextFormatted("{}", "hex.builtin.view.information.highest_entropy"_lang);
ImGui::TableNextColumn();
if (this->m_highestBlockEntropy < 0) ImGui::TextUnformatted("???");
else ImGui::TextFormatted("{:.8f}", this->m_highestBlockEntropy);
ImGui::TextFormatted("{:.5f} @ 0x{:02X}", this->m_highestBlockEntropy, this->m_highestBlockEntropyAddress);
ImGui::TableNextColumn();
ImGui::TextFormatted("{}", "hex.builtin.view.information.lowest_entropy"_lang);
ImGui::TableNextColumn();
ImGui::TextFormatted("{:.5f} @ 0x{:02X}", this->m_lowestBlockEntropy, this->m_lowestBlockEntropyAddress);
ImGui::TableNextColumn();
ImGui::TextFormatted("{}", "hex.builtin.view.information.plain_text_percentage"_lang);
ImGui::TableNextColumn();
if (this->m_plainTextCharacterPercentage < 0) ImGui::TextUnformatted("???");
else ImGui::TextFormatted("{:.8f}", this->m_plainTextCharacterPercentage);
else ImGui::TextFormatted("{:.2f}%", this->m_plainTextCharacterPercentage);
ImGui::EndTable();
}
@ -304,7 +308,7 @@ namespace hex::plugin::builtin {
ImGui::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{}", "hex.builtin.view.information.encrypted"_lang);
}
if (this->m_plainTextCharacterPercentage > 99) {
if (this->m_plainTextCharacterPercentage > 95) {
ImGui::TableNextColumn();
ImGui::TextFormattedColored(ImVec4(0.92F, 0.25F, 0.2F, 1.0F), "{}", "hex.builtin.view.information.plain_text"_lang);
}
@ -312,8 +316,6 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
ImGui::NewLine();
ImGui::BeginGroup();
{
ImGui::TextUnformatted("hex.builtin.view.information.digram"_lang);