nodes: Fixed a few issues with locatizations, errors and overlays
This commit is contained in:
parent
3b7f2fbdaa
commit
858e1aed3b
@ -29,7 +29,7 @@ namespace hex::dp {
|
|||||||
auto &outputData = attribute->getOutputData();
|
auto &outputData = attribute->getOutputData();
|
||||||
|
|
||||||
if (!outputData.has_value())
|
if (!outputData.has_value())
|
||||||
throw std::runtime_error("No data available at connected attribute");
|
throwNodeError("No data available at connected attribute");
|
||||||
|
|
||||||
return outputData.value();
|
return outputData.value();
|
||||||
}
|
}
|
||||||
@ -49,10 +49,10 @@ namespace hex::dp {
|
|||||||
auto &outputData = attribute->getOutputData();
|
auto &outputData = attribute->getOutputData();
|
||||||
|
|
||||||
if (!outputData.has_value())
|
if (!outputData.has_value())
|
||||||
throw std::runtime_error("No data available at connected attribute");
|
throwNodeError("No data available at connected attribute");
|
||||||
|
|
||||||
if (outputData->size() < sizeof(u64))
|
if (outputData->size() < sizeof(u64))
|
||||||
throw std::runtime_error("Not enough data provided for integer");
|
throwNodeError("Not enough data provided for integer");
|
||||||
|
|
||||||
return *reinterpret_cast<i64 *>(outputData->data());
|
return *reinterpret_cast<i64 *>(outputData->data());
|
||||||
}
|
}
|
||||||
@ -72,10 +72,10 @@ namespace hex::dp {
|
|||||||
auto &outputData = attribute->getOutputData();
|
auto &outputData = attribute->getOutputData();
|
||||||
|
|
||||||
if (!outputData.has_value())
|
if (!outputData.has_value())
|
||||||
throw std::runtime_error("No data available at connected attribute");
|
throwNodeError("No data available at connected attribute");
|
||||||
|
|
||||||
if (outputData->size() < sizeof(float))
|
if (outputData->size() < sizeof(float))
|
||||||
throw std::runtime_error("Not enough data provided for float");
|
throwNodeError("Not enough data provided for float");
|
||||||
|
|
||||||
float result = 0;
|
float result = 0;
|
||||||
std::memcpy(&result, outputData->data(), sizeof(float));
|
std::memcpy(&result, outputData->data(), sizeof(float));
|
||||||
@ -84,24 +84,24 @@ namespace hex::dp {
|
|||||||
|
|
||||||
void Node::setBufferOnOutput(u32 index, const std::vector<u8> &data) {
|
void Node::setBufferOnOutput(u32 index, const std::vector<u8> &data) {
|
||||||
if (index >= this->getAttributes().size())
|
if (index >= this->getAttributes().size())
|
||||||
throw std::runtime_error("Attribute index out of bounds!");
|
throwNodeError("Attribute index out of bounds!");
|
||||||
|
|
||||||
auto &attribute = this->getAttributes()[index];
|
auto &attribute = this->getAttributes()[index];
|
||||||
|
|
||||||
if (attribute.getIOType() != Attribute::IOType::Out)
|
if (attribute.getIOType() != Attribute::IOType::Out)
|
||||||
throw std::runtime_error("Tried to set output data of an input attribute!");
|
throwNodeError("Tried to set output data of an input attribute!");
|
||||||
|
|
||||||
attribute.getOutputData() = data;
|
attribute.getOutputData() = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setIntegerOnOutput(u32 index, i64 integer) {
|
void Node::setIntegerOnOutput(u32 index, i64 integer) {
|
||||||
if (index >= this->getAttributes().size())
|
if (index >= this->getAttributes().size())
|
||||||
throw std::runtime_error("Attribute index out of bounds!");
|
throwNodeError("Attribute index out of bounds!");
|
||||||
|
|
||||||
auto &attribute = this->getAttributes()[index];
|
auto &attribute = this->getAttributes()[index];
|
||||||
|
|
||||||
if (attribute.getIOType() != Attribute::IOType::Out)
|
if (attribute.getIOType() != Attribute::IOType::Out)
|
||||||
throw std::runtime_error("Tried to set output data of an input attribute!");
|
throwNodeError("Tried to set output data of an input attribute!");
|
||||||
|
|
||||||
std::vector<u8> buffer(sizeof(u64), 0);
|
std::vector<u8> buffer(sizeof(u64), 0);
|
||||||
std::memcpy(buffer.data(), &integer, sizeof(u64));
|
std::memcpy(buffer.data(), &integer, sizeof(u64));
|
||||||
@ -111,12 +111,12 @@ namespace hex::dp {
|
|||||||
|
|
||||||
void Node::setFloatOnOutput(u32 index, float floatingPoint) {
|
void Node::setFloatOnOutput(u32 index, float floatingPoint) {
|
||||||
if (index >= this->getAttributes().size())
|
if (index >= this->getAttributes().size())
|
||||||
throw std::runtime_error("Attribute index out of bounds!");
|
throwNodeError("Attribute index out of bounds!");
|
||||||
|
|
||||||
auto &attribute = this->getAttributes()[index];
|
auto &attribute = this->getAttributes()[index];
|
||||||
|
|
||||||
if (attribute.getIOType() != Attribute::IOType::Out)
|
if (attribute.getIOType() != Attribute::IOType::Out)
|
||||||
throw std::runtime_error("Tried to set output data of an input attribute!");
|
throwNodeError("Tried to set output data of an input attribute!");
|
||||||
|
|
||||||
std::vector<u8> buffer(sizeof(float), 0);
|
std::vector<u8> buffer(sizeof(float), 0);
|
||||||
std::memcpy(buffer.data(), &floatingPoint, sizeof(float));
|
std::memcpy(buffer.data(), &floatingPoint, sizeof(float));
|
||||||
@ -126,7 +126,7 @@ namespace hex::dp {
|
|||||||
|
|
||||||
void Node::setOverlayData(u64 address, const std::vector<u8> &data) {
|
void Node::setOverlayData(u64 address, const std::vector<u8> &data) {
|
||||||
if (this->m_overlay == nullptr)
|
if (this->m_overlay == nullptr)
|
||||||
throw std::runtime_error("Tried setting overlay data on a node that's not the end of a chain!");
|
throwNodeError("Tried setting overlay data on a node that's not the end of a chain!");
|
||||||
|
|
||||||
this->m_overlay->setAddress(address);
|
this->m_overlay->setAddress(address);
|
||||||
this->m_overlay->getData() = data;
|
this->m_overlay->getData() = data;
|
||||||
|
@ -162,12 +162,12 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
for (u32 i = 0; i < data.endNodes.size(); i++)
|
for (u32 i = 0; i < data.endNodes.size(); i++)
|
||||||
data.dataOverlays.push_back(ImHexApi::Provider::get()->newOverlay());
|
data.dataOverlays.push_back(ImHexApi::Provider::get()->newOverlay());
|
||||||
|
}
|
||||||
|
|
||||||
u32 overlayIndex = 0;
|
u32 overlayIndex = 0;
|
||||||
for (auto endNode : data.endNodes) {
|
for (auto endNode : data.endNodes) {
|
||||||
endNode->setCurrentOverlay(data.dataOverlays[overlayIndex]);
|
endNode->setCurrentOverlay(data.dataOverlays[overlayIndex]);
|
||||||
overlayIndex++;
|
overlayIndex++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.currNodeError.reset();
|
data.currNodeError.reset();
|
||||||
|
@ -605,6 +605,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.nodes.buffer.slice.input.to", "To" },
|
{ "hex.builtin.nodes.buffer.slice.input.to", "To" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat", "Repeat" },
|
{ "hex.builtin.nodes.buffer.repeat", "Repeat" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.header", "Repeat buffer" },
|
{ "hex.builtin.nodes.buffer.repeat.header", "Repeat buffer" },
|
||||||
|
{ "hex.builtin.nodes.buffer.repeat.input.buffer", "Input" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.input.count", "Count" },
|
{ "hex.builtin.nodes.buffer.repeat.input.count", "Count" },
|
||||||
|
|
||||||
{ "hex.builtin.nodes.control_flow", "Control flow" },
|
{ "hex.builtin.nodes.control_flow", "Control flow" },
|
||||||
|
@ -607,6 +607,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.nodes.buffer.slice.input.to", "To" },
|
{ "hex.builtin.nodes.buffer.slice.input.to", "To" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat", "繰り返し" },
|
{ "hex.builtin.nodes.buffer.repeat", "繰り返し" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.header", "バッファを繰り返し" },
|
{ "hex.builtin.nodes.buffer.repeat.header", "バッファを繰り返し" },
|
||||||
|
//{ "hex.builtin.nodes.buffer.repeat.input.buffer", "Input" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.input.count", "カウント" },
|
{ "hex.builtin.nodes.buffer.repeat.input.count", "カウント" },
|
||||||
|
|
||||||
{ "hex.builtin.nodes.control_flow", "制御フロー" },
|
{ "hex.builtin.nodes.control_flow", "制御フロー" },
|
||||||
|
@ -604,6 +604,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.nodes.buffer.slice.input.to", "끝" },
|
{ "hex.builtin.nodes.buffer.slice.input.to", "끝" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat", "출력" },
|
{ "hex.builtin.nodes.buffer.repeat", "출력" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.header", "버퍼 반복" },
|
{ "hex.builtin.nodes.buffer.repeat.header", "버퍼 반복" },
|
||||||
|
//{ "hex.builtin.nodes.buffer.repeat.input.buffer", "Input" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.input.count", "개수" },
|
{ "hex.builtin.nodes.buffer.repeat.input.count", "개수" },
|
||||||
|
|
||||||
{ "hex.builtin.nodes.control_flow", "데이터 플로우" },
|
{ "hex.builtin.nodes.control_flow", "데이터 플로우" },
|
||||||
|
@ -603,6 +603,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.nodes.buffer.slice.input.to", "Para" },
|
{ "hex.builtin.nodes.buffer.slice.input.to", "Para" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat", "Repetir" },
|
{ "hex.builtin.nodes.buffer.repeat", "Repetir" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.header", "Repetir buffer" },
|
{ "hex.builtin.nodes.buffer.repeat.header", "Repetir buffer" },
|
||||||
|
//{ "hex.builtin.nodes.buffer.repeat.input.buffer", "Input" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.input.count", "Contar" },
|
{ "hex.builtin.nodes.buffer.repeat.input.count", "Contar" },
|
||||||
|
|
||||||
{ "hex.builtin.nodes.control_flow", "Control flow" },
|
{ "hex.builtin.nodes.control_flow", "Control flow" },
|
||||||
|
@ -603,6 +603,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.nodes.buffer.slice.input.to", "到" },
|
{ "hex.builtin.nodes.buffer.slice.input.to", "到" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat", "Repeat" },
|
{ "hex.builtin.nodes.buffer.repeat", "Repeat" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.header", "Repeat buffer" },
|
{ "hex.builtin.nodes.buffer.repeat.header", "Repeat buffer" },
|
||||||
|
//{ "hex.builtin.nodes.buffer.repeat.input.buffer", "Input" },
|
||||||
{ "hex.builtin.nodes.buffer.repeat.input.count", "Count" },
|
{ "hex.builtin.nodes.buffer.repeat.input.count", "Count" },
|
||||||
|
|
||||||
{ "hex.builtin.nodes.control_flow", "Control flow" },
|
{ "hex.builtin.nodes.control_flow", "Control flow" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user