Force Feedback Functions

Force feedback functions let a script read the vibration the game is currently sending back to the controller. In Helios, these reads use the same returned feedback shown on the FFB row in Device Monitor.

Force feedback is read-only in GPC3. A script can react to rumble, but it cannot start, change, block, or stop the vibration a controller receives.

Quick Reference

Function Signature Returns Use
ffb_get fix32 ffb_get(int id, uint32 *duration) Strength 0.0 to 100.0 Read one feedback channel and, optionally, its remaining time
ffb_get_actual fix32 ffb_get_actual(int id, uint32 *duration) Strength 0.0 to 100.0 Same reading as ffb_get()
get_rumble int get_rumble(int id) Whole-number percentage Cronus-style read of one feedback channel
ffb_set ffb_set(id, strength, ms) N/A Accepted for compatibility; does nothing
ffb_reset ffb_reset() N/A Accepted for compatibility; does nothing
set_rumble set_rumble(id, strength) N/A Accepted for compatibility; does nothing
block_rumble / reset_rumble block_rumble() / reset_rumble() N/A Accepted for compatibility; do nothing

Feedback Channels

Channel Titan name Cronus name Meaning
FFB_L FFB_1 RUMBLE_A Left body motor
FFB_R FFB_2 RUMBLE_B Right body motor
FFB_RT FFB_3 RUMBLE_RT Right trigger motor
FFB_LT FFB_4 RUMBLE_LT Left trigger motor
FFB_LH N/A N/A Left haptic signal level
FFB_RH N/A N/A Right haptic signal level

FFB_LH and FFB_RH report haptic signal levels from controllers that use haptics. They are not motor strength values, so compare them against thresholds you have tested for your game.

Reading Strength and Remaining Time

gpc
fix32 ffb_get(int id, uint32 *duration);
fix32 ffb_get_actual(int id, uint32 *duration);

Returns the current strength of one feedback channel, from 0.0 (off) to 100.0 (full). Because GPC3 never overrides feedback, ffb_get() and ffb_get_actual() always return the same value.

Parameters

Parameter Type Description
id int Feedback channel, such as FFB_L or FFB_RT
duration uint32 pointer or NULL Receives the remaining time in milliseconds; pass NULL when you only need the strength

Remaining Time

Value written to duration Meaning
1 and up Milliseconds left on the current effect
0xFFFFFFFF Feedback is active but has no known end time
0 No feedback on this channel

When an effect's time runs out, the next read returns 0.0, even if the game has not sent a stop yet.

When Reads Return Zero

A read returns 0.0 strength and writes 0 duration when:

  • the game is not sending feedback on that channel;
  • the connection that reports feedback is disconnected or not running;
  • the channel identifier is not one of the channels above.

A zero reading does not prove a controller or game lacks vibration. Check Device Monitor to confirm that feedback is being reported.

gpc
uint32 remaining;

main {
    fix32 left = ffb_get(FFB_L, &remaining);

    if (left > 20.0) {
        printf("Left motor %f%%, %u ms left", left, remaining);
    }
}

get_rumble

gpc
int get_rumble(int id);

Returns the strength of one channel as a whole-number percentage from 0 to 100. Fractions are dropped, so a strength of 30.75 returns 30. Use the Cronus names RUMBLE_A, RUMBLE_B, RUMBLE_RT, and RUMBLE_LT, or any channel from the table above.

gpc
main {
    if (get_rumble(RUMBLE_A) >= 50) {
        set_val(BUTTON_16, 100);
    }
}

Write and Reset Calls

ffb_set(), ffb_reset(), set_rumble(), block_rumble(), and reset_rumble() compile so imported Titan Two and Cronus scripts keep working, but they have no effect. They do not change what the read functions return and do not send vibration to the controller.

If a migrated script depends on these calls to create or suppress rumble, that part of the script will not behave the same way in Helios. See Script Compatibility.

Practical Patterns

React to Trigger Feedback

gpc
main {
    if (ffb_get(FFB_RT, NULL) > 0.0) {
        printf("Right trigger feedback active");
    }
}

Report Strong Rumble Once

Print one message when either body motor passes a strong level, then wait until the feedback drops before reporting again.

gpc
bool reported = FALSE;

main {
    fix32 strength = max(ffb_get(FFB_L, NULL), ffb_get(FFB_R, NULL));

    if (strength >= 60.0 && !reported) {
        printf("Strong rumble: %f%%", strength);
        reported = TRUE;
    } else if (strength < 20.0) {
        reported = FALSE;
    }
}

Notes

  • Feedback reads are available in Helios. Builds without a feedback source return zero.
  • Readings come from whatever connection reports returned feedback, such as Titan Bridge or a Remote Play output.
  • Use NULL for the second argument when you do not need the remaining time.
  • Feedback values change only when the game sends new feedback; reading them does not affect the controller.