private static void HandleSrcFfb(ForceFeedbackJesus.ForceFeedbackJesus jesus, byte value) { if (value >= 0x98 && value <= 0x9F) { // Constant Force Right jesus.TriggerRightRollEffect(value - 0x97); } if (value >= 0xA8 && value <= 0xAF) { // Constant Force Left jesus.TriggerLeftRollEffect(value - 0xA7); } if (value >= 0xB8 && value <= 0xBF) { // Sine Wave jesus.TriggerSineEffect(value - 0xB7); } if (value >= 0xC0 && value <= 0xC7) { // Spring Force jesus.TriggerSpringEffect(value - 0xBF); } if (value >= 0xD8 && value <= 0xDF) { // Friction jesus.TriggerFrictionEffect(value - 0xD7); } }
private static void HandleIdFfb(ForceFeedbackJesus.ForceFeedbackJesus jesus, int value) { switch ((byte)((value >> 16) & 0xFF)) { case 4: { byte direction = (byte)((byte)(value >> 8) & 0xF); byte strength = (byte)((byte)(value) & 0xFF); if (direction == 0) { strength |= 0x80; strength = (byte)-strength; float v = strength; jesus.TriggerRightRollEffect(v / 12.5f); } else { float v = strength; jesus.TriggerLeftRollEffect(v / 12.5f); } } break; case 5: { float v = value & 0xFF; jesus.TriggerSineEffect(v / 4.5f); } break; case 6: { float v = value & 0xFF; jesus.TriggerFrictionEffect(v / 4.5f); } break; } }