[Bugfix] FS#13975 - Keyremap plugin: text importer allow multiple ACTION_NONE entries

importing discards duplicate entries based on context + action code
however you may want multiple entries to map to the same action
and you can't do it within the same context

instead only consider an entry as a duplicate if they have the same
context, actioncode, button, and prebutton

Change-Id: I5aba3459505987ba37e26758aec62f02fcf8165a
This commit is contained in:
William Wilgus 2026-09-05 10:39:54 -04:00
parent 20fa5f017d
commit 45bd2b970b

View file

@ -746,11 +746,14 @@ static int keymap_add_button_entry(int context, int action_code,
for (int i = 0; i < ctx_data.act_count; i++)
{
if (ctx_data.act_map[i].context == context &&
ctx_data.act_map[i].map.action_code == action_code)
ctx_data.act_map[i].map.action_code == action_code &&
ctx_data.act_map[i].map.button_code == button_code &&
ctx_data.act_map[i].map.pre_button_code == pre_button_code)
{
/*Duplicate -- Update the existing entry */
ctx_data.act_map[i].map.button_code = button_code;
ctx_data.act_map[i].map.pre_button_code = pre_button_code;
/*Duplicate -- Use the existing entry */
/* FS#13975 allow multiple entries to map same action code */
logf("keyremap: skipping duplicate @ [%d] ctx: %d, act: %d btn: %d pbtn: %d",
i, context, action_code, button_code, pre_button_code);
return ctx_data.act_count;
}
}