Fixed localization issues when using the content registry
This commit is contained in:
parent
36a4930b35
commit
424bba71f7
@ -8,7 +8,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
hex::ContentRegistry::CommandPaletteCommands::add(
|
hex::ContentRegistry::CommandPaletteCommands::add(
|
||||||
hex::ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
hex::ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||||
"#", "hex.builtin.command.calc.desc"_lang,
|
"#", "hex.builtin.command.calc.desc",
|
||||||
[](auto input) {
|
[](auto input) {
|
||||||
hex::MathEvaluator evaluator;
|
hex::MathEvaluator evaluator;
|
||||||
evaluator.registerStandardVariables();
|
evaluator.registerStandardVariables();
|
||||||
@ -29,7 +29,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
hex::ContentRegistry::CommandPaletteCommands::add(
|
hex::ContentRegistry::CommandPaletteCommands::add(
|
||||||
hex::ContentRegistry::CommandPaletteCommands::Type::KeywordCommand,
|
hex::ContentRegistry::CommandPaletteCommands::Type::KeywordCommand,
|
||||||
"/web", "hex.builtin.command.web.desc"_lang,
|
"/web", "hex.builtin.command.web.desc",
|
||||||
[](auto input) {
|
[](auto input) {
|
||||||
return hex::format("hex.builtin.command.web.result"_lang, input.data());
|
return hex::format("hex.builtin.command.web.result"_lang, input.data());
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
using Style = hex::ContentRegistry::DataInspector::NumberDisplayStyle;
|
using Style = hex::ContentRegistry::DataInspector::NumberDisplayStyle;
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.binary"_lang, sizeof(u8), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.binary", sizeof(u8), [](auto buffer, auto endian, auto style) {
|
||||||
std::string binary;
|
std::string binary;
|
||||||
for (u8 i = 0; i < 8; i++)
|
for (u8 i = 0; i < 8; i++)
|
||||||
binary += ((buffer[0] << i) & 0x80) == 0 ? '0' : '1';
|
binary += ((buffer[0] << i) & 0x80) == 0 ? '0' : '1';
|
||||||
@ -28,76 +28,76 @@ namespace hex::plugin::builtin {
|
|||||||
return [binary] { ImGui::TextUnformatted(binary.c_str()); };
|
return [binary] { ImGui::TextUnformatted(binary.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u8"_lang, sizeof(u8), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u8", sizeof(u8), [](auto buffer, auto endian, auto style) {
|
||||||
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||||
auto value = hex::format(format, *reinterpret_cast<u8*>(buffer.data()));
|
auto value = hex::format(format, *reinterpret_cast<u8*>(buffer.data()));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s8"_lang, sizeof(s8), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s8", sizeof(s8), [](auto buffer, auto endian, auto style) {
|
||||||
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||||
auto value = hex::format(format, *reinterpret_cast<s8*>(buffer.data()));
|
auto value = hex::format(format, *reinterpret_cast<s8*>(buffer.data()));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u16"_lang, sizeof(u16), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u16", sizeof(u16), [](auto buffer, auto endian, auto style) {
|
||||||
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u16*>(buffer.data()), endian));
|
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u16*>(buffer.data()), endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s16"_lang, sizeof(s16), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s16", sizeof(s16), [](auto buffer, auto endian, auto style) {
|
||||||
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s16*>(buffer.data()), endian));
|
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s16*>(buffer.data()), endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u32"_lang, sizeof(u32), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u32", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||||
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
auto format = (style == Style::Decimal) ? "%u" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u32*>(buffer.data()), endian));
|
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u32*>(buffer.data()), endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s32"_lang, sizeof(s32), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s32", sizeof(s32), [](auto buffer, auto endian, auto style) {
|
||||||
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
auto format = (style == Style::Decimal) ? "%d" : ((style == Style::Hexadecimal) ? "0x%X" : "0o%o");
|
||||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s32*>(buffer.data()), endian));
|
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s32*>(buffer.data()), endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u64"_lang, sizeof(u64), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.u64", sizeof(u64), [](auto buffer, auto endian, auto style) {
|
||||||
auto format = (style == Style::Decimal) ? "%llu" : ((style == Style::Hexadecimal) ? "0x%llX" : "0o%llo");
|
auto format = (style == Style::Decimal) ? "%llu" : ((style == Style::Hexadecimal) ? "0x%llX" : "0o%llo");
|
||||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u64*>(buffer.data()), endian));
|
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<u64*>(buffer.data()), endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s64"_lang, sizeof(s64), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.s64", sizeof(s64), [](auto buffer, auto endian, auto style) {
|
||||||
auto format = (style == Style::Decimal) ? "%lld" : ((style == Style::Hexadecimal) ? "0x%llX" : "0o%llo");
|
auto format = (style == Style::Decimal) ? "%lld" : ((style == Style::Hexadecimal) ? "0x%llX" : "0o%llo");
|
||||||
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s64*>(buffer.data()), endian));
|
auto value = hex::format(format, hex::changeEndianess(*reinterpret_cast<s64*>(buffer.data()), endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.float"_lang, sizeof(float), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.float", sizeof(float), [](auto buffer, auto endian, auto style) {
|
||||||
auto value = hex::format("%e", hex::changeEndianess(*reinterpret_cast<float*>(buffer.data()), endian));
|
auto value = hex::format("%e", hex::changeEndianess(*reinterpret_cast<float*>(buffer.data()), endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.double"_lang, sizeof(double), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.double", sizeof(double), [](auto buffer, auto endian, auto style) {
|
||||||
auto value = hex::format("%e", hex::changeEndianess(*reinterpret_cast<double*>(buffer.data()), endian));
|
auto value = hex::format("%e", hex::changeEndianess(*reinterpret_cast<double*>(buffer.data()), endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.ascii"_lang, sizeof(char8_t), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.ascii", sizeof(char8_t), [](auto buffer, auto endian, auto style) {
|
||||||
auto value = hex::format("'%s'", makePrintable(*reinterpret_cast<char8_t*>(buffer.data())).c_str());
|
auto value = hex::format("'%s'", makePrintable(*reinterpret_cast<char8_t*>(buffer.data())).c_str());
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.wide"_lang, sizeof(char16_t), [](auto buffer, auto endian, auto style) {
|
hex::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 c = *reinterpret_cast<char16_t*>(buffer.data());
|
||||||
auto value = hex::format("'%lc'", c == 0 ? '\x01' : hex::changeEndianess(c, endian));
|
auto value = hex::format("'%lc'", c == 0 ? '\x01' : hex::changeEndianess(c, endian));
|
||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.utf8"_lang, sizeof(char8_t) * 4, [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.utf8", sizeof(char8_t) * 4, [](auto buffer, auto endian, auto style) {
|
||||||
char utf8Buffer[5] = { 0 };
|
char utf8Buffer[5] = { 0 };
|
||||||
char codepointString[5] = { 0 };
|
char codepointString[5] = { 0 };
|
||||||
u32 codepoint = 0;
|
u32 codepoint = 0;
|
||||||
@ -116,7 +116,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
#if defined(OS_WINDOWS) && defined(ARCH_64_BIT)
|
#if defined(OS_WINDOWS) && defined(ARCH_64_BIT)
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time32"_lang, sizeof(__time32_t), [](auto buffer, auto endian, auto style) {
|
hex::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);
|
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<__time32_t*>(buffer.data()), endian);
|
||||||
std::tm * ptm = _localtime32(&endianAdjustedTime);
|
std::tm * ptm = _localtime32(&endianAdjustedTime);
|
||||||
char timeBuffer[32];
|
char timeBuffer[32];
|
||||||
@ -129,7 +129,7 @@ namespace hex::plugin::builtin {
|
|||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time64"_lang, sizeof(__time64_t), [](auto buffer, auto endian, auto style) {
|
hex::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);
|
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<__time64_t*>(buffer.data()), endian);
|
||||||
std::tm * ptm = _localtime64(&endianAdjustedTime);
|
std::tm * ptm = _localtime64(&endianAdjustedTime);
|
||||||
char timeBuffer[64];
|
char timeBuffer[64];
|
||||||
@ -144,7 +144,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.time"_lang, sizeof(time_t), [](auto buffer, auto endian, auto style) {
|
hex::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);
|
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<time_t*>(buffer.data()), endian);
|
||||||
std::tm * ptm = localtime(&endianAdjustedTime);
|
std::tm * ptm = localtime(&endianAdjustedTime);
|
||||||
char timeBuffer[64];
|
char timeBuffer[64];
|
||||||
@ -159,7 +159,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.guid"_lang, sizeof(GUID), [](auto buffer, auto endian, auto style) {
|
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.guid", sizeof(GUID), [](auto buffer, auto endian, auto style) {
|
||||||
GUID guid;
|
GUID guid;
|
||||||
std::memcpy(&guid, buffer.data(), sizeof(GUID));
|
std::memcpy(&guid, buffer.data(), sizeof(GUID));
|
||||||
auto value = hex::format("%s{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
|
auto value = hex::format("%s{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
|
||||||
@ -173,7 +173,7 @@ namespace hex::plugin::builtin {
|
|||||||
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
return [value] { ImGui::TextUnformatted(value.c_str()); };
|
||||||
});
|
});
|
||||||
|
|
||||||
hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.rgba8"_lang, sizeof(u32), [](auto buffer, auto endian, auto style) {
|
hex::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));
|
ImColor value(hex::changeEndianess(*reinterpret_cast<u32*>(buffer.data()), endian));
|
||||||
|
|
||||||
return [value] {
|
return [value] {
|
||||||
|
@ -8,8 +8,8 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeNullptr : public dp::Node {
|
class NodeNullptr : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeNullptr() : Node("hex.builtin.nodes.constants.nullptr.header"_lang, {
|
NodeNullptr() : Node("hex.builtin.nodes.constants.nullptr.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.constants.nullptr.output"_lang)
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.constants.nullptr.output")
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
@ -19,8 +19,8 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeBuffer : public dp::Node {
|
class NodeBuffer : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeBuffer() : Node("hex.builtin.nodes.constants.buffer.header"_lang, {
|
NodeBuffer() : Node("hex.builtin.nodes.constants.buffer.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.constants.buffer.output"_lang)
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.constants.buffer.output")
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
void drawNode() override {
|
void drawNode() override {
|
||||||
@ -45,8 +45,8 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeString : public dp::Node {
|
class NodeString : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeString() : Node("hex.builtin.nodes.constants.string.header"_lang, {
|
NodeString() : Node("hex.builtin.nodes.constants.string.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.constants.string.output"_lang)
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.constants.string.output")
|
||||||
}) {
|
}) {
|
||||||
this->m_value.resize(0xFFF, 0x00);
|
this->m_value.resize(0xFFF, 0x00);
|
||||||
}
|
}
|
||||||
@ -72,8 +72,8 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeInteger : public dp::Node {
|
class NodeInteger : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeInteger() : Node("hex.builtin.nodes.constants.int.header"_lang, {
|
NodeInteger() : Node("hex.builtin.nodes.constants.int.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.int.output"_lang)
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.int.output")
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
void drawNode() override {
|
void drawNode() override {
|
||||||
@ -96,8 +96,8 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeFloat : public dp::Node {
|
class NodeFloat : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeFloat() : Node("hex.builtin.nodes.constants.float.header"_lang, {
|
NodeFloat() : Node("hex.builtin.nodes.constants.float.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Float, "hex.builtin.nodes.constants.float.output"_lang)
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Float, "hex.builtin.nodes.constants.float.output")
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
void drawNode() override {
|
void drawNode() override {
|
||||||
@ -120,11 +120,11 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeRGBA8 : public dp::Node {
|
class NodeRGBA8 : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeRGBA8() : Node("hex.builtin.nodes.constants.rgba8.header"_lang,
|
NodeRGBA8() : Node("hex.builtin.nodes.constants.rgba8.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.rgba8.output.r"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.rgba8.output.r"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.rgba8.output.g"_lang),
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.rgba8.output.g"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.rgba8.output.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.rgba8.output.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.rgba8.output.a"_lang)}) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.constants.rgba8.output.a")}) {}
|
||||||
|
|
||||||
void drawNode() override {
|
void drawNode() override {
|
||||||
ImGui::PushItemWidth(200);
|
ImGui::PushItemWidth(200);
|
||||||
@ -146,7 +146,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeComment : public dp::Node {
|
class NodeComment : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeComment() : Node("hex.builtin.nodes.constants.comment.header"_lang, { }) {
|
NodeComment() : Node("hex.builtin.nodes.constants.comment.header", { }) {
|
||||||
this->m_comment.resize(0xFFF, 0x00);
|
this->m_comment.resize(0xFFF, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +165,8 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeDisplayInteger : public dp::Node {
|
class NodeDisplayInteger : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeDisplayInteger() : Node("hex.builtin.nodes.display.int.header"_lang, {
|
NodeDisplayInteger() : Node("hex.builtin.nodes.display.int.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.display.int.input"_lang)
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.display.int.input")
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
void drawNode() override {
|
void drawNode() override {
|
||||||
@ -191,8 +191,8 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeDisplayFloat : public dp::Node {
|
class NodeDisplayFloat : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeDisplayFloat() : Node("hex.builtin.nodes.display.float.header"_lang, {
|
NodeDisplayFloat() : Node("hex.builtin.nodes.display.float.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Float, "hex.builtin.nodes.display.float.input"_lang)
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Float, "hex.builtin.nodes.display.float.input")
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
void drawNode() override {
|
void drawNode() override {
|
||||||
@ -218,9 +218,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeBitwiseNOT : public dp::Node {
|
class NodeBitwiseNOT : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeBitwiseNOT() : Node("hex.builtin.nodes.bitwise.not.header"_lang, {
|
NodeBitwiseNOT() : Node("hex.builtin.nodes.bitwise.not.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.not.input"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.not.input"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.not.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.not.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto input = this->getBufferOnInput(0);
|
auto input = this->getBufferOnInput(0);
|
||||||
@ -235,10 +235,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeBitwiseAND : public dp::Node {
|
class NodeBitwiseAND : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeBitwiseAND() : Node("hex.builtin.nodes.bitwise.and.header"_lang, {
|
NodeBitwiseAND() : Node("hex.builtin.nodes.bitwise.and.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.and.input.a"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.and.input.a"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.and.input.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.and.input.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.and.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.and.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto inputA = this->getBufferOnInput(0);
|
auto inputA = this->getBufferOnInput(0);
|
||||||
@ -255,10 +255,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeBitwiseOR : public dp::Node {
|
class NodeBitwiseOR : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeBitwiseOR() : Node("hex.builtin.nodes.bitwise.or.header"_lang, {
|
NodeBitwiseOR() : Node("hex.builtin.nodes.bitwise.or.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.or.input.a"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.or.input.a"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.or.input.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.or.input.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.or.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.or.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto inputA = this->getBufferOnInput(0);
|
auto inputA = this->getBufferOnInput(0);
|
||||||
@ -275,10 +275,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeBitwiseXOR : public dp::Node {
|
class NodeBitwiseXOR : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeBitwiseXOR() : Node("hex.builtin.nodes.bitwise.xor.header"_lang, {
|
NodeBitwiseXOR() : Node("hex.builtin.nodes.bitwise.xor.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.xor.input.a"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.xor.input.a"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.xor.input.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.xor.input.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.xor.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.bitwise.xor.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto inputA = this->getBufferOnInput(0);
|
auto inputA = this->getBufferOnInput(0);
|
||||||
@ -295,10 +295,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeReadData : public dp::Node {
|
class NodeReadData : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeReadData() : Node("hex.builtin.nodes.data_access.read.header"_lang, {
|
NodeReadData() : Node("hex.builtin.nodes.data_access.read.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.read.address"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.read.address"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.read.size"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.read.size"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.data_access.read.data"_lang)
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.data_access.read.data")
|
||||||
}) { }
|
}) { }
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
@ -316,9 +316,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeWriteData : public dp::Node {
|
class NodeWriteData : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeWriteData() : Node("hex.builtin.nodes.data_access.write.header"_lang, {
|
NodeWriteData() : Node("hex.builtin.nodes.data_access.write.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.write.address"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.write.address"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.data_access.write.data"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.data_access.write.data") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto address = this->getIntegerOnInput(0);
|
auto address = this->getIntegerOnInput(0);
|
||||||
@ -330,9 +330,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeCastIntegerToBuffer : public dp::Node {
|
class NodeCastIntegerToBuffer : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeCastIntegerToBuffer() : Node("hex.builtin.nodes.casting.int_to_buffer.header"_lang, {
|
NodeCastIntegerToBuffer() : Node("hex.builtin.nodes.casting.int_to_buffer.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.casting.int_to_buffer.input"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.casting.int_to_buffer.input"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.casting.int_to_buffer.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.casting.int_to_buffer.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto input = this->getIntegerOnInput(0);
|
auto input = this->getIntegerOnInput(0);
|
||||||
@ -346,9 +346,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeCastBufferToInteger : public dp::Node {
|
class NodeCastBufferToInteger : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeCastBufferToInteger() : Node("hex.builtin.nodes.casting.buffer_to_int.header"_lang, {
|
NodeCastBufferToInteger() : Node("hex.builtin.nodes.casting.buffer_to_int.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.casting.buffer_to_int.input"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.casting.buffer_to_int.input"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.casting.buffer_to_int.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.casting.buffer_to_int.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto input = this->getBufferOnInput(0);
|
auto input = this->getBufferOnInput(0);
|
||||||
@ -362,11 +362,11 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeIf : public dp::Node {
|
class NodeIf : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeIf() : Node("ex.builtin.nodes.control_flow.if.header"_lang,
|
NodeIf() : Node("ex.builtin.nodes.control_flow.if.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.if.condition"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.if.condition"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.control_flow.if.true"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.control_flow.if.true"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.control_flow.if.false"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.control_flow.if.false"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.control_flow.if.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.control_flow.if.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto cond = this->getIntegerOnInput(0);
|
auto cond = this->getIntegerOnInput(0);
|
||||||
@ -383,10 +383,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeEquals : public dp::Node {
|
class NodeEquals : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeEquals() : Node("hex.builtin.nodes.control_flow.equals.header"_lang,
|
NodeEquals() : Node("hex.builtin.nodes.control_flow.equals.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.equals.input.a"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.equals.input.a"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.equals.input.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.equals.input.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.equals.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.equals.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto inputA = this->getIntegerOnInput(0);
|
auto inputA = this->getIntegerOnInput(0);
|
||||||
@ -398,9 +398,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeNot : public dp::Node {
|
class NodeNot : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeNot() : Node("hex.builtin.nodes.control_flow.not.header"_lang,
|
NodeNot() : Node("hex.builtin.nodes.control_flow.not.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.not.input"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.not.input"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.not.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.not.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto input = this->getIntegerOnInput(0);
|
auto input = this->getIntegerOnInput(0);
|
||||||
@ -411,10 +411,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeGreaterThan : public dp::Node {
|
class NodeGreaterThan : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeGreaterThan() : Node("hex.builtin.nodes.control_flow.gt.header"_lang,
|
NodeGreaterThan() : Node("hex.builtin.nodes.control_flow.gt.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.gt.input.a"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.gt.input.a"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.gt.input.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.gt.input.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.gt.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.gt.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto inputA = this->getIntegerOnInput(0);
|
auto inputA = this->getIntegerOnInput(0);
|
||||||
@ -426,10 +426,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeLessThan : public dp::Node {
|
class NodeLessThan : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeLessThan() : Node("hex.builtin.nodes.control_flow.lt.header"_lang,
|
NodeLessThan() : Node("hex.builtin.nodes.control_flow.lt.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.lt.input.a"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.lt.input.a"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.lt.input.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.lt.input.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.lt.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.lt.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto inputA = this->getIntegerOnInput(0);
|
auto inputA = this->getIntegerOnInput(0);
|
||||||
@ -441,10 +441,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeBoolAND : public dp::Node {
|
class NodeBoolAND : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeBoolAND() : Node("hex.builtin.nodes.control_flow.and.header"_lang,
|
NodeBoolAND() : Node("hex.builtin.nodes.control_flow.and.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.and.input.a"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.and.input.a"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.and.input.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.and.input.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.and.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.and.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto inputA = this->getIntegerOnInput(0);
|
auto inputA = this->getIntegerOnInput(0);
|
||||||
@ -456,10 +456,10 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeBoolOR : public dp::Node {
|
class NodeBoolOR : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeBoolOR() : Node("hex.builtin.nodes.control_flow.or.header"_lang,
|
NodeBoolOR() : Node("hex.builtin.nodes.control_flow.or.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.or.input.a"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.or.input.a"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.or.input.b"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.or.input.b"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.or.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.control_flow.or.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto inputA = this->getIntegerOnInput(0);
|
auto inputA = this->getIntegerOnInput(0);
|
||||||
@ -471,12 +471,12 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeCryptoAESDecrypt : public dp::Node {
|
class NodeCryptoAESDecrypt : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeCryptoAESDecrypt() : Node("hex.builtin.nodes.crypto.aes.header"_lang,
|
NodeCryptoAESDecrypt() : Node("hex.builtin.nodes.crypto.aes.header",
|
||||||
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.key"_lang),
|
{ dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.key"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.iv"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.iv"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.nonce"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.nonce"),
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.input"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.input"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.output") }) {}
|
||||||
|
|
||||||
void drawNode() override {
|
void drawNode() override {
|
||||||
ImGui::PushItemWidth(100);
|
ImGui::PushItemWidth(100);
|
||||||
@ -514,9 +514,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeDecodingBase64 : public dp::Node {
|
class NodeDecodingBase64 : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeDecodingBase64() : Node("hex.builtin.nodes.decoding.base64.header"_lang, {
|
NodeDecodingBase64() : Node("hex.builtin.nodes.decoding.base64.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.decoding.base64.input"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.decoding.base64.input"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.decoding.base64.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.decoding.base64.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto input = this->getBufferOnInput(0);
|
auto input = this->getBufferOnInput(0);
|
||||||
@ -529,9 +529,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
class NodeDecodingHex : public dp::Node {
|
class NodeDecodingHex : public dp::Node {
|
||||||
public:
|
public:
|
||||||
NodeDecodingHex() : Node("hex.builtin.nodes.decoding.hex.header"_lang, {
|
NodeDecodingHex() : Node("hex.builtin.nodes.decoding.hex.header", {
|
||||||
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.decoding.hex.input"_lang),
|
dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.decoding.hex.input"),
|
||||||
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.decoding.hex.output"_lang) }) {}
|
dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.decoding.hex.output") }) {}
|
||||||
|
|
||||||
void process() override {
|
void process() override {
|
||||||
auto input = this->getBufferOnInput(0);
|
auto input = this->getBufferOnInput(0);
|
||||||
@ -566,40 +566,40 @@ namespace hex::plugin::builtin {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void registerDataProcessorNodes() {
|
void registerDataProcessorNodes() {
|
||||||
ContentRegistry::DataProcessorNode::add<NodeInteger>("hex.builtin.nodes.constants"_lang, "hex.builtin.nodes.constants.int"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeInteger>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.int");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeFloat>("hex.builtin.nodes.constants"_lang, "hex.builtin.nodes.constants.float"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeFloat>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.float");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeNullptr>("hex.builtin.nodes.constants"_lang, "hex.builtin.nodes.constants.nullptr"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeNullptr>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.nullptr");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeBuffer>("hex.builtin.nodes.constants"_lang, "hex.builtin.nodes.constants.buffer"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeBuffer>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.buffer");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeString>("hex.builtin.nodes.constants"_lang, "hex.builtin.nodes.constants.string"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeString>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.string");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeRGBA8>("hex.builtin.nodes.constants"_lang, "hex.builtin.nodes.constants.rgba8"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeRGBA8>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.rgba8");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeComment>("hex.builtin.nodes.constants"_lang, "hex.builtin.nodes.constants.comment"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeComment>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.comment");
|
||||||
|
|
||||||
ContentRegistry::DataProcessorNode::add<NodeDisplayInteger>("hex.builtin.nodes.display"_lang, "hex.builtin.nodes.display.int"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeDisplayInteger>("hex.builtin.nodes.display", "hex.builtin.nodes.display.int");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeDisplayFloat>("hex.builtin.nodes.display"_lang, "hex.builtin.nodes.display.float"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeDisplayFloat>("hex.builtin.nodes.display", "hex.builtin.nodes.display.float");
|
||||||
|
|
||||||
ContentRegistry::DataProcessorNode::add<NodeReadData>("hex.builtin.nodes.data_access"_lang, "hex.builtin.nodes.data_access.read"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeReadData>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.read");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeWriteData>("hex.builtin.nodes.data_access"_lang, "hex.builtin.nodes.data_access.write"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeWriteData>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.write");
|
||||||
|
|
||||||
ContentRegistry::DataProcessorNode::add<NodeCastIntegerToBuffer>("hex.builtin.nodes.casting"_lang, "hex.builtin.nodes.casting.int_to_buffer"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeCastIntegerToBuffer>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.int_to_buffer");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeCastBufferToInteger>("hex.builtin.nodes.casting"_lang, "hex.builtin.nodes.casting.buffer_to_int"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeCastBufferToInteger>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.buffer_to_int");
|
||||||
|
|
||||||
ContentRegistry::DataProcessorNode::add<NodeIf>("hex.builtin.nodes.control_flow"_lang, "hex.builtin.nodes.control_flow.if"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeIf>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.if");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeEquals>("hex.builtin.nodes.control_flow"_lang, "hex.builtin.nodes.control_flow.equals"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeEquals>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.equals");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeNot>("hex.builtin.nodes.control_flow"_lang, "hex.builtin.nodes.control_flow.not"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeNot>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.not");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeGreaterThan>("hex.builtin.nodes.control_flow"_lang, "hex.builtin.nodes.control_flow.gt"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeGreaterThan>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.gt");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeLessThan>("hex.builtin.nodes.control_flow"_lang, "hex.builtin.nodes.control_flow.lt"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeLessThan>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.lt");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeBoolAND>("hex.builtin.nodes.control_flow"_lang, "hex.builtin.nodes.control_flow.and"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeBoolAND>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.and");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeBoolOR>("hex.builtin.nodes.control_flow"_lang, "hex.builtin.nodes.control_flow.or"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeBoolOR>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.or");
|
||||||
|
|
||||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseAND>("hex.builtin.nodes.bitwise"_lang, "hex.builtin.nodes.bitwise.and"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeBitwiseAND>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.and");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseOR>("hex.builtin.nodes.bitwise"_lang, "hex.builtin.nodes.bitwise.or"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeBitwiseOR>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.or");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseXOR>("hex.builtin.nodes.bitwise"_lang, "hex.builtin.nodes.bitwise.xor"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeBitwiseXOR>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.xor");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseNOT>("hex.builtin.nodes.bitwise"_lang, "hex.builtin.nodes.bitwise.not"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeBitwiseNOT>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.not");
|
||||||
|
|
||||||
ContentRegistry::DataProcessorNode::add<NodeDecodingBase64>("hex.builtin.nodes.decoding"_lang, "hex.builtin.nodes.decoding.base64"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeDecodingBase64>("hex.builtin.nodes.decoding", "hex.builtin.nodes.decoding.base64");
|
||||||
ContentRegistry::DataProcessorNode::add<NodeDecodingHex>("hex.builtin.nodes.decoding"_lang, "hex.builtin.nodes.decoding.hex"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeDecodingHex>("hex.builtin.nodes.decoding", "hex.builtin.nodes.decoding.hex");
|
||||||
|
|
||||||
ContentRegistry::DataProcessorNode::add<NodeCryptoAESDecrypt>("hex.builtin.nodes.crypto"_lang, "hex.builtin.nodes.crypto.aes"_lang);
|
ContentRegistry::DataProcessorNode::add<NodeCryptoAESDecrypt>("hex.builtin.nodes.crypto", "hex.builtin.nodes.crypto.aes");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,9 +4,16 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
void registerSettings() {
|
void registerSettings() {
|
||||||
|
|
||||||
ContentRegistry::Settings::add("Interface", "Color theme", 0, [](nlohmann::json &setting) {
|
ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.color", 0, [](auto name, nlohmann::json &setting) {
|
||||||
static int selection = setting;
|
static int selection = setting;
|
||||||
if (ImGui::Combo("Color theme", &selection, "Dark\0Light\0Classic\0")) {
|
|
||||||
|
const char* themes[] = {
|
||||||
|
"hex.builtin.setting.interface.color.dark"_lang,
|
||||||
|
"hex.builtin.setting.interface.color.light"_lang,
|
||||||
|
"hex.builtin.setting.interface.color.classic"_lang
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ImGui::Combo(name.data(), &selection, themes, IM_ARRAYSIZE(themes))) {
|
||||||
setting = selection;
|
setting = selection;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -14,7 +21,7 @@ namespace hex::plugin::builtin {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
ContentRegistry::Settings::add("Interface", "Language", "en-US", [](nlohmann::json &setting) {
|
ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.language", "en-US", [](auto name, nlohmann::json &setting) {
|
||||||
auto &languages = LangEntry::getSupportedLanguages();
|
auto &languages = LangEntry::getSupportedLanguages();
|
||||||
|
|
||||||
static int selection = [&]() -> int {
|
static int selection = [&]() -> int {
|
||||||
@ -37,7 +44,7 @@ namespace hex::plugin::builtin {
|
|||||||
}();
|
}();
|
||||||
|
|
||||||
|
|
||||||
if (ImGui::Combo("Language", &selection, languageNames.data(), languageNames.size())) {
|
if (ImGui::Combo(name.data(), &selection, languageNames.data(), languageNames.size())) {
|
||||||
|
|
||||||
u16 index = 0;
|
u16 index = 0;
|
||||||
for (auto &[languageCode, languageName] : languages){
|
for (auto &[languageCode, languageName] : languages){
|
||||||
|
@ -341,12 +341,12 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void registerToolEntries() {
|
void registerToolEntries() {
|
||||||
ContentRegistry::Tools::add("hex.builtin.tools.demangler"_lang, drawDemangler);
|
ContentRegistry::Tools::add("hex.builtin.tools.demangler", drawDemangler);
|
||||||
ContentRegistry::Tools::add("hex.builtin.tools.ascii_table"_lang, drawASCIITable);
|
ContentRegistry::Tools::add("hex.builtin.tools.ascii_table", drawASCIITable);
|
||||||
ContentRegistry::Tools::add("hex.builtin.tools.regex_replacer"_lang, drawRegexReplacer);
|
ContentRegistry::Tools::add("hex.builtin.tools.regex_replacer", drawRegexReplacer);
|
||||||
ContentRegistry::Tools::add("hex.builtin.tools.color"_lang, drawColorPicker);
|
ContentRegistry::Tools::add("hex.builtin.tools.color", drawColorPicker);
|
||||||
ContentRegistry::Tools::add("hex.builtin.tools.calc"_lang, drawMathEvaluator);
|
ContentRegistry::Tools::add("hex.builtin.tools.calc", drawMathEvaluator);
|
||||||
ContentRegistry::Tools::add("hex.builtin.tools.base_converter"_lang, drawBaseConverter);
|
ContentRegistry::Tools::add("hex.builtin.tools.base_converter", drawBaseConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -425,6 +425,14 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.tools.base_converter.oct", "OCT" },
|
{ "hex.builtin.tools.base_converter.oct", "OCT" },
|
||||||
{ "hex.builtin.tools.base_converter.bin", "BIN" },
|
{ "hex.builtin.tools.base_converter.bin", "BIN" },
|
||||||
|
|
||||||
|
{ "hex.builtin.setting.imhex", "ImHex" },
|
||||||
|
{ "hex.builtin.setting.imhex.recent_files", "Recent Files" },
|
||||||
|
{ "hex.builtin.setting.interface", "Interface" },
|
||||||
|
{ "hex.builtin.setting.interface.color", "Color theme" },
|
||||||
|
{ "hex.builtin.setting.interface.color.dark", "Dark" },
|
||||||
|
{ "hex.builtin.setting.interface.color.light", "Light" },
|
||||||
|
{ "hex.builtin.setting.interface.color.classic", "Classic" },
|
||||||
|
{ "hex.builtin.setting.interface.language", "Language" }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
|
||||||
void registerLanguageEnUS();
|
|
||||||
|
|
||||||
void registerDataInspectorEntries();
|
void registerDataInspectorEntries();
|
||||||
void registerToolEntries();
|
void registerToolEntries();
|
||||||
void registerPatternLanguageFunctions();
|
void registerPatternLanguageFunctions();
|
||||||
@ -11,20 +9,22 @@ namespace hex::plugin::builtin {
|
|||||||
void registerSettings();
|
void registerSettings();
|
||||||
void registerDataProcessorNodes();
|
void registerDataProcessorNodes();
|
||||||
|
|
||||||
|
void registerLanguageEnUS();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IMHEX_PLUGIN_SETUP {
|
IMHEX_PLUGIN_SETUP {
|
||||||
|
|
||||||
using namespace hex::plugin::builtin;
|
using namespace hex::plugin::builtin;
|
||||||
|
|
||||||
registerLanguageEnUS();
|
|
||||||
|
|
||||||
registerDataInspectorEntries();
|
registerDataInspectorEntries();
|
||||||
registerToolEntries();
|
registerToolEntries();
|
||||||
registerPatternLanguageFunctions();
|
registerPatternLanguageFunctions();
|
||||||
registerCommandPaletteCommands();
|
registerCommandPaletteCommands();
|
||||||
registerSettings();
|
registerSettings();
|
||||||
registerDataProcessorNodes();
|
registerDataProcessorNodes();
|
||||||
|
|
||||||
|
registerLanguageEnUS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,22 +33,22 @@ namespace hex {
|
|||||||
|
|
||||||
struct Entry {
|
struct Entry {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::function<bool(nlohmann::json&)> callback;
|
std::function<bool(std::string_view, nlohmann::json&)> callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void load();
|
static void load();
|
||||||
static void store();
|
static void store();
|
||||||
|
|
||||||
static void add(std::string_view category, std::string_view name, s64 defaultValue, const std::function<bool(nlohmann::json&)> &callback);
|
static void add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 defaultValue, const std::function<bool(std::string_view, nlohmann::json&)> &callback);
|
||||||
static void add(std::string_view category, std::string_view name, std::string_view defaultValue, const std::function<bool(nlohmann::json&)> &callback);
|
static void add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, std::string_view defaultValue, const std::function<bool(std::string_view, nlohmann::json&)> &callback);
|
||||||
|
|
||||||
static void write(std::string_view category, std::string_view name, s64 value);
|
static void write(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 value);
|
||||||
static void write(std::string_view category, std::string_view name, std::string_view value);
|
static void write(std::string_view unlocalizedCategory, std::string_view unlocalizedName, std::string_view value);
|
||||||
static void write(std::string_view category, std::string_view name, const std::vector<std::string>& value);
|
static void write(std::string_view unlocalizedCategory, std::string_view unlocalizedName, const std::vector<std::string>& value);
|
||||||
|
|
||||||
static s64 read(std::string_view category, std::string_view name, s64 defaultValue);
|
static s64 read(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 defaultValue);
|
||||||
static std::string read(std::string_view category, std::string_view name, std::string_view defaultValue);
|
static std::string read(std::string_view unlocalizedCategory, std::string_view unlocalizedName, std::string_view defaultValue);
|
||||||
static std::vector<std::string> read(std::string_view category, std::string_view name, const std::vector<std::string>& defaultValue = { });
|
static std::vector<std::string> read(std::string_view unlocalizedCategory, std::string_view unlocalizedName, const std::vector<std::string>& defaultValue = { });
|
||||||
|
|
||||||
static std::map<std::string, std::vector<Entry>>& getEntries();
|
static std::map<std::string, std::vector<Entry>>& getEntries();
|
||||||
static nlohmann::json& getSettingsData();
|
static nlohmann::json& getSettingsData();
|
||||||
@ -73,12 +73,12 @@ namespace hex {
|
|||||||
struct Entry {
|
struct Entry {
|
||||||
Type type;
|
Type type;
|
||||||
std::string command;
|
std::string command;
|
||||||
std::string description;
|
std::string unlocalizedDescription;
|
||||||
std::function<std::string(std::string)> displayCallback;
|
std::function<std::string(std::string)> displayCallback;
|
||||||
std::function<void(std::string)> executeCallback;
|
std::function<void(std::string)> executeCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void add(Type type, std::string_view command, std::string_view description, const std::function<std::string(std::string)> &displayCallback, const std::function<void(std::string)> &executeCallback = [](auto){});
|
static void add(Type type, std::string_view command, std::string_view unlocalizedDescription, const std::function<std::string(std::string)> &displayCallback, const std::function<void(std::string)> &executeCallback = [](auto){});
|
||||||
static std::vector<Entry>& getEntries();
|
static std::vector<Entry>& getEntries();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ namespace hex {
|
|||||||
std::function<void()> function;
|
std::function<void()> function;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void add(std::string_view name, const std::function<void()> &function);
|
static void add(std::string_view unlocalizedName, const std::function<void()> &function);
|
||||||
|
|
||||||
static std::vector<Entry>& getEntries();
|
static std::vector<Entry>& getEntries();
|
||||||
};
|
};
|
||||||
@ -145,12 +145,12 @@ namespace hex {
|
|||||||
using GeneratorFunction = std::function<DisplayFunction(const std::vector<u8>&, std::endian, NumberDisplayStyle)>;
|
using GeneratorFunction = std::function<DisplayFunction(const std::vector<u8>&, std::endian, NumberDisplayStyle)>;
|
||||||
|
|
||||||
struct Entry {
|
struct Entry {
|
||||||
std::string name;
|
std::string unlocalizedName;
|
||||||
size_t requiredSize;
|
size_t requiredSize;
|
||||||
GeneratorFunction generatorFunction;
|
GeneratorFunction generatorFunction;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void add(std::string_view name, size_t requiredSize, GeneratorFunction function);
|
static void add(std::string_view unlocalizedName, size_t requiredSize, GeneratorFunction function);
|
||||||
|
|
||||||
static std::vector<Entry>& getEntries();
|
static std::vector<Entry>& getEntries();
|
||||||
};
|
};
|
||||||
@ -164,8 +164,8 @@ namespace hex {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<hex::derived_from<dp::Node> T, typename ... Args>
|
template<hex::derived_from<dp::Node> T, typename ... Args>
|
||||||
static void add(std::string_view category, std::string_view name, Args&& ... args) {
|
static void add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, Args&& ... args) {
|
||||||
add(Entry{ category.data(), name.data(), [args...]{ return new T(std::forward<Args>(args)...); } });
|
add(Entry{ unlocalizedCategory.data(), unlocalizedName.data(), [args...]{ return new T(std::forward<Args>(args)...); } });
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addSeparator();
|
static void addSeparator();
|
||||||
|
@ -16,7 +16,7 @@ namespace hex::dp {
|
|||||||
In, Out
|
In, Out
|
||||||
};
|
};
|
||||||
|
|
||||||
Attribute(IOType ioType, Type type, std::string_view name) : m_id(SharedData::dataProcessorNodeIdCounter++), m_ioType(ioType), m_type(type), m_name(name) {
|
Attribute(IOType ioType, Type type, std::string_view unlocalizedName) : m_id(SharedData::dataProcessorNodeIdCounter++), m_ioType(ioType), m_type(type), m_unlocalizedName(unlocalizedName) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ namespace hex::dp {
|
|||||||
[[nodiscard]] u32 getID() const { return this->m_id; }
|
[[nodiscard]] u32 getID() const { return this->m_id; }
|
||||||
[[nodiscard]] IOType getIOType() const { return this->m_ioType; }
|
[[nodiscard]] IOType getIOType() const { return this->m_ioType; }
|
||||||
[[nodiscard]] Type getType() const { return this->m_type; }
|
[[nodiscard]] Type getType() const { return this->m_type; }
|
||||||
[[nodiscard]] std::string_view getName() const { return this->m_name; }
|
[[nodiscard]] std::string_view getUnlocalizedName() const { return this->m_unlocalizedName; }
|
||||||
|
|
||||||
void addConnectedAttribute(u32 linkId, Attribute *to) { this->m_connectedAttributes.insert({ linkId, to }); }
|
void addConnectedAttribute(u32 linkId, Attribute *to) { this->m_connectedAttributes.insert({ linkId, to }); }
|
||||||
void removeConnectedAttribute(u32 linkId) { this->m_connectedAttributes.erase(linkId); }
|
void removeConnectedAttribute(u32 linkId) { this->m_connectedAttributes.erase(linkId); }
|
||||||
@ -41,7 +41,7 @@ namespace hex::dp {
|
|||||||
u32 m_id;
|
u32 m_id;
|
||||||
IOType m_ioType;
|
IOType m_ioType;
|
||||||
Type m_type;
|
Type m_type;
|
||||||
std::string m_name;
|
std::string m_unlocalizedName;
|
||||||
std::map<u32, Attribute*> m_connectedAttributes;
|
std::map<u32, Attribute*> m_connectedAttributes;
|
||||||
Node *m_parentNode;
|
Node *m_parentNode;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ namespace hex::dp {
|
|||||||
|
|
||||||
class Node {
|
class Node {
|
||||||
public:
|
public:
|
||||||
Node(std::string_view title, std::vector<Attribute> attributes) : m_id(SharedData::dataProcessorNodeIdCounter++), m_title(title), m_attributes(std::move(attributes)) {
|
Node(std::string_view unlocalizedName, std::vector<Attribute> attributes) : m_id(SharedData::dataProcessorNodeIdCounter++), m_unlocalizedName(unlocalizedName), m_attributes(std::move(attributes)) {
|
||||||
for (auto &attr : this->m_attributes)
|
for (auto &attr : this->m_attributes)
|
||||||
attr.setParentNode(this);
|
attr.setParentNode(this);
|
||||||
}
|
}
|
||||||
@ -14,7 +14,7 @@ namespace hex::dp {
|
|||||||
virtual ~Node() = default;
|
virtual ~Node() = default;
|
||||||
|
|
||||||
[[nodiscard]] u32 getID() const { return this->m_id; }
|
[[nodiscard]] u32 getID() const { return this->m_id; }
|
||||||
[[nodiscard]] std::string_view getTitle() const { return this->m_title; }
|
[[nodiscard]] std::string_view getUnlocalizedName() const { return this->m_unlocalizedName; }
|
||||||
[[nodiscard]] std::vector<Attribute>& getAttributes() { return this->m_attributes; }
|
[[nodiscard]] std::vector<Attribute>& getAttributes() { return this->m_attributes; }
|
||||||
|
|
||||||
void setCurrentOverlay(prv::Overlay *overlay) {
|
void setCurrentOverlay(prv::Overlay *overlay) {
|
||||||
@ -33,7 +33,7 @@ namespace hex::dp {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
u32 m_id;
|
u32 m_id;
|
||||||
std::string m_title;
|
std::string m_unlocalizedName;
|
||||||
std::vector<Attribute> m_attributes;
|
std::vector<Attribute> m_attributes;
|
||||||
prv::Overlay *m_overlay = nullptr;
|
prv::Overlay *m_overlay = nullptr;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ namespace hex::dp {
|
|||||||
auto attribute = this->getConnectedInputAttribute(index);
|
auto attribute = this->getConnectedInputAttribute(index);
|
||||||
|
|
||||||
if (attribute == nullptr)
|
if (attribute == nullptr)
|
||||||
throwNodeError(hex::format("Nothing connected to input '%s'", this->m_attributes[index].getName().data()));
|
throwNodeError(hex::format("Nothing connected to input '%s'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||||
|
|
||||||
if (attribute->getType() != Attribute::Type::Buffer)
|
if (attribute->getType() != Attribute::Type::Buffer)
|
||||||
throwNodeError("Tried to read buffer from non-buffer attribute");
|
throwNodeError("Tried to read buffer from non-buffer attribute");
|
||||||
@ -78,7 +78,7 @@ namespace hex::dp {
|
|||||||
auto attribute = this->getConnectedInputAttribute(index);
|
auto attribute = this->getConnectedInputAttribute(index);
|
||||||
|
|
||||||
if (attribute == nullptr)
|
if (attribute == nullptr)
|
||||||
throwNodeError(hex::format("Nothing connected to input '%s'", this->m_attributes[index].getName().data()));
|
throwNodeError(hex::format("Nothing connected to input '%s'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||||
|
|
||||||
if (attribute->getType() != Attribute::Type::Integer)
|
if (attribute->getType() != Attribute::Type::Integer)
|
||||||
throwNodeError("Tried to read integer from non-integer attribute");
|
throwNodeError("Tried to read integer from non-integer attribute");
|
||||||
@ -100,7 +100,7 @@ namespace hex::dp {
|
|||||||
auto attribute = this->getConnectedInputAttribute(index);
|
auto attribute = this->getConnectedInputAttribute(index);
|
||||||
|
|
||||||
if (attribute == nullptr)
|
if (attribute == nullptr)
|
||||||
throwNodeError(hex::format("Nothing connected to input '%s'", this->m_attributes[index].getName().data()));
|
throwNodeError(hex::format("Nothing connected to input '%s'", static_cast<const char*>(LangEntry(this->m_attributes[index].getUnlocalizedName()))));
|
||||||
|
|
||||||
if (attribute->getType() != Attribute::Type::Float)
|
if (attribute->getType() != Attribute::Type::Float)
|
||||||
throwNodeError("Tried to read float from non-float attribute");
|
throwNodeError("Tried to read float from non-float attribute");
|
||||||
|
@ -19,13 +19,15 @@ namespace hex {
|
|||||||
|
|
||||||
class LangEntry {
|
class LangEntry {
|
||||||
public:
|
public:
|
||||||
LangEntry(const char *unlocalizedString);
|
explicit LangEntry(const char *unlocalizedString);
|
||||||
|
explicit LangEntry(const std::string &unlocalizedString);
|
||||||
|
explicit LangEntry(std::string_view unlocalizedString);
|
||||||
|
|
||||||
operator std::string() const;
|
operator std::string() const;
|
||||||
operator std::string_view() const;
|
operator std::string_view() const;
|
||||||
operator const char*() const;
|
operator const char*() const;
|
||||||
|
|
||||||
std::string_view get() const;
|
[[nodiscard]] std::string_view get() const;
|
||||||
|
|
||||||
static void loadLanguage(std::string_view language);
|
static void loadLanguage(std::string_view language);
|
||||||
static const std::map<std::string, std::string>& getSupportedLanguages();
|
static const std::map<std::string, std::string>& getSupportedLanguages();
|
||||||
|
@ -21,83 +21,91 @@ namespace hex {
|
|||||||
settingsFile << getSettingsData();
|
settingsFile << getSettingsData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentRegistry::Settings::add(std::string_view category, std::string_view name, s64 defaultValue, const std::function<bool(nlohmann::json&)> &callback) {
|
void ContentRegistry::Settings::add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 defaultValue, const std::function<bool(std::string_view, nlohmann::json&)> &callback) {
|
||||||
ContentRegistry::Settings::getEntries()[category.data()].emplace_back(Entry{ name.data(), callback });
|
ContentRegistry::Settings::getEntries()[unlocalizedCategory.data()].emplace_back(Entry{ unlocalizedName.data(), callback });
|
||||||
|
|
||||||
auto &json = getSettingsData();
|
auto &json = getSettingsData();
|
||||||
|
|
||||||
if (!json.contains(category.data()))
|
if (!json.contains(unlocalizedCategory.data()))
|
||||||
json[category.data()] = nlohmann::json::object();
|
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||||
if (!json[category.data()].contains(name.data()))
|
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||||
json[category.data()][name.data()] = defaultValue;
|
json[unlocalizedCategory.data()][unlocalizedName.data()] = defaultValue;
|
||||||
|
|
||||||
|
Settings::store();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentRegistry::Settings::add(std::string_view category, std::string_view name, std::string_view defaultValue, const std::function<bool(nlohmann::json&)> &callback) {
|
void ContentRegistry::Settings::add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, std::string_view defaultValue, const std::function<bool(std::string_view, nlohmann::json&)> &callback) {
|
||||||
ContentRegistry::Settings::getEntries()[category.data()].emplace_back(Entry{ name.data(), callback });
|
ContentRegistry::Settings::getEntries()[unlocalizedCategory.data()].emplace_back(Entry{ unlocalizedName.data(), callback });
|
||||||
|
|
||||||
getSettingsData()[category.data()] = nlohmann::json::object();
|
|
||||||
getSettingsData()[category.data()][name.data()] = defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentRegistry::Settings::write(std::string_view category, std::string_view name, s64 value) {
|
|
||||||
auto &json = getSettingsData();
|
auto &json = getSettingsData();
|
||||||
|
|
||||||
if (!json.contains(category.data()))
|
if (!json.contains(unlocalizedCategory.data()))
|
||||||
json[category.data()] = nlohmann::json::object();
|
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||||
|
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||||
|
json[unlocalizedCategory.data()][unlocalizedName.data()] = defaultValue;
|
||||||
|
|
||||||
json[category.data()][name.data()] = value;
|
Settings::store();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentRegistry::Settings::write(std::string_view category, std::string_view name, std::string_view value) {
|
void ContentRegistry::Settings::write(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 value) {
|
||||||
auto &json = getSettingsData();
|
auto &json = getSettingsData();
|
||||||
|
|
||||||
if (!json.contains(category.data()))
|
if (!json.contains(unlocalizedCategory.data()))
|
||||||
json[category.data()] = nlohmann::json::object();
|
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||||
|
|
||||||
json[category.data()][name.data()] = value;
|
json[unlocalizedCategory.data()][unlocalizedName.data()] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentRegistry::Settings::write(std::string_view category, std::string_view name, const std::vector<std::string>& value) {
|
void ContentRegistry::Settings::write(std::string_view unlocalizedCategory, std::string_view unlocalizedName, std::string_view value) {
|
||||||
auto &json = getSettingsData();
|
auto &json = getSettingsData();
|
||||||
|
|
||||||
if (!json.contains(category.data()))
|
if (!json.contains(unlocalizedCategory.data()))
|
||||||
json[category.data()] = nlohmann::json::object();
|
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||||
|
|
||||||
json[category.data()][name.data()] = value;
|
json[unlocalizedCategory.data()][unlocalizedName.data()] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentRegistry::Settings::write(std::string_view unlocalizedCategory, std::string_view unlocalizedName, const std::vector<std::string>& value) {
|
||||||
|
auto &json = getSettingsData();
|
||||||
|
|
||||||
|
if (!json.contains(unlocalizedCategory.data()))
|
||||||
|
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||||
|
|
||||||
|
json[unlocalizedCategory.data()][unlocalizedName.data()] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s64 ContentRegistry::Settings::read(std::string_view category, std::string_view name, s64 defaultValue) {
|
s64 ContentRegistry::Settings::read(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 defaultValue) {
|
||||||
auto &json = getSettingsData();
|
auto &json = getSettingsData();
|
||||||
|
|
||||||
if (!json.contains(category.data()))
|
if (!json.contains(unlocalizedCategory.data()))
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
if (!json[category.data()].contains(name.data()))
|
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|
||||||
return json[category.data()][name.data()].get<s64>();
|
return json[unlocalizedCategory.data()][unlocalizedName.data()].get<s64>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ContentRegistry::Settings::read(std::string_view category, std::string_view name, std::string_view defaultValue) {
|
std::string ContentRegistry::Settings::read(std::string_view unlocalizedCategory, std::string_view unlocalizedName, std::string_view defaultValue) {
|
||||||
auto &json = getSettingsData();
|
auto &json = getSettingsData();
|
||||||
|
|
||||||
if (!json.contains(category.data()))
|
if (!json.contains(unlocalizedCategory.data()))
|
||||||
return defaultValue.data();
|
return defaultValue.data();
|
||||||
if (!json[category.data()].contains(name.data()))
|
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||||
return defaultValue.data();
|
return defaultValue.data();
|
||||||
|
|
||||||
return json[category.data()][name.data()].get<std::string>();
|
return json[unlocalizedCategory.data()][unlocalizedName.data()].get<std::string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> ContentRegistry::Settings::read(std::string_view category, std::string_view name, const std::vector<std::string>& defaultValue) {
|
std::vector<std::string> ContentRegistry::Settings::read(std::string_view unlocalizedCategory, std::string_view unlocalizedName, const std::vector<std::string>& defaultValue) {
|
||||||
auto &json = getSettingsData();
|
auto &json = getSettingsData();
|
||||||
|
|
||||||
if (!json.contains(category.data()))
|
if (!json.contains(unlocalizedCategory.data()))
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
if (!json[category.data()].contains(name.data()))
|
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|
||||||
return json[category.data()][name.data()].get<std::vector<std::string>>();
|
return json[unlocalizedCategory.data()][unlocalizedName.data()].get<std::vector<std::string>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,8 +135,8 @@ namespace hex {
|
|||||||
|
|
||||||
/* Command Palette Commands */
|
/* Command Palette Commands */
|
||||||
|
|
||||||
void ContentRegistry::CommandPaletteCommands::add(ContentRegistry::CommandPaletteCommands::Type type, std::string_view command, std::string_view description, const std::function<std::string(std::string)> &displayCallback, const std::function<void(std::string)> &executeCallback) {
|
void ContentRegistry::CommandPaletteCommands::add(ContentRegistry::CommandPaletteCommands::Type type, std::string_view command, std::string_view unlocalizedDescription, const std::function<std::string(std::string)> &displayCallback, const std::function<void(std::string)> &executeCallback) {
|
||||||
getEntries().push_back(ContentRegistry::CommandPaletteCommands::Entry{ type, command.data(), description.data(), displayCallback, executeCallback });
|
getEntries().push_back(ContentRegistry::CommandPaletteCommands::Entry{ type, command.data(), unlocalizedDescription.data(), displayCallback, executeCallback });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ContentRegistry::CommandPaletteCommands::Entry>& ContentRegistry::CommandPaletteCommands::getEntries() {
|
std::vector<ContentRegistry::CommandPaletteCommands::Entry>& ContentRegistry::CommandPaletteCommands::getEntries() {
|
||||||
@ -160,8 +168,8 @@ namespace hex {
|
|||||||
|
|
||||||
/* Tools */
|
/* Tools */
|
||||||
|
|
||||||
void ContentRegistry::Tools::add(std::string_view name, const std::function<void()> &function) {
|
void ContentRegistry::Tools:: add(std::string_view unlocalizedName, const std::function<void()> &function) {
|
||||||
getEntries().emplace_back(Entry{ name.data(), function });
|
getEntries().emplace_back(Entry{ unlocalizedName.data(), function });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ContentRegistry::Tools::Entry>& ContentRegistry::Tools::getEntries() {
|
std::vector<ContentRegistry::Tools::Entry>& ContentRegistry::Tools::getEntries() {
|
||||||
@ -171,8 +179,8 @@ namespace hex {
|
|||||||
|
|
||||||
/* Data Inspector */
|
/* Data Inspector */
|
||||||
|
|
||||||
void ContentRegistry::DataInspector::add(std::string_view name, size_t requiredSize, ContentRegistry::DataInspector::GeneratorFunction function) {
|
void ContentRegistry::DataInspector::add(std::string_view unlocalizedName, size_t requiredSize, ContentRegistry::DataInspector::GeneratorFunction function) {
|
||||||
getEntries().push_back({ name.data(), requiredSize, std::move(function) });
|
getEntries().push_back({ unlocalizedName.data(), requiredSize, std::move(function) });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ContentRegistry::DataInspector::Entry>& ContentRegistry::DataInspector::getEntries() {
|
std::vector<ContentRegistry::DataInspector::Entry>& ContentRegistry::DataInspector::getEntries() {
|
||||||
|
@ -14,6 +14,8 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LangEntry::LangEntry(const char *unlocalizedString) : m_unlocalizedString(unlocalizedString) { }
|
LangEntry::LangEntry(const char *unlocalizedString) : m_unlocalizedString(unlocalizedString) { }
|
||||||
|
LangEntry::LangEntry(const std::string &unlocalizedString) : m_unlocalizedString(unlocalizedString) { }
|
||||||
|
LangEntry::LangEntry(std::string_view unlocalizedString) : m_unlocalizedString(unlocalizedString) { }
|
||||||
|
|
||||||
LangEntry::operator std::string() const {
|
LangEntry::operator std::string() const {
|
||||||
return std::string(get());
|
return std::string(get());
|
||||||
|
@ -101,7 +101,7 @@ namespace hex {
|
|||||||
|
|
||||||
std::vector<CommandResult> results;
|
std::vector<CommandResult> results;
|
||||||
|
|
||||||
for (const auto &[type, command, description, displayCallback, executeCallback] : ContentRegistry::CommandPaletteCommands::getEntries()) {
|
for (const auto &[type, command, unlocalizedDescription, displayCallback, executeCallback] : ContentRegistry::CommandPaletteCommands::getEntries()) {
|
||||||
|
|
||||||
auto AutoComplete = [this, &currCommand = command](auto) {
|
auto AutoComplete = [this, &currCommand = command](auto) {
|
||||||
focusInputTextBox();
|
focusInputTextBox();
|
||||||
@ -112,7 +112,7 @@ namespace hex {
|
|||||||
if (type == ContentRegistry::CommandPaletteCommands::Type::SymbolCommand) {
|
if (type == ContentRegistry::CommandPaletteCommands::Type::SymbolCommand) {
|
||||||
if (auto [match, value] = MatchCommand(input, command); match != MatchType::NoMatch) {
|
if (auto [match, value] = MatchCommand(input, command); match != MatchType::NoMatch) {
|
||||||
if (match != MatchType::PerfectMatch)
|
if (match != MatchType::PerfectMatch)
|
||||||
results.push_back({ command + " (" + description + ")", "", AutoComplete });
|
results.push_back({ command + " (" + LangEntry(unlocalizedDescription) + ")", "", AutoComplete });
|
||||||
else {
|
else {
|
||||||
auto matchedCommand = input.substr(command.length()).data();
|
auto matchedCommand = input.substr(command.length()).data();
|
||||||
results.push_back({ displayCallback(matchedCommand), matchedCommand, executeCallback });
|
results.push_back({ displayCallback(matchedCommand), matchedCommand, executeCallback });
|
||||||
@ -121,7 +121,7 @@ namespace hex {
|
|||||||
} else if (type == ContentRegistry::CommandPaletteCommands::Type::KeywordCommand) {
|
} else if (type == ContentRegistry::CommandPaletteCommands::Type::KeywordCommand) {
|
||||||
if (auto [match, value] = MatchCommand(input, command + " "); match != MatchType::NoMatch) {
|
if (auto [match, value] = MatchCommand(input, command + " "); match != MatchType::NoMatch) {
|
||||||
if (match != MatchType::PerfectMatch)
|
if (match != MatchType::PerfectMatch)
|
||||||
results.push_back({ command + " (" + description + ")", "", AutoComplete });
|
results.push_back({ command + " (" + LangEntry(unlocalizedDescription) + ")", "", AutoComplete });
|
||||||
else {
|
else {
|
||||||
auto matchedCommand = input.substr(command.length() + 1).data();
|
auto matchedCommand = input.substr(command.length() + 1).data();
|
||||||
results.push_back({ displayCallback(matchedCommand), matchedCommand, executeCallback });
|
results.push_back({ displayCallback(matchedCommand), matchedCommand, executeCallback });
|
||||||
|
@ -49,7 +49,7 @@ namespace hex {
|
|||||||
|
|
||||||
std::vector<u8> buffer(entry.requiredSize);
|
std::vector<u8> buffer(entry.requiredSize);
|
||||||
provider->read(this->m_startAddress, buffer.data(), buffer.size());
|
provider->read(this->m_startAddress, buffer.data(), buffer.size());
|
||||||
this->m_cachedData.emplace_back(entry.name, entry.generatorFunction(buffer, this->m_endian, this->m_numberDisplayStyle));
|
this->m_cachedData.emplace_back(entry.unlocalizedName, entry.generatorFunction(buffer, this->m_endian, this->m_numberDisplayStyle));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,10 +67,10 @@ namespace hex {
|
|||||||
|
|
||||||
ImGui::TableHeadersRow();
|
ImGui::TableHeadersRow();
|
||||||
|
|
||||||
for (const auto &[name, function] : this->m_cachedData) {
|
for (const auto &[unlocalizedName, function] : this->m_cachedData) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::TextUnformatted(name.c_str());
|
ImGui::TextUnformatted(LangEntry(unlocalizedName));
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
function();
|
function();
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
View::subscribeEvent(Events::SettingsChanged, [](auto) {
|
View::subscribeEvent(Events::SettingsChanged, [](auto) {
|
||||||
int theme = ContentRegistry::Settings::getSettingsData()["Interface"]["Color theme"];
|
int theme = ContentRegistry::Settings::getSettingsData()["hex.builtin.setting.interface"]["hex.builtin.setting.interface.color"];
|
||||||
|
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
default:
|
default:
|
||||||
@ -238,7 +238,7 @@ namespace hex {
|
|||||||
imnodes::BeginNode(node->getID());
|
imnodes::BeginNode(node->getID());
|
||||||
|
|
||||||
imnodes::BeginNodeTitleBar();
|
imnodes::BeginNodeTitleBar();
|
||||||
ImGui::TextUnformatted(node->getTitle().data());
|
ImGui::TextUnformatted(LangEntry(node->getUnlocalizedName()));
|
||||||
imnodes::EndNodeTitleBar();
|
imnodes::EndNodeTitleBar();
|
||||||
|
|
||||||
node->drawNode();
|
node->drawNode();
|
||||||
@ -254,11 +254,11 @@ namespace hex {
|
|||||||
|
|
||||||
if (attribute.getIOType() == dp::Attribute::IOType::In) {
|
if (attribute.getIOType() == dp::Attribute::IOType::In) {
|
||||||
imnodes::BeginInputAttribute(attribute.getID(), pinShape);
|
imnodes::BeginInputAttribute(attribute.getID(), pinShape);
|
||||||
ImGui::TextUnformatted(attribute.getName().data());
|
ImGui::TextUnformatted(LangEntry(attribute.getUnlocalizedName()));
|
||||||
imnodes::EndInputAttribute();
|
imnodes::EndInputAttribute();
|
||||||
} else if (attribute.getIOType() == dp::Attribute::IOType::Out) {
|
} else if (attribute.getIOType() == dp::Attribute::IOType::Out) {
|
||||||
imnodes::BeginOutputAttribute(attribute.getID(), imnodes::PinShape(pinShape + 1));
|
imnodes::BeginOutputAttribute(attribute.getID(), imnodes::PinShape(pinShape + 1));
|
||||||
ImGui::TextUnformatted(attribute.getName().data());
|
ImGui::TextUnformatted(LangEntry(attribute.getUnlocalizedName()));
|
||||||
imnodes::EndOutputAttribute();
|
imnodes::EndOutputAttribute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ namespace hex {
|
|||||||
{
|
{
|
||||||
|
|
||||||
View::subscribeEvent(Events::SettingsChanged, [this](auto) {
|
View::subscribeEvent(Events::SettingsChanged, [this](auto) {
|
||||||
int theme = ContentRegistry::Settings::getSettingsData()["Interface"]["Color theme"];
|
int theme = ContentRegistry::Settings::getSettingsData()["hex.builtin.setting.interface"]["hex.builtin.setting.interface.color"];
|
||||||
|
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
default:
|
default:
|
||||||
|
@ -6,7 +6,7 @@ namespace hex {
|
|||||||
|
|
||||||
ViewSettings::ViewSettings() : View("hex.view.settings.title"_lang) {
|
ViewSettings::ViewSettings() : View("hex.view.settings.title"_lang) {
|
||||||
View::subscribeEvent(Events::OpenWindow, [this](auto name) {
|
View::subscribeEvent(Events::OpenWindow, [this](auto name) {
|
||||||
if (std::any_cast<const char*>(name) == std::string("hex.view.settings.title"_lang)) {
|
if (std::any_cast<const char*>(name) == std::string("hex.view.settings.title")) {
|
||||||
View::doLater([]{ ImGui::OpenPopup("hex.view.settings.title"_lang); });
|
View::doLater([]{ ImGui::OpenPopup("hex.view.settings.title"_lang); });
|
||||||
this->getWindowOpenState() = true;
|
this->getWindowOpenState() = true;
|
||||||
}
|
}
|
||||||
@ -23,10 +23,10 @@ namespace hex {
|
|||||||
|
|
||||||
if (ImGui::BeginPopupModal("hex.view.settings.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("hex.view.settings.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) {
|
for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) {
|
||||||
ImGui::TextUnformatted(category.c_str());
|
ImGui::TextUnformatted(LangEntry(category));
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
for (auto &[name, callback] : entries) {
|
for (auto &[name, callback] : entries) {
|
||||||
if (callback(ContentRegistry::Settings::getSettingsData()[category][name]))
|
if (callback(LangEntry(name), ContentRegistry::Settings::getSettingsData()[category][name]))
|
||||||
View::postEvent(Events::SettingsChanged);
|
View::postEvent(Events::SettingsChanged);
|
||||||
}
|
}
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
|
@ -11,7 +11,7 @@ namespace hex {
|
|||||||
void ViewTools::drawContent() {
|
void ViewTools::drawContent() {
|
||||||
if (ImGui::Begin("hex.view.tools.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
if (ImGui::Begin("hex.view.tools.title"_lang, &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||||
for (const auto& [name, function] : ContentRegistry::Tools::getEntries()) {
|
for (const auto& [name, function] : ContentRegistry::Tools::getEntries()) {
|
||||||
if (ImGui::CollapsingHeader(name.c_str())) {
|
if (ImGui::CollapsingHeader(LangEntry(name))) {
|
||||||
function();
|
function();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ namespace hex {
|
|||||||
EventManager::subscribe(Events::SettingsChanged, this, [](auto) -> std::any {
|
EventManager::subscribe(Events::SettingsChanged, this, [](auto) -> std::any {
|
||||||
|
|
||||||
{
|
{
|
||||||
int theme = ContentRegistry::Settings::getSettingsData()["Interface"]["Color theme"];
|
int theme = ContentRegistry::Settings::getSettingsData()["hex.builtin.setting.interface"]["hex.builtin.setting.interface.color"];
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
default:
|
default:
|
||||||
case 0: /* Dark theme */
|
case 0: /* Dark theme */
|
||||||
@ -72,7 +72,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string language = ContentRegistry::Settings::getSettingsData()["Interface"]["Language"];
|
std::string language = ContentRegistry::Settings::getSettingsData()["hex.builtin.setting.interface"]["hex.builtin.setting.interface.language"];
|
||||||
LangEntry::loadLanguage(language);
|
LangEntry::loadLanguage(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ namespace hex {
|
|||||||
std::vector<std::string> recentFilesVector;
|
std::vector<std::string> recentFilesVector;
|
||||||
std::copy(this->m_recentFiles.begin(), this->m_recentFiles.end(), std::back_inserter(recentFilesVector));
|
std::copy(this->m_recentFiles.begin(), this->m_recentFiles.end(), std::back_inserter(recentFilesVector));
|
||||||
|
|
||||||
ContentRegistry::Settings::write("ImHex", "RecentFiles", recentFilesVector);
|
ContentRegistry::Settings::write("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.recent_files", recentFilesVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { };
|
return { };
|
||||||
@ -119,13 +119,13 @@ namespace hex {
|
|||||||
return { };
|
return { };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this->initPlugins();
|
||||||
|
|
||||||
ContentRegistry::Settings::load();
|
ContentRegistry::Settings::load();
|
||||||
View::postEvent(Events::SettingsChanged);
|
View::postEvent(Events::SettingsChanged);
|
||||||
|
|
||||||
for (const auto &path : ContentRegistry::Settings::read("ImHex", "RecentFiles"))
|
for (const auto &path : ContentRegistry::Settings::read("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.recent_files"))
|
||||||
this->m_recentFiles.push_back(path);
|
this->m_recentFiles.push_back(path);
|
||||||
|
|
||||||
this->initPlugins();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::~Window() {
|
Window::~Window() {
|
||||||
@ -362,7 +362,7 @@ namespace hex {
|
|||||||
ImGui::Text("hex.welcome.header.customize"_lang);
|
ImGui::Text("hex.welcome.header.customize"_lang);
|
||||||
{
|
{
|
||||||
if (ImGui::DescriptionButton("hex.welcome.customize.settings.title"_lang, "hex.welcome.customize.settings.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8f, 0)))
|
if (ImGui::DescriptionButton("hex.welcome.customize.settings.title"_lang, "hex.welcome.customize.settings.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x * 0.8f, 0)))
|
||||||
EventManager::post(Events::OpenWindow, "Preferences");
|
EventManager::post(Events::OpenWindow, "hex.view.settings.title");
|
||||||
}
|
}
|
||||||
ImGui::TableNextRow(ImGuiTableRowFlags_None, 100);
|
ImGui::TableNextRow(ImGuiTableRowFlags_None, 100);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
Loading…
Reference in New Issue
Block a user