Accessibility Control Examples

These patterns adapt controls without changing the underlying application. Confirm the BUTTON_* mappings for your device in Device Monitor before using them.

Simple Remap

gpc
main {
    fix32 source = get_val(BUTTON_5);

    set_val(BUTTON_15, source);
    set_val(BUTTON_5, 0);
}

This moves one physical input to a more convenient output and clears the original output.

Swap Two Buttons

gpc
main {
    fix32 first = get_val(BUTTON_15);
    fix32 second = get_val(BUTTON_14);

    set_val(BUTTON_15, second);
    set_val(BUTTON_14, first);
}

Read both inputs before setting either output.

One-Handed Modifier Layer

gpc
main {
    if (get_val(BUTTON_8) > 50) {
        fix32 upper = get_val(BUTTON_5);
        fix32 lower = get_val(BUTTON_7);

        set_val(BUTTON_13, upper);
        set_val(BUTTON_15, lower);
        set_val(BUTTON_5, 0);
        set_val(BUTTON_7, 0);
    }
}

Holding the modifier exposes two alternate outputs on buttons reachable by the same hand. Change the button constants to suit the controller and user.

Hold-to-Toggle Conversion

gpc
bool output_enabled = FALSE;

main {
    if (event_active(BUTTON_5)) {
        output_enabled = !output_enabled;
    }

    if (output_enabled) {
        set_val(BUTTON_15, 100);
    } else {
        set_val(BUTTON_15, 0);
    }
    set_val(BUTTON_5, 0);
}

Each physical press changes the output between held and released. Choose an activation button that cannot be pressed accidentally, and provide a clear way to turn the output off.

Safety Notes

  • Test remaps with Device Monitor before connecting an output target.
  • Keep the original source value if more than one rule needs it.
  • Add a dedicated reset input for any latched or toggle state.
  • Make small changes so each mapping can be checked independently.