mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
sys: First attempt at reducing build times
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
|
||||
#include "math_evaluator.hpp"
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void registerCommandPaletteCommands() {
|
||||
|
||||
hex::ContentRegistry::CommandPaletteCommands::add(
|
||||
hex::ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPaletteCommands::add(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
"#", "hex.builtin.command.calc.desc",
|
||||
[](auto input) {
|
||||
hex::MathEvaluator evaluator;
|
||||
@@ -27,8 +27,8 @@ namespace hex::plugin::builtin {
|
||||
return hex::format("#{0} = ???", input.data());
|
||||
});
|
||||
|
||||
hex::ContentRegistry::CommandPaletteCommands::add(
|
||||
hex::ContentRegistry::CommandPaletteCommands::Type::KeywordCommand,
|
||||
ContentRegistry::CommandPaletteCommands::add(
|
||||
ContentRegistry::CommandPaletteCommands::Type::KeywordCommand,
|
||||
"/web", "hex.builtin.command.web.desc",
|
||||
[](auto input) {
|
||||
return hex::format("hex.builtin.command.web.result"_lang, input.data());
|
||||
@@ -37,8 +37,8 @@ namespace hex::plugin::builtin {
|
||||
hex::openWebpage(input);
|
||||
});
|
||||
|
||||
hex::ContentRegistry::CommandPaletteCommands::add(
|
||||
hex::ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPaletteCommands::add(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
"$", "hex.builtin.command.cmd.desc",
|
||||
[](auto input) {
|
||||
return hex::format("hex.builtin.command.cmd.result"_lang, input.data());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
@@ -18,9 +18,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void registerDataInspectorEntries() {
|
||||
|
||||
using Style = hex::ContentRegistry::DataInspector::NumberDisplayStyle;
|
||||
using Style = ContentRegistry::DataInspector::NumberDisplayStyle;
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.binary", sizeof(u8), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.binary", sizeof(u8), [](auto buffer, auto endian, auto style) {
|
||||
std::string binary;
|
||||
for (u8 i = 0; i < 8; i++)
|
||||
binary += ((buffer[0] << i) & 0x80) == 0 ? '0' : '1';
|
||||
@@ -31,76 +31,76 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u8", sizeof(u8), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.u8", sizeof(u8), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, *reinterpret_cast<u8*>(buffer.data()));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s8", sizeof(s8), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.s8", sizeof(s8), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, *reinterpret_cast<s8*>(buffer.data()));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u16", sizeof(u16), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.u16", sizeof(u16), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u16*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s16", sizeof(s16), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.s16", sizeof(s16), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s16*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u32", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.u32", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u32*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s32", sizeof(s32), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.s32", sizeof(s32), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s32*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u64", sizeof(u64), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.u64", sizeof(u64), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u64*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s64", sizeof(s64), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.s64", sizeof(s64), [](auto buffer, auto endian, auto style) {
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "{0:#o}");
|
||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s64*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.float", sizeof(float), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.float", sizeof(float), [](auto buffer, auto endian, auto style) {
|
||||
auto value = hex::format("{0:G}", hex::changeEndianess(*reinterpret_cast<float*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.double", sizeof(double), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.double", sizeof(double), [](auto buffer, auto endian, auto style) {
|
||||
auto value = hex::format("{0:G}", hex::changeEndianess(*reinterpret_cast<float*>(buffer.data()), endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.ascii", sizeof(char8_t), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.ascii", sizeof(char8_t), [](auto buffer, auto endian, auto style) {
|
||||
auto value = hex::format("'{0}'", makePrintable(*reinterpret_cast<char8_t*>(buffer.data())).c_str());
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.wide", sizeof(char16_t), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.wide", sizeof(char16_t), [](auto buffer, auto endian, auto style) {
|
||||
auto c = *reinterpret_cast<char16_t*>(buffer.data());
|
||||
auto value = hex::format("'{0}'", c == 0 ? '\x01' : char16_t(hex::changeEndianess(c, endian)));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.utf8", sizeof(char8_t) * 4, [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.utf8", sizeof(char8_t) * 4, [](auto buffer, auto endian, auto style) {
|
||||
char utf8Buffer[5] = { 0 };
|
||||
char codepointString[5] = { 0 };
|
||||
u32 codepoint = 0;
|
||||
@@ -119,7 +119,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
#if defined(OS_WINDOWS) && defined(ARCH_64_BIT)
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(__time32_t), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(__time32_t), [](auto buffer, auto endian, auto style) {
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<__time32_t*>(buffer.data()), endian);
|
||||
struct tm *ptm = _localtime32(&endianAdjustedTime);
|
||||
std::string value;
|
||||
@@ -131,7 +131,7 @@ namespace hex::plugin::builtin {
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time64", sizeof(__time64_t), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time64", sizeof(__time64_t), [](auto buffer, auto endian, auto style) {
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<__time64_t*>(buffer.data()), endian);
|
||||
struct tm *ptm = _localtime64(&endianAdjustedTime);
|
||||
std::string value;
|
||||
@@ -145,7 +145,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
#else
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time", sizeof(time_t), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time", sizeof(time_t), [](auto buffer, auto endian, auto style) {
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<time_t*>(buffer.data()), endian);
|
||||
struct tm *ptm = localtime(&endianAdjustedTime);
|
||||
std::string value;
|
||||
@@ -159,7 +159,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
#endif
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.guid", sizeof(GUID), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.guid", sizeof(GUID), [](auto buffer, auto endian, auto style) {
|
||||
GUID guid;
|
||||
std::memcpy(&guid, buffer.data(), sizeof(GUID));
|
||||
auto value = hex::format("{}{{{:08X}-{:04X}-{:04X}-{:02X}{:02X}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}}}",
|
||||
@@ -173,7 +173,7 @@ namespace hex::plugin::builtin {
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
});
|
||||
|
||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.rgba8", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.rgba8", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
ImColor value(hex::changeEndianess(*reinterpret_cast<u32*>(buffer.data()), endian));
|
||||
|
||||
auto stringValue = hex::format("(0x{:02X}, 0x{:02X}, 0x{:02X}, 0x{:02X})", u8(0xFF * (value.Value.x)), u8(0xFF * (value.Value.y)), u8(0xFF * (value.Value.z)), u8(0xFF * (value.Value.w)));
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/data_processor/node.hpp>
|
||||
|
||||
#include <hex/helpers/crypto.hpp>
|
||||
#include <hex/helpers/shared_data.hpp>
|
||||
|
||||
#include <cctype>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
class NodeNullptr : public dp::Node {
|
||||
@@ -38,13 +44,11 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, this->m_buffer);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
void store(nlohmann::json &j) override {
|
||||
j = nlohmann::json::object();
|
||||
|
||||
output["size"] = this->m_size;
|
||||
output["data"] = this->m_buffer;
|
||||
|
||||
return output;
|
||||
j["size"] = this->m_size;
|
||||
j["data"] = this->m_buffer;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
@@ -80,12 +84,10 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, output);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
void store(nlohmann::json &j) override {
|
||||
j = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
j["data"] = this->m_value;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
@@ -115,12 +117,10 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, data);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
void store(nlohmann::json &j) override {
|
||||
j = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
j["data"] = this->m_value;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
@@ -151,12 +151,10 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, data);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
void store(nlohmann::json &j) override {
|
||||
j = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
j["data"] = this->m_value;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
@@ -189,16 +187,14 @@ namespace hex::plugin::builtin {
|
||||
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
void store(nlohmann::json &j) override {
|
||||
j = nlohmann::json::object();
|
||||
|
||||
output["data"] = nlohmann::json::object();
|
||||
output["data"]["r"] = this->m_color.Value.x;
|
||||
output["data"]["g"] = this->m_color.Value.y;
|
||||
output["data"]["b"] = this->m_color.Value.z;
|
||||
output["data"]["a"] = this->m_color.Value.w;
|
||||
|
||||
return output;
|
||||
j["data"] = nlohmann::json::object();
|
||||
j["data"]["r"] = this->m_color.Value.x;
|
||||
j["data"]["g"] = this->m_color.Value.y;
|
||||
j["data"]["b"] = this->m_color.Value.z;
|
||||
j["data"]["a"] = this->m_color.Value.w;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
@@ -223,12 +219,10 @@ namespace hex::plugin::builtin {
|
||||
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
void store(nlohmann::json &j) override {
|
||||
j = nlohmann::json::object();
|
||||
|
||||
output["comment"] = this->m_comment;
|
||||
|
||||
return output;
|
||||
j["comment"] = this->m_comment;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
@@ -751,15 +745,12 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(4, output);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
void store(nlohmann::json &j) override {
|
||||
j = nlohmann::json::object();
|
||||
|
||||
output["data"] = nlohmann::json::object();
|
||||
output["data"]["mode"] = this->m_mode;
|
||||
output["data"]["key_length"] = this->m_keyLength;
|
||||
|
||||
|
||||
return output;
|
||||
j["data"] = nlohmann::json::object();
|
||||
j["data"]["mode"] = this->m_mode;
|
||||
j["data"]["key_length"] = this->m_keyLength;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
|
||||
#include <hex/lang/ast_node.hpp>
|
||||
#include <hex/lang/log_console.hpp>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
|
||||
#include <hex/helpers/net.hpp>
|
||||
#include <hex/helpers/shared_data.hpp>
|
||||
|
||||
#include <regex>
|
||||
#include <chrono>
|
||||
@@ -8,6 +9,12 @@
|
||||
#include <llvm/Demangle/Demangle.h>
|
||||
#include "math_evaluator.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <imgui_internal.h>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/helpers/shared_data.hpp>
|
||||
|
||||
#include <codicons_font.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <imgui_imhex_extensions.h>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user