For the complete documentation index, see llms.txt. This page is also available as Markdown.

Group several controls safely

When a feature owns several buttons, read and write each ordinary identifier explicitly. This is more verbose, but it keeps the input layer, output order, and platform mapping visible.

group-controls-explicitly.gpc
int dpad_active;

main {
    dpad_active = get_ival(PS5_UP)   || get_ival(PS5_DOWN) ||
                  get_ival(PS5_LEFT) || get_ival(PS5_RIGHT);

    if(dpad_active) set_val(TRACE_1, 1);

    if(menu_open) {
        set_val(PS5_UP, 0);
        set_val(PS5_DOWN, 0);
        set_val(PS5_LEFT, 0);
        set_val(PS5_RIGHT, 0);
    }
}

Use a user function when the same explicit group write occurs in several states. Keep that function before the final writer for the affected controls and do not hide platform-specific identifiers behind unexplained numeric values.

Last updated