patterns: Fixed wrong offsets when passing custom types to functions

This commit is contained in:
WerWolv 2021-10-08 21:39:30 +02:00
parent a29e3789d2
commit 2dc1886ee9
2 changed files with 14 additions and 7 deletions

View File

@ -689,10 +689,13 @@ namespace hex::pl {
}
void setOffset(u64 offset) override {
for (auto &entry : this->m_entries) {
entry->setOffset(offset + (entry->getOffset() - this->getOffset()));
if (!this->isLocal()) {
for (auto &entry : this->m_entries) {
entry->setOffset(offset + (entry->getOffset() - this->getOffset()));
}
}
PatternData::setOffset(offset);
}
@ -956,8 +959,10 @@ namespace hex::pl {
}
void setOffset(u64 offset) override {
for (auto &member : this->m_members) {
member->setOffset(offset + (member->getOffset() - this->getOffset()));
if (!this->isLocal()) {
for (auto &member: this->m_members) {
member->setOffset(offset + (member->getOffset() - this->getOffset()));
}
}
PatternData::setOffset(offset);
@ -1093,8 +1098,10 @@ namespace hex::pl {
}
void setOffset(u64 offset) override {
for (auto &member : this->m_members) {
member->setOffset(offset + (member->getOffset() - this->getOffset()));
if (!this->isLocal()) {
for (auto &member: this->m_members) {
member->setOffset(offset + (member->getOffset() - this->getOffset()));
}
}
PatternData::setOffset(offset);

View File

@ -39,8 +39,8 @@ namespace hex::pl {
}
pattern->setVariableName(name);
pattern->setOffset(this->getStack().size());
pattern->setLocal(true);
pattern->setOffset(this->getStack().size());
this->getStack().emplace_back();
variables.push_back(pattern);