From 12249df1a770f6f0d90f9025152896e35017bab3 Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 25 Mar 2018 17:39:17 -0400 Subject: [PATCH] HD Packs: Added support for <= & >= operators in memoryCheck conditions --- Core/HdPackConditions.h | 10 +++++++++- Core/HdPackLoader.cpp | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Core/HdPackConditions.h b/Core/HdPackConditions.h index a158c633..acb4a1ea 100644 --- a/Core/HdPackConditions.h +++ b/Core/HdPackConditions.h @@ -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; } diff --git a/Core/HdPackLoader.cpp b/Core/HdPackLoader.cpp index dc834ce8..ef20ea99 100644 --- a/Core/HdPackLoader.cpp +++ b/Core/HdPackLoader.cpp @@ -454,6 +454,10 @@ void HdPackLoader::ProcessConditionTag(vector &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."); }