2021-09-21 00:48:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <hex.hpp>
|
|
|
|
|
2022-02-01 17:09:40 +00:00
|
|
|
#include <hex/ui/view.hpp>
|
2023-11-18 13:50:43 +00:00
|
|
|
#include <hex/api/task_manager.hpp>
|
2021-09-21 00:48:41 +00:00
|
|
|
|
|
|
|
#include <array>
|
2021-09-21 17:54:13 +00:00
|
|
|
#include <vector>
|
2021-09-21 00:48:41 +00:00
|
|
|
|
2023-02-15 16:01:36 +00:00
|
|
|
#include "ui/hex_editor.hpp"
|
|
|
|
|
2021-12-07 21:47:41 +00:00
|
|
|
namespace hex::plugin::builtin {
|
2021-09-21 00:48:41 +00:00
|
|
|
|
2023-11-21 12:47:50 +00:00
|
|
|
class ViewDiff : public View::Window {
|
2021-09-21 00:48:41 +00:00
|
|
|
public:
|
2021-09-21 17:54:13 +00:00
|
|
|
ViewDiff();
|
|
|
|
~ViewDiff() override;
|
2021-09-21 00:48:41 +00:00
|
|
|
|
|
|
|
void drawContent() override;
|
2023-11-21 12:47:50 +00:00
|
|
|
ImGuiWindowFlags getWindowFlags() const override { return ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse; }
|
2021-09-21 00:48:41 +00:00
|
|
|
|
2023-02-16 07:53:05 +00:00
|
|
|
public:
|
2023-02-15 16:01:36 +00:00
|
|
|
struct Column {
|
|
|
|
ui::HexEditor hexEditor;
|
|
|
|
int provider = -1;
|
|
|
|
i32 scrollLock = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class DifferenceType : u8 {
|
|
|
|
Added,
|
|
|
|
Removed,
|
|
|
|
Modified
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Diff {
|
|
|
|
Region region;
|
|
|
|
DifferenceType type;
|
|
|
|
};
|
|
|
|
|
2023-08-29 10:14:12 +00:00
|
|
|
private:
|
2023-11-10 19:47:08 +00:00
|
|
|
std::function<std::optional<color_t>(u64, const u8*, size_t)> createCompareFunction(size_t otherIndex) const;
|
2023-08-29 10:14:12 +00:00
|
|
|
void analyze(prv::Provider *providerA, prv::Provider *providerB);
|
|
|
|
|
2023-02-15 16:01:36 +00:00
|
|
|
private:
|
|
|
|
std::array<Column, 2> m_columns;
|
2021-09-21 17:54:13 +00:00
|
|
|
|
2023-02-15 16:01:36 +00:00
|
|
|
std::vector<Diff> m_diffs;
|
|
|
|
TaskHolder m_diffTask;
|
|
|
|
std::atomic<bool> m_analyzed = false;
|
2021-09-21 00:48:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|