Skip to content

Commit dc21b3e

Browse files
authored
Version 1.7.1 (#5)
* Add AEWF file detection hexfeature * bump version * improve aewf detector * cache highlights * add new workflow
1 parent bb9ea26 commit dc21b3e

8 files changed

Lines changed: 184 additions & 9 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # triggers on v1.0.0, v2.3.4, etc.
7+
8+
permissions:
9+
contents: write # required to create releases
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
24+
- name: Install dependencies (Linux)
25+
if: runner.os == 'Linux'
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -y \
29+
build-essential cmake \
30+
libgl1-mesa-dev libx11-dev libxrandr-dev \
31+
libxinerama-dev libxcursor-dev libxi-dev \
32+
libwayland-dev libxkbcommon-dev
33+
34+
- name: Configure and build (Linux)
35+
if: runner.os == 'Linux'
36+
run: |
37+
mkdir build
38+
cd build
39+
cmake .. -DCMAKE_BUILD_TYPE=Release
40+
make
41+
42+
- name: Configure and build (Windows)
43+
if: runner.os == 'Windows'
44+
run: |
45+
mkdir build
46+
cd build
47+
cmake .. -DCMAKE_BUILD_TYPE=Release
48+
cmake --build . --config Release
49+
50+
- name: Upload Linux artifact
51+
if: runner.os == 'Linux'
52+
uses: actions/upload-artifact@v6
53+
with:
54+
name: EntropyVisualizer-Linux
55+
path: build/EntropyVisualizer
56+
57+
- name: Upload Windows artifact
58+
if: runner.os == 'Windows'
59+
uses: actions/upload-artifact@v6
60+
with:
61+
name: EntropyVisualizer-Windows
62+
path: build/Release/EntropyVisualizer.exe
63+
64+
release:
65+
needs: build
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- name: Download Linux artifact
70+
uses: actions/download-artifact@v6
71+
with:
72+
name: EntropyVisualizer-Linux
73+
path: artifacts/linux
74+
75+
- name: Download Windows artifact
76+
uses: actions/download-artifact@v6
77+
with:
78+
name: EntropyVisualizer-Windows
79+
path: artifacts/windows
80+
81+
- name: Create GitHub Release
82+
uses: softprops/action-gh-release@v2
83+
with:
84+
tag_name: ${{ github.ref_name }}
85+
name: Release ${{ github.ref_name }}
86+
draft: false
87+
prerelease: false
88+
files: |
89+
artifacts/linux/EntropyVisualizer
90+
artifacts/windows/EntropyVisualizer.exe

include/entropy/hex_display_feature.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#pragma once
22

33
#include <cstdint>
4+
#include <map>
45
#include <string>
56
#include <vector>
67

78
#include "imgui.h"
89

9-
#ifndef RGBA_COLOR
10-
#define RGBA_COLOR(R, G, B, A) (((unsigned int)(A) << 24) | ((unsigned int)(B) << 0) | ((unsigned int)(G) << 8) | ((unsigned int)(R) << 16))
11-
#endif
12-
1310
namespace entropy {
1411

1512
struct Highlight {
@@ -32,6 +29,7 @@ class HexDisplayFeature {
3229
ImGui::PushID(getName().c_str());
3330
if (ImGui::ColorEdit4("Color", (float *)&col)) {
3431
color = ImGui::ColorConvertFloat4ToU32(col);
32+
highlightCache.clear();
3533
}
3634
ImGui::PopID();
3735
}
@@ -40,6 +38,7 @@ class HexDisplayFeature {
4038
unsigned int color_value = 0;
4139
if (sscanf(value.c_str(), "0x%X", &color_value) == 1) {
4240
color = color_value;
41+
highlightCache.clear();
4342
}
4443
}
4544
}
@@ -57,6 +56,7 @@ class HexDisplayFeature {
5756

5857
public:
5958
mutable uint32_t color = IM_COL32(255, 0, 0, 255); // Default red color
59+
mutable std::map<size_t, std::vector<Highlight>> highlightCache;
6060
};
6161

6262
} // namespace entropy

include/entropy/hexdisplay/55aa_finder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace entropy {
1010

1111
class AA55FinderFeature : public HexDisplayFeature {
1212
public:
13-
AA55FinderFeature() { color = RGBA_COLOR(255, 255, 0, 255); }
13+
AA55FinderFeature() { color = IM_COL32(255, 255, 0, 255); }
1414
std::string getName() const override { return "55AA Finder"; }
1515
std::string getSlug() const override { return "55aa"; }
1616
std::string getVersion() const override { return "1.0"; }
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#pragma once
2+
3+
#include <cstdint>
4+
#include <string>
5+
#include <vector>
6+
7+
#include <entropy/hex_display_feature.h>
8+
9+
namespace entropy {
10+
11+
class AEWFDetector : public HexDisplayFeature {
12+
public:
13+
AEWFDetector() { color = IM_COL32(255, 0, 0, 255); }
14+
std::string getName() const override { return "AEWF Detector"; }
15+
std::string getSlug() const override { return "aewf"; }
16+
std::string getVersion() const override { return "1.0"; }
17+
std::string getAuthor() const override { return "Entropy Visualizer Team"; }
18+
int getPriority() const override { return 10; }
19+
20+
std::vector<Highlight> getHighlights(const std::vector<uint8_t> &sectorData, size_t sectorIndex) const override {
21+
std::vector<Highlight> highlights;
22+
23+
// .E01 file
24+
// Signature: EVF 0x09 0x0d 0x0a 0xff 0x00
25+
const char aewf_signature[] = {'E', 'V', 'F', 0x09, 0x0d, 0x0a, (char)0xff, 0x00};
26+
27+
// check if sectorData contains the signature
28+
for (size_t i = 0; i + sizeof(aewf_signature) <= sectorData.size(); i++) {
29+
if (memcmp(&sectorData[i], aewf_signature, sizeof(aewf_signature)) == 0) {
30+
for (size_t j = 0; j < sizeof(aewf_signature); j++) {
31+
highlights.push_back({i + j, this->color});
32+
}
33+
return highlights;
34+
}
35+
}
36+
37+
// .AD1 file
38+
// Signature: ADSEGMENTEDFILE\0
39+
const char ad1_signature[] = {'A', 'D', 'S', 'E', 'G', 'M', 'E', 'N', 'T', 'E', 'D', 'F', 'I', 'L', 'E', 0x00};
40+
41+
for (size_t i = 0; i + sizeof(ad1_signature) <= sectorData.size(); i++) {
42+
if (memcmp(&sectorData[i], ad1_signature, sizeof(ad1_signature)) == 0) {
43+
// Found AD1 signature
44+
for (size_t j = 0; j < sizeof(ad1_signature); j++) {
45+
highlights.push_back({i + j, this->color});
46+
}
47+
return highlights;
48+
}
49+
}
50+
51+
return highlights;
52+
}
53+
};
54+
55+
} // namespace entropy

include/entropy/hexdisplay/zero_bytes.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace entropy {
1010

1111
class ZeroBytesFeature : public HexDisplayFeature {
1212
public:
13-
ZeroBytesFeature() { color = RGBA_COLOR(255, 255, 255, 100); }
13+
ZeroBytesFeature() { color = IM_COL32(255, 255, 255, 100); }
1414
std::string getName() const override { return "Zero Bytes Finder"; }
1515
std::string getSlug() const override { return "zeros"; }
1616
std::string getVersion() const override { return "1.0"; }
@@ -37,7 +37,10 @@ class ZeroBytesFeature : public HexDisplayFeature {
3737
// Default Config (color)
3838
HexDisplayFeature::renderSettingsPanel();
3939

40-
ImGui::Checkbox("Color FF as well", &colorFF);
40+
bool changed = ImGui::Checkbox("Color FF as well", &colorFF);
41+
if (changed) {
42+
highlightCache.clear();
43+
}
4144

4245
ImGui::PopID();
4346
}
@@ -59,6 +62,7 @@ class ZeroBytesFeature : public HexDisplayFeature {
5962
void setConfig(const std::string &key, const std::string &value) override {
6063
if (key == "colorFF") {
6164
colorFF = (value == "1");
65+
highlightCache.clear();
6266
return;
6367
}
6468
// default options

include/entropy/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#pragma once
22

3-
#define VERSION "1.7.0"
3+
#define VERSION "1.7.1"
44
#define DATE "26.01.2026"

src/hex_display_feature_manager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <entropy/hex_display_feature_manager.h>
22
#include <entropy/hexdisplay/55aa_finder.h>
3+
#include <entropy/hexdisplay/aewf_detector.h>
34
#include <entropy/hexdisplay/zero_bytes.h>
45
#include <iostream>
56

@@ -17,6 +18,7 @@ void HexDisplayFeatureManager::loadFeatures() {
1718
// Statically load all hex display features
1819
features.push_back(new ZeroBytesFeature());
1920
features.push_back(new AA55FinderFeature());
21+
features.push_back(new AEWFDetector());
2022
}
2123

2224
} // namespace entropy

src/ui.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,29 @@ void renderHexViewWindow(UiState &uiState, const AppState &appState) {
5858
if (uiState.currentSectorData.empty()) {
5959
ImGui::Text("No data available");
6060
} else {
61+
// Clear highlight cache if sector changed
62+
static size_t lastSectorIndex = SIZE_MAX;
63+
if (lastSectorIndex != uiState.currentSectorIndex) {
64+
if (appState.hexDisplayFeatureManager) {
65+
for (auto *feature : appState.hexDisplayFeatureManager->getFeatures()) {
66+
feature->highlightCache.clear();
67+
}
68+
}
69+
lastSectorIndex = uiState.currentSectorIndex;
70+
}
71+
6172
// Collect highlights from plugins
6273
std::map<size_t, std::pair<uint32_t, int>> highlightMap; // color, priority
6374
if (appState.hexDisplayFeatureManager) {
6475
for (const auto *feature : appState.hexDisplayFeatureManager->getFeatures()) {
6576
if (appState.featureEnabled.count(feature->getName()) && appState.featureEnabled.at(feature->getName())) {
66-
auto highlights = feature->getHighlights(uiState.currentSectorData, uiState.currentSectorIndex);
77+
std::vector<Highlight> highlights;
78+
if (feature->highlightCache.count(uiState.currentSectorIndex)) {
79+
highlights = feature->highlightCache[uiState.currentSectorIndex];
80+
} else {
81+
highlights = feature->getHighlights(uiState.currentSectorData, uiState.currentSectorIndex);
82+
feature->highlightCache[uiState.currentSectorIndex] = highlights;
83+
}
6784
int priority = feature->getPriority();
6885
for (const auto &h : highlights) {
6986
auto it = highlightMap.find(h.offset);
@@ -266,6 +283,13 @@ void renderVisualization(ImDrawList *draw_list, GLuint tex, const std::vector<ui
266283
loadHexData(sector_index);
267284
uiState.showHexView = true;
268285
}
286+
287+
if (ImGui::IsMouseDragging(ImGuiMouseButton_Left) && !ImGui::GetIO().WantCaptureMouse) {
288+
size_t sector_index = current_block * block_size + idx;
289+
uiState.highlighted_sector = sector_index;
290+
loadHexData(sector_index);
291+
uiState.showHexView = true;
292+
}
269293
}
270294
}
271295

0 commit comments

Comments
 (0)