mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 05:05:19 -05:00
nodes: Allow data processor content to be stored in project files
This commit is contained in:
@@ -38,6 +38,20 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, this->m_buffer);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["size"] = this->m_size;
|
||||
output["data"] = this->m_buffer;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_size = j["size"];
|
||||
this->m_buffer = j["data"].get<std::vector<u8>>();
|
||||
}
|
||||
|
||||
private:
|
||||
u32 m_size = 1;
|
||||
std::vector<u8> m_buffer;
|
||||
@@ -66,6 +80,18 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, output);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_value = j["data"];
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_value;
|
||||
};
|
||||
@@ -89,6 +115,18 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, data);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_value = j["data"];
|
||||
}
|
||||
|
||||
private:
|
||||
u64 m_value = 0;
|
||||
};
|
||||
@@ -113,6 +151,18 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(0, data);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = this->m_value;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_value = j["data"];
|
||||
}
|
||||
|
||||
private:
|
||||
float m_value = 0;
|
||||
};
|
||||
@@ -139,6 +189,22 @@ namespace hex::plugin::builtin {
|
||||
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = nlohmann::json::object();
|
||||
output["data"]["r"] = this->m_color.Value.x;
|
||||
output["data"]["g"] = this->m_color.Value.y;
|
||||
output["data"]["b"] = this->m_color.Value.z;
|
||||
output["data"]["a"] = this->m_color.Value.w;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_color = ImVec4(j["data"]["r"], j["data"]["g"], j["data"]["b"], j["data"]["a"]);
|
||||
}
|
||||
|
||||
private:
|
||||
ImColor m_color;
|
||||
};
|
||||
@@ -157,6 +223,18 @@ namespace hex::plugin::builtin {
|
||||
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["comment"] = this->m_comment;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_comment = j["comment"];
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_comment;
|
||||
};
|
||||
@@ -660,6 +738,22 @@ namespace hex::plugin::builtin {
|
||||
this->setBufferOnOutput(4, output);
|
||||
}
|
||||
|
||||
nlohmann::json store() override {
|
||||
auto output = nlohmann::json::object();
|
||||
|
||||
output["data"] = nlohmann::json::object();
|
||||
output["data"]["mode"] = this->m_mode;
|
||||
output["data"]["key_length"] = this->m_keyLength;
|
||||
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void load(nlohmann::json &j) override {
|
||||
this->m_mode = j["data"]["mode"];
|
||||
this->m_keyLength = j["data"]["key_length"];
|
||||
}
|
||||
|
||||
private:
|
||||
int m_mode = 0;
|
||||
int m_keyLength = 0;
|
||||
|
||||
Reference in New Issue
Block a user