mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
[Feature] FS#13884 allow merging imported text keymaps
allows you to import a file and merge text keymaps pops a yes no prompt to erase existing duplicates will be overwritten Change-Id: I0f4425e765f0a2ff6b73b830bcaea1b3f31e83cb
This commit is contained in:
parent
e80e1448f1
commit
ad05e23b72
1 changed files with 18 additions and 1 deletions
|
|
@ -742,6 +742,19 @@ static int keymap_add_button_entry(int context, int action_code,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
/*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;
|
||||
return ctx_data.act_count;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasctx || keyremap_buffer.end - sizeof(struct action_mapping_t) < keyremap_buffer.front)
|
||||
goto fail;
|
||||
keyremap_buffer.end -= sizeof(struct action_mapping_t);
|
||||
|
|
@ -948,7 +961,11 @@ static int keyremap_import_file(char *filenamebuf, size_t bufsz)
|
|||
char *pact;
|
||||
int ctx = -1;
|
||||
|
||||
keyremap_reset_buffer();
|
||||
if (ctx_data.ctx_count == 0 || rb->yesno_pop("Delete Current Entries?") == true)
|
||||
{
|
||||
keyremap_reset_buffer();
|
||||
}
|
||||
|
||||
next_line:
|
||||
while (rb->read_line(fd, filenamebuf, (int) bufsz) > 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue