mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
patterns: Updated to new API
This commit is contained in:
@@ -42,7 +42,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
namespace {
|
||||
|
||||
void drawLinePlotVisualizer(pl::ptrn::Pattern &, pl::ptrn::Iteratable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
void drawLinePlotVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
static std::vector<float> values;
|
||||
auto dataPattern = arguments[0].toPattern();
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
void drawScatterPlotVisualizer(pl::ptrn::Pattern &, pl::ptrn::Iteratable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
void drawScatterPlotVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
static std::vector<float> xValues, yValues;
|
||||
|
||||
auto xPattern = arguments[0].toPattern();
|
||||
@@ -83,7 +83,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
void drawImageVisualizer(pl::ptrn::Pattern &, pl::ptrn::Iteratable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
void drawImageVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
static ImGui::Texture texture;
|
||||
if (shouldReset) {
|
||||
auto pattern = arguments[0].toPattern();
|
||||
@@ -96,7 +96,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::Image(texture, texture.getSize());
|
||||
}
|
||||
|
||||
void drawBitmapVisualizer(pl::ptrn::Pattern &, pl::ptrn::Iteratable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
void drawBitmapVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
static ImGui::Texture texture;
|
||||
if (shouldReset) {
|
||||
auto pattern = arguments[0].toPattern();
|
||||
@@ -111,7 +111,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::Image(texture, texture.getSize());
|
||||
}
|
||||
|
||||
void drawDisassemblyVisualizer(pl::ptrn::Pattern &, pl::ptrn::Iteratable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
void drawDisassemblyVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
struct Disassembly {
|
||||
u64 address;
|
||||
std::vector<u8> bytes;
|
||||
@@ -167,7 +167,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
void draw3DVisualizer(pl::ptrn::Pattern &, pl::ptrn::Iteratable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
void draw3DVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
auto verticesPattern = arguments[0].toPattern();
|
||||
auto indicesPattern = arguments[1].toPattern();
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
}
|
||||
|
||||
void drawSoundVisualizer(pl::ptrn::Pattern &, pl::ptrn::Iteratable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
void drawSoundVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
auto wavePattern = arguments[0].toPattern();
|
||||
auto channels = arguments[1].toUnsigned();
|
||||
auto sampleRate = arguments[2].toUnsigned();
|
||||
@@ -443,7 +443,7 @@ namespace hex::plugin::builtin {
|
||||
(waveData.size() / sampleRate) / 60, (waveData.size() / sampleRate) % 60);
|
||||
}
|
||||
|
||||
void drawChunkBasedEntropyVisualizer(pl::ptrn::Pattern &, pl::ptrn::Iteratable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
void drawChunkBasedEntropyVisualizer(pl::ptrn::Pattern &, pl::ptrn::IIterable &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
|
||||
// variable used to store the result to avoid having to recalculate the result at each frame
|
||||
static DiagramChunkBasedEntropyAnalysis analyzer;
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (!inspectorCode.empty()) {
|
||||
if (this->m_runtime.executeString(inspectorCode, {}, inVariables, true)) {
|
||||
const auto &patterns = this->m_runtime.getAllPatterns();
|
||||
const auto &patterns = this->m_runtime.getPatterns();
|
||||
|
||||
for (const auto &pattern : patterns) {
|
||||
if (pattern->getVisibility() == pl::ptrn::Visibility::Hidden)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace hex::plugin::builtin {
|
||||
this->m_shouldReset = false;
|
||||
}
|
||||
|
||||
this->m_patternDrawer.draw(runtime.getAllPatterns());
|
||||
this->m_patternDrawer.draw(runtime.getPatterns());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
const auto &patterns = [&, this] -> const auto& {
|
||||
if (patternProvider->isReadable() && *this->m_executionDone)
|
||||
return runtime.getAllPatterns(id);
|
||||
return runtime.getPatterns(id);
|
||||
else {
|
||||
static const std::vector<std::shared_ptr<pl::ptrn::Pattern>> empty;
|
||||
return empty;
|
||||
|
||||
Reference in New Issue
Block a user