HD Packs: Added support for <= & >= operators in memoryCheck conditions

This commit is contained in:
Sour 2018-03-25 17:39:17 -04:00
parent f2b02c81b8
commit 12249df1a7
2 changed files with 13 additions and 1 deletions

View file

@ -51,7 +51,9 @@ enum class HdPackConditionOperator
Equal = 0,
NotEqual = 1,
GreaterThan = 2,
LowerThan = 3
LowerThan = 3,
LowerThanOrEqual = 4,
GreaterThanOrEqual = 5,
};
struct HdPackBaseMemoryCondition : public HdPackCondition
@ -83,6 +85,8 @@ struct HdPackBaseMemoryCondition : public HdPackCondition
case HdPackConditionOperator::NotEqual: out << "!="; break;
case HdPackConditionOperator::GreaterThan: out << ">"; break;
case HdPackConditionOperator::LowerThan: out << "<"; break;
case HdPackConditionOperator::LowerThanOrEqual: out << "<="; break;
case HdPackConditionOperator::GreaterThanOrEqual: out << ">="; break;
}
out << ",";
out << HexUtilities::ToHex(OperandB);
@ -139,6 +143,8 @@ struct HdPackMemoryCheckCondition : public HdPackBaseMemoryCondition
case HdPackConditionOperator::NotEqual: return screenInfo->WatchedAddressValues[OperandA] != screenInfo->WatchedAddressValues[OperandB];
case HdPackConditionOperator::GreaterThan: return screenInfo->WatchedAddressValues[OperandA] > screenInfo->WatchedAddressValues[OperandB];
case HdPackConditionOperator::LowerThan: return screenInfo->WatchedAddressValues[OperandA] < screenInfo->WatchedAddressValues[OperandB];
case HdPackConditionOperator::LowerThanOrEqual: return screenInfo->WatchedAddressValues[OperandA] <= screenInfo->WatchedAddressValues[OperandB];
case HdPackConditionOperator::GreaterThanOrEqual: return screenInfo->WatchedAddressValues[OperandA] >= screenInfo->WatchedAddressValues[OperandB];
}
return false;
}
@ -156,6 +162,8 @@ struct HdPackMemoryCheckConstantCondition : public HdPackBaseMemoryCondition
case HdPackConditionOperator::NotEqual: return screenInfo->WatchedAddressValues[OperandA] != OperandB;
case HdPackConditionOperator::GreaterThan: return screenInfo->WatchedAddressValues[OperandA] > OperandB;
case HdPackConditionOperator::LowerThan: return screenInfo->WatchedAddressValues[OperandA] < OperandB;
case HdPackConditionOperator::LowerThanOrEqual: return screenInfo->WatchedAddressValues[OperandA] <= OperandB;
case HdPackConditionOperator::GreaterThanOrEqual: return screenInfo->WatchedAddressValues[OperandA] >= OperandB;
}
return false;
}

View file

@ -454,6 +454,10 @@ void HdPackLoader::ProcessConditionTag(vector<string> &tokens, bool createInvert
op = HdPackConditionOperator::GreaterThan;
} else if(opString == "<") {
op = HdPackConditionOperator::LowerThan;
} else if(opString == "<=") {
op = HdPackConditionOperator::LowerThanOrEqual;
} else if(opString == ">=") {
op = HdPackConditionOperator::GreaterThanOrEqual;
} else {
checkConstraint(false, "[HDPack] Invalid operator.");
}