Skip to content

Commit

Permalink
enableAxis also enables direction and directionEnable enables all axes
Browse files Browse the repository at this point in the history
Should fix forza motorsport
  • Loading branch information
Ultrawipf committed Apr 5, 2024
1 parent 83e0776 commit fc0106d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Firmware/FFBoard/Src/HidFFB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,14 @@ void HidFFB::set_effect(FFB_SetEffect_t* effect){
}

float phaseX = M_PI*2.0 * (effect->directionX/36000.0);
effect_p->axisMagnitudes[0] = directionEnable ? sin(phaseX) : (effect->enableAxis & X_AXIS_ENABLE ? 1 : 0); // Angular vector if dirEnable used otherwise full or 0 if axis enabled
effect_p->axisMagnitudes[1] = directionEnable ? cos(phaseX) : (effect->enableAxis & Y_AXIS_ENABLE ? 1 : 0); // Angular vector if dirEnable used otherwise full or 0 if axis enabled
// Angular vector if dirEnable used or axis enabled otherwise 0 if axis disabled
effect_p->axisMagnitudes[0] = (directionEnable || (effect->enableAxis & X_AXIS_ENABLE) ? sin(phaseX) : 0);
effect_p->axisMagnitudes[1] = (directionEnable || (effect->enableAxis & Y_AXIS_ENABLE) ? cos(phaseX) : 0);


#if MAX_AXIS == 3
float phaseY = M_PI*2.0 * (effect->directionY/36000.0);
effect_p->axisMagnitudes[3] = directionEnable ? sin(phaseY) : (effect->enableAxis & Z_AXIS_ENABLE ? 1 : 0); // Angular vector if dirEnable used otherwise full or 0 if axis enabled
effect_p->axisMagnitudes[3] = (directionEnable || (effect->enableAxis & Z_AXIS_ENABLE) ? sin(phaseY) : 0); // Angular vector if dirEnable used otherwise full or 0 if axis enabled

#endif
if(effect->duration == 0){ // Fix for games assuming 0 is infinite
Expand Down

0 comments on commit fc0106d

Please sign in to comment.