]> Devoid-pointer.net GitWeb - FFBChecker.git/commitdiff
Fix limits of valid values of effect parameters.
authorMichal Malý <madcatxster@prifuk.cz>
Sat, 7 Dec 2013 19:47:54 +0000 (20:47 +0100)
committerMichal Malý <madcatxster@prifuk.cz>
Sat, 7 Dec 2013 19:47:54 +0000 (20:47 +0100)
ffbconstanteffect.cpp
ffbeffect.cpp
ffbperiodiceffect.cpp
ffbrampeffect.cpp

index c9616b442854d46315ed9b2c87491585b37d50e2..879dd1125264b8b40f6f81fee5a3423522507a33 100644 (file)
@@ -39,18 +39,18 @@ bool FFBConstantEffect::setParameters(const std::shared_ptr<FFBConstantEffectPar
     return false;
 
   if (GlobalSettings::GS()->doSanityChecks) {
-    if (!checkBoundsInclusive(params->attackLength, 0, 0xFFFF)){
+    if (!checkBoundsInclusive(params->attackLength, 0, 0x7FFF)){
       reportError("Attack length out of bounds");
       return false;
     }
-    if (!checkBoundsInclusive(params->attackLevel, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->attackLevel, 0, 0x7FFF)) {
       reportError("Attack level out of bounds");
       return false;
-    } if (!checkBoundsInclusive(params->fadeLength, 0, 0xFFFF)) {
+    } if (!checkBoundsInclusive(params->fadeLength, 0, 0x7FFF)) {
       reportError("Fade length out of bounds");
       return false;
     }
-    if (!checkBoundsInclusive(params->fadeLevel, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->fadeLevel, 0, 0x7FFF)) {
       reportError("Fade level out of bounds");
       return false;
     }
index 98a49b871a7257318459235ddfa9c327ab6dc26d..5e932579d9c9fb499375066e6df1448edbfb7b69 100644 (file)
@@ -37,12 +37,12 @@ bool FFBEffect::checkGenericParameters(const std::shared_ptr<FFBEffectParameters
     return false;
   }
 
-  if (!checkBoundsInclusive(params->replayDelay, 0, 0xFFFF)) {
+  if (!checkBoundsInclusive(params->replayDelay, 0, 0x7FFF)) {
     reportError("Replay delay out of bounds.");
     return false;
   }
 
-  if (!checkBoundsInclusive(params->replayLength, 0, 0xFFFF)) {
+  if (!checkBoundsInclusive(params->replayLength, 0, 0x7FFF)) {
     reportError("Replay length out of bounds.");
     return false;
   }
index c9ff718961a657106a9f86aa9b5a73125ab418c4..b07200ab40d5bca418b52b5f9566540b05819fd0 100644 (file)
@@ -64,22 +64,22 @@ bool FFBPeriodicEffect::setParameters(const std::shared_ptr<FFBPeriodicEffectPar
     return false;
 
   if (GlobalSettings::GS()->doSanityChecks) {
-    if (!checkBoundsInclusive(params->attackLength, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->attackLength, 0, 0x7FFF)) {
       reportError("Attack length out of bounds.");
       return false;
     }
 
-    if (!checkBoundsInclusive(params->attackLevel, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->attackLevel, 0, 0x7FFF)) {
       reportError("Attack level out of bounds.");
       return false;
     }
 
-    if (!checkBoundsInclusive(params->fadeLength, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->fadeLength, 0, 0x7FFF)) {
       reportError("Fade length out of bounds.");
       return false;
     }
 
-    if (!checkBoundsInclusive(params->fadeLevel, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->fadeLevel, 0, 0x7FFF)) {
       reportError("Fade level out of bounds.");
       return false;
     }
@@ -94,12 +94,12 @@ bool FFBPeriodicEffect::setParameters(const std::shared_ptr<FFBPeriodicEffectPar
       return false;
     }
 
-    if (!checkBoundsInclusive(params->period, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->period, 0, 0x7FFF)) {
       reportError("Period out of bounds.");
       return false;
     }
 
-    if (!checkBoundsInclusive(params->phase, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->phase, 0, 0x7FFF)) {
       reportError("Phase out of bounds.");
       return false;
     }
index 97c3afec3fcd9d52d305f5befa7483ede84ed6f3..3428b26787f6623441b9ca516eefd47b25d9b69f 100644 (file)
@@ -42,22 +42,22 @@ bool FFBRampEffect::setParameters(const std::shared_ptr<FFBRampEffectParameters>
     return false;
 
   if (GlobalSettings::GS()->doSanityChecks) {
-    if (!checkBoundsInclusive(params->attackLength, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->attackLength, 0, 0x7FFF)) {
       reportError("Attack length out of bounds.");
       return false;
     }
 
-    if (!checkBoundsInclusive(params->attackLevel, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->attackLevel, 0, 0x7FFF)) {
       reportError("Attack level out of bounds.");
       return false;
     }
 
-    if (!checkBoundsInclusive(params->fadeLength, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->fadeLength, 0, 0x7FFF)) {
       reportError("Fade length out of bounds.");
       return false;
     }
 
-    if (!checkBoundsInclusive(params->fadeLevel, 0, 0xFFFF)) {
+    if (!checkBoundsInclusive(params->fadeLevel, 0, 0x7FFF)) {
       reportError("Fade level out of bounds.");
       return false;
     }