refactor: Rework features that use external libraries into optional plugins (#1470)

This commit is contained in:
Nik
2023-12-23 21:09:41 +01:00
committed by GitHub
parent 84bfd10416
commit 61bfe10bc2
149 changed files with 2940 additions and 2390 deletions

View File

@@ -1,46 +0,0 @@
#pragma once
#include <hex/api/task_manager.hpp>
#include <hex/ui/view.hpp>
#include <ui/widgets.hpp>
#include <content/helpers/disassembler.hpp>
#include <string>
#include <vector>
namespace hex::plugin::builtin {
struct Disassembly {
u64 address;
u64 offset;
size_t size;
std::string bytes;
std::string mnemonic;
std::string operators;
};
class ViewDisassembler : public View::Window {
public:
explicit ViewDisassembler();
~ViewDisassembler() override;
void drawContent() override;
private:
TaskHolder m_disassemblerTask;
u64 m_baseAddress = 0;
ui::RegionType m_range = ui::RegionType::EntireData;
Region m_codeRegion = { 0, 0 };
Architecture m_architecture = Architecture::ARM;
cs_mode m_mode = cs_mode(0);
std::vector<Disassembly> m_disassembly;
void disassemble();
};
}

View File

@@ -82,7 +82,7 @@ namespace hex::plugin::builtin {
ImGui::NewLine();
ImGui::TextUnformatted("hex.builtin.view.pattern_editor.accept_pattern.question"_lang);
ImGuiExt::ConfirmButtons("hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang,
ImGuiExt::ConfirmButtons("hex.ui.common.yes"_lang, "hex.ui.common.no"_lang,
[this, provider] {
m_view->loadPatternFile(m_view->m_possiblePatternFiles.get(provider)[m_selectedPatternFile], provider);
this->close();

View File

@@ -1,44 +0,0 @@
#pragma once
#include <hex.hpp>
#include <hex/ui/view.hpp>
#include <hex/api/task_manager.hpp>
namespace hex::plugin::builtin {
class ViewYara : public View::Window {
public:
ViewYara();
~ViewYara() override;
void drawContent() override;
private:
struct YaraMatch {
std::string identifier;
std::string variable;
u64 address;
size_t size;
bool wholeDataMatch;
mutable u32 highlightId;
mutable u32 tooltipId;
};
private:
PerProvider<std::vector<std::pair<std::fs::path, std::fs::path>>> m_rules;
PerProvider<std::vector<YaraMatch>> m_matches;
PerProvider<std::vector<YaraMatch*>> m_sortedMatches;
u32 m_selectedRule = 0;
TaskHolder m_matcherTask;
std::vector<std::string> m_consoleMessages;
void applyRules();
void clearResult();
};
}